Results of Covered Call Tutorial from QC Backtest (Fig 1) differs from Local LEAN CLI Backtest (Fig 2).
Fig 1 Results of Covered Call Tutorial from https://www.quantconnect.com/tutorials/applied-options/covered-callFIg 2 Local LEAN CLI Backtest
It's almost as if the local LEAN CLI backtest did not fulfil any option orders.
Not sure why there's a discrepancy.
Related questions:
Are options data free?
What is the recommended warm-up convention? How many days? Is warm-up required? I noticed that I didn't have to call `self.SetWarmUp(TimeSpan.FromDays( 60 ))` when running backtests on QC. However, on local LEAN CLI backtests, I would get the following error message if I didn't call `self.SetWarmUp()`:
20211101 10:03:16.161 ERROR:: SPY: The security does not have an accurate
price as it has not yet received a bar of data. Before placing a trade (or using
SetHoldings) warm up your algorithm with SetWarmup, or use
slice.Contains(symbol) to confirm the Slice object has price before using the
data. Data does not necessarily all arrive at the same time so your algorithm
should confirm the data is ready before using it. In live trading this can mean
you do not have an active subscription to the asset class you're trying to
trade. If using custom data make sure you've set the 'Value' property.
And even with the call to warm-up I'd get:
20211101 10:54:19.276 ERROR:: This operation is not allowed in
Initialize or during warm up: OrderRequest.Submit. Please move this code to the
OnWarmupFinished() method.
I've attached the context surrounding this error message below.
I'm not sure what I'm misunderstanding here. Help appreciated.
Context surrounding warm-up error message:
< ... > means omitted lines.
< ... >
20211101 10:54:18.675 TRACE:: SetUp Backtesting: User: 0 ProjectId: 844107777
AlgoId: 1202266554
20211101 10:54:18.676 TRACE:: Dates: Start: 01/01/2014 End: 03/01/2014 Cash:
¤100,000.00
20211101 10:54:18.684 TRACE:: BacktestingResultHandler(): Sample Period Set: 21.60
20211101 10:54:18.689 TRACE:: Time.TradeableDates(): Security Count: 2
20211101 10:54:18.697 TRACE:: Config.GetValue(): forward-console-messages - Using
default value: True
20211101 10:54:18.708 TRACE:: JOB HANDLERS:
20211101 10:54:18.709 TRACE:: DataFeed:
QuantConnect.Lean.Engine.DataFeeds.FileSystemDataFeed
20211101 10:54:18.712 TRACE:: Setup:
QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler
20211101 10:54:18.714 TRACE:: RealTime:
QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler
20211101 10:54:18.715 TRACE:: Results:
QuantConnect.Lean.Engine.Results.BacktestingResultHandler
20211101 10:54:18.716 TRACE:: Transactions:
QuantConnect.Lean.Engine.TransactionHandlers.BacktestingTransactionHandler
20211101 10:54:18.717 TRACE:: Alpha:
QuantConnect.Lean.Engine.Alphas.DefaultAlphaHandler
20211101 10:54:18.719 TRACE:: ObjectStore:
QuantConnect.Lean.Engine.Storage.LocalObjectStore
20211101 10:54:18.721 TRACE:: History Provider:
QuantConnect.Lean.Engine.HistoricalData.SubscriptionDataReaderHistoryProvider
20211101 10:54:18.718 TRACE:: Debug: Launching analysis for 1202266554 with LEAN
Engine v2.5.0.0
20211101 10:54:18.759 TRACE:: Event Name "Daily Sampling", scheduled to run at
1/1/2014 5:00:00 AM (UTC)...
20211101 10:54:18.760 TRACE:: AlgorithmManager.Run(): Begin DataStream - Start:
1/1/2014 12:00:00 AM Stop: 3/1/2014 11:59:59 PM
20211101 10:54:18.796 TRACE:: AlgorithmManager.Stream(): WarmupHistoryRequest: IBM:
Start: 9/3/2013 4:00:00 AM End: 1/1/2014 5:00:00 AM Resolution: Minute
20211101 10:54:19.221 TRACE:: Debug: Warning: The following securities were set to
raw price normalization mode to work with options: IBM...
Algorithm warming up...
20211101 10:54:19.276 ERROR:: This operation is not allowed in
Initialize or during warm up: OrderRequest.Submit. Please move this code to the
OnWarmupFinished() method.
20211101 10:54:21.766 TRACE:: AlgorithmManager.Stream(): Finished warmup
20211101 10:54:21.869 TRACE:: UniverseSelection.AddPendingInternalDataFeeds():
Adding internal benchmark data feed IBM,IBM,Hour,TradeBar,Trade,Adjusted,Internal
20211101 10:54:22.054 TRACE:: Synchronizer.GetEnumerator(): Exited thread.
20211101 10:54:22.055 TRACE:: AlgorithmManager.Run(): Firing On End Of Algorithm...
20211101 10:54:22.059 TRACE:: Engine.Run(): Exiting Algorithm Manager
20211101 10:54:22.064 TRACE:: FileSystemDataFeed.Exit(): Start. Setting
cancellation token...
20211101 10:54:22.066 TRACE:: FileSystemDataFeed.Exit(): Exit Finished.
20211101 10:54:22.068 TRACE:: DefaultAlphaHandler.Exit(): Exiting...
20211101 10:54:22.076 TRACE:: DefaultAlphaHandler.Exit(): Ended
20211101 10:54:22.077 TRACE:: BacktestingResultHandler.Exit(): starting...
20211101 10:54:22.079 TRACE:: BacktestingResultHandler.Exit(): Saving logs...
20211101 10:54:22.089 TRACE:: StopSafely(): waiting for 'Result Thread' thread to
stop...
20211101 10:54:22.129 TRACE:: Debug: Algorithm finished warming up.
20211101 10:54:22.130 TRACE:: Log: Time: 02/06/2014 05:00:00 OrderID: 1 EventID: 1
Symbol: IBM Status: Submitted Quantity: 100
20211101 10:54:22.131 TRACE:: Debug: Algorithm Id:(1202266554) completed in 3.34
seconds at 21k data points per second. Processing total of 70,579 data points.
20211101 10:54:22.132 TRACE:: Debug: Your log was successfully created and can be
retrieved from: /Results/1202266554-log.txt
20211101 10:54:22.133 TRACE:: BacktestingResultHandler.Run(): Ending Thread...
20211101 10:54:22.283 TRACE:: Config.GetValue(): regression-update-statistics -
Using default value: False
20211101 10:54:22.284 TRACE::
STATISTICS:: Total Trades 0
STATISTICS:: Average Win 0%
STATISTICS:: Average Loss 0%
< ... >
Louis Szeto
Hi Urban
It looks like you didn't have the required data for the local backtest. For locally used data, they are subjected to a fee per file. You may check out the pricing page of the US equity options dataset, and this tutorial on how to download the local data for backtesting.
Best
Louis
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.
Urban
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!