Hi,
I just installed Lean CLI by 'pip install lean'. I also used 'lean data generate --start 20201230 --end 20210404 --symbol-count 2 --security-type Crypto --resolution Daily' to generate some random daily crypto data for testing first.
It do create some random crypto coins under data/crypto/gdax/daily folder, like htm_trade.zip.
But when I do backtest, in main,py. I added below:
self.AddCrypto('htm',Resolution.Daily)When run backtest, I always met below error:
20210406 06:02:24.528 ERROR:: During the algorithm initialization, the following exception has occurred: ArgumentException : Symbol can't be found in the Symbol Properties Database:
HTM
at QuantConnect.Securities.SecurityService.CreateSecurity (QuantConnect.Symbol symbol, System.Collections.Generic.List`1[T] subscriptionDataConfigList, System.Decimal leverage,
System.Boolean addToSymbolCache) [0x0009f] in <c30ce690247848b4a0fd72de161d85ef>:0
at QuantConnect.Securities.SecurityManager.CreateSecurity (QuantConnect.Symbol symbol, System.Collections.Generic.List`1[T] subscriptionDataConfigList, System.Decimal leverage,
System.Boolean addToSymbolCache) [0x00000] in <c30ce690247848b4a0fd72de161d85ef>:0
at QuantConnect.Algorithm.QCAlgorithm.AddSecurity[T] (QuantConnect.SecurityType securityType, System.String ticker, System.Nullable`1[T] resolution, System.String market,
System.Boolean fillDataForward, System.Decimal leverage, System.Boolean extendedMarketHours) [0x000a9] in <8aacd975115945239bf5a2a558e45dc3>:0
When I replace with below standard btcusd, then all backtest OK.
self.AddCrypto('btcusd',Resolution.Daily)
Does this mean only the special symbol's name we can use during local backtest?
Thanks,
henry
Jasper van Merle
Hi Henry,
The error you are seeing is a bug, you should be able to use randomly generated symbols in local backtests. I opened an issue for it on GitHub, you can track our progress here.
Henry111
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!