Hello all,
When I run “lean backtest --download-data test_project” for a brand new project named test_project, I get the following error that I could use some help resolving:
Unhandled exception. System.ArgumentException: Unable to locate any exports matching the requested typeName: QuantConnect.Data.Auxiliary.LocalZipMapFileProvider (Parameter 'typeName')
Below is the algorithm class code. I removed the default SPY security and added a single Forex security that I ordered a few months ago through QuantConnect's Data Library. Backtests with this security were working fine in an older version of the Lean CLI.
I appreciate any help getting around this as I prefer backtesting locally first.
This occurs with Lean CLI version 1.0.5.
class Testproject(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2021, 1, 2) # Set Start Date
self.SetEndDate(2021, 1, 3)
self.SetCash(10000) # Set Strategy Cash
self.AddForex("GBPUSD", Resolution.Hour, Market.Oanda)
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.Debug(self.UtcTime)
Jasper van Merle
Hi Jose,
The error you're seeing is most likely caused by an outdated version of LEAN, because we only added the LocalZipMapFileProvider last Monday. Can you try running `lean backtest test_project --update`? The `--update` flag makes the CLI pull the latest version of the LEAN Docker image before starting the backtest.
Jose Torres
Thanks for the fast reply Jasper!
I have some follow-up errors, that I mention here. I'm not sure if I should be making a new post since they're still related to getting data via the ApiDataProvider.
I ran `lean backtest test_project --update`, and see two new errors that cause the backtest to fail. Could you help me understand each one? The backtest isn't trying to access an equity security, so #1 confuses me, and I don't know what “Cost 10” is referring to in #2. I haven't had to pay any sort of cost for forex data in the past in these backtests.
#1. System.ArgumentException: ApiDataProvider(): Must besubscribed to map and factor files to use the ApiDataProviderto download Equity data from QuantConnect. at QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider.CheckMapFactorFileSubscription()
#2 ZipDataCacheProvider.Fetch(): Inner try/catch System.ArgumentException: ApiDataProvider.Fetch(): Cost 10 for forex/oanda/hour/gbpusd.zip data exceeds remaining purchase limit: 0
Thanks again for the help!
Jose
Jasper van Merle
Hi Jose,
1: this is probably caused by the benchmark being set to SPY (which is the default). Make sure you change it using SetBenchmark.
2: we no longer offer free data, but instead charge per file per download now. The new pricing is documented in the CLI documentation.
Jose Torres
Thank you again for the quick replies! Huge help.
Jose
Jose Torres
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!