Sector Performance
Returns the historical performance of every sector, one column per sector.
The values are the average percentage change of the companies in that sector on that date, so 1.25 means +1.25% and not +125%. One API call is made per sector because the combined endpoint this used to read was retired and now answers with an empty response.
Without a date range the API hands back only the earliest days it holds, so pass start_date and end_date to look at a recent window.
Sector Performance in Python
get_sectors_performance is part of the Discovery module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_sectors_performance as shown below.
from financetoolkit import Discovery
discovery = Discovery(api_key="FINANCIAL_MODELING_PREP_KEY")
sectors_performance = discovery.get_sectors_performance()
sectors_performance.tail()
Which returns:
| Date | Basic Materials | Communication Services | Consumer Cyclical | Consumer Defensive | Energy | Financial Services | Healthcare | Industrials | Real Estate | Technology | Utilities |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 2024-02-26 | -2.0728 | -1.454 | 0.7303 | 0.324 | -0.1413 | -0.0491 | 2.7031 | -1.2333 | 0.4945 | 0.2893 | -1.5214 |
| 2024-02-27 | 2.8956 | 1.0041 | -0.7125 | 0.1136 | 2.5373 | 3.0268 | 9.1978 | -0.5179 | 0.7542 | 0.0419 | 4.6884 |
| 2024-02-28 | 4.343 | -0.8573 | -0.9692 | -0.0826 | -3.6163 | 1.8261 | -0.9719 | 1.0113 | -0.2592 | -0.6251 | 1.6461 |
| 2024-02-29 | -1.3336 | 0.7907 | 1.2483 | 3.4536 | 0.6259 | -0.5633 | -1.4379 | -4.1022 | 1.7541 | 1.2096 | 9.9286 |
| 2024-03-01 | 0.8526 | 0.0092 | 1.5435 | -3.7427 | 1.399 | -0.8531 | 2.544 | 0.1322 | 0.1964 | 1.6327 | -2.0912 |
Parameters
get_sectors_performance accepts the following parameters:
- start_date (str | None): The start date to filter data with, e.g. “2024-01-01”.
- end_date (str | None): The end date to filter data with, e.g. “2024-12-31”.