get_trade_detail_data延迟 第一类原因: 官方给的提示如下: 委托/成交/持仓/账号信息的更新, 是在客户端后台进行的, python策略中无法手动控制。 解释如下:python提供的取账号信息接口 get_trade_detail_data, 与四种交易回调函数(order_callback, deal_callback, position_callback等等), 都是从客户端本地缓存中...
1.get_trade_detail_data-查询账号资金信息、委托记录等 调用方法 get_trade_detail_data(accountID, strAccountType, strDatatype, strategyName)或不区分策略get_trade_detail_data(accountID, strAccountType, strDatatype) 参数 参数名类型说明备注 accountID string 资金账号 必填 strAccountType string 账号类型...
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 resultlist:...
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...
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...
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,...
具体参数释义见文档 market_data = C.get_market_data_ex(["open", "high", "low", "close"],C.stock_list,period = "1d",end_time = bar_date) # 获取当前账户资金 for i in get_trade_detail_data(C.account_id,"stock","account"): cash = i.m_dAvailable # 获取当前持仓...
最近我发现有些朋友会用到通达信选股,希望能将通达信公式,移植成为QMT的python代码,今天我就分享一下我是怎么做的,并且给大家分享一段策略代码,大家可以参考策略代码,来完成自己的策略。首先我在网上找了一个python第三方库MyTT,这个库是用纯python来实现的,只调用了pandas和numpy库,因此你也可以不用pip install My...
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,...
resultlist=get_trade_detail_data(accountid,datatype,'ACCOUNT') forobjinresultlist: result=obj.m_dAvailable returnresult 📊 策略优化与风险管理 在实际应用中,你需要对策略进行优化和风险管理: 参数调整:根据市场情况调整资金量和利率阈值。 回测分析:通过历史数据回测策略的有效性。