LEAN is the open
source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Liquid ETF Competition: $10,000 Prize Pool
Alpha Streams Long Only, ETF Universe Competition.
Learn more
Can someone advise regarding how to address the 'Insufficient Buying Power' errors I'm getting when running the code shown below? I've searched the documentation and Community postings but didn't see anything that would directly help in this case.
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.
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.
The algorithm is using daily data. Consequently, the target quantities calculated by EqualWeightingPortfolioConstructionModel (and MaximumDrawdownPercentPerSecurity) models take into account the previous day closing price. Since the order, converted into MarketOnOpen order, will be filled with the current day's open price, a price gap can cause the Insufficient Buying Power error.
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 for the response. I've revised the algorithm to use minute resolution data, but am still getting the errors below. The backtest is attached. Are there other settings that need to be changed?
Troy
482 | 13:47:26: Backtest Handled Error: Order Error: id: 97, Insufficient buying power to complete order (Value:988655.22), Reason: Id: 97, Initial Margin: 898793.6177272727272727272727, Free Margin: 92341.4721439090909090909091483 | 13:47:36: Backtest Handled Error: Order Error: id: 1425, Insufficient buying power to complete order (Value:860577.51), Reason: Id: 1425, Initial Margin: 782357.03590909090909090909092, Free Margin: 80649.69459076363636363636363484 | 13:47:42: Backtest Handled Error: Order Error: id: 2018, Insufficient buying power to complete order (Value:797302.99), Reason: Id: 2018, Initial Margin: 724833.58500000000000000000001, Free Margin: 74936.62417124545454545454545
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...
To attach images, drag and drop them into the textarea.
Please tag your post with applicable tags from below or click Publish to continue.
FAQ
A:
Please send bug reports to support@quantconnect.com
Please send bug reports to QuantConnect Support so our team can respond as quickly as
possible. Click Support Request below to submit your discussion as a bug report, or Publish
Discussion to continue posting as a discussion to the forums.
Please send bug reports to support@quantconnect.com