Back

How to get the brokerage object in the algorithm object?

Hi,

I want to call some brokerage specific function in the algorithm object?

How do I get the brokerage object? what's the navigation?

Thanks.

Update Backtest







0

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.


Hey Ming! It is actually intentionally walled off from the algorithm to make QC Algorithms relatively broker agnostic. Do you have something specific you can share so we can consider it as a feature request? 

0

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.


One example:

https://documentation.tradier.com/brokerage-api/trading/advanced-orders 

Tradier has many advanced order types, which may not be supported by other brokerages at all, hence won't be avaliable in a common Brokerage interface in the current framework.

And the user may also want to call some Tradier specfic api that are not be captured by the common Brokerage interface (which can only be the least common denominator of all the supporeted Brokerages as always when you have abstraction layer).

So expose the brokerage object directly to the Algorithm object will give user more freedom and flexibility. Most of the time, a user only use one or two brokerages, the ability to switch between all these brokages is not a big concern. And the user is more concerned about the ability to call vendor specific api of their already selected brokerage.

https://github.com/QuantConnect/Lean/tree/master/Brokerages

 

0

I see thank you for the example. 

Unfortunately, it is not as simple as just writing the code to allow execution to those endpoints, we need to ensure LEAN handles the unknown states of the new orders as they create fills in the portfolio. Without a full integration, they will cause unknown portfolio states.

It is on our radar to create more advanced order types but at this time we only support the ones documented. We'll try and extend this over the next 6 months. I see you're a C# developer, can you help contribute some of them?

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed