Runtime Error: GetMaximumOrderQuantityForTargetBuyingPower failed to converge to target order margin -1.5651680682753667769363771413. Current order margin is -1.2630574350000. Order quantity -2. Lot size is 1. Order fees 1. Security symbol FSI SJSSXC0V7145. Margin unit 0.6315287175000.
I don't have any clue why I got this or even what module the problem would be in
Arthur Asenheimer INVESTOR
Colton Sellers Martin Molinero
Maybe related to #5727 ?
Simon Koeman
It would be helpful if you could attach a MWE, so the QC team can reproduce the issue.
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.
Colton Sellers
Hey Simon Koeman , if you can, would you mind sharing with us the details of the algorithm that triggered this bug? Arthur is correct that it is likely the change we just made to Lean on Friday but we are having trouble reproducing the issue. If you can't we totally understand, even a MRE like Arthur suggested that is stripped down version of your algorithm would be incredibly helpful.
Thanks again!
Colton
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.
Colton Sellers
Just a follow up, we just merged a change that will provide more details to make it easier to reproduce for us in the event of future bug reports.
If you run your algorithm on the latest Master branch the details it will provide should be sufficient enough for me to reproduce the exact circumstances. Thanks again for the report.
Colton
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.
Simon Koeman
I've since changed my algorithm and not had this particular issue again. I still don't know what exactly caused the issue but it probably was what you are saying. Next time if I have some time to spare I'll go though my code and try to make a MWE, but I don't think I can reproduce this error anymore.
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.
Colton Sellers
No worries, thanks Simon.
As I mentioned above, now the error log should contain enough information for me to reproduce it without your code. At least in unit test form. The source is preferred but don't feel obliged to put in more work than you have time for 😊
Colton
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.
Josh M
Any update on this?
I just got this error and here are the error logs:
Runtime Error: GetMaximumOrderQuantityForTargetBuyingPower failed to converge on the target margin: -14946.065217493140935875633023; the following information can be used to reproduce the issue. Total Portfolio Cash: 1013470.500; Leverage: 1; Order Fee: 139; Lot Size: 1; Per Unit Margin: 497.50000; Current Holdings: QuantConnect.Securities.Option.OptionHolding; Target Percentage: %-1.4962464078122763484654814700; Current Order Target Margin: 138229.03478250685906412436697; Current Order Margin: 138305.00000 in BuyingPowerModel.cs:line 467
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.
Josh M
I got a similar error regardless of if it was calls or puts I was using the emit insights and insight weighted portfolio construction to emit insights to sell
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.
Martin Molinero
Hey Josh M !
Could you please provide an algorithm reproducing the issue? it will help us solve it ASAP, thanks!
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.
Josh M
Hey Martin, I'll post a block of code of a base algorithm as the next post in this series. (cant post backtest because it never completed!)
This isn't exactly my code, but a much reduced version just to replicate the error. Hope it helps! Let me know how I can further improve/assist <3
Best,
JM
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.
Josh M
Colton Sellers Martin Molinero
Any feedback on what I can do to fix the error on my side via the minimal code I posted?
Thanks,
Josh
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.
Manoj Kandlikar
getting same error :
2019-01-23 09:51:00 :Runtime Error: GetMaximumOrderQuantityForTargetBuyingPower failed to converge on the target margin: -1291.1757684500925717102951330; the following information can be used to reproduce the issue. Total Portfolio Cash: -68335.500; Leverage: 1; Order Fee: 2; Lot Size: 1; Per Unit Margin: 1410.00000; Current Holdings: QuantConnect.Securities.Option.OptionHolding; Target Percentage: %-1.3544346382285573423864544900; Current Order Target Margin: 10758.624231549907428289704866; Current Order Margin: 11280.00000 in BuyingPowerModel.cs:line 4672019-01-23 09:51:00 :Algorithm Id:(368fd27ac3a8709379855d07777fab20) completed in 16.28 seconds at 6k data points per second. Processing total of 96,129 data points.
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.
Colton Sellers
Hey everybody,
Thank you for your reports on this issue and also your patience. We worked out the problem in Lean and have created a PR for the fix here.
Josh M I reproduced this issue using your error message and also tested it with your supplied algorithm so thank you for all the info! We really appreciate it. They both succeed without any convergence issues on the branch.
We look to have this fix polished and merged tomorrow!
Thanks,
Colton
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.
Colton Sellers
The PR has been merged!
Thanks again everyone!
Colton
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!