Unable to run rJtc.Optimization.Launcher.Legacy
dakr001 opened this issue · 9 comments
Hi,
Thank you James for sharing this great effort. Not sure if this is the right place raise a query since there is no discussion forum area. I followed the quickstart steps from https://github.com/jameschch/LeanParameterOptimization.
Basically I'm on the last step: Build and run the project "Jtc.Optimization.Launcher.Legacy". I have managed to build the project but when trying to run, I get the following:
Unable to start Jtc.Optimization.LeanOptimizer.Legacy.dll.
Jtc.Optimization.LeanOptimizer.Legacy.dll is not a valid Win32 application.
Not sure if this is similar to x86/x64 build as raised by abhi555shek. If so how do I check whether built using x86/x64?
Thanks.
The legacy launcher is a .net framework console app (hence the "Legacy") and so you should find an exe in the build output. In due course this will be retired in favor of a cloud launcher and a .net core launcher.
Thanks James,
Still having some issues. I didn't use your Lean fork as had trouble running Lean itself. Used the latest Lean from Github and tested to be working with no changes.
Tested Lean using instructions on https://www.quantconnect.com/lean/documentation/topic14.html
-
Opened, built and ran QuantConnect.Lean.sln. This seems to work fine.
-
Opened, built and ran Opened QuantConnect.Algorithm.CSharp.csproj This seems to work fine.
-
Then tried to build and run Jtc.Optimization.Launcher.Legacy but got some errors:-
Build: 13 succeeded, 5 failed, 2 up-to-date, 0 skipped. Two example errors below
C:\Users\username\source\repos\Lean\LeanParameterOptimization-master\Jtc.Optimization.LeanOptimizer.Example\InstancedConfig.cs(6,7,6,19): error CS0246: The type or namespace name 'QuantConnect' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\username\source\repos\Lean\LeanParameterOptimization-master\Jtc.Optimization.LeanOptimizer.Example\ParameterizedAlgorithm.cs(14,7,14,19): error CS0246: The type or namespace name 'QuantConnect' could not be found (are you missing a using directive or an assembly reference?) -
I tried changing settings based on the quickstart instructions;
Settings:
"algorithmLocation": "../../../Jtc.Optimization.LeanOptimizer.Example/ParameterizedSharedAppDomainAlgorithm.py",
"algorithmTypeName": "ParameterizedAlgorithm",
"dataFolder": "../../../../Lean/Data",
"maxThreads": 4,
"algorithmLanguage": "Python",
But still got some errors:
Build: 15 succeeded, 5 failed, 0 up-to-date, 0 skipped. Two examples below.
3>C:\Users\username\source\repos\Lean\LeanParameterOptimization-master\Jtc.Optimization.LeanOptimizer.Example\ParameterizedAlgorithm.cs(13,7,13,19): error CS0246: The type or namespace name 'QuantConnect' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\username\source\repos\Lean\LeanParameterOptimization-master\Jtc.Optimization.LeanOptimizer.Example\ParameterizedSharedAppDomainAlgorithm.cs(13,7,13,19): error CS0246: The type or namespace name 'QuantConnect' could not be found (are you missing a using directive or an assembly reference?)
Any help please?
The reference from the optimizer to the lean dll's is via a relative path like so:
<Reference Include="QuantConnect.Algorithm">
<HintPath>..\..\Lean\Algorithm\bin\Debug\QuantConnect.Algorithm.dll</HintPath>
</Reference>
This means your Lean clone and the optimizer should share the same parent folder. So something like:
c:\workspace\Lean
c:\workspace\LeanParameterOptimization
The expectation of the reference path is that Lean is build with the default AnyCPU Debug mode.
The reason for this kind of loose reference is to allow the user to control the source of their own Lean clone rather than trust my distribution, or being limited to the libraries included in the official Lean.Engine nuget package. I have considered changing this but still see a valid reason to expect someone to start with a Lean clone and then move onto parallel backtests with the optimizer.
Thanks James,
I misinterpreted the instruction and put LeanParameterOptimization inside the Lean directory. Good news is majority of builds succeeded and I managed to run the optimisation example in the browser. Thank you.
A couple of follow up questions please:
- There were still some errors during build. Should I be concerned about these?
========== Build: 16 succeeded, 4 failed, 0 up-to-date, 0 skipped ==========
12>C:\Users\username\source\repos\LeanParameterOptimization-master\Jtc.Optimization.LeanOptimizer\SingleRunner.cs(152,51,152,78): error CS7036: There is no argument given that corresponds to the required formal parameter 'dataPermissionsManager' of 'LeanEngineAlgorithmHandlers.LeanEngineAlgorithmHandlers(IResultHandler, ISetupHandler, IDataFeed, ITransactionHandler, IRealTimeHandler, IMapFileProvider, IFactorFileProvider, IDataProvider, IAlphaHandler, IObjectStore, IDataPermissionManager)'
12>C:\Users\username\source\repos\LeanParameterOptimization-master\Jtc.Optimization.LeanOptimizer\Runner.cs(110,55,110,82): error CS7036: There is no argument given that corresponds to the required formal parameter 'dataPermissionsManager' of 'LeanEngineAlgorithmHandlers.LeanEngineAlgorithmHandlers(IResultHandler, ISetupHandler, IDataFeed, ITransactionHandler, IRealTimeHandler, IMapFileProvider, IFactorFileProvider, IDataProvider, IAlphaHandler, IObjectStore, IDataPermissionManager)'
12>C:\Users\username\source\repos\LeanParameterOptimization-master\Jtc.Optimization.LeanOptimizer\Handlers\EmptyObjectStore.cs(14,68,14,79): warning CS0067: The event 'EmptyObjectStore.ErrorRaised' is never used
15>CSC : error CS0006: Metadata file 'C:\Users\username\source\repos\LeanParameterOptimization-master\Jtc.Optimization.LeanOptimizer\bin\Debug\netstandard2.0\Jtc.Optimization.LeanOptimizer.dll' could not be found
16>CSC : error CS0006: Metadata file 'C:\Users\username\source\repos\LeanParameterOptimization-master\Jtc.Optimization.LeanOptimizer\bin\Debug\netstandard2.0\Jtc.Optimization.LeanOptimizer.dll' could not be found
17>Jtc.Optimization.OnlineOptimizer -> C:\Users\username\source\repos\LeanParameterOptimization-master\Jtc.Optimization.OnlineOptimizer\bin\Debug\netstandard2.1\Jtc.Optimization.OnlineOptimizer.dll
- I couldn't find any exe in the build output directory C:\Users\username\source\repos\LeanParameterOptimization-master\Jtc.Optimization.Launcher.Legacy\bin\Debug
Hi James, I am getting the same error as mentioned by dakr001 for missing formal parameter 'dataPermissionsManager'. Couldn't find the solution to this yet.
The master branch of the main Lean repository occasionally has breaking changes. If you need a stable Optimizer compatible build, you should be able to use latest branch from my fork. This will lag slightly behind the official build. Otherwise, testing has started on integrating the latest official build. Will update this issue when complete.
Latest Lean build has now been integrated for use in the current Optimizer master branch.
Thanks a lot James. It is working perfectly with C# now but giving an error at 'PythonEngine.Initialize()' for Python sample file, might be due to Pythonnet incompatibility similar to QuantConnect/Lean#1031
@AmazingAbhi If you are still having python issues please open another ticket. Closing this as original issue was fixed.