Commit Graph

283 Commits

Author SHA1 Message Date
Joe Jevnik bc0b117dc9 MAINT: make the data loading apis more consistent.
Changes BcolzDailyBarWriter to not be an abc, data is passed as an
iterator of (sid, dataframe) pairs to the write method.

Changes the AssetsDBWriter to be a single class which accepts an engine
at construction time and has a `write` method for writing dataframes for
the various tables. We no longer support writing the various other data
types, callers should coerce their data into a dataframe themselves. See
zipline.assets.synthetic for some helpers to do this.

Adds many new fixtures and updates some existing fixtures to use the new
ones:

WithDefaultDateBounds
  A fixture that provides the suite a START_DATE and END_DATE. This is
  meant to make it easy for other fixtures to synchronize their date
  ranges without depending on eachother in strange ways. For example,
  WithBcolzMinuteBarReader and WithBcolzDailyBarReader by default should
  both have data for the same dates, so they may use depend on
  WithDefaultDates without forcing a dependency between them.

WithTmpDir, WithInstanceTmpDir
  Provides the suite or individual test case a temporary directory.

WithBcolzDailyBarReader
  Provides the suite a BcolzDailyBarReader which reads from bcolz data
  written to a temporary directory. The data will be read from
  dataframes and then converted to bcolz files with
  BcolzDailyBarWriter.write

WithBcolzDailyBarReaderFromCSVs
  Provides the suite a BcolzDailyBarReader which reads from bcolz data
  written to a temporary directory. The data will be read from a
  collection of CSV files and then converted into the bcolz data through
  BcolzDailyBarWriter.write_csvs

WithBcolzMinuteBarReader
  Provides the suite a BcolzMinuteBarReader which reads from bcolz data
  written to a temporary directory. The data will be read from
  dataframes and then converted to bcolz files with
  BcolzMinuteBarWriter.write

WithAdjustmentReader
  Provides the suite a SQLiteAdjustmentReader which reads from an in
  memory sqlite database. The data will be read from dataframes and then
  converted into sqlite with SQLiteAdjustmentWriter.write

WithDataPortal
  Provides each test case a DataPortal object with data from temporary
  resources.
2016-04-15 23:46:10 -04:00
Eddie Hebert e1b376a49b BUG: Add limit to memory growth on sliding windows
Add a cap of 5 sliding windows (one per OHCLV column) to the history
loader's cache of sliding windos.

This prevents unbounded growth on algorithms that call history with a
highly varied list of equities.

To follow is splitting the cache up by column and by sid, so that the
loader does not re-prefetch sids which have already been read with
sufficient data; however this patch is enough to fix the issue where an
algo with high rotation can add up a megabyte per day of memory on
algorithms which rotate on a 5% dollar volume pipeline. With this cap
those algorithms have more plateaus with regard to memory consumption.

This patch requires new dependency of `cachetools` library.
2016-04-14 22:20:02 -04:00
Richard Frank 5254b273b2 PERF: Reimplemented remember_last with a weak_lru_cache
which won't leak instances whose methods have been decorated

(specifically DataPortal instances)

MAINT: Not using functools32 anymore
2016-04-12 19:33:21 -04:00
Maya Tydykov 005299e7e4 MAINT: update blaze version 2016-04-06 13:49:32 -04:00
Richard Frank 6e7c66b158 BLD: ordered_pip is unforgiving 2016-04-06 09:33:33 -04:00
Richard Frank 39fbdd30e3 MAINT: Use environment markers instead of separate requirements
file for py2
2016-04-05 23:07:00 -04:00
John Stanford 34f47da033 Added a Dockerfile for repeatable runtimes
Builds docker image with  TA-Lib, Jupyter, and checked out version of zipline and
starts Jupyter server on port https://localhost:8888 when container runs.  The
default password for the Jupyter server is 'jupyter'.

Instructions on usage found in the Dockerfile comments.  Example image at
docker.io/jxstanford/zipline.
2016-04-04 17:05:52 -04:00
Richard Frank be4dcb22dc MAINT: intervaltree requires sortedcontainers 2016-04-04 16:12:58 -04:00
Eddie Hebert 16fd6681a6 ENH: Rewrite of Zipline to use lazy access pattern
More documentation to follow in release notes.

Based on lazy-mainline branch, see for more details.

Also-By: Jean Bredeche <jean@quantopian.com>
Also-By: Andrew Liang <aliang@quantopian.com>
Also-By: Abhijeet Kalyan <akalyan@quantopian.com>
2016-04-04 16:12:58 -04:00
Richard Frank 42c1ef86b5 DEV: Move TA-Lib reqs to own file 2016-03-23 15:26:55 -04:00
Richard Frank 2ee66e4c1d BLD: Bumped numexpr version and added conda recipe 2016-03-23 15:26:54 -04:00
Richard Frank cbc1316a7a MAINT: Moved scripts to appveyor dir 2016-03-23 15:26:53 -04:00
Joe Jevnik 96046fc12d BLD: appveyor.yml 2016-03-23 15:26:50 -04:00
Joe Jevnik 792860b4cb MAINT: rename bz.Data -> bz.data 2016-03-15 14:29:48 -04:00
Joe Jevnik 9b1408596d Merge pull request #1012 from quantopian/partial-uploads
DEV: allow partial uploads in conda_build_matrix
2016-03-10 15:19:33 -05:00
Scott Sanderson 14360ca4b8 DOC: Minor docstring tweaks. 2016-03-02 12:25:23 -05:00
Jonathan Kamens f5d6060bb4 MAINT: Upgrade six, futures, requests-futures, piprot versions
Upgrade six 1.9.0 -> 1.10.0 in requirements.txt, and futures 3.0.3 ->
3.0.5, requests-futures 0.9.5 -> 0.9.7, and piprot 0.9.1 -> 0.9.6 in
requirements_dev.txt.
2016-02-27 11:46:51 -05:00
Jonathan Kamens 369a24aaec MAINT: Remove obsolete comment from requirements.txt
There was a comment in requirements.txt warning not to use
python-dateutil 2.4.0, which was necessary when we were using 2.3.x
and 2.4.0 was broken for us, but now we're using 2.4.2 which is fixed,
so the comment is no longer needed.
2016-02-27 11:45:44 -05:00
Joe Jevnik 36f2bac01f DEV: allow partial uploads in conda_build_matrix 2016-02-25 17:42:43 -05:00
Joe Jevnik e45a973e22 DEV: add conda_build_matrix.py to help upload packages 2016-02-24 21:26:05 -05:00
Richard Frank 88e4758648 DEV: Added script for building all versions of zipline conda package 2016-02-24 21:26:05 -05:00
Richard Frank adb051700a BLD: Downgrade Cython
because of mislabeled osx anaconda package
2016-02-19 15:42:02 -05:00
Joe Jevnik 97f1ac7970 BLD: add setuptools>18 for bcolz 2016-02-18 21:11:47 -05:00
Joe Jevnik 2036f3d389 ENH: condense the blaze query 2016-02-17 20:22:31 -05:00
Jonathan Kamens 11465d907d MAINT: Upgrade Logbook version
Upgrade Logbook to 0.12.5. This required changing a usage of
`logbook.NullHandler()` which passed `bubble=True`, since
`NullHandler` no longer supports the `bubble` argument.
2016-02-16 13:32:25 -05:00
Richard Frank d5bd2a9fb8 BLD: Pinning version of indirect dependency 2016-02-12 17:00:45 -05:00
Scott Sanderson 5f49fa22cb MAINT: Upgrade numpy and fix warnings.
Mostly fixes ambiguous calls to numpy.full, and uses explicitly-united
NaT values.
2016-02-11 18:46:39 -05:00
James Kirk 2803802736 Merge pull request #941 from quantopian/futures-tick-size
ENH: Adds tick_size and renames futures multiplier
2016-01-25 11:18:31 -05:00
Jonathan Kamens 0c2a1a1654 MAINT: Upgrade sphinx to 1.3.4 in dev requirements. 2016-01-23 19:13:58 -05:00
jfkirk ece9e59ef9 ENH: Adds asset db downgrade management and tests 2016-01-22 14:56:30 -05:00
Joe Jevnik 110798b0be MAINT: update blaze commit again 2016-01-22 14:21:25 -05:00
Joe Jevnik 0f43b6b371 MAINT: fix blaze commit 2016-01-21 13:30:16 -05:00
Joe Jevnik 33db0e330e BLD: update blaze 2016-01-21 12:43:02 -05:00
Jonathan Kamens 2ee40db0ec MAINT: Upgrade requests 2.7.0 -> 2.9.1 2016-01-06 22:33:33 -05:00
Scott Sanderson 8220d1ee86 ENH: Adds support for different typed adjusted arrays and adds an
EarningsCalendar loader.

- Moves most of AdjustedArray back into Python. The window iterator is
  the only part that's performance-intensive.

- Adds a bootleg templating system for creating specialized versions of
  AdjustedArrayWindow for each concrete type we care about.

- Adds support for differently dtyped terms in pipeline. This allows us
  to use datetime64s which are needed in the EarningsCalendar.

- Adds EarningsCalendar dataset for the next and previous earnings
  announcements in pipeline.

- Adds in memory loader for EarningsCalendar.

- Adds blaze loader for EarningsCalendar.
2015-12-08 20:24:06 -05:00
Scott Sanderson 63af5273d1 DOC: Add docs section on installation. 2015-12-08 12:35:34 -05:00
Scott Sanderson 653e7cbbf2 Merge pull request #690 from quantopian/time-tests
TEST: Run nosetests with timings.
2015-10-25 16:50:02 -04:00
llllllllll aedbbcc6f0 BLD: blaze ecosystem commits 2015-10-19 16:35:03 -04:00
llllllllll 8c1bcd684e BLD: show versions on travis 2015-10-19 16:35:02 -04:00
llllllllll e3bf786bd5 BLD: blaze it up 2015-10-19 16:35:02 -04:00
Richard Frank 99de89c817 PERF: Don't recalc similar atomic terms 2015-10-12 16:13:55 -04:00
Scott Sanderson f82a01841b MAINT: Rename ALL the things.
zipline.modelling.* -> zipline.pipeline.*
zipline.data.ffc.loaders -> zipline.pipeline.loaders
tests/modelling -> tests/pipeline
2015-10-01 18:03:53 -04:00
llllllllll 9cd3707440 BLD: Adds sqlalchemy to reqs 2015-09-10 11:53:23 -04:00
llllllllll dd956116b7 ENH: sqlalchemy 2015-09-10 11:53:23 -04:00
Scott Sanderson c738eab0b8 TEST: Run nosetests with timings.
We already did this on travis.  Make it part of the normal test workflow
instead of a special case for travis.
2015-08-26 19:08:35 -04:00
Scott Sanderson a801547122 BLD: Read requirements from setup.py
- 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.
2015-08-19 03:31:29 -04:00
Scott Sanderson 7f374f2ba3 MAINT: Bump bcolz version to latest. 2015-08-04 18:16:09 -04:00
Scott Sanderson ef4f642e62 ENH: Compute engine architecture for FFC API.
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.
2015-07-29 12:30:46 -04:00
Jonathan Kamens 576e4184d7 BLD: Update mock to release 1.3.0 2015-07-24 12:28:51 -04:00
Jonathan Kamens 393ea35e46 BLD: Switch back to PyPI version of xlrd
The bug which prompted us to use our own version of xlrd is patched in
the current PyPI release, so switch back to it.
2015-07-24 12:28:12 -04:00