Hello, I am hoping to build an angular dashboard for local lean-cli backtest results but I am running into the following error:

  1. Traceback (most recent call last):
  2. File "/Users/me/PycharmProjects/projectName/src/quantconnect/bt_viz/main.py", line 106, in <module>
  3. qb: QuantBook = QuantBook()
  4. System.Exception: QuantBook.Main(): System.ArgumentException: Unable to locate any exports matching the requested typeName: (Parameter 'typeName')
  5. at QuantConnect.Util.Composer.GetExportedValueByTypeName[T](String typeName, Boolean forceTypeNameOnExisting) in /Users/me/PycharmProjects/Lean/Common/Util/Composer.cs:line 307
  6. at QuantConnect.Lean.Engine.LeanEngineSystemHandlers.FromConfiguration(Composer composer) in /Users/me/PycharmProjects/Lean/Engine/LeanEngineSystemHandlers.cs:line 109
  7. at QuantConnect.Research.QuantBook..ctor() in /Users/me/PycharmProjects/Lean/Research/QuantBook.cs:line 120
  8. at QuantConnect.Research.QuantBook..ctor() in /Users/me/PycharmProjects/Lean/Research/QuantBook.cs:line 197
  9. at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
  10. at System.Reflection.ConstructorInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)

 

My python code (not in a Jupyter notebook nor backtest):

  1. import os
  2. import sys
  3. sys.path.append(os.path.dirname("/Users/me/PycharmProjects/lean/Launcher/bin/Debug/"))
  4. from pythonnet import load
  5. load("coreclr")
  6. import pythonnet
  7. import clr
  8. import json
  9. clr.AddReference("QuantConnect.Research")
  10. clr.AddReference("System")
  11. clr.AddReference("QuantConnect.Common")
  12. clr.AddReference("QuantConnect.Indicators")
  13. clr.AddReference("QuantConnect.Lean.Engine")
  14. from datetime import timedelta, datetime
  15. from QuantConnect.Research import QuantBook
  16. from QuantConnect import *
  17. from QuantConnect.Algorithm import *
  18. #from QuantConnect.Packets import BacktestResult
  19. qb: QuantBook = QuantBook()
+ Expand

and my config.json

 

  1. {
  2. "algorithm-language": "Python",
  3. "parameters": {},
  4. "description": "",
  5. "cloud-id": 111111,
  6. "organization-id": "aaaa",
  7. "local-id": 1111,
  8. "job-user-id": "11111",
  9. "api-access-token": "aa",
  10. "composer-dll-directory": "/Users/me/PycharmProjects/lean/Launcher/bin/Debug",
  11. "data-directory": "../data",
  12. "algo-type-name": "BasicTemplateAlgorithm",
  13. "python-venv": "/Users/me/PycharmProjects/projectName/venv/bin/"
  14. }

I think I'm missing a config value , maybe i need to load lean.json some way.

Thanks!

 

Author

Non Compete

November 2022