C:\Users\63036\Desktop\LeanCLI>lean backtest "Energetic Apricot Gorilla" --download-data
Select the organization to purchase and download data with: yi ren
[?1h=20210908 23:00:06.283 TRACE:: Config.Get(): Configuration key not found. Key: plugin-directory - Using default
value:
20210908 23:00:06.291 TRACE:: Composer(): Loading Assemblies from /Lean/Launcher/bin/Debug
20210908 23:00:06.304 TRACE:: Python for .NET Assembly:
QuantConnect.DataSource.ExamplePythonScriptMyCustomDataTypeDoNotUse, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null
20210908 23:00:06.332 TRACE:: Python for .NET Assembly: Python.Runtime, Version=2.0.6.0, Culture=neutral,
PublicKeyToken=5000fea6cba702dd
20210908 23:00:06.350 TRACE:: Config.Get(): Configuration key not found. Key: data-directory - Using default value:
../../../Data/
20210908 23:00:06.353 TRACE:: Config.Get(): Configuration key not found. Key: version-id - Using default value:
20210908 23:00:06.353 TRACE:: Config.Get(): Configuration key not found. Key: cache-location - Using default value:
/Lean/Data
20210908 23:00:06.353 TRACE:: Engine.Main(): LEAN ALGORITHMIC TRADING ENGINE v2.5.0.0 Mode: DEBUG (64bit) Host:
DESKTOP-IRVG37J
20210908 23:00:06.357 TRACE:: Engine.Main(): Started 11:00 PM
20210908 23:00:06.358 TRACE:: Config.Get(): Configuration key not found. Key: lean-manager-type - Using default value:
LocalLeanManager
20210908 23:00:06.370 TRACE:: JobQueue.NextJob(): Selected /LeanCLI/main.py
20210908 23:00:06.416 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-capacity - Using default value: 120
20210908 23:00:06.417 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-time-interval-minutes - Using default
value: 1440
20210908 23:00:06.417 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-refill-amount - Using default value: 18
20210908 23:00:06.420 TRACE:: Config.Get(): Configuration key not found. Key: data-permission-manager - Using default
value: DataPermissionManager
20210908 23:00:06.429 TRACE:: Config.GetValue(): data-purchase-limit - Using default value:
79228162514264337593543950335
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an
invocation.
 ---> System.InvalidOperationException: ApiDataProvider(): Must agree to terms at
https://www.quantconnect.com/terms/data/?organization=97092a1c19fb05e80f8da331c1a5b4aa, before using the
ApiDataProvider
   at QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider..ctor() in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/DataFeeds/ApiDataProvider.cs:line 92
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean&
canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
   at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache,
Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at QuantConnect.Util.Composer.GetExportedValueByTypeName[T](String typeName) in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Util/Composer.cs:line 259
   at QuantConnect.Lean.Engine.LeanEngineAlgorithmHandlers.FromConfiguration(Composer composer) in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/LeanEngineAlgorithmHandlers.cs:line 198
   at QuantConnect.Lean.Engine.Initializer.GetAlgorithmHandlers() in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/Initializer.cs:line 78
   at QuantConnect.Lean.Launcher.Program.Main(String[] args) in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Launcher/Program.cs:line 72
Error: Something went wrong while running 'Energetic Apricot Gorilla' in the 'backtesting' environment, the output is
stored in 'Energetic Apricot Gorilla\backtests\2021-09-09_07-00-03'

C:\Users\63036\Desktop\LeanCLI>lean backtest "Pensive Magenta Dinosaur" --download-data
Select the organization to purchase and download data with: yi ren
[?1h=20210908 23:03:05.136 TRACE:: Config.Get(): Configuration key not found. Key: plugin-directory - Using default
value:
20210908 23:03:05.144 TRACE:: Composer(): Loading Assemblies from /Lean/Launcher/bin/Debug
20210908 23:03:05.158 TRACE:: Python for .NET Assembly:
QuantConnect.DataSource.ExamplePythonScriptMyCustomDataTypeDoNotUse, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null
20210908 23:03:05.185 TRACE:: Python for .NET Assembly: Python.Runtime, Version=2.0.6.0, Culture=neutral,
PublicKeyToken=5000fea6cba702dd
20210908 23:03:05.206 TRACE:: Config.Get(): Configuration key not found. Key: data-directory - Using default value:
../../../Data/
20210908 23:03:05.209 TRACE:: Config.Get(): Configuration key not found. Key: version-id - Using default value:
20210908 23:03:05.209 TRACE:: Config.Get(): Configuration key not found. Key: cache-location - Using default value:
/Lean/Data
20210908 23:03:05.209 TRACE:: Engine.Main(): LEAN ALGORITHMIC TRADING ENGINE v2.5.0.0 Mode: DEBUG (64bit) Host:
DESKTOP-IRVG37J
20210908 23:03:05.212 TRACE:: Engine.Main(): Started 11:03 PM
20210908 23:03:05.214 TRACE:: Config.Get(): Configuration key not found. Key: lean-manager-type - Using default value:
LocalLeanManager
20210908 23:03:05.226 TRACE:: JobQueue.NextJob(): Selected /LeanCLI/main.py
20210908 23:03:05.274 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-capacity - Using default value: 120
20210908 23:03:05.274 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-time-interval-minutes - Using default
value: 1440
20210908 23:03:05.275 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-refill-amount - Using default value: 18
20210908 23:03:05.277 TRACE:: Config.Get(): Configuration key not found. Key: data-permission-manager - Using default
value: DataPermissionManager
20210908 23:03:05.286 TRACE:: Config.GetValue(): data-purchase-limit - Using default value:
79228162514264337593543950335
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an
invocation.
 ---> System.InvalidOperationException: ApiDataProvider(): Must agree to terms at
https://www.quantconnect.com/terms/data/?organization=97092a1c19fb05e80f8da331c1a5b4aa, before using the
ApiDataProvider
   at QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider..ctor() in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/DataFeeds/ApiDataProvider.cs:line 92
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean&
canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
   at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache,
Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at QuantConnect.Util.Composer.GetExportedValueByTypeName[T](String typeName) in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Util/Composer.cs:line 259
   at QuantConnect.Lean.Engine.LeanEngineAlgorithmHandlers.FromConfiguration(Composer composer) in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/LeanEngineAlgorithmHandlers.cs:line 198
   at QuantConnect.Lean.Engine.Initializer.GetAlgorithmHandlers() in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Engine/Initializer.cs:line 78
   at QuantConnect.Lean.Launcher.Program.Main(String[] args) in
/LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Launcher/Program.cs:line 72
Error: Something went wrong while running 'Pensive Magenta Dinosaur' in the 'backtesting' environment, the output is
stored in 'Pensive Magenta Dinosaur\backtests\2021-09-09_07-03-01'

 

class PensiveMagentaDinosaur(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 3, 7)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.AddEquity("SPY", Resolution.Minute)


    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
        '''

        if not self.Portfolio.Invested:
           self.SetHoldings("SPY", 1)

What's wrong with that