So I'm fairly new to all of this, so bare with me as I try to explain my issue.
My code is simple, I am trying to add securities to a universe with a CoarseFundemental selection.
private SecurityChanges _changes = SecurityChanges.None;
public override void Initialize()
{
SetStartDate(2020, 10, 25); //Set Start Date
SetEndDate(DateTime.Now);
SetCash(3000);//Set Strategy Cash
UniverseSettings.Resolution = Resolution.Daily;
AddUniverse(CoarseFundementalFilter);
}
private IEnumerable<Symbol> CoarseFundementalFilter(IEnumerable<CoarseFundamental> coarse)
{
var selected = coarse.Where(c => c.Price < 35).OrderByDescending(x => x.DollarVolume).Select(x => x.Symbol).Take(10);
return selected;
}
public override void OnSecuritiesChanged(SecurityChanges changes)
{
_changes = changes;
Log($"OnSecuritiesChanged({Time}):: {changes}");
}
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// Slice object keyed by symbol containing the stock data
public override void OnData(Slice data)
{
Log($"OnData({UtcTime:o}): Keys: {string.Join(", ", data.Keys.OrderBy(x => x))}");
}
I keep getting the following errors in the backtest.
Backtest Handled Error: No data loaded for ACB WYXFTA8WCGV9 because there were no tradeable dates for this security.
No data loaded for XPEV XHD34ASNWZ1H because there were no tradeable dates for this security.
No data loaded for PLTR XIAKBH8EIMHX because there were no tradeable dates for this security.
No data loaded for TLRY WWAWWB4P01GL because there were no tradeable dates for this security.
No data loaded for AVTR X4K9WJLO3VXH because there were no tradeable dates for this security.
What is it that I'm doing wrong? Why do I get the error and never see any of my Log output?
Shile Wen
Hi Marco,
The error message isn't an indication that you are doing something wrong, it's just a warning that data is missing for a given security. Furthermore, to view the logs, go into tab generated by the backtest and scroll down until you see the Log tab. Users who'd like to print the output to the console should use the Debug method.
Best,
Shile Wen
Mike Kemner
Sorry to resurrect an old thread but can you elaborate on this? Is the data missing due to it not being added into the universe or is the data simply not available in the quantconnect db?
Varad Kabade
Hi Marco Williams,
This warning is thrown when a security is in the universe only when the market is not open. See the attached backtest and the LEAN source code [1, 2, 3] for reference.
Varad Kabade
Mike Kemner
Thanks for the reply Varad kabade, Is there a way to detect this before it happens when the market is open. My algorithm breaks in March 2020. I'm guessing this is due to a circuit breaker halt.
Varad Kabade
Hi Mike Kemner,
We recommend using the IsTradable property of the Security object before trading on the asset. Refer to the attached backtest demonstrating the above logic. For further assistance, please open a new thread and attach the backtest.
Best,
Varad Kabade
Xinmin Cai
I am piggybacking on this question.
I have something written to run selection after the last trading day for each week (Usually on Saturday). Because of this, I got lots of logs. Is there a way to suppress the logs so that I don't use tons of logs?
Thanks in advance!
Xinmin Cai
I should add that I got this error when using self.History() function to request historical data.
Varad Kabade
Hi Xinmin Cai,
Would you mind attaching the backtest/code snippet highlighting the issue for precise diagnosis?
Best,
Varad Kabade
Marco Williams
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!