Hi
When I run backtest my strategy works well there is no error but when I deploy live it show me an error.
Runtime Error: 'AAPL' wasn't found in the Slice object, likely because there was no-data at this moment in time and it wasn't possible to fillforward historical data. Please check the data exists before accessing it with data.ContainsKey("AAPL")
at update
if data[self.symbol] is None:
~~~~^^^^^^^^^^^^^
in ppoAlphaModel.py: line 36
Stack Trace: 'AAPL' wasn't found in the Slice object, likely because there was no-data at this moment in time and it wasn't possible to fillforward historical data. Please check the data exists before accessing it with data.ContainsKey("AAPL")
at update
if data[self.symbol] is None:
~~~~^^^^^^^^^^^^^
in ppoAlphaModel.py: line 36
can you explain me why it is happening and how can I handle this error ?
Mia Alissi
The error message you're seeing is indicating that at the moment your algorithm is trying to access data for the 'AAPL' symbol, there is no data available in the Slice object. This can happen if there is no trading data for 'AAPL' at that specific moment in time, or if the data hasn't been loaded yet.
To handle this error, you can add a check in your code to ensure that the data for 'AAPL' exists before trying to access it. You can use the
ContainsKey
method of the Slice object to do this. Here's an example of how you can modify your code:In this code,
data.ContainsKey(self.symbol)
checks if the data for 'AAPL' exists in the Slice object. If it doesn't, the function returns immediately, preventing the runtime error.This issue is common when running algorithms live because live trading data can have gaps or delays, whereas backtesting data is preloaded and doesn't have these issues. Therefore, it's always a good practice to check if the data exists before trying to access it in a live trading algorithm.
For more information, you can refer to these discussions on the QuantConnect forum where similar issues have been addressed: Discussion 1, Discussion 2, Discussion 3.
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.
Sukhvinder Pal Singh
Thank you Mia Alissi
So now I got new issue
Why it show me to buy new node. I have already a live node in my subscription. can you guide me where I can check if there is already a running node or not.
or any alternative way to fix this issue.
Mia Alissi
You can check your running nodes in the Resources panel of your QuantConnect account. Here's how you can do it:
To stop a node, open the Resources panel and then click the stop button next to the node. This should free up the node for use by another project.
If you still see the message to buy a new node, it could be because all your nodes are currently in use. If you need to run more projects simultaneously, you may need to purchase additional nodes.
For more information, you can refer to the QuantConnect Documentation on Resource Management.
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.
Sukhvinder Pal Singh
ok got it.
Now please let me know how can I view similar UI of quantconnect in my local VS Code. I know it can be I have seen somewhere.
please provide me a guide to setup.
P.S : I have quantconnect Subscription.
Louis Szeto
Hi Sukhvinder
Please refer to our local platform.
Best
Louis
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.
Sukhvinder Pal Singh
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!