Commit Graph

4370 Commits

Author SHA1 Message Date
Eddie Hebert 40c7deb697 ENH: Add asset dispatch to data portal.
Combine the equity and future readers into asset dispatch readers, so
that simulations that use both asset types can access data for each.

This patch enables `history` for future assets in algorithms; however,
it does not add extra coverage in the `test_data_portal` or `test_history`
to cover future assets. Those tests will follow, however putting this in
separately since it shows that the wrapping of the readers in the asset
dispatch reader does not break existing equity strategies.
2016-08-26 13:29:08 -04:00
Eddie Hebert c460af0a40 Merge pull request #1433 from quantopian/dispatch-bar-reader
MAINT: Add a reader which dispatches on asset type
2016-08-26 08:44:20 -04:00
Eddie Hebert 0f604686b6 MAINT: Add a reader which dispatches on asset type
Add `AssetDispatchSessionBarReader` and corresponding minute and session
bar version of that reader.
This reader routes requests to the appropriate reader based on the asset
type of the requested sids.

`load_raw_array` in the dispatch reader batches the sid by asset type
and then interleaves the results in the out arrays, so that the arrays
data corresponds with sids in the order that sids are passed to the
method, to meet the expected behavior of `load_raw_arrays`.

The dispatch redaer is intended for use by the data portal when using
both future and equities. The dispatch reader will also be passed to the
to the `HistoryLoader`s contained within the data portal, where the
batched `load_raw_arrays` will be used.

Also, BUG:
- Fix the return of `MinuteResampleSessionBarReader.load_raw_arrays` to
match all other readers.
- Use the input dt for the `MinuteResampleSessionBarReader.load_raw_arrays`
as a session label, instead of a minute dt, since it is a session bar
reader.
(Both of these bugs where discovered when using the resample reader for
future data in the dispatch tests.)
2016-08-25 16:29:45 -04:00
Eddie Hebert 67112e0e11 Merge pull request #1432 from quantopian/reindex-reader
ENH: Add a reader base which reindexes results.
2016-08-25 09:34:06 -04:00
Richard Frank 3a7438cbb7 Merge pull request #1430 from quantopian/ingest-versions
Ingest versions
2016-08-24 16:49:42 -04:00
Eddie Hebert 562098dbf8 ENH: Add a reader base which reindexes results.
Working towards history results which contain mixed asset types, add
a reader which makes `load_raw_arrays` return results indexed on the
session/minute ranges specified by the specified `trading_calendar`
instead of the calendar of the backing reader.

This reader will be used to make Equity readers align with Future
readers. It is intended for use as part of another reader (which will
dispatch queries based on asset type and then recombined results) which
will be passed to the `[Minute|Session]HistoryLoaders in the data portal.
2016-08-24 16:28:19 -04:00
Richard Frank 317c5f07cc BLD: alembic is now a production requirement 2016-08-24 15:32:31 -04:00
Richard Frank 1f9cb8ed9f BUG: More python3 compat 2016-08-24 15:32:31 -04:00
Richard Frank 3493723e7b DEV: zipline ingest can downgrade the assets db
This lets us publish an "old" db version for the most recent release
of zipline, using the latest code base.
2016-08-24 15:32:30 -04:00
Richard Frank e1497b0a56 MAINT: Put downgrade in transaction 2016-08-24 13:24:07 -04:00
Richard Frank 89132a6925 MAINT: Consolidate coercion to sqlite conn/eng 2016-08-24 13:24:07 -04:00
Richard Frank 67dbeab820 MAINT: Clean up usage of engine versus connection 2016-08-24 13:24:07 -04:00
Eddie Hebert a788191b8e Merge pull request #1431 from quantopian/spot-price-get-value
MAINT: Standardize reader get value methods.
2016-08-24 13:22:13 -04:00
Andrew Daniels 012888fcc7 MAINT: Modifies minute bars to use a dict of OHLC ratios (#1428)
For scaling up pricing data before writing to bcolz, the writer now
accepts a dict mapping each sid to the ratio to use. It still accepts a
single ratio as default_ohlc_ratio, which is used as a fallback if no
mapping exists for a given sid. The default is OHLC_RATIO (1000).

This allows better handling of futures pricing data, where the required
precision across root symbols is not consistent.
2016-08-24 13:14:16 -04:00
Eddie Hebert 71a34bf7ac MAINT: Standardize reader get value methods.
The daily/session bar reader's `spot_price` took the same parameters and
returned the same kind of output as the minute bar reader's `get_value`.

Standardize on one method to make a common interface, which may be
formally factored out in a later patch; to help enable writing reader
implementations or mixins which can be agnostic to the bar frequency.
2016-08-24 12:46:36 -04:00
Ana Ruelas eba78aec1b Merge pull request #1322 from quantopian/move_risk_calculations
Move risk calculations
2016-08-23 18:39:22 -04:00
Ana Ruelas 5b0ff75c8a MAINT: Update whatsnew for empyrical changes 2016-08-23 17:02:12 -04:00
Ana Ruelas 7f042476be TST: Rebuilt example data using empyrical 2016-08-23 13:49:48 -04:00
Ana Ruelas f57fe0a4b0 TST: Update to empyrical, increase test coverage
ENH: Resolve rebase conflict by using updated example_data.tar

TST: Increase test coverage for risk portion of zipline
2016-08-23 13:49:43 -04:00
Ana Ruelas 57d1bb82c4 ENH: Use qrisk to calculate risk metrics in cumulative and period
TST: Remove metric correctness testing from period and cumulative tests

ENH: Removed answer key and related files

ENH: Update qrisk version
2016-08-23 13:49:27 -04:00
Eddie Hebert 82436aa548 Merge pull request #1427 from quantopian/use-equities-calendar-in-equity-fixtures
TST: Use equity calendar when writing equity data
2016-08-23 12:15:00 -04:00
Eddie Hebert 0fb3d9033a TST: Use equity calendar when writing equity data
Use the equity calendar to write equity data, even when the simulation
calendar has been set to a different calendar.

Discovered when writing a test that used a calendar for future asset
data, but also wrote equity data.
2016-08-23 11:11:32 -04:00
Richard Frank b9a7e2fc32 Merge pull request #1426 from quantopian/really-ingest
BUG: Fixes zipline ingest with non-default bundle on python 2
2016-08-22 18:56:27 -04:00
Richard Frank 45da8270ff BUG: Fixes zipline ingest with non-default bundle on python 2 2016-08-22 18:30:39 -04:00
Andrew Daniels a8f2b704a2 BUG: Fixes BcolzMinuteBarMetadata to read the version correctly (#1425)
We were mistakenly using the minute_per_day field.

We now expose from the metadata object the version from which the
metadata was read. This allows a new test that verifies the version is
read correctly.
2016-08-22 17:45:07 -04:00
Scott Sanderson 7f575c5b0c Merge pull request #1423 from quantopian/fix-sharedoc
Fix sharedoc
2016-08-22 14:51:05 -04:00
Lotanna Ezenwa 4b5c8f0e1c Merge pull request #1422 from quantopian/fix-ewma-constructors
BUG: Add kwargs to ewma constructors
2016-08-22 14:29:10 -04:00
Richard Frank 5217e835c3 Merge pull request #1424 from quantopian/no-more-symbols
DOC: Updated more docs to remove --symbols, which was removed
2016-08-22 13:43:56 -04:00
Richard Frank 87a40491d1 DOC: Updated more docs to remove --symbols, which was removed 2016-08-22 13:29:16 -04:00
Scott Sanderson 346a58604e MAINT: Simpler impl of pad_lines_after_first. 2016-08-22 13:14:31 -04:00
LotannaEzenwa e813d723b5 Added kwargs to ewma constructors
fixed typos
2016-08-22 13:14:23 -04:00
Scott Sanderson 45302e140e DOC: Fix docs formatting for sharedoc.
The first line of indentation was incorrect.
2016-08-22 13:01:32 -04:00
Jean Bredeche ddb1009c25 Merge pull request #1407 from quantopian/minute_panel_daily_history
ENH: Add fast "vectorized" `minute_to_session_label` for DatetimeIndex
2016-08-22 10:27:40 -04:00
Richard Frank 81e3a944fd Merge pull request #1418 from quantopian/all-calendars
All calendars
2016-08-22 08:48:33 -04:00
Richard Frank 7fbdf0672f DOC: Added licenses to calendar modules 2016-08-21 17:19:59 -04:00
Richard Frank dcedd7adf5 MAINT: Removed unused holiday definitions 2016-08-21 17:19:59 -04:00
Richard Frank 9fccb7354e BUG: Fix and test getting all default calendars 2016-08-21 17:19:59 -04:00
John Ricklefs e5490fe109 Merge pull request #1416 from quantopian/exch_full_synthetic
ENH: Expose exchange_full on all Asset types
2016-08-20 13:51:29 -04:00
John Ricklefs 0c0ad0a734 ENH: If no exchange_full provided, use exchange 2016-08-19 16:45:52 -04:00
John Ricklefs 288c17caf6 ENH: Add exchange_full to all Assets, incl. Futures. 2016-08-19 16:45:52 -04:00
John Ricklefs de3a3843f9 ENH: Expose exchange_full on Equity objects 2016-08-19 15:59:52 -04:00
Andrew Daniels 813e56c41d ENH: Adds QuantopianUSFuturesCalendar (#1414)
For trading US futures across the exchanges supported by Zipline.
2016-08-19 13:40:09 -04:00
Eddie Hebert 6c9e1e5bd5 Merge pull request #1413 from quantopian/normalize-equity-future-in-data-portal
MAINT: Remove future/equity distinction.
2016-08-18 23:50:36 -04:00
Richard Frank 2604773c6b Merge pull request #1409 from quantopian/doc-zipline-run
DOC: Replace run_algo.py in docs with zipline run
2016-08-18 17:37:00 -04:00
Nathan Wolfe d34c4d28b6 ENH: Add fast "vectorized" minute_to_session_label for DatetimeIndex
The new TradingCalendar method is called `minute_index_to_session_labels`.
It takes a DatetimeIndex of in-order market minutes and returns a
DatetimeIndex of the corresponding sessions.

The new method is approximately 100x faster than mapping
`minute_to_session_label` over a large DatetimeIndex.
2016-08-18 17:27:47 -04:00
Eddie Hebert db6fd73b39 MAINT: Remove future/equity distinction.
In the data portal, remove methods that make a distinction between
future and equity asset type. Instead rely on the pricing reader
dispatching.

In support of incoming work which will upsample equity history arrays to
the larger future calendar.

Also, remove perf tracker tests which were using an equity
reader/writer, to be added back in later.
2016-08-18 16:18:32 -04:00
Eddie Hebert f86a250061 Merge pull request #1412 from quantopian/remove-unused-data-portal-members
MAINT: Remove unused data portal members.
2016-08-18 16:14:24 -04:00
Andrew Daniels 37e6a48e99 ENH: Pass calendar instance to BcolzMinuteBarWriter (#1406)
* First pass.

* Improvements and fixes

- Update usages of BcolzMinuteBarWriter
- Updates with rebuilt example data
- Expose calendar from BcolzMinuteBarMetadata instead of calendar_name
- Keep market_opens and market_closes in metadata for compatibility

* Store start_session and end_session in minute bcolz metadata

- start_session replaces first_trading_day
- Add end_session to limit to correct days

* For last_available_dt, get last close from calendar to maintain tz

* Bumps version and handles earlier versionson read

* Rebuilt example data on python 3

* Indicate metadata fields that are deprecated
2016-08-18 15:41:26 -04:00
Eddie Hebert ab1b485393 Merge pull request #1411 from quantopian/add-htmlcov-to-gitignore
TST: Add coverage output to gitignore.
2016-08-18 15:07:15 -04:00
Eddie Hebert a1b48c4bbe Merge pull request #1410 from quantopian/rename-history-loader
MAINT: Remove equity from history loader classname
2016-08-18 14:48:28 -04:00