i would like to implement level 2 custom data feed from interactive brokers, how can i request data from the ib gateway using lean? can you referance some examples of other interactive brokers data feeds?
QUANTCONNECT COMMUNITY
i would like to implement level 2 custom data feed from interactive brokers, how can i request data from the ib gateway using lean? can you referance some examples of other interactive brokers data feeds?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Derek Melchin
Hi Yair,
The IB data subscription is created in the InteractiveBrokersBrokerage model. See the source code for reference. To request level 2 data, this model needs to be adjusted to call the market depth IB API method.
Note that this can only be done with a local copy of LEAN. Addtionally, it's not possible to fetch this data at the algortihm level.
We don't currently have any examples of this to share.
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Yair Klein
Thenks Derek, with your help i was able to implement market depth subscription in the InteractiveBrokersBrokerage.cs. how can i implement it as custom data and feed it into my algorithm?
Â
Alexandre Catarino
Hi Yair Klein ,
Sorry about the wait.
We have suggested implementing the L2 data in Lean at the brokerage level since it seems it would be the proper way to do it since it's market data. However, it's not a trivial implementation since this information would need to be stored in an "OrderBook" object that doesn't exist in Lean.
Alternatively, it could be implemented as custom data as first intended. One possible solution would implement a custom data object would have two lists: one for bids and another for asks from a second/minute snapshot. I think it would be challenging to manage order books with this solution, but it depends on how you want to use this information.
Yair Klein
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!