274 views
0

请教下:

在主循环里执行以下语句,有时下单正常,但有时候会重复下单!感觉account.frozen_margin没更新一样?

if (account.frozen_margin+account.margin) <= 0 and (now_date<“14:55″ or now_date>”21:00″):
trNum = 1
order=api.insert_order(symbol=symbol1, direction=”BUY”, offset=”OPEN”, volume=trNum, limit_price=price1)
order=api.insert_order(symbol=symbol2, direction=”SELL”, offset=”OPEN”, volume=trNum, limit_price=price2)
api.wait_update()

time.sleep(1)

Answered question
0

冻结保证金需要去向ctp查询后才会更新,会有等待时间,等待时间过程中可能会造成重复下单

另外不建议在程序内使用 time.sleep()函数 https://www.shinnytech.com/question/7973/

Answered question
You are viewing 1 out of 1 answers, click here to view all answers.