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

Author