Skip to content

JPY Futures History Request Error #8616

@DerekMelchin

Description

@DerekMelchin

Expected Behavior

This algorithm runs without error:

class MyAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_end_date(2021, 1, 1)
        self.set_start_date(2020, 3, 1)
        self._future = self.add_future(Futures.Currencies.JPY)
        self.schedule.on(self.date_rules.month_start(self._future.symbol), self.time_rules.after_market_open(self._future.symbol, 1), self._rebalance)

    def _rebalance(self):
        self.history(self._future.symbol, timedelta(365), Resolution.DAILY)

Actual Behavior

It runs fine until August 2020, then it throws

Runtime Error: cannot handle a non-unique multi-index!
  at reindex
    raise ValueError("cannot handle a non-unique multi-index!")
 in base.py: line 4430
  at _reindex_axes
    new_index, indexer = ax.reindex(
                         ^^^^^^^^^^^
 in generic.py: line 5543
  at reindex
    return self._reindex_axes(
           ^^^^^^^^^^^^^^^^^^^
 in generic.py: line 5520
  at reindex
    return super().reindex(
           ^^^^^^^^^^^^^^^^
 in series.py: line 4980
  at _homogenize
    val = val.reindex(index, copy=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 in construction.py: line 610
  at arrays_to_mgr
    arrays, refs = _homogenize(arrays, index, dtype)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 in construction.py: line 118
  at dict_to_mgr
    return arrays_to_mgr(arrays, columns, index, dtype=dtype, typ=typ, consolidate=copy)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 in construction.py: line 502
  at __init__
    mgr = dict_to_mgr(data, index, columns, dtype=dtype, copy=copy, typ=manager)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 in frame.py: line 732
  at _rebalance
    self.history(self._future.symbol, timedelta(365), Resolution.DAILY)
 in main.py: line 13

Potential Solution

N/A

Reproducing the Problem

Run algorithm above

System Information

QC Cloud

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions