PDF下载 下载

指数成分股

阅读 554

掘金量化支持获取多种股票指数数据,包括指数的行情数据以及成分股数据

为了避免未来函数,我们支持获取历史任意时刻的指数成分股信息

 

Python 数据接口
  1. get_constituents - 查询指数最新成份股
  2. get_history_constituents - 查询指数成份股的历史数据

示例1

获取“SHSE.000001”的最新成分股数据:

  1. get_constituents(index='SHSE.000001', fields='symbol, weight', df=True)

返回结果:

  1. symbol weight
  2. SHSE.603966 0.01
  3. SHSE.603960 0.01
  4. ···

示例2

获取“SHSE.000001”的在2021-07-01 — 2021-07-10的历史数据:

  1. get_history_constituents(index='SHSE.000001', start_date='2021-07-01', end_date='2021-07-10')

返回结果:

  1. [{'trade_date': datetime.datetime(2021, 6, 30, 0, 0, tzinfo=tzfile('PRC')), 'constituents': {'SHSE.603939': 0.09000000357627869, 'SHSE.600545': 0.009999999776482582, 'SHSE.603286': 0.0, 'SHSE.603725': 0.0, 'SHSE.603956': 0.019999999552965164, 'SHSE.600681': 0.009999999776482582, 'SHSE.603256': 0.019999999552965164, 'SHSE.600583': 0.03999999910593033, 'SHSE.600794': 0.009999999776482582, 'SHSE.601696': 0.12999999523162842, 'SHSE.600406': 0.28999999165534973, 'SHSE.603868': 0.03999999910593033, 'SHSE.600520': 0.0, 'SHSE.600035': 0.009999999776482582, 'SHSE.600208': 0.05999999865889549, 'SHSE.600836': 0.009999999776482582, 'SHSE.603829': ...

 

其他语言数据接口

C#

C++

MATLAB

0 篇笔记