@vladisld Thank you man! outsideRth=True
is what I am looking for!
Latest posts made by xingweicmu
-
RE: Trade outside of Regular Trading Hour on IB
-
Trade outside of Regular Trading Hour on IB
Hi everyone,
I am using paper account to trade on IB. My problem is I cannot put DAY order with limit order in after-hours on IB.
So I was trying to put a limit order in after-hours on IB using the following piece of code:
self.log('BUY CREATE, %.2f' % self.data.close[0]) self.order = self.buy( size=self.p.size, exectype=bt.Order.Limit, price=round(self.data.close[0] * 1.01, 2), valid=bt.Order.DAY, )
The order wasn't executed even when the limit price is reached. But if I put the limit order with the same value on TWS directly, the order was executed instantly. So by comparing those two orders, I find the order that I manually put on TWS has a DAY time in force while the one created by backtrader don't have a time in force(even though I put valid param as DAY in above code), see the following screenshot.
Order generated by backtrader:
So I wonder if I was doing it in the wrong way or how I could put a limit order with DAY time in force in after-hours.
Thanks~