Commit Graph

4285 Commits

Author SHA1 Message Date
Nathan Wolfe 4865ade9b2 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
Andrew Daniels 08a03edad7 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 9bd16aa313 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 ce717a1061 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 5a3588875a Merge pull request #1399 from quantopian/move-resample-code
TST: Share resample test cases.
2016-08-17 10:25:39 -04:00
Scott Sanderson 19429b9ad8 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 c7bd0d06e2 ENH: Add input validation to attach_pipeline. 2016-08-16 15:53:20 -04:00
Eddie Hebert 9685f3077a 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 369eedf583 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 3136ef3f93 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 60f65cb8ce 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 90a8ea2df3 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 34ec70abec 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
Joe Jevnik ea80b8892c TST: Adds dispatch for assert_equal(set, set) 2016-08-10 15:32:36 -04:00
Joe Jevnik 1b17296efd BUG: fix the v5-v4 downgrade path to properly take the most recently held ticker 2016-08-10 13:27:28 -04:00
Richard Frank 5811129acb Merge pull request #1386 from quantopian/conda-updates
Conda updates
2016-08-10 13:24:15 -04:00
Richard Frank 0c71aaa6ad BLD: Try newer appveyor image 2016-08-10 12:54:49 -04:00
Richard Frank 7d9f191ae8 BLD: Update conda packages 2016-08-10 12:53:51 -04:00
Scott Sanderson f5ff9d8514 Merge pull request #1384 from quantopian/fix-flapping-stoch-osc-test
BUG/TEST: Fix stochastic oscillator test.
2016-08-09 18:52:33 -04:00
Scott Sanderson 007e1f9cfb BUG/TEST: Fix stochastic oscillator test.
- Don't create unnecessary extra data (requires passing fastd_period=1
  to TA-Lib or else it fills the FastK with NaNs even though it must
  have already computed them...

- Use random_sample instead of random_integers so that we're not
  dependent on integer arithmetic.

- Pass array_decimal to assert_equal so that we do almost equal checking
  on results.
2016-08-09 17:55:24 -04:00
Eddie Hebert 5cf9921f04 Merge pull request #1381 from quantopian/test-futures-last-sale-dt
Support last sale dt and spot value for Future assets.
2016-08-09 15:52:50 -04:00
Joe Jevnik 05ec87b45b Merge pull request #1380 from quantopian/show-correct-symbol
BUG: always show the most recent symbol in Asset objects
2016-08-09 15:29:04 -04:00
Eddie Hebert 34c74346c9 ENH: Data portal reads future asset pricing.
Use the future asset equity pricing reader, instead of reading directly
from the bcolz table. Required since the format for writing the future
data now uses the minute bar reader/writer pair.

Add test cases to `test_data_portal` asserting both equity and future
`get_spot_value` results.
2016-08-09 15:19:26 -04:00
Eddie Hebert 37f4a5a56b TST: Add tests for Future asset last sale price.
In support, also add future asset minute bar data and reader fixtures.
2016-08-09 14:10:57 -04:00
Jean Bredeche 24f2ef8d72 Merge pull request #1383 from quantopian/fix-holiday-calendar
BUG: Fix HolidayCalendar init
2016-08-09 10:04:32 -04:00
David Michalowicz 7b3f604584 Merge pull request #1382 from quantopian/window-safe-zscore
Factors created from `zscore` should be window safe
2016-08-09 09:29:58 -04:00
Jean Bredeche ec441c55ea BUG: Fix HolidayCalendar init 2016-08-09 09:10:43 -04:00
dmichalowicz 1dad512184 BUG: zscores should be window safe 2016-08-08 18:07:34 -04:00
Joe Jevnik 586a41ff7c DOC: explain the group by and inner select more 2016-08-08 16:39:24 -04:00
Joe Jevnik 8fa84b0f00 BUG: always show the most recent symbol in Asset objects 2016-08-08 13:01:55 -04:00
Eddie Hebert 8c53d49d40 Merge pull request #1379 from quantopian/data-portal-coverage
Prepare data portal tests for covering Futures assets types.
2016-08-08 10:35:18 -04:00
Eddie Hebert bc4c6fb245 MAINT: Use reader dict for last sale dt lookup.
Also, add direct coverage of last_traded_dt in the `test_data_portal`
module.

Prepares for adding test coverage of `get_last_traded_dt` for `Future` assets.
2016-08-08 10:02:18 -04:00
Eddie Hebert c7020a9945 TST: Use data portal fixture.
Wire in data portal fixture for test data_portal, prepare for putting
more coverage of results in test_data_portal suite.
2016-08-08 08:25:20 -04:00
Eddie Hebert a260fb16c4 Merge pull request #1378 from quantopian/use-asset-type-to-key-fixture-calendars
TST: Key trading calendar fixture with Asset types
2016-08-08 06:33:12 -04:00
Eddie Hebert f4891b0a08 TST: Key trading calendar fixture with Asset types
Instead of using strings of 'equities' and 'futures', use the Asset
subclasses to key the trading calendar fixtures.
2016-08-08 03:49:48 -04:00
Scott Sanderson fc11fd0fc5 Merge pull request #1377 from quantopian/isolate-global-calendar-state
MAINT: Isolate global calendar state.
2016-08-05 16:26:46 -04:00
Scott Sanderson a265356082 MAINT: Remove unused variable. 2016-08-05 16:03:00 -04:00
Scott Sanderson c77d51de83 MAINT: Isolate global calendar state.
Encapsulate the shared global calendar map in an object.

This allows consumers that don't want to participate in custom
registration to pass around a calendar dispatcher, and would make it
easier to support contextual management of the global calendar map if we
want to do that in the future.

As a bonus, we now only create one instance of each calendar, instead of
one per alias.
2016-08-05 15:25:02 -04:00
Eddie Hebert ab1e11862f Merge pull request #1372 from quantopian/use-sum-instead-of-last-for-sourcing-daily
TST: Use sum for volume on daily data resample.
2016-08-05 14:53:23 -04:00
Eddie Hebert dd2c7db22d TST: Use sum for volume on daily data resample.
Change the mock minute data to no longer use an increasing arange, so
that a days worth of minute data can be summed and fit inside of a
uint32.

This change was required because of working on new test data that looked
like [0, 100, 200, 0, ] which was resulting in a daily rollup of 0 data,
when the coverage needed a non-0 value.

Also, factor out the resampling function, with an eye on a making it
easier to convert from minute bars to daily bars during ingest/load
processes.
2016-08-05 14:24:14 -04:00
Eddie Hebert d2cab0668f Merge pull request #1366 from quantopian/multi-trading-calendars
TST: Make room for multiple calendars in tests.
2016-08-05 13:54:50 -04:00
Eddie Hebert e934c6aeaf TST: Make room for multiple calendars in tests.
When adding fixtures for futures data, there will be a need for multiple
calendars in the fixture ecosystem. e.g. a test that includes both
equities and futures would need an overall calendar which encompasses
both equities and futures; however, the test data for equities should
still still be limited to the bounds set by the NYSE calendar.

Make the fixtures that setup trading calendars and values dervied from
the trading calendar (e.g. trading sessions) accept an iterable of
calendars which need to be created, then populate those values into a
dict keyed by the calendar name.

Change `WithNYSETradingDays` to include sessions in the name,
since we are moving to session as the name for the 'day' unit.

Provide `trading_days` which is really "NYSE trading sessions` on
`WithTradingSessions` for backwards compatibility.
2016-08-05 12:17:27 -04:00