Sector Performance
curl --request GET \
--url https://stocks-dev.up.railway.app/api/v1/market/sectorsimport requests
url = "https://stocks-dev.up.railway.app/api/v1/market/sectors"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://stocks-dev.up.railway.app/api/v1/market/sectors', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://stocks-dev.up.railway.app/api/v1/market/sectors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://stocks-dev.up.railway.app/api/v1/market/sectors"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://stocks-dev.up.railway.app/api/v1/market/sectors")
.asString();require 'uri'
require 'net/http'
url = URI("https://stocks-dev.up.railway.app/api/v1/market/sectors")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"sectors": [
{
"sector": "<string>",
"changesPercentage": 123,
"change": 123,
"currentValue": 123,
"volume": 123,
"marketCap": 123,
"numberOfStocks": 123,
"topPerformers": [
{
"symbol": "<string>",
"name": "<string>",
"changesPercentage": 123
}
]
}
],
"period": "<string>",
"source": "<string>",
"timestamp": "<string>"
}Market Data
Sector Performance
Get performance data for all market sectors
GET
/
api
/
v1
/
market
/
sectors
Sector Performance
curl --request GET \
--url https://stocks-dev.up.railway.app/api/v1/market/sectorsimport requests
url = "https://stocks-dev.up.railway.app/api/v1/market/sectors"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://stocks-dev.up.railway.app/api/v1/market/sectors', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://stocks-dev.up.railway.app/api/v1/market/sectors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://stocks-dev.up.railway.app/api/v1/market/sectors"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://stocks-dev.up.railway.app/api/v1/market/sectors")
.asString();require 'uri'
require 'net/http'
url = URI("https://stocks-dev.up.railway.app/api/v1/market/sectors")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"sectors": [
{
"sector": "<string>",
"changesPercentage": 123,
"change": 123,
"currentValue": 123,
"volume": 123,
"marketCap": 123,
"numberOfStocks": 123,
"topPerformers": [
{
"symbol": "<string>",
"name": "<string>",
"changesPercentage": 123
}
]
}
],
"period": "<string>",
"source": "<string>",
"timestamp": "<string>"
}Overview
Retrieve performance data for all major market sectors. This endpoint provides real-time sector performance metrics including price changes, volume, and key statistics, helping investors identify sector rotation trends and investment opportunities.Sector performance analysis is crucial for understanding market dynamics, identifying rotation patterns, and making strategic asset allocation decisions across different industries.
Parameters
string
default:"1d"
Performance period: “1d”, “5d”, “1m”, “3m”, “6m”, “1y”, “ytd”
Response
array
Array of sector performance data
Show Sector Object
Show Sector Object
string
Sector name (e.g., “Technology”, “Healthcare”, “Financial Services”)
number
Sector performance percentage change
number
Absolute change in sector index value
number
Current sector index value
number
Total sector trading volume
number
Total market capitalization of sector
number
Number of stocks in the sector
string
Performance period analyzed
string
Data source identifier (“FMP”)
string
ISO timestamp of the response
Examples
curl "https://stocks-dev.up.railway.app/api/v1/market/sectors?period=1d"
import requests
response = requests.get("https://stocks-dev.up.railway.app/api/v1/market/sectors")
data = response.json()
print(f"🏭 Sector Performance ({data['period']} period)")
print("=" * 60)
# Sort sectors by performance
sectors = sorted(data['sectors'], key=lambda x: x['changesPercentage'], reverse=True)
for i, sector in enumerate(sectors, 1):
name = sector['sector']
change_pct = sector['changesPercentage']
market_cap = sector['marketCap'] / 1e12 # Convert to trillions
num_stocks = sector['numberOfStocks']
# Performance emoji
if change_pct >= 2:
emoji = "🚀"
elif change_pct >= 0.5:
emoji = "🟢"
elif change_pct >= -0.5:
emoji = "🟡"
elif change_pct >= -2:
emoji = "🔴"
else:
emoji = "💥"
print(f"{i:2d}. {emoji} {name:<20} {change_pct:>+6.2f}%")
print(f" Market Cap: ${market_cap:.1f}T | Stocks: {num_stocks}")
# Show top performers
if sector.get('topPerformers'):
top_3 = sector['topPerformers'][:3]
performers = ", ".join([f"{stock['symbol']} (+{stock['changesPercentage']:.1f}%)"
for stock in top_3])
print(f" Top: {performers}")
print()
# Summary statistics
best_sector = max(sectors, key=lambda x: x['changesPercentage'])
worst_sector = min(sectors, key=lambda x: x['changesPercentage'])
avg_performance = sum(s['changesPercentage'] for s in sectors) / len(sectors)
print(f"📊 Summary:")
print(f" Best: {best_sector['sector']} (+{best_sector['changesPercentage']:.2f}%)")
print(f" Worst: {worst_sector['sector']} ({worst_sector['changesPercentage']:+.2f}%)")
print(f" Average: {avg_performance:+.2f}%")
const response = await fetch('https://stocks-dev.up.railway.app/api/v1/market/sectors');
const data = await response.json();
console.log(`🏭 Sector Performance (${data.period} period)`);
console.log("=".repeat(60));
// Sort sectors by performance
const sectors = data.sectors.sort((a, b) => b.changesPercentage - a.changesPercentage);
sectors.forEach((sector, index) => {
const name = sector.sector;
const changePct = sector.changesPercentage;
const marketCap = sector.marketCap / 1e12; // Convert to trillions
const numStocks = sector.numberOfStocks;
// Performance emoji
let emoji;
if (changePct >= 2) emoji = "🚀";
else if (changePct >= 0.5) emoji = "🟢";
else if (changePct >= -0.5) emoji = "🟡";
else if (changePct >= -2) emoji = "🔴";
else emoji = "💥";
console.log(`${(index + 1).toString().padStart(2)}. ${emoji} ${name.padEnd(20)} ${changePct >= 0 ? '+' : ''}${changePct.toFixed(2)}%`);
console.log(` Market Cap: $${marketCap.toFixed(1)}T | Stocks: ${numStocks}`);
// Show top performers
if (sector.topPerformers) {
const top3 = sector.topPerformers.slice(0, 3);
const performers = top3.map(stock => `${stock.symbol} (+${stock.changesPercentage.toFixed(1)}%)`).join(", ");
console.log(` Top: ${performers}`);
}
console.log();
});
// Summary statistics
const bestSector = sectors[0];
const worstSector = sectors[sectors.length - 1];
const avgPerformance = sectors.reduce((sum, s) => sum + s.changesPercentage, 0) / sectors.length;
console.log("📊 Summary:");
console.log(` Best: ${bestSector.sector} (+${bestSector.changesPercentage.toFixed(2)}%)`);
console.log(` Worst: ${worstSector.sector} (${worstSector.changesPercentage >= 0 ? '+' : ''}${worstSector.changesPercentage.toFixed(2)}%)`);
console.log(` Average: ${avgPerformance >= 0 ? '+' : ''}${avgPerformance.toFixed(2)}%`);
<?php
$response = file_get_contents('https://stocks-dev.up.railway.app/api/v1/market/sectors');
$data = json_decode($response, true);
echo "🏭 Sector Performance (" . $data['period'] . " period)\n";
echo str_repeat("=", 60) . "\n";
// Sort sectors by performance
usort($data['sectors'], function($a, $b) {
return $b['changesPercentage'] <=> $a['changesPercentage'];
});
foreach ($data['sectors'] as $index => $sector) {
$name = $sector['sector'];
$change_pct = $sector['changesPercentage'];
$market_cap = $sector['marketCap'] / 1e12; // Convert to trillions
$num_stocks = $sector['numberOfStocks'];
// Performance emoji
if ($change_pct >= 2) $emoji = "🚀";
elseif ($change_pct >= 0.5) $emoji = "🟢";
elseif ($change_pct >= -0.5) $emoji = "🟡";
elseif ($change_pct >= -2) $emoji = "🔴";
else $emoji = "💥";
echo sprintf("%2d. %s %-20s %+6.2f%%\n",
$index + 1, $emoji, $name, $change_pct);
echo " Market Cap: $" . number_format($market_cap, 1) . "T | Stocks: $num_stocks\n";
// Show top performers
if (isset($sector['topPerformers'])) {
$top_3 = array_slice($sector['topPerformers'], 0, 3);
$performers = array_map(function($stock) {
return $stock['symbol'] . " (+" . number_format($stock['changesPercentage'], 1) . "%)";
}, $top_3);
echo " Top: " . implode(", ", $performers) . "\n";
}
echo "\n";
}
?>
Response Example
{
"sectors": [
{
"sector": "Technology",
"changesPercentage": 2.45,
"change": 15.67,
"currentValue": 654.23,
"volume": 125000000,
"marketCap": 15420000000000,
"numberOfStocks": 287,
"topPerformers": [
{
"symbol": "NVDA",
"name": "NVIDIA Corporation",
"changesPercentage": 8.92
},
{
"symbol": "AMD",
"name": "Advanced Micro Devices",
"changesPercentage": 6.45
},
{
"symbol": "MSFT",
"name": "Microsoft Corporation",
"changesPercentage": 3.21
}
]
},
{
"sector": "Healthcare",
"changesPercentage": 1.23,
"change": 8.45,
"currentValue": 695.12,
"volume": 85000000,
"marketCap": 8750000000000,
"numberOfStocks": 156,
"topPerformers": [
{
"symbol": "JNJ",
"name": "Johnson & Johnson",
"changesPercentage": 2.85
},
{
"symbol": "PFE",
"name": "Pfizer Inc.",
"changesPercentage": 2.34
}
]
},
{
"sector": "Energy",
"changesPercentage": -1.87,
"change": -12.34,
"currentValue": 647.89,
"volume": 65000000,
"marketCap": 3210000000000,
"numberOfStocks": 89,
"topPerformers": [
{
"symbol": "XOM",
"name": "Exxon Mobil Corporation",
"changesPercentage": 0.45
}
]
}
],
"period": "1d",
"source": "FMP",
"timestamp": "2025-06-28T20:45:15.123456"
}
Understanding Sector Analysis
Sector Classification
Sector Classification
Major Market Sectors:
- Technology: Software, hardware, semiconductors, internet
- Healthcare: Pharmaceuticals, biotech, medical devices
- Financial Services: Banks, insurance, investment firms
- Consumer Discretionary: Retail, automotive, entertainment
- Consumer Staples: Food, beverages, household products
- Energy: Oil, gas, renewable energy
- Industrials: Manufacturing, aerospace, defense
- Materials: Chemicals, metals, mining
- Utilities: Electric, gas, water utilities
- Real Estate: REITs, property development
- Communication Services: Telecom, media, internet services
Sector Rotation
Sector Rotation
Economic Cycle Patterns:
- Early Cycle: Technology, Consumer Discretionary outperform
- Mid Cycle: Industrials, Materials gain momentum
- Late Cycle: Energy, Financials typically lead
- Recession: Utilities, Consumer Staples show resilience
Performance Drivers
Performance Drivers
- Economic Indicators: GDP growth, inflation, interest rates
- Market Sentiment: Risk-on vs risk-off behavior
- Regulatory Changes: Policy impacts on specific sectors
- Technological Disruption: Innovation affecting industries
Use Cases
Asset Allocation
Portfolio Strategy
- Sector rotation timing
- Diversification decisions
- Risk management
Market Analysis
Trend Identification
- Economic cycle positioning
- Leadership analysis
- Momentum assessment
ETF Selection
Sector Investing
- Sector ETF choices
- Thematic investing
- Tactical allocation
Risk Assessment
Portfolio Risk
- Sector concentration
- Correlation analysis
- Defensive positioning
Sector Analysis Tips
Strong Sector Indicators:
- Consistent outperformance over multiple periods
- High relative volume and participation
- Leadership from quality companies
- Supportive fundamental trends
Investment Strategies:
- Follow sector rotation patterns
- Use sector ETFs for broad exposure
- Monitor relative strength vs market
- Consider defensive sectors during uncertainty
Sector Considerations:
- Sector concentration risk in portfolios
- Cyclical vs secular trends
- Regulatory and policy impacts
- Global economic dependencies
Error Responses
Invalid Period (400)
Invalid Period (400)
{
"error": "Invalid period parameter",
"detail": "Period must be one of: 1d, 5d, 1m, 3m, 6m, 1y, ytd"
}
Market Closed (503)
Market Closed (503)
{
"error": "Market data unavailable",
"detail": "Markets are currently closed. Data may be delayed."
}
MCP Protocol Usage
For AI agents using the Model Context Protocol:{
"method": "tools/call",
"params": {
"name": "fmp_get_sector_performance",
"arguments": {
"random_string": "dummy"
}
}
}
Related Endpoints
Market Gainers
Get the biggest stock gainers by sector
Market Losers
Get the biggest stock losers by sector
Stock Screener
Filter stocks by sector criteria
Most Active
Get most active stocks by sector