请问下,大神原谅我这个新手。谢谢之前的大神解答我好几个小白问题
1、如果我之前short开一手空单。现在self.buy(bar.close_price , abs(self.pos) , stop = True) 。
那么我是平掉之前的空单,并开一手多单?还是既有一手空单,又有一手多单,锁仓了?
2、我在self.buy(bar.close_price , abs(self.pos) , stop = True)以及sell、short、cover 后面都 print(bar.datetime , bar.close_price),
然后我又在on_order函数后又 print(order.datetime , order.price), 发现时间order.datetime 比 bar.datetime 晚了五分钟(我是在on_5min_bar上执行的),但bar.close_price 和 order.price 是一样的。对比k线数据 on_5min_bar里面bar.datetime 和bar.close_price 对应的才是正确的。这是为什么呢?
例如:buy后面的打印的是 2022-04-12 13:35:00 1234 ,on_order打印的是 2022-04-12 13:40:00 1234