文档
测试

3)获取交易明细数据

POST

说明 / 示例

3)获取交易明细数据 get_trade_detail_data() 用法: get_trade_detail_data(accountID, strAccountType, strDatatype, strategyName) 或不区分策略get_trade_detail_data(accountID, strAccountType, strDatatype) 释义: 获取交易明细数据函数 参数: accountID:string,资金账号。 strAccountType:string,账号类型,可选值: ‘FUTURE’:期货 ‘STOCK’:股票 ‘CREDIT’:信用 ‘HUGANGTONG’:沪港通 ‘SHENGANGTONG’:深港通 ‘STOCK_OPTION’:期权 strDatatype:string,数据类型: ‘POSITION’:持仓 ‘ORDER’:委托 ‘DEAL’ :成交 ‘ACCOUNT’:账号 ‘TASK’:任务 strategyName:string,策略名,对应 passorder 下单函数中的参数 strategyName 的值,只对委托 ‘ORDER’、成交 ‘DEAL’ 起作用。 返回: list,list 中放的是 PythonObj,通过 dir(pythonobj) 可返回某个对象的属性列表。 *注:有五种交易相关信息,包括: POSITION:持仓 ORDER:委托 DEAL:成交 ACCOUNT:账号 TASK:任务 示例: ```py def handlebar(ContextInfo): obj_list = get_trade_detail_data('6000000248','stock','position') for obj in obj_list: print(obj.m_strInstrumentID) # 查看有哪些属性字段 print(dir(obj)) # 可用资金查询 acct_info = get_trade_detail_data('6000000248', 'stock', 'account') for i in acct_info: print(i.m_dAvailable) # 当前持仓查询 position_info = get_trade_detail_data('6000000248', 'stock', 'position') for i in position_info: print(i.m_strInstrumentID, i.m_nVolume) ```