使用history_deals_get读取历史记录,部分最新的数据无法被读取? 新评论 wkinmt5 2020.05.20 02:09 groupStr = "*ARS*" deals=mt5.history_deals_get(from_date, to_date, group=groupStr) if deals==None: print("No deals with group=\"{}\", error code={}".format(groupStr,mt5.last_error())) elif len(deals)> 0: print("history_deals_get({}, {}, group=\"{}\")={}".format(from_date,to_date,groupStr,len(deals))) print(deals) else: print("deals is not None ,and count !> 0",deals) print("") 在上面的代码中,如果USDARS是刚刚完成的交易(30分钟内都有这个问题,多久没有这个问题还没试出来),代码就会走到else部分。 deals is not None ,and count !> 0 () 尝试使用position_id的搜索就没有这个问题。 deals=mt5.history_deals_get(position=position_id) if deals==None: print("No deals with position={}, error code={}".format(position_id,mt5.last_error())) elif len(deals)> 0: print("history_deals_get({}, {}, position={})={}".format(from_date,to_date,position_id,len(deals))) print("deals by position",deals) 我想问下,有没有什么办法,查询到历史交易的position_id? Renjun Gu 2020.05.25 03:26 #1 history_deals_get这个是自定义函数; 意思就是这个函数是自己写的,应该检测这个函数有没有问题 光你这几句代码看不出毛病 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
在上面的代码中,如果USDARS是刚刚完成的交易(30分钟内都有这个问题,多久没有这个问题还没试出来),代码就会走到else部分。
deals is not None ,and count !> 0 ()
尝试使用position_id的搜索就没有这个问题。
我想问下,有没有什么办法,查询到历史交易的position_id?