前言
今天主要讲的是除了板块信息和股票信息之外的其他信息如何获取的函数!还是分几个部分来讲
具体的开通渠道可以看文章末尾!
一、get_deliver —— 获取历史交割单信息
get_deliver(start_date, end_date)
这个函数用来获取账户历史交割单信息。
注意事项:
1、开始日期start_date和结束日期end_date为必传字段
2、仅支持查询上一个交易日(包含)之前的交割单信息
3、因不同柜台返回的字段存在差异,因此接口返回的为柜台原数据,使用时请根据实际柜台信息做字段解析
4、该接口仅支持查询普通股票账户(非两融)
示例
def initialize(context):g.security = "600570.SS"set_universe(g.security)def before_trading_start(context, data):h = get_deliver('20210101', '20211117')log.info(h)def handle_data(context, data):pass
二、get_fundjour —— 获取历史资金流水信息
get_fundjour(start_date, end_date)
这个函数是用来获取账户历史资金流水信息。
注意事项:
1、开始日期start_date和结束日期end_date为必传字段
2、仅支持查询上一个交易日(包含)之前的资金流水信息
3、因不同柜台返回的字段存在差异,因此接口返回的为柜台原数据,使用时请根据实际柜台信息做字段解析
4、该接口仅支持查询普通股票账户(非两融)
示例
def initialize(context):g.security = "600570.SS"set_universe(g.security)def before_trading_start(context, data):h = get_fundjour('20210101', '20211117')log.info(h)def handle_data(context, data):pass
三、get_research_path —— 获取研究路径
这个函数主要是用于获取研究根目录路径,该路径为'/home/fly/notebook/'。
示例
def initialize(context):g.security = "600570.SS"set_universe(g.security)path = get_research_path()def handle_data(context, data):pass
四、get_trade_name —— 获取交易名称
用于获取当前交易的名称。
示例
def initialize(context):g.security = "600570.SS"set_universe(g.security)def handle_data(context, data):name = get_trade_name()