Hi,
I'm trying to setup a research notebook to work locally on a Windows 10 machine.
First I tried the recommended approach, using Lean CLI.. That didn't work because the data directory isn't configured correctly by the CLI. However, after fixing that issue in the config.json file I now get a new exception when trying to create QuantBook() :
ExceptionTraceback (most recent call last)
<ipython-input-2-89d82235227d> in <module>
19
20 # Create an instance
---> 21 qb = QuantBook()
22
23 # Select asset data
Exception: QuantBook.Main(): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ArgumentException: Must specify valid information for parsing in the string. (Parameter 'value')
at System.Enum.TryParse(Type enumType, String value, Boolean ignoreCase, Boolean throwOnFailure, Object& result)
at System.Enum.Parse(Type enumType, String value)
at QuantConnect.Queues.JobQueue..ctor()
--- 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)
at QuantConnect.Lean.Engine.LeanEngineSystemHandlers.FromConfiguration(Composer composer)
at QuantConnect.Research.QuantBook..ctor()
at QuantConnect.Research.QuantBook..ctor()
I then tried running it locally, without lean and without the docket image. That actually worked better, but not completely. I was able to create the QuantBook, import the history and plot the chart, however, it still fails when running the last block with the BollingerBars. Here it throws an exception from pandas about an invalid operation:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-4-2be348dae713> in <module>
4
5 # Gets historical data of indicator
----> 6 bbdf = qb.Indicator(bb, "SPY", 360, Resolution.Daily)
7
8 # drop undesired fields
c:\python\python36\lib\site-packages\pandas\core\frame.py in __init__(self, data, index, columns, dtype, copy)
409 )
410 elif isinstance(data, dict):
--> 411 mgr = init_dict(data, index, columns, dtype=dtype)
412 elif isinstance(data, ma.MaskedArray):
413 import numpy.ma.mrecords as mrecords
c:\python\python36\lib\site-packages\pandas\core\internals\construction.py in init_dict(data, index, columns, dtype)
255 arr if not is_datetime64tz_dtype(arr) else arr.copy() for arr in arrays
256 ]
--> 257 return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
258
259
c:\python\python36\lib\site-packages\pandas\core\internals\construction.py in arrays_to_mgr(arrays, arr_names, index, columns, dtype)
80
81 # don't force copy because getting jammed in an ndarray anyway
---> 82 arrays = _homogenize(arrays, index, dtype)
83
84 # from BlockManager perspective
c:\python\python36\lib\site-packages\pandas\core\internals\construction.py in _homogenize(data, index, dtype)
309 # Forces alignment. No need to copy data since we
310 # are putting it into an ndarray later
--> 311 val = val.reindex(index, copy=False)
312 else:
313 if isinstance(val, dict):
c:\python\python36\lib\site-packages\pandas\core\series.py in reindex(self, index, **kwargs)
4219 @Appender(generic.NDFrame.reindex.__doc__)
4220 def reindex(self, index=None, **kwargs):
-> 4221 return super().reindex(index=index, **kwargs)
4222
4223 def drop(
c:\python\python36\lib\site-packages\pandas\core\generic.py in reindex(self, *args, **kwargs)
4512 # perform the reindex on the axes
4513 return self._reindex_axes(
-> 4514 axes, level, limit, tolerance, method, fill_value, copy
4515 ).__finalize__(self)
4516
c:\python\python36\lib\site-packages\pandas\core\generic.py in _reindex_axes(self, axes, level, limit, tolerance, method, fill_value, copy)
4533 fill_value=fill_value,
4534 copy=copy,
-> 4535 allow_dups=False,
4536 )
4537
c:\python\python36\lib\site-packages\pandas\core\generic.py in _reindex_with_indexers(self, reindexers, fill_value, copy, allow_dups)
4575 fill_value=fill_value,
4576 allow_dups=allow_dups,
-> 4577 copy=copy,
4578 )
4579
c:\python\python36\lib\site-packages\pandas\core\internals\managers.py in reindex_indexer(self, new_axis, indexer, axis, fill_value, allow_dups, copy)
1249 # some axes don't allow reindexing with dups
1250 if not allow_dups:
-> 1251 self.axes[axis]._can_reindex(indexer)
1252
1253 if axis >= self.ndim:
c:\python\python36\lib\site-packages\pandas\core\indexes\base.py in _can_reindex(self, indexer)
3360 # trying to reindex on an axis with duplicates
3361 if not self.is_unique and len(indexer):
-> 3362 raise ValueError("cannot reindex from a duplicate axis")
3363
3364 def reindex(self, target, method=None, level=None, limit=None, tolerance=None):
ValueError: cannot reindex from a duplicate axis
Any suggestions how to fix either of these issues?
Thanks,
Eran
Jared Broad
Hi Eran,
We only offer support on the LEAN CLI; there are too many environmental variables to support people's individual setups.
What do you mean by this and could you please provide detailed logs?
>I tried the recommended approach, using Lean CLI.. That didn't work because the data directory isn't configured correctly by the CLI. However, after fixing that issue in the config.json file
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.
Eran Kutner
Looks like the second issue is fixed in a later commit, so now the local environment is working as expected. The LeanCLI environment still doesn't work but that is less of a concern for me.
Thanks
Jasper van Merle
Hi Eran,
What do you mean with “The LeanCLI environment still doesn't work”? Do you mean running `lean research <project name>` in the directory you ran `lean init` in doesn't work?
Eran Kutner
Jared Broad
Hi Jared,
The original error I got from the docker container said something about not being able to access the data directory. I couldn't figure out why it didn't work because I saw in the Jupyter log that it was using the default data-directory value of ../../../Data and verified that indeed there was a data folder at that location, under /Lean/Launcher. When I manually created a config.json file in my project folder and explicitly set the data-directory to an absolute path I stopped getting the error about the data folder and started getting the one I posted above. The strange thing is that I tried to reproduce it now for you and can't, even after deleting my own config file I still get the above error and not the data access error.
Anyway, as I wrote in my previous comment, I got it to work properly in my local environment and the exception in the BollingerBars indicator was a bug that was fixed in a commit a few days ago.
Non Compete
try adding to the config.js file for example
"data-directory": "../data"
Eran Kutner
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!