Commit Graph

4314 Commits

Author SHA1 Message Date
Scott Sanderson acd5ef0e1c Merge pull request #1394 from quantopian/downsample
Add Generic Downsampling to Pipeline
2016-08-18 12:15:54 -04:00
Scott Sanderson 5a5353bead BUG: Fix broken graph visualizations. 2016-08-18 11:07:17 -04:00
Eddie Hebert 42d61d7e4f Merge pull request #1404 from quantopian/session-bar-fixup
MAINT: Use session bar reader interface.
2016-08-18 10:04:46 -04:00
Scott Sanderson b1894e0d54 BUG: Supply a module for Downsampled terms. 2016-08-17 19:48:33 -04:00
Scott Sanderson 8cc8814b5f BUG: Fix nondeterministic failure from sorting. 2016-08-17 19:48:33 -04:00
Scott Sanderson 6006aedeef BLD: Ignore numpy_utils.py doctests on windows.
They fail because of 32/64-bit issues.
2016-08-17 19:48:33 -04:00
Richard Frank aae9f84ade Merge pull request #1403 from quantopian/keep-last-zero
BUG: Fixes should_clean for keep_last=0
2016-08-17 19:05:31 -04:00
Richard Frank fcf1067071 BUG: Fixes should_clean for keep_last=0 2016-08-17 18:18:01 -04:00
Scott Sanderson 659ba57d4b BUG: Force iterator for py3. 2016-08-17 16:52:09 -04:00
Scott Sanderson d82e38e73b BUG/TEST: Fix test assertion in py3. 2016-08-17 16:52:09 -04:00
Scott Sanderson 5e7e56176f BUG: Fix broken fixture resolution.
Make sure that WithDefaultDateBounds is last in everyone's mro().
2016-08-17 16:52:09 -04:00
Scott Sanderson 19963f5b02 MAINT: Clean up downsampling boilerplate.
Consolidate docs and mixin applications into one place.
2016-08-17 16:52:09 -04:00
Scott Sanderson 7fc0dd6d97 MAINT: Use numpy_utils.as_column in more places. 2016-08-17 16:52:09 -04:00
Scott Sanderson 20e48cf826 ENH: Add non-windowed downsampling. 2016-08-17 16:52:09 -04:00
Scott Sanderson 72a31ceb7d DOC: Docstring cleanups. 2016-08-17 16:52:09 -04:00
Scott Sanderson 221ec2073f STY: Flake8 cleanup. 2016-08-17 16:52:09 -04:00
Scott Sanderson b40ebdcfce ENH: Add support for downsampling.
Adds a new ``downsample`` method to all computable terms.  Computable
terms (Filters, Factors, and Classifiers) can be downsampled to yearly,
quarterly, monthly, or weekly frequency.

The result of ``term.downsample`` is a new term of the same
family (Filter/Factor/Classifier) as ``term``.  The downsampled term
computes by delegating to the original term; repeatedly calling its
``compute`` method with length-1 date ranges.

Downsampled terms take advantage of a new ``compute_extra_rows`` Term
method, which allows terms to dynamically request that additional extra
rows of themselves be computed based on the dates for which they're
being computed.  This ensures, for example, that a monthly-downsampled
term always computes at the start of a month, even when a
naively-calculated pipeline window would end in the middle of the month.
2016-08-17 16:52:09 -04:00
Scott Sanderson 790ee59455 MAINT: Add alt-constructor for NoFurtherDataError. 2016-08-17 16:52:09 -04:00
Scott Sanderson c0005e22ad MAINT: Clean up WithTradingSessions.
- Add WithDefaultDateBounds, since we use alias('START_DATE') and
  alias ('END_DATE').

- Fix copypasta in assertion.
2016-08-17 16:52:09 -04:00
Scott Sanderson 141a088f7f ENH: Add numpy_utils.changed_locations. 2016-08-17 16:52:09 -04:00
Scott Sanderson 7bc8603e22 MAINT: Remove double import. 2016-08-17 16:52:09 -04:00
Scott Sanderson 6ac8046498 MAINT: Add nearest_unequal_elements.. 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 d99d993aea MAINT: Remove empty inputs from BoundColumn.
They belong on LoadableTerm instead.
2016-08-17 16:52:09 -04:00
Scott Sanderson 1d93e1c21f ENH: Add as_column to numpy_utils. 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
Scott Sanderson d4a9d286fc DOC: Add a docstring for RecarrayField. 2016-08-17 16:52:09 -04:00
Scott Sanderson 670f3c106f DOC: Clarify how AssetExists() is special. 2016-08-17 16:52:09 -04:00
Scott Sanderson 9e06886794 DOC: Fix typo in docstring. 2016-08-17 16:52:09 -04:00
Eddie Hebert 3511959520 MAINT: Use session bar reader interface.
Replace `DailyBarReader` with `SessionBarReader`.

This was intended to go with the patch that added the `SessionBarReader`
abstract base class.

Also, added `trading_calendar` property decorator.
2016-08-17 14:30:48 -04:00
Andrew Daniels 440806ad60 MAINT: Use TradingCalendar objects for bundles (#1397)
* MAINT: Use TradingCalendar objects for bundles

Instead of trading days, opens, and closes, register now takes a
TradingCalendar object, along with a start_session and end_session. The
ingest function is now passed these values instead as well.

* Accept calendar name in addition to the actual object

* Updates bundles documentation for changes

* Fix typo in docs

* Use class formatting

* Force start_session and end_session within the bounds of the calendar

* Use UTC timestamps in test_core

* Document Trading Calendar API in appendix.rst
2016-08-17 13:37:07 -04:00
Eddie Hebert deac07d264 Merge pull request #1401 from quantopian/session-bar-interface
MAINT: Factor out session bar reader interface.
2016-08-17 12:30:17 -04:00
Eddie Hebert 151b01389a MAINT: Factor out session bar reader interface.
In preparation for making a resampling session bar reader, make an
abstract base class with the methods currently used by consumers of the
reader; which should assist in making a drop-in replacement of the daily
bar reader.

While pulling out the interface, it does appear that `spot_price` and
the minute bar reader's `get_value` are the same method but by different
names, showing that there may be room for having both `MinuteBarReader`
and `SessionBarReader` sharing a common `BarReader` interface.
2016-08-17 11:12:39 -04:00
Eddie Hebert 72ee32025f Merge pull request #1399 from quantopian/move-resample-code
TST: Share resample test cases.
2016-08-17 10:25:39 -04:00
Scott Sanderson 7a330f6bf9 Merge pull request #1398 from quantopian/validate-attach-pipeline
ENH: Add input validation to attach_pipeline.
2016-08-16 19:49:31 -04:00
Scott Sanderson ed3b0fcaa7 ENH: Add input validation to attach_pipeline. 2016-08-16 15:53:20 -04:00
Eddie Hebert d1f7a819fc TST: Share resample test cases.
Also, move `DailyHistoryAggregator` to `resample` module, so that tools
for converting from minute to session bars are collocated.

This patch is in preparation of adding a daily bar reader which
resamples minute data, which will be located in the `resample` module
and share the test cases and expected results in `test_resample`.
2016-08-16 15:44:32 -04:00
Eddie Hebert 4642fd2e1b Merge pull request #1391 from quantopian/minute-bar-interface
MAINT: Define minute bar reader interface.
2016-08-15 22:34:40 -04:00
Andrew Daniels 7719f6e1a2 BUG: Fixes asset writer to the select the latest asset to hold a sid (#1392)
* BUG: Fixes asset writer to the select the latest asset to hold a sid

When constructing the asset_info dataframe, we were previously taking
the first symbol/sid pair to include, when we should be taking the most
recent.

* Ensure groups are sorted by increasing end_date

* Updates test_lookup_symbol_change_ticker to also cover asset_name
2016-08-15 20:38:02 -04:00
Eddie Hebert b3d0f672a4 MAINT: Define minute bar reader interface.
Define the minute bar interface and make the `BcolzMinuteBarReader`
implement that interface.
2016-08-15 19:06:02 -04:00
Jean Bredeche a0116349c9 Merge pull request #1390 from quantopian/revert-can-trade-behavior-for-now
BUG: Temporarily commenting out new can_trade functionality until we sort out downstream dependencies.
2016-08-15 11:22:46 -07:00
Jean Bredeche 9a2ad260e5 BUG: Temporarily commenting out new can_trade functionality until we sort out downstream dependencies. 2016-08-13 21:46:00 -04:00
Eddie Hebert 0ebffbaeb9 Merge pull request #1388 from quantopian/future-pricing-cleanup
Cleanup some Futures related modules and values.
2016-08-11 14:21:53 -04:00
Jean Bredeche 6688ae7bb6 Merge pull request #1385 from quantopian/register-calendar-types
ENH: Add public API to register calendars by type
2016-08-11 12:44:41 -04:00
Eddie Hebert 294c716112 MAINT: Define futures minutes per day.
Define the commonly used minutes per day for futures data as a module
level value.
2016-08-11 12:32:17 -04:00
Eddie Hebert e5fb4bb9c6 MAINT: Remove unused future pricing stubs.
The FutureMinuteReader is now implemented by using a minute bar reader
with a different minutes per day value.
2016-08-11 12:29:37 -04:00
Richard Frank 9f15efd8a0 MAINT: Removed unused module 2016-08-11 12:11:47 -04:00
Jean Bredeche 7803ec6e46 ENH: Add public API to register calendars by type 2016-08-11 11:27:48 -04:00
Joe Jevnik 220ffc54a8 Merge pull request #1387 from quantopian/sqlite-needs-distinct-on-because-this-is-ugly
v5 downgrade
2016-08-10 16:10:04 -04:00
Joe Jevnik 23363ee45a TST: test the v5->v4 downgrade 2016-08-10 15:32:49 -04:00