更新后,日内交易没能平仓
CLOSE_HOUR,CLOSE_MINUTE=14,45 #平仓时间
if api.is_changing(quote,"datetime"):
now=datetime.strptime(quote.datetime,"%Y-%m-%d %H:%M:%S.%f")
if now.hour==CLOSE_HOUR and now.minute>=CLOSE_MINUTE:
target_pos_value=0 #平仓
wait_time=time.time()+60
print("交易时间即将关闭,平仓,策略将关闭")
while api.wait_update(deadline=wait_time):
pass
api.close()
break
exit
xiaosu88 编辑问题 2021年5月27日