Hi,
I used LEAN CLI to backtest binance crypto, then use 'lean report' function to create the report.html. I found the benchmark (in my case, it is BTCUSD) line missing in the graph.
The simple script as below:
class Temptest1(QCAlgorithm): def Initialize(self): self.SetTimeZone('UTC') self.SetBrokerageModel(BrokerageName.Binance, AccountType.Cash) self.UniverseSettings.Resolution = Resolution.Minute self.SetAccountCurrency("USD") self.SetBenchmark(Symbol.Create("BTCUSD", SecurityType.Crypto, Market.Binance)) self.SetStartDate(2021, 4, 1) self.SetEndDate(2021, 4, 10) self.SetCash(20000) self.AddCrypto("BTCUSD", Resolution.Minute, Market.Binance) self.AddCrypto("ETHUSD", Resolution.Minute, Market.Binance) self.count=0 def OnData(self, data): """OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data """ self.count += 1 if self.count==1: self.MarketOrder(symbol='ETHUSD', quantity=1) The 'lean backtest' without error, and 'lean report --backtest-data-source-file' created the html. It only has ETHUSD line, and missing the benchmark BTCUSD line.Do we know why?Thanks,henry
Jasper van Merle
Hi Henry,
This is most likely a data issue. The benchmark internally subscribes to hourly data of the given symbol, even if your algorithm already subscribes to data of the same symbol with a lower resolution. Please make sure you got hourly BTCUSD data for Binance from 2021-04-01 until 2021-04-10.
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!