释义: 取交易明细数据函数 用法: get_trade_detail_data(accountID,strAccountType,strDatatype,strategyName)或不区分策略get_trade_detail_data(accountID,strAccountType,strDatatype); 参数: accountID:st…
用法: get_history_trade_detail_data(accountID,strAccountType,strDatatype,strStratDate,strEndDate); 释义: 获取历史成交明细数据,返回结果为一个([timetag,obj...])的元组 参数: accountID:string,账号; strAccountType:string,账号类型,有"FUTURE","STOCK","CREDIT","HUGANGTONG","SHENGANGTONG","STOCK...
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...
#获取持仓信息{code.market:手数}defget_holdings(accountid,datatype):holdinglist={}resultlist=get_trade_detail_data(accountid,datatype,"POSITION")forobjinresultlist:holdinglist[obj.m_strInstrumentID+"."+obj.m_strExchangeID]=obj.m_nVolume/100#返回{code.market:持仓手数}returnholdinglist 接下来...
if close[-1]<np.array(MA20)[-1] and close[-2]>=np.array(MA20)[-2]: order_target_value(ContextInfo.tradestock,0,ContextInfo,ContextInfo.accountID) def get_totalvalue(accountid,datatype): result=0 resultlist=get_trade_detail_data(accountid,datatype,"ACCOUNT") for obj in ...
get_trade_detail_data(),主要用该函数获得账户信息(如可用资金)和持仓信息。这里有别于聚宽代码,聚宽是通过访问context全局变量里面的portfolio对象获得相关信息。 get_market_data_ex(),获得股票对应的价格信息,对应于聚宽里面的get_price(),history() 和attribute_history()函数。
python提供的取账号信息接口 get_trade_detail_data, 与四种交易回调函数, 都是从客户端本地缓存中读取数据 / 触发调用,不是调用时查询柜台再返回。客户端本地缓存状态定期接收柜台推送刷新,有交易主推的柜台50ms一次,没有交易主推的柜台1-6秒一次。 不能认为get_trade_detail_data查到的状态是与柜台完全一致的...
account_1 = get_trade_detail_data(wg.acct, wg.acct_type, 'account') if len(account_1)==0: print(f'账号{wg.acct} 未登录 请检查') return wg.account = account_1[0] vailable_cash = wg.account.m_dAvailable holdings = get_trade_detail_data(wg.acct, wg.acct_type, 'position') wg...
resultlist=get_trade_detail_data(accountid,datatype,'ACCOUNT') forobjinresultlist: result=obj.m_dAvailable returnresult 📊 策略优化与风险管理 在实际应用中,你需要对策略进行优化和风险管理: 参数调整:根据市场情况调整资金量和利率阈值。 回测分析:通过历史数据回测策略的有效性。
for i in get_trade_detail_data(C.account_id,"stock","account"): cash = i.m_dAvailable # 获取当前持仓信息,本示例中的holding_dict结构是{stock_code:lots} holding_dict = {obj.m_strInstrumentID+"."+obj.m_strExchangeID : obj.m_nVolume for obj in get_trade_detail_data(C.account_id,...