We need to call gc.collect before tearing down our class because we have
a cycle between TradingAlgorithm and AlgorithmSimulator which ultimately
holds a reference to the pipeline engine passed to the tests here.
This means that we're not guaranteed to have deleted our disk-backed
resource readers (e.g. SQLiteAdjustmentReader) before trying to delete
the tempdir, which causes failures on Windows because Windows doesn't
allow you to delete a file if someone still has an open handle to that
file.
The real fix for this is to break the cycle between TradingAlgorithm and
AlgorithmSimulator, but that requires significant breaking API changes.
If minutes already exist for the last existing day, adjust the number of
minutes padded to account for them. Previously we would always pad 390,
leading to a mismatch in the number of rows.
Minutely data can now be appended to bcolz files even when
minutes in the same day have already been written. For example,
previously attempting to write data for the minute 2016-05-11 16:30
would raise an exception if any OHLCV data for 2016-05-11 had been
written to the same file.
Trying to overwrite existing minutes still raises a
BcolzMinuteOverlappingData exception.
Note that previously all sids' bcolz files ended at the same time.
This is no longer necessarily the case. The last record in each
sid's bcolz file now corresponds to the latest minute for which
OHLCV data is provided to the writer.
STY: remove unused imports
MAINT: change dtype to object for compatibility with python3
MAINT: rename pipeline columns and constants for clarity
MAINT: rename column
MAINT: add back cash amount constant
BUG: fix field names
BUG: pass remaining args
WIP: make buyback units parameterized so that user can choose
BUG: fix filtering based on units parameter
WIP: test for undesired units
Revert "WIP: make buyback units parameterized so that user can choose"
This reverts commit df3b838d525bff5026eba1d81865c6645d534c88.
The previous algorithm assumed that the group labels were integers. It
produced nonsense with LabelArrays (though sadly didn't crash because
numpy promotes None and void to object).
- Return a value from `verify_all_indices_unique` so that `panel` isn't
unconditionally `None` in `PanelDailyBarReader`.
- Fix a bug where we always set the volume of every asset to `1e9`.
- Add minimal suite of tests for get_spot_value, which catch both of the
above.
NOTE: There are still several issues with `PanelDailyBarReader`. The
docstring for `get_spot_value` claims that it will return -1 on days
where an asset didn't trade, which isn't the case. It also claims that
it will raise `NoDataOnDate` when a request is made outside the panel
range, but it just raises a KeyError. We also still have no coverage
for `load_raw_arrays`, so it's likely that there are more bugs lurking.
Refactor AlgorithmSimulator so that DAY_END is emitted for both
minute and daily emission, and that handling of end-of-minute
and end-of-day are separated