首页 > 解决方案 > 如何获取 IEX 云中可用的扇区列表

问题描述

我正在使用 IEX 云 API,并尝试使用扇区规范来使用集合过滤器。为此,我需要一个可用扇区的列表。我可以获得标准普尔 500 指数股票的收盘价。但我想瞄准所有全球矿业股。理想情况下,我可以使用 SIC 代码,但这不能用作收集过滤器。

参考文件建议

GET /ref-data/sectors

但是我的python代码

batch_api_call_url=f'https://sandbox.iexapis.com/stable/stock/market/ref-data/sectors&token={IEX_CLOUD_API_TOKEN}' 
data = requests.get(batch_api_call_url) 

不起作用。

任何建议或参考将不胜感激。

标签: pythoncollectionspython-requestsrequesthttp-get

解决方案


该 URL 似乎不正确 - 它不应包含 /stock/market/。

这是一个工作请求示例:

batch_api_call_url = f'https://cloud.iexapis.com/stable/ref-data/sectors?token={IEX_CLOUD_API_TOKEN}'
data = requests.get(batch_api_call_url)

推荐阅读