Buy and Hold / Futures Margin Calls Issue

Back

 

I keep getting this error which isn't allowing me to complete the bootcamp and i dont know how to get by it:

Runtime Error: Error running OnEndOfAlgorithm(): KeyNotFoundException : This asset symbol (GC VOFJUCDY9W15) was not found in your security list. Please add this security or check it exists before using it with 'Securities.ContainsKey("GC VOFJUCDY9W15")'
at QuantConnect.Securities.SecurityManager.get_Item (QuantConnect.Symbol symbol) [0x00021] in <2e90ef4f2ffd4a758e24242ce2a36e80>:0
at QuantConnect.Securities.SecurityPortfolioManager.get_Item (QuantConnect.Symbol symbol) [0x00000] in <2e90ef4f2ffd4a758e24242ce2a36e80>:0
at QuantConnect.ExtendedDictionary`1[T].get_Item (System.String ticker) [0x0001b] in <2e90ef4f2ffd4a758e24242ce2a36e80>:0
a (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0 (Open Stacktrace)

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.


Hi Lee,

Each Bootcamp task has a button at the bottom of the page to show the solution. I recommend comparing the code causing this issue to the solution file. As the error message points out, ensure the algorithm isn't trying to access the SecurityManager with a key it doesn't have. This can be done by using its ContainsKey method.

Best,
Derek Melchin

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