基金

基础数据

目前,东财掘金量化支持上交所和深交所的交易标的查询。

交易所名称 市场代码
上交所 SHSE
深交所 SZSE

Python 数据接口1

示例 1

获取“SHSE.510300”的基本信息:

get_symbol_infos(sec_type1=1020, symbols='SHSE.510300')

返回结果:

[{'symbol': 'SHSE.510300', 'sec_type1': 1020, 'sec_type2': 102001, 'board': 10200101, 'exchange': 'SHSE', 'sec_id': '510300', 'sec_name': '华泰柏瑞沪深300ETF', 'sec_abbr': 'HTBRHS300ETF', 'price_tick': 0.001, 'trade_n': 1, 'listed_date': datetime.datetime(2012, 5, 28, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'delisted_date': datetime.datetime(2038, 1, 1, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'underlying_symbol': '', 'option_type': '', 'option_margin_ratio1': 0.0, 'option_margin_ratio2': 0.0, 'call_or_put': '', 'conversion_start_date': None}]

示例 2

获取“SHSE.510300”的基本数据及最新日频数据:

get_symbols(sec_type1=1020, symbols='SHSE.510300', trade_date='2022-01-13')

返回结果:

[{'trade_date': datetime.datetime(2022, 1, 13, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'pre_close': 4.919, 'upper_limit': 5.411, 'lower_limit': 4.427, 'turn_rate': 4.1024, 'adj_factor': 1.146326449, 'margin_ratio': 1.0, 'multiplier': 1, 'is_adjusted': False, 'is_suspended': False, 'position': 0, 'settle_price': 0.0, 'pre_settle': 0.0, 'conversion_price': 0.0, 'exercise_price': 0.0, 'is_st': False, 'symbol': 'SHSE.510300', 'sec_type1': 1020, 'sec_type2': 102001, 'board': 10200101, 'exchange': 'SHSE', 'sec_id': '510300', 'sec_name': '华泰柏瑞沪深300ETF', 'sec_abbr': 'HTBRHS300ETF', 'price_tick': 0.001, 'trade_n': 1, 'listed_date': datetime.datetime(2012, 5, 28, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'delisted_date': datetime.datetime(2038, 1, 1, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'underlying_symbol': '', 'option_type': '', 'option_margin_ratio1': 0.0, 'option_margin_ratio2': 0.0, 'call_or_put': '', 'conversion_start_date': None}]

示例 3

获取“SHSE.510300”在 2021-03-01 -- 2021-3-3 的历史信息数据:

get_history_symbol(symbol='SHSE.510300', start_date='2021-03-01', end_date='2021-03-03', df=False)

返回结果:

[{'trade_date': datetime.datetime(2021, 3, 1, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'pre_close': 5.329, 'upper_limit': 5.862, 'lower_limit': 4.796, 'turn_rate': 6.9226, 'adj_factor': 1.146326449, 'margin_ratio': 1.0, 'multiplier': 1, 'is_adjusted': False, 'is_suspended': False, 'position': 0, 'settle_price': 0.0, 'pre_settle': 0.0, 'conversion_price': 0.0, 'exercise_price': 0.0, 'is_st': False, 'symbol': 'SHSE.510300', 'sec_type1': 1020, 'sec_type2': 102001, 'board': 10200101, 'exchange': 'SHSE', 'sec_id': '510300', 'sec_name': '华泰柏瑞沪深300ETF', 'sec_abbr': 'HTBRHS300ETF', 'price_tick': 0.001, 'trade_n': 1, 'listed_date': datetime.datetime(2012, 5, 28, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'delisted_date': datetime.datetime(2038, 1, 1, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'underlying_symbol': '', 'option_type': '', 'option_margin_ratio1': 0.0, 'option_margin_ratio2': 0.0, 'call_or_put': '', 'conversion_start_date': None},
 {'trade_date': datetime.datetime(2021, 3, 2, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'pre_close': 5.418, 'upper_limit': 5.96, 'lower_limit': 4.876, 'turn_rate': 5.5579, 'adj_factor': 1.146326449, 'margin_ratio': 1.0, 'multiplier': 1, 'is_adjusted': False, 'is_suspended': False, 'position': 0, 'settle_price': 0.0, 'pre_settle': 0.0, 'conversion_price': 0.0, 'exercise_price': 0.0, 'is_st': False, 'symbol': 'SHSE.510300', 'sec_type1': 1020, 'sec_type2': 102001, 'board': 10200101, 'exchange': 'SHSE', 'sec_id': '510300', 'sec_name': '华泰柏瑞沪深300ETF', 'sec_abbr': 'HTBRHS300ETF', 'price_tick': 0.001, 'trade_n': 1, 'listed_date': datetime.datetime(2012, 5, 28, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'delisted_date': datetime.datetime(2038, 1, 1, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'underlying_symbol': '', 'option_type': '', 'option_margin_ratio1': 0.0, 'option_margin_ratio2': 0.0, 'call_or_put': '', 'conversion_start_date': None},
 {'trade_date': datetime.datetime(2021, 3, 3, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'pre_close': 5.349, 'upper_limit': 5.884, 'lower_limit': 4.814, 'turn_rate': 4.7013, 'adj_factor': 1.146326449, 'margin_ratio': 1.0, 'multiplier': 1, 'is_adjusted': False, 'is_suspended': False, 'position': 0, 'settle_price': 0.0, 'pre_settle': 0.0, 'conversion_price': 0.0, 'exercise_price': 0.0, 'is_st': False, 'symbol': 'SHSE.510300', 'sec_type1': 1020, 'sec_type2': 102001, 'board': 10200101, 'exchange': 'SHSE', 'sec_id': '510300', 'sec_name': '华泰柏瑞沪深300ETF', 'sec_abbr': 'HTBRHS300ETF', 'price_tick': 0.001, 'trade_n': 1, 'listed_date': datetime.datetime(2012, 5, 28, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'delisted_date': datetime.datetime(2038, 1, 1, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'Asia/Shanghai')), 'underlying_symbol': '', 'option_type': '', 'option_margin_ratio1': 0.0, 'option_margin_ratio2': 0.0, 'call_or_put': '', 'conversion_start_date': None}]

其他语言数据接口1

C#

C++

MATLAB


行情数据

实时行情数据

东财掘金量化目前支持获取国内两个市场的基金实时行情数据。

包含 Tick 行情和 Bar 行情。

交易所名称 市场代码
上交所 SHSE
深交所 SZSE

Tick - Tick 行情

快照行情, 包含以下内容:

参数名 类型 说明
symbol str 标的代码
open float 开盘价
high float 最高价
low float 最低价
price float 最新价
cum_volume int 成交总量/最新成交量,累计值
cum_amount float 成交总金额/最新成交额,累计值
trade_type int 交易类型 1: ‘双开’, 2: ‘双平’, 3: ‘多开’, 4: ‘空开’, 5: ‘空平’, 6: ‘多平’, 7: ‘多换’, 8: ‘空换’
last_volume int 瞬时成交量
cum_position int 合约持仓量(期),累计值(股票此值为 0)
last_amount float 瞬时成交额 (郑商所 last_amount 为 0)
created_at datetime.datetime 创建时间
quotes list[quote] 股票提供买卖 1-5 档,list[0]~list[4]分别对应买卖一档到五档;跌停时无买方报价,涨停时无卖方报价
iopv float 基金份额参考净值,(只适用于基金)

Quote - 报价(dict)

参数名 类型 说明
bid_p float 买价
bid_v int 买量
ask_p float 卖价
ask_v int 卖量

Bar - Bar 行情

支持以下多种频率的基金实时行情数据:

交易所名称 市场代码 数据频率
上交所 SHSE 60s, 300s, 900s, 1800s, 3600s
深交所 SZSE 60s, 300s, 900s, 1800s, 3600s

注:s 表示“秒”。

行情包含以下数据:

参数名 类型 说明
symbol str 标的代码
frequency str 频率
open float 开盘价
close float 收盘价
high float 最高价
low float 最低价
amount float 成交额
volume int 成交量
bob datetime.datetime bar 开始时间
eob datetime.datetime bar 结束时间

历史行情数据

东财掘金量化目前支持获取国内两个市场的基金历史行情数据。

包含 Tick 行情和 Bar 行情。

交易所名称 市场代码
上交所 SHSE
深交所 SZSE

Tick - Tick 行情

快照行情,包含以下内容:

参数名 类型 说明
symbol str 标的代码
open float 开盘价
high float 最高价
low float 最低价
price float 最新价
cum_volume int 成交总量/最新成交量,累计值
cum_amount float 成交总金额/最新成交额,累计值
trade_type int 交易类型 1:‘双开’, 2:‘双平’, 3:‘多开’, 4:‘空开’, 5:‘空平’, 6:‘多平’, 7:‘多换’, 8:‘空换’
last_volume int 瞬时成交量
cum_position int 合约持仓量(期),累计值(股票该值为 0)
last_amount float 瞬时成交额(郑商所 last_amount 为 0)
created_at datetime.datetime 创建时间
quotes list[quote] 股票提供买卖 1-5 档,list[0]~list[4]分别对应买卖一档到五档;跌停时无买方报价,涨停时无卖方报价
iopv float 基金份额参考净值,(只适用于基金)

Quote - 报价(dict)

参数名 类型 说明
bid_p float 买价
bid_v int 买量
ask_p float 卖价
ask_v int 卖量

Bar - Bar 行情

支持以下多种频率的基金历史行情数据:

交易所名称 市场代码 频率以及数据范围
上交所 SHSE 60s 以及 60s 的整数倍(2017-1-1 - 至今), 1d(2005-1-1 - 至今), 不提供 60s 以下数据
深交所 SZSE 60s 以及 60s 的整数倍(2017-1-1 - 至今), 1d(2005-1-1 - 至今), 不提供 60s 以下数据

注:s 表示“秒”, d 表示“天”。

行情包含以下数据:

参数名 类型 说明
symbol str 标的代码
frequency str 频率
open float 开盘价
close float 收盘价
high float 最高价
low float 最低价
amount float 成交额
volume int 成交量
bob datetime.datetime bar 开始时间
eob datetime.datetime bar 结束时间

成分持仓

Python 数据接口2

其他语言数据接口2

C#

C++


场内净值

Python 数据接口3

其他语言数据接口3

C#

C++


分红折算

Python 数据接口4

其他语言数据接口4

C#

C++