Interactive Broker order OutsideRth attribute
-
In both IB API and ibPy API there is reference to the OutsideRth attribute of an order.
https://interactivebrokers.github.io/tws-api/classIBApi_1_1Order.html#a60dcca6e3c3ae6ae6e0c5f3fdffc5a4a
https://github.com/blampe/IbPy/blob/master/ib/ext/EClientSocket.pyLooks like in Backtrader the attribute is not exposed. Is there any way I can tweak the attribute inside Backtrader for live trading? And is the default attribute of this setting False?
Thanks,
Kevin
-
Actucally, you can set the OutsideRth attribute like this:
self.order = self.buy( size=1, exectype=bt.Order.Limit, price=someprice, outsideRth=True )
-
@jmoons thanks I will try it.
-
Documented here: Docs - Live Data Feeds and Live Trading - Interactive Brokers
Because
ibpy
was using the Java API source as the building cornerstone, the actual argument name is:m_outsideRth
.But you can pass it without the leading
m_
and the code will dynamically add it for you in the background. -
@backtrader cool thanks a lot!
-
Hi Kevin --
Another option for you is to use the IB data cache code that brettelliot wrote at https://community.backtrader.com/topic/1007/how-to-cached-data-from-ib-and-use-it-later/2
It exposes the IB connection so that the ib api parameter for RTH is available (use_rth).
Also gets you a nice cache and a bit of a speedup as well.
B.
-
@bigdavediode thanks I will look into this.