When the dts and length of cols are mismatched the writer behaves in
unintended ways. e.g. in a case where a consumer passed dts which had
minutes with no trades removed, but regular (market minute for day)
sized arrays for the data with `0`'s on minutes without trades, the non
trade minutes from cols are written to slots in the output where a trade
is intended.
Protect against this misuse by checking that all lengths are equal when
using the `write_cols` method.
Make a separate `_write_cols` method for use by both `write_cols` and
`write`, since the `write` method which takes a DataFrame has the
matched input length enforced by the DataFrame.
BUG: correctly create asset finder
MAINT: rename fixture
STY: fixes for flake8
STY: add space around assignment
MAINT: add var back to constructor
MAINT: remove unused import
MAINT: compare var with None directly
MAINT: fix merge errors
MAINT: remove record date - not needed.
MAINT: restructure dividends dataset.
MAINT: restructure dividends factors.
WIP: update dividends tests.
MAINT: correct the way to get the 'next' event frame.
Write arrays representing corresponding market opens and market closes,
which will eventually replace the `minute_index` field.
The market closes are being added for incoming work on another branch
which will use the market closes to generate a list of non-market
minutes to filter out when returning data from `unadjusted_window`.
Classifiers are computations that represent grouping keys. They can be
used in conjuction with normalization functions like ``zscore`` or
``demean`` to perform normalizations over subsets of a dataset.
Notable changes:
- Added ``demean()`` and ``zscore()`` methods to ``Factor``.
- Added a classifier versions of ``Latest`` and ``CustomTermMixin``.
The .latest attribute of int64 dataset columns no produces a
classifier by default.
- Added ``Everything``, a classifier that maps all data to the same
value.
- Added ``zipline.lib.normalize``, which implements a naive, pure-Python
grouped normalize function. This will likely be moved to Cython in a
subsequent PR.
Allow comparisons like SomeFilter() & AssetExists().
Previously such comparisons would fail because & and | on Filters
explicitly checked that the other side of the operator was also a
Filter.
We now only enforce that the other side of the expression is a Term
with a dtype of bool_.
Add a method to minute bar reader which returns the OHLCV for all
requested fields for a list assets over the specified start and end
minutes.
Initial usage is intended for use by a loader which consumes minute bar
data to resample into daily bars, but may also be used when aggregating
minute data during '1d' history calls in Q2.0.
This iteration does not include including of early closes.
Renames zipline.utils.test_utils to zipline.testing
Adds zipline.testing.fixtures.ZiplineTestCase to manage setup and
teardown and adds mixins to define fixtures like an asset finder or
trading calendar.
# The first commit's message is:
BUG: ignore sids in deltas missing from asset index.
# This is the 2nd commit message:
MAINT: use correct debugger.
# This is the 3rd commit message:
MAINT: fix set add.
# This is the 4th commit message:
WIP: move sid filtering.
# This is the 5th commit message:
WIP: move filtering logic.
# This is the 6th commit message:
WIP: working test.
# This is the 7th commit message:
TST: clean up test.
# This is the 8th commit message:
STY: fix flake8.
Allow creation of TradingEnvironment to specify a minimum date, so that
trading days, market opens, etc. can trimmed to a range more relevant to
the backtest.
This changes is with an eye towards storing all market minutes in the
trading environment, where storing values for much more than the
simulation range starts to become more costly.
Replace it by distinguishing between "Loadable" and "Computable".
This is useful because it's now possible to write computable terms that
don't require any inputs (e.g. an `Always` filter or an `Everything`
classifier).