QuantConnect / Lean

Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
https://lean.io
Apache License 2.0
9.83k stars 3.26k forks source link

Launcher: loading incorrect python algo #4171

Closed lefig closed 4 years ago

lefig commented 4 years ago

My configuration is as follows:

environment": "backtesting", // "live-paper", "backtesting", "live-interactive", "live-interactive-iqfeed"

// algorithm class selector "algorithm-type-name": "BasicTemplateAlgorithm",

// Algorithm language selector - options CSharp, FSharp, VisualBasic, Python, Java "algorithm-language": "Python",

//Physical DLL location //"algorithm-location": "QuantConnect.Algorithm.CSharp.dll", "algorithm-location": "../../../Algorithm.Python/BasicTemplateAlgorithm.py", //"algorithm-location": "QuantConnect.Algorithm.FSharp.dll", //"algorithm-location": "QuantConnect.Algorithm.VisualBasic.dll", //"algorithm-location": "QuantConnect.Algorithm.Java.dll",

//Jupyter notebook "composer-dll-directory": ".",

// engine "data-folder": "../../../Data/",

So I would expect that the file used is taken from the python project using the relative path.

However, I find that always the current debug folder of the Launcher has python files located by default and that the same named file (BasicTemplateAlgorithm.py) is loaded from here and not the intended script taken from the python lib.

Martin-Molinero commented 4 years ago

Hey @lefig Yes, the https://github.com/QuantConnect/Lean/blob/master/Queues/JobQueue.cs#L176 is copying the python file over if not present using the provided "algorithm-location". I did some quick tests locally and python seems to be loading the algorithm at "algorithm-location" (which is being added to the python path) even if also present locally in the bin folder, to test this I just emptied the BasicTemplateAlgorithm.py present locally verifying Lean still executed it.

Martin-Molinero commented 4 years ago

Closing this issue for now