59 Commits

Author SHA1 Message Date
Conner Fromknecht 99efa7a9f3 Fixed catalyst tests except example tests 2017-06-19 14:43:10 -07:00
Ana Ruelas a88df2be0d ENH: Add run_chunked_pipeline method to PipelineEngine 2017-06-02 16:48:09 -04:00
Joe Jevnik dd191f4ab2 STY: cleanup 2016-10-28 15:04:18 -04:00
Scott Sanderson bb2d25e67c ENH: Allow windows of NumericalExpression.
If all the inputs to an expr are window-safe, then the expr is itself
window-safe.
2016-10-28 15:04:18 -04:00
Scott Sanderson 582c44a4aa TEST: Add more populate_initial_workspace tests.
- Tests different pipeline lengths and window lengths.
- Tests a term that depends on a window of a term that's been
  precomputed.
2016-10-28 15:04:18 -04:00
Joe Jevnik d07f133579 STY: remove unused imports and method, clean up docs 2016-10-28 15:04:18 -04:00
Joe Jevnik bae4088cc0 ENH: cleanup branch based on feedback 2016-10-28 15:04:18 -04:00
Joe Jevnik 0123bb8a97 ENH: prune the graph based on the initial workspace 2016-10-28 15:04:18 -04:00
Joe Jevnik 67b35168db ENH: provide a hook for prepopulating the initial workspace 2016-10-28 15:04:18 -04:00
Scott Sanderson 966c0ceedb MAINT: Remove outdated compat code. 2016-09-20 17:12:07 -04:00
Scott Sanderson 7e2230a763 STY: Fix flake8 failures. 2016-09-20 17:12:07 -04:00
Scott Sanderson ca54721058 MAINT: Pandas compat for rolling_*. 2016-09-20 17:12:07 -04:00
Scott Sanderson 221ec2073f STY: Flake8 cleanup. 2016-08-17 16:52:09 -04:00
Scott Sanderson a8b67d352e MAINT: Refactor in prep for downsampled terms.
- Split out extra_rows handling into an `ExecutionPlan` subclass.
  `ExecutionPlan` now requires the dates and calendar against which a
  set of terms will be computed, and now defers to a term's
  `compute_extra_rows` method when deciding how many extra rows are
  required to compute for that term. This will allow downsampled terms
  to request enough extra rows to guarantee that we can maintain consistent
  calculation dates.

  As a consequence of the above, `TermGraph` now only deals with logical
  dependencies, not with metadata surrounding extra row calculations.
  This means that TermGraph can be used to generate dependency
  visualizations in interactive contexts where we don't yet have a
  calendar or start/end dates.

- Refactored test_{filter,factor,classifier} to use check_terms instead
  of run_graph.  This makes it easier to make changes to TermGraph,
  since the testing interface is now to simply provide a dict of terms.

- Refactored BasePipelineTestCase to use fixtures to create an asset
  finder.  This fixes a potential leak of the test's asset db, which was
  not being explicitly cleaned up.

- Refactored test_technical to use BasePipelineTestCase.

- Added a new special term, `InputDates()`, which can be used to request
  date labels for inputs.  Like `AssetExists`, `InputDates` is provided
  in the initial workspace by default.

- Added a default (failing) `_compute` method to `AssetExists` which
  provides a more useful error than AttributeError.
2016-08-17 16:52:09 -04:00
Scott Sanderson a81562d5f4 MAINT: Improve/test errors for insufficient data. 2016-08-17 16:52:09 -04:00
dmichalowicz a8486c5f6e ENH: Factor-to-factor correlations/regressions 2016-07-19 11:16:55 -04:00
Jean Bredeche 6fb4923cc7 Re-implemented the Calendar API.
Instead of having separate ExchangeCalendar and TradingSchedule objects, we
now just have TradingCalendar.  The TradingCalendar keeps track of each
session (defined as a contiguous set of minutes between an open and a close).
It's also responsible for handling the grouping logic of any given minute
to its containing session, or the next/previous session if it's not a market
minute for the given calendar.
2016-07-12 13:13:50 -04:00
David Michalowicz d6c1c5fce9 Merge pull request #1309 from nathanwolfe/adv-fix
BUG: Correct AverageDollarVolume NaN handling
2016-06-30 14:04:43 -04:00
Eddie Hebert 51eda06323 MAINT: Add equity to naming of bar data classes.
In preparation of adding futures, add equity to the names of both the
classes and methods for writing bcolz data. Futures data will use a
different minutes per day with a separate reader. This change will allow
both equity and futures fixtures to be side by side.

Also, break out the method which generates the dataframes and trading
days member into fixtures (`EquityMinuteBarData` and
`EquityDailyBarData`) on which the `*BarReader` fixture depends.  This
fixture is separated out to enable reader/writers in different formats
to use the same data setup. (There is internal code which needs to write
minute and daily bar data in a database format.)
2016-06-30 08:21:42 -04:00
Nathan Wolfe 985e6bafee DOC: Add comment explaining ADV NaN test expected result calculation. 2016-06-29 11:34:21 -04:00
Nathan Wolfe e67b5e5516 TST: Change AverageDollarVolume test to check case of partial NaNs 2016-06-29 11:16:39 -04:00
Nathan Wolfe ebbcca73e8 TST: Add NaN cases to AverageDollarVolume factor test. 2016-06-29 10:12:35 -04:00
dmichalowicz 393f82e81e ENH: Add single-column input/output capabilities to pipeline terms 2016-06-23 10:24:09 -04:00
jfkirk 75e0e4723d TST: Refactors more tests to use WithTradingSchedule 2016-06-08 13:34:20 -04:00
jfkirk d9fc514fa8 TST: Adds TradingSchedule test fixture 2016-06-08 13:34:20 -04:00
jfkirk c8304e8601 ENH: Adds ExchangeCalendar, TradingSchedule, and implementations
Conflicts:
	tests/data/test_minute_bars.py
	tests/data/test_us_equity_pricing.py
	tests/finance/test_slippage.py
	tests/pipeline/test_engine.py
	tests/pipeline/test_us_equity_pricing_loader.py
	tests/serialization_cases.py
	tests/test_algorithm.py
	tests/test_assets.py
	tests/test_bar_data.py
	tests/test_benchmark.py
	tests/test_exception_handling.py
	tests/test_fetcher.py
	tests/test_finance.py
	tests/test_history.py
	tests/test_perf_tracking.py
	tests/test_security_list.py
	tests/utils/test_events.py
	zipline/algorithm.py
	zipline/data/data_portal.py
	zipline/data/us_equity_loader.py
	zipline/errors.py
	zipline/finance/trading.py
	zipline/testing/core.py
	zipline/utils/events.py
2016-06-08 13:34:18 -04:00
dmichalowicz d57872f2be TST: Test correlation/regression factors with nonexistent asset 2016-05-18 15:11:12 -04:00
dmichalowicz 1ec0bced6d ENH: Add builtin factors for correlation and regression 2016-05-18 15:11:12 -04:00
Scott Sanderson bb6f908036 TEST: Add test for categorical postprocessing. 2016-05-04 15:54:50 -04:00
Joe Jevnik 59c8e371a2 ENH: Updates the cli, data bundles and extensions.
Adds the data bundle concept which makes it easy for users to register
loading functions to build out minute and daily data along with an
assets db and adjustments db. By default we have provided a `quandl`
bundle which pulls from the public domain WIKI dataset. Users may
register new bundles by decorating an ingest function with
`zipline.data.bundles.register(<name>)`. This also provides a
`yahoo_equities` function for creating an ingestion function that will
load a static set of assets from yahoo.

The cli is now structured as a couple of subcommands and has been
changed to `python -m zipline`. The old behavior of `run_algo.py` has
been moved to the `run` subcommand. This is almost entirely the same
except that it now takes the name of the data bundle to use, defaulting
to `quandl`.

The next subcommand is `ingest` which takes the name of
a data bundle to ingest. This will run the loading machinery and write
the data to a specified location that `run` can find.

There is also a `clean` subcommand which deletes the data that was
written with `ingest`.

Extensions have also been added to zipline. This is an experimental
feature where users can provide an extra set of python files to run at
the start of the process. These can be used to configure aspects of
zipline. Right now the only thing that is supported in an extension file
is the registration of a new data bundle.
2016-05-03 18:38:24 -04:00
dmichalowicz d9bfcaabde ENH: Support multiple outputs for custom factors 2016-04-21 10:57:29 -04:00
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
Scott Sanderson 4449f289c2 TEST: Test that the mask is what we expect. 2016-04-07 17:29:47 -04:00
dmichalowicz 8db59b387b TST: Overhaul test case 2016-04-07 17:29:47 -04:00
dmichalowicz 5bae74adda ENH: Allow passing a mask when creating a factor 2016-04-07 17:29:47 -04:00
Joe Jevnik 721dd36116 TST: move test_utils and adds test fixture classes
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.
2016-03-10 15:39:52 -05:00
Scott Sanderson c105735574 DEV: Add support for specifying missing_value.
Consequently, enable support for `int`-dtyped Factors and BoundColumns.
2016-02-12 21:23:47 -05:00
Scott Sanderson a96dd70634 MAINT: Rename ConstantLoader to PrecomputedLoader. 2016-02-12 21:21:19 -05:00
Richard Frank 069fe5ccda TST: Updated for new pandas and made clearer types of values 2016-02-11 18:46:43 -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
Scott Sanderson 72887f0065 ENH: Change DollarVolume to AverageDollarVolume. 2015-12-28 16:12:11 -05:00
Scott Sanderson 8abef95bb5 DOC: Rename exponential stddev.
ExponentialWeightedStandardDeviation -> ExponentialWeightedMovingStdDev.

This is more consistent with the other moving moment factors.
2015-12-18 14:30:28 -05:00
Scott Sanderson b91f9697b9 ENH: Add ExponentialWeightedStandardDeviation. 2015-12-11 22:13:27 -05:00
Scott Sanderson 2235a53581 ENH: Add EWMA and DollarVolume factors. 2015-12-11 22:13:27 -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 9e463fd5d8 MAINT: make_rotating_asset -> make_rotating_equity. 2015-11-13 18:26:54 -05:00
Scott Sanderson 4109640acb MAINT: make_simple_asset_info -> make_simple_equity_info. 2015-11-13 18:26:54 -05:00
John Ricklefs f599795d27 ENH: Allow pipelines to run with matching start/end dates 2015-10-22 14:23:00 -04:00
Richard Frank 7a638e4580 STY: Moving args to new line 2015-10-12 16:13:55 -04:00
Richard Frank 940831e1cf TST: Added test that columns are batched
when they share the same loader and extra_rows
2015-10-12 11:17:06 -04:00