- Fixes an error where Modeling API data known as of the close of `day
N` would be shown to algorithms during `before_trading_start` as of
the close of the same day. Algorithms should now only receive data
during `before_trading_start/handle_data` that was known as of the
simulation time at which the function would be called.
- All Term instances now have a `mask` attribute that must be a `Filter`
or an instance of `AssetExists()`. `mask` can be used to specify that
a Factor should be computed in a manner that ignores the values that
were not `True` in the mask.
- Changed the interface for `FFCLoader.load_adjusted_array` and
`Term._compute` from `(columns, mask)`, with mask as a DataFrame, to
`(columns, dates, assets, mask)`, where mask is a numpy array. This
is primarily to avoid having to reconstruct extra DataFrames when
using masks produced by non `AssetExists` filters.
- Adds `BoundColumn.latest`, which gives the most-recently-known value
of a column.
- Add an `ascending=True` keyword to `rank()`.
- Add `top(N)` and `bottom(N)` methods to Factor. These return Filters
that pass the top and bottom N elements each day.
- Add a slightly faster path for rank(method='ordinal'). I had
originally thought the fast path was 2-3x faster because I had my
benchmark data axes flipped. The actual speedup is only 5-10%, which
means it probably wasn't worth the effort to Cythonize...but we have a
slightly faster version now so we might as well use it.
- Refactor test_filter and test_factor to make it easier to implement
and test transformations on factors. These tests now subclass
BaseFFCTestCase, which provides facilities for passing a dict of terms
and an "initial_workspace", the values for which are used by
SimpleFFCEngine rather than needing to manually manage the inputs and
outputs of each term.
Rather than specifying only the package "zipline" in setup.py, use
`find_packages` to find all the subpackages as well, so they (or, most
specifically, their `__init__.py` files) are properly packaged in the
egg file.
Modify setup.py to defer the use of Cython and numpy until
`setup_requires` has already been processed, so that Cython and numpy
are available when they are needed.
- Parse our requirements.txt to keep install_requires up to date.
- Create extras builds for talib and dev.
- Use pip install -e .[dev] on Travis to install Zipline before testing.
This patch lays the groundwork for a compute engine designed to
facilitate construction of factor-based universe screening and portfolio
allocation. It contains:
A new module, `zipline.modelling`, containing entities that can be used
to express computations as dependency graphs. Each node in such a graph
is an instance of the base `Term` class, defined in
`zipline.modelling.term`. Dependency graphs are executed by instances
of `FFCEngine`, defined in `zipline.modelling.engine`.
A new module, `zipline.data.ffc`, containing loaders and dataset
definitions for inputs to the modelling API.
New `TradingAlgorithm` api methods: `add_factor`, and `add_filter`.
These methods can only be called from `initialize`, and are used to
inform the algorithm that each day it should compute the given terms.
Computed factor results are made available through a new attribute of
the `data` object in `before_trading_start` and `handle_data`. Computed
filter results control which assets are available in the factor matrix
on each day.
This commit refactors the Security cython class to Asset, and refactors some fields of the class accordingly. This change is so the terminology is consistent and correct when Asset is extended to asset types that are not securities, such as futures.
The class is not yet used. Adding this class is part of the effort to allow Zipline
simulation of more types of assets than stocks.
DEV: Adds build_ext to .travis.yml
Add a CLI that reads in an algorithm, loads data,
run the algorithm, and output performance metrics.
The examples are adapted to the new zipline API and
analyses are split into separate files.
Also add config files that run the example
algorithms with preset settings.
Highlights
- Reworked risk metrics, including verification against Excel spreadsheet
- Additional order methods
- Conversion of many data structures to use pandas
- Change to behavior of stop and limit orders (@pcawthron)
- Use pandas timezone handling throughout instead of Delorean
- New commission model (@stanh)
- Adds beginning of support for Toronto stock exchange. (@dstephens)
- Python 3 compatibility.
Unit tests now pass when run with Python 3.3, and Python 3 should
now be considered officially supported.
If anything does not work under Python 3, please file as a bug.
zipline.__version__ is now present. Closes#94.
Moreover, git master should have a .dev version string according
to convention. Releases then get the .dev label removed.
Highlights:
- Benchmark updating now permits empty ranges.
(Fixes runtime crash when running immediately after Easter 2013.)
- Risk metrics
- Performance improvents from converting to numpy and pandas.
<@wesm, wesmckinn@gmail.com>
- Refactoring of risk metric calculation out of class structure.
The pyandoc module throws an OSError of:
"No such file or directory",
when the underlying pandoc binary does not exist.
This error has caused confusion for numerous people during pip
installation.
pandoc is only needed on upload to PyPI to convert to ReST.
So, instead of doing a try/except on the `import pandoc` for all cases,
now checking whether or not 'upload' was invoked when calling setup.py,
so that only maintainers have to worry about installation of pandoc.
By only exercising the pandoc logic when
Highlights, with thanks to contributors inline:
- Runtime performance improvements
- Fixed the omission of peformance messages on days with no trades
- Changes to batch_transform implementation
-- supports sid filtering
-- performance improvements using pandas
-- added an option for only computating when there is a window length's
worth of data
- Added new risk metrics
-- Sortino
-- information ration
(Ryan Day, ryanday2@gmail.com @rday)
- Added stop and limit orders
(Tony Worm, verdverm@gmail.com @verdverm)
- Added variable recording
- Deprecated market_aware and delta kwargs to EventWindow
- Fixes to trading calendars for missing holidays
- Added TradingEnviorment context manager
- Added support for streaming through dividends
- Yahoo source now has OHLC
- Updates downloaded benchmark and treasury data when new data is available.
(Ryan Day, ryanday2@gmail.com @rday)
- Added optional adjustment of Yahoo data
(Jeremiah Lowin, jlowin@lowindata.com @jlowin)
Salient changes since last version:
- Adds non-holiday closings to trading calendar.
- Forward filling of missing treasury data.
- Improves handling of treasury data when the backtest's
end date day is not a market day.
- Adds option to forward fill data in batch transform.