When running a Deep Reinforcement Learning algorithm on the research environment, the kernel constantly dies after some episodes using the attached notebook (or see my github):
https://github.com/localhorst87/trading_rl.git
My guess was that it's most likely a memory issue, so I tried to run it offline, using the LEAN engine.
I followed all required installation steps. Importing everythin works well, but trying to call the QuantBook there's the following error:
Exception Traceback (most recent call last)
<ipython-input-1-928c9a85d91c> in <module>
19
20 # Create an instance
---> 21 qb = QuantBook()
22
23 # Select asset data
Exception: QuantBook.Main(): System.ArgumentException: Unable to locate any exports matching the requested typeName: QuantConnect.Lean.Engine.Results.BacktestingResultHandler
Parametername: typeName
bei QuantConnect.Util.Composer.GetExportedValueByTypeName[T](String typeName) in C:\Users\Maurizio\Documents\Programming\python\finance\Lean\Common\Util\Composer.cs:Zeile 205.
bei QuantConnect.Lean.Engine.LeanEngineAlgorithmHandlers.FromConfiguration(Composer composer) in C:\Users\Maurizio\Documents\Programming\python\finance\Lean\Engine\LeanEngineAlgorithmHandlers.cs:Zeile 171.
bei QuantConnect.Jupyter.QuantBook..ctor() in C:\Users\Maurizio\Documents\Programming\python\finance\Lean\Jupyter\QuantBook.cs:Zeile 68.
bei QuantConnect.Jupyter.QuantBook..ctor() in C:\Users\Maurizio\Documents\Programming\python\finance\Lean\Jupyter\QuantBook.cs:Zeile 101.
There's another user with the problem, but the issue remained unresolved until now...See the last answer of the following thread:
https://www.quantconnect.com/forum/discussion/2847/running-a-local-research-environment/p1
Did anybody had the same issue?
Thanks, Maurizio
I'm using Windows 10, Python 3.6
Link Liang
Hi Maurizio,
Here is a solution that might help your problem:
1. In config.json under Lean/Launcher folder, uncomment line
"composer-dll-directory": ".",
2. rebuild the whole solution
If you still encounter this problem or have other issues, feel free to follow up!
Maurizio Ahmann
hey Liang,
first of all thank you for your response.
I made some progress and now my notebook runs offline! I made the dumb mistake to start the notebook from the wrong directory. not from the launcher folder...
In addition: To request history data I had to adjust the commands to request history data. Same for indicators.
# not working: price = qb.History("EURUSD", 100, Resolution.Hour) # working: price = qb.History( qb.Symbol("EURUSD"), 100, Nullable[Resolution](Resolution.Hour) )
Maurizio Ahmann
Regarding the other issue that the kernel dies: I could find out that the qb.Indicator - method massively slows down when calling repeatedly. Can you help out?
Link Liang
Hi Maurizio,
Thanks for sharing your experience to the community!
qb.Indicator in fact returns a panda dataframe, not a QuantConnect indicator class. Therefore if you request a very large amount of data, the kernel would have to wait for a long time until the dataframe is returned. Because of the limitation of timeout in our research environment, it is very likely to kill the kernel.
It is a good idea to run research locally. Meanwhile, you could try to use lower resolution to reduce the size of a single request. In addition, cutting the time between startdate and enddate into several pieces, and request them seperately might also help to prevent kernel death.
Regarding the speed, the only real way to make it faster is to reduce the amount of data you request. You could store and reuse some indicators data to avoid request the same data multiple times. However, if you need a lot of data for your algorithm, the speed would be Inevitably slow.
Maurizio Ahmann
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!