Despite added the filter criteria for specific security to exclude, I keep getting same error during the back testing. Where this is being called from. I filtered out the security from on_data and CoarseSelectionFunction
Backtest Handled Error: No data loaded for ABFS R735QTJ8XC9X because there were no tradeable dates for this security.
def OnData(self, data):
if self.IsWarmingUp or not self.warmUpCompleted:
return
if not data:
self.log("No data available for this slice")
return
try:
if data.ContainsKey("ABFS"):
return
except Exception as e:
self.logger.log(f"Error processing data for ABFS: {str(e)}")
def CoarseSelectionFunction(self, coarse):
trading_date = self.algorithm.Time.strftime('%Y-%m-%d') # Get the trading day in 'YYYY-MM-DD' format
# Track memory usage before selection
process = psutil.Process()
memory_before = process.memory_info().rss / (1024 * 1024) # Convert to MB
selected: List[str] = []
for stock in coarse:
if stock.Symbol.Value != 'ABFS' and stock.HasFundamentalData and stock.Price > params.PRICE_THRESHOLD and stock.DollarVolume > params.DOLLAR_VOLUME_THRESHOLD:
selected.append(stock.Symbol)
Mia Alissi
Here are the issues identified in your code snippets and suggestions to resolve them:
OnData Method:
Exception
class should be derived fromBaseException
. However, this is a minor issue and not directly related to your problem. Ensure that your logging mechanism is correctly set up.CoarseSelectionFunction:
psutil
: It seems likepsutil
is not imported. If you need to track memory usage, ensure you importpsutil
at the beginning of your script.params
: Ensure thatparams
is defined and accessible within the scope ofCoarseSelectionFunction
. You might need to defineparams
as a class attribute or pass it as an argument.Additional Suggestions:
initialize
method or any other part of your algorithm.If the issue persists, consider reviewing the full algorithm to identify any other areas where "ABFS" might be referenced or added.
Sources: Accrual Anomaly, Coarse Fine Fundamental Combo Algorithm, Debugging - QuantConnect.com, Coarse Fundamental Top3 Algorithm, Momentum And Reversal Combined With Volatility Effect In Stocks
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.
Dharmesh Khalasi
How to make sure algorithm to continue despite this below error
Louis Szeto
Hi Dharmesh
Make sure you subscribe on ALB's data using “self.add_equity” method.
BestLouis
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.
Dharmesh Khalasi
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!