get_etf_info
该接口用于获取单支或者多支ETF的信息。
原型
get_etf_info(etf_code)
适用环境
该函数仅支持PTrade客户端可用、仅在股票交易模块可用,对接jz_ufx、ATP、云订柜台不支持该函数
释义
该接口用于获取单支或者多支ETF的信息。
注意事项
无
参数
etf_code : 单支ETF代码或者一个ETF代码的list,必传参数(list[str]/str)
返回值
正常返回一个dict类型字段,包含每只ETF信息,key为ETF代码,values为包含etf信息的dict。异常返回空dict,如{}(dict[str:dict[...]])
返回结果字段介绍:
etf_redemption_code -- 申赎代码(str:str);
publish -- 是否需要发布IOPV(str:int);
report_unit -- 最小申购、赎回单位(str:int);
cash_balance -- 现金差额(str:float);
max_cash_ratio -- 现金替代比例上限(str:float);
pre_cash_component -- T-1日申购基准单位现金余额(str:float);
nav_percu -- T-1日申购基准单位净值(str:float);
nav_pre -- T-1日基金单位净值(str:float);
allot_max -- 申购上限(str:float);
redeem_max -- 赎回上限(str:float);
字段备注:
publish -- 是否需要发布IOPV,1是需要发布,0是不需要发布;
返回如下:
{'510020.SS': {'nav_percu': 206601.39, 'redeem_max': 0.0, 'nav_pre': 0.207, 'report_unit': 1000000, 'max_cash_ratio': 0.4,
'cash_balance': -813.75, 'etf_redemption_code': '510021', 'pre_cash_component': 598.39, 'allot_max': 0.0, 'publish': 1}}
示例
def initialize(context):
g.security = '600570.SS'
set_universe(g.security)
def handle_data(context, data):
#ETF信息
etf_info = get_etf_info('510020.SS')
log.info(etf_info)
etfs_info = get_etf_info(['510020.SS','510050.SS'])
log.info(etfs_info)