Back

Questions about placing orders

A couple of questions about placing orders and broker interactions...

1. Are all orders placed as "good till cancelled"? Any convenient way to place a "good till end of day" order without writing code to cancel un-filled orders at the end of day?

2. How can one get the current cash or buying power in a live traded Interactive Brokers (IB) account? I want to make sure I don't order more than I can afford.

Also, excuse me if this is spelled out in documentation. If so, could you also point me in that direction so I won't need to expose my ignorance in the forums here.

Thanks

Update Backtest








At the moment, all order are GTC. We need to cancel un-filled orders manually (write code to do it).
Current cash is self.Portfolio.Cash, but we should look at self.Portfolio.MarginRemaining for buying power. If you want to evaluate the max quantity you can use in an order, you can use:

target = 1 # 100%
leverage = self.Securities[symbol].Leverage
maximum_quantity = self.CalculateOrderQuantity(symbol, target * leverage)

In the Algorithm Lab page, you can find links to docs and tutorials. 

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.


Thank you! I'll give that a try. The documentation link on the Algorithm Lab page points to the overview (which doesn't have info on either Portfolio.Cash or CalculateOrderQuantity.) I did find something though in the lean docs. https://www.quantconnect.com/lean/docs#topic458.html

0

We are working on more detailed documentation and tutorials.
They are now open-source projects, so everyone can contribute and/or ask for new additions in the issues (here and here).

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