Commit Graph

219 Commits

Author SHA1 Message Date
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 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
Jean Bredeche 7d4b19a7f0 ENH: Use bundle name as exchange value 2016-08-02 23:21:39 -04:00
Jean Bredeche 97ccb54326 MAINT: PR cleanup 2016-08-02 23:12:07 -04:00
Jean Bredeche d8af3fb92e ENH: Augment data.can_trade to check whether the asset's exchange is currently
open.
2016-08-02 23:11:10 -04:00
Joe Jevnik 4265a13edf Revert "Merge pull request #1354 from quantopian/revert-1302-point-in-time-asset-db"
This reverts commit 3b633011c6, reversing
changes made to 70ac5323de.
2016-08-02 14:25:10 -04:00
Joe Jevnik 9103516e82 Merge pull request #1313 from nathanwolfe/master
BUG: Add support for Panel data in accordance with documentation
2016-07-29 20:11:56 -04:00
Nathan Wolfe 0a196c7a69 MAINT: Correct PanelBarReader sessions property, expand test
`tests/test_panel_daily_bar_reader.py` expanded to cover minute
frequency as well, using the same tests. Renamed to
`test_panel_bar_reader.py`.
2016-07-29 17:36:18 -04:00
Nathan Wolfe ab9a899c5b MAINT: Switch PanelBarReader to take trading calendar and freq args 2016-07-29 17:36:08 -04:00
Nathan Wolfe 763f2ab8b4 MAINT: Combine daily and minute into PanelBarReader.
Also simplify `load_raw_arrays` and `get_last_traded_dt`.
2016-07-29 17:34:28 -04:00
Nathan Wolfe cfe755855c ENH: Add PanelMinuteBarReader, use it in TradingAlgorithm.run.
TradingAlgorithm.run didn't support Panel minute bar data, and assumed
all Panel data was daily.

To rectify this, adding PanelMinuteBarReader class.
TradingAlgorithm.run decides whether to use it or PanelDailyBarReader
by assuming data is daily if and only if the time of day of every
Timestamp is identical.
2016-07-29 17:10:21 -04:00
Jean Bredeche a937d6e6b1 Merge pull request #1352 from quantopian/move-daily-aggregator
MAINT: Move daily aggregator to own module.
2016-07-28 09:45:50 -04:00
Joe Jevnik 814a2be7b7 Revert "Point in time asset db" 2016-07-27 23:29:08 -04:00
Eddie Hebert e00a25568d MAINT: Move daily aggregator to own module.
Break out the daily history aggregator into its own module, instead of
being collocated with DataPortal.
2016-07-27 16:59:26 -04:00
Jean Bredeche 3305933089 DEV: Change daily mode to use last minute of session instead of session itself. 2016-07-27 09:20:24 -04:00
Jean Bredeche 2462929368 Revert "Merge pull request #1340 from quantopian/by-daily-i-mean-minutely"
This reverts commit f4456719b0, reversing
changes made to 4be07e4628.
2016-07-26 16:20:14 -04:00
Eddie Hebert 52f3e91a4b Merge pull request #1341 from quantopian/generalize-minute-bars
ENH: Removes dependence of BcolzMinuteBarReader on 390 minutes per day
2016-07-26 15:17:00 -04:00
Joe Jevnik 54be3858ba TST: adds test bundle to builtins to make it easier to rebuild when the asset db changes 2016-07-26 13:34:58 -04:00
Jean Bredeche bcb547d5a8 DEV: Change daily mode to use last minute of session instead of session itself. 2016-07-26 12:49:49 -04:00
Eddie Hebert 5cfccb9dd2 ENH: Add a format version to minute bar metadata.
Set the version to 1, with a fallback of version of 0 if version is not
found.

If the version is 0, use 390 (US Equities) for the number of minutes in
the day, so that existing files work as before.
2016-07-26 12:36:05 -04:00
Andrew Daniels 14489c8b10 ENH: Removes dependence of BcolzMinuteBarReader on 390 minutes per day
Adds a minutes_per_day field to BcolzMinuteBarMetadata, so that the
minutes_per_day value passed to the BcolzMinuteBarWriter is written as a
part of the minute bar metadata. This allows the reader to share this
value, instead of always assuming 390.

Also rebuilds the example data to incorporate this format change.
2016-07-26 12:36:05 -04:00
LotannaEzenwa f43941933f ENH: Makes working_dir work on Windows. Updates bundle core 2016-07-25 13:10:23 -04:00
Joe Jevnik b2ee6c6f84 BUG: forward show_progress in yahoo 2016-07-25 13:09:55 -04:00
Joe Jevnik e8728c0cd4 TST: fix data tests 2016-07-25 13:09:55 -04:00
Jean Bredeche 7418e893a9 BUG: Implement sessions property for PanelDailyBarReader
Also, renamed it from `_sessions_ to `sessions` and defined an
abstractproperty in `DailyBarReader`.
2016-07-24 21:08:11 -04:00
Jean Bredeche 5a0f840917 Clean up daily bar reader/writer to take advantage of new trading calendar. The reader
is backwards-compatible with the previous format.

In USEquityLoader, use dailyreader's trading_calendar.

This is backwards compatible and will fall back to the NYSE calendar if
the reader doesn’t have a calendar specified.
2016-07-15 15:13:57 -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
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
Richard Frank 000b64703a BUG: Fixes quandl bundle failing to download pricing data
for invalid symbol
2016-06-22 18:11:58 -04:00
Andrew Daniels 7ae370b037 MAINT: Fixes DataPortal.get_spot_value to correctly handle 'price' field
Querying for the price field of an equity actually looks at the close
field, so we should do the same for futures. Otherwise `data.can_trade`
and `data.current` of 'price' fail for futures.
2016-06-20 10:34:18 -04:00
Andrew Daniels 02a91ec4ab MAINT: Removes the set_first_trading_day method of DataPortal
Since the first trading day is now passed directly to the DataPortal on
init, there's no need for a method that does this. Moves all the
additional logic/assignments into the init. Also corrects an issue where
we would never create certain attributes if self._first_trading_day was
None.

Adds the ability to specify the first trading day for a data portal in a
test case when using the WithDataPortal fixture.
2016-06-08 13:34:23 -04:00
Jean Bredeche b1428aaad1 DEV: Cleaned up trading_minute_window
Removed it from ExchangeCalendar.

Fixed TradingSchedule’s implementation to be much faster.  Removed the
`step` parameter.
2016-06-08 13:34:23 -04:00
jfkirk 2a8f69fc01 MAINT: DataPortal env -> asset_finder 2016-06-08 13:34:22 -04:00
jfkirk 10a118d94c MAINT: Removes references to tradingcalendar 2016-06-08 13:34:20 -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 26742dda67 MAINT: Removes obsolete tradingcalendar module 2016-06-08 13:34:19 -04:00
jfkirk 4b7390ac81 WIP: Refactors tests to use TradingSchedule 2016-06-08 13:34:19 -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
Eddie Hebert 58467f9b3e MAINT: Only calc inverse ratio if it applies.
Avoid unneeded work by only calcultaing the inverse ratio when it
applies to the current range.
2016-06-07 10:41:18 -04:00
Eddie Hebert b450ab841f BUG: Apply latest adjustment for minute 1d
Fix behavior in minute mode history with frequency `1d`, where on the
day immediately following an adjustment action, the overnight adjustment
would not apply. (However the adjustment would be applied after a 1 day
lag.)

The root cause of the bug was that the history data for minute mode when
using `1d` stitches together a sliding window of the daily data for
previous  and the current minute. That daily data sliding window and
corresponding adjustments was being read as if the data was being viewed
from on the last day of the window; however in this case the data is
being viewed from the day after the window has completed. The difference
in view points requires the adjustments to popped and applied by the
adjusted array one index earlier. The fix uses the `extra_slot` value as
signifier on whether the data is being viewed on the following day and
then accordingly adjusts the index of the mulitpy object.

Also, change the split and merger test data ratios to have different values,
to ensure that different adjustment values are applied; as opposed to
doubling up on just one of the values.
2016-06-07 10:41:18 -04:00
Jason Wirth 4dd6e4fb61 correct CLI command 2016-06-02 19:36:18 -07:00
Andrew Daniels 1cf8e46ae6 Merge pull request #1245 from quantopian/daily-bars-first-day-attr
BUG: Fixes reading and writing of daily bars first_trading_day attr
2016-06-02 15:09:12 -04:00
Andrew Daniels 8e6c98e9aa BUG: Fixes reading and writing of daily bars first_trading_day attr
When writing first_trading_day, it is already in the correct frame of
reference (seconds since epoch) and does not need to be transformed
further. Adjusts the reader to expect this value.
2016-06-02 13:41:09 -04:00
Andrew Daniels 71f12ec272 MAINT: Adds first_trading_day arg to DataPortal
Instead of inferring it from the minute/daily writer, we now require the
first trading day to be passed explicitly, so the creator of the
DataPortal controls what is used as the first trading day.
2016-06-02 13:16:43 -04:00
Stewart Douglas 71bcc7f911 DOC: Update comments to reflect new behavior 2016-05-26 09:38:25 -04:00
Scott Sanderson 5caccaeed5 Merge pull request #1230 from quantopian/pipeline-example
DOC/TEST: Add example algo using Pipeline.
2016-05-25 22:35:59 -04:00
Andrew Daniels f1cfe1f2db BUG: Fixes bcolz padding to not always pad 390 minutes
If minutes already exist for the last existing day, adjust the number of
minutes padded to account for them. Previously we would always pad 390,
leading to a mismatch in the number of rows.
2016-05-25 14:26:16 -04:00
Scott Sanderson 392ac2f9d6 DOC/TEST: Add example algo using Pipeline. 2016-05-24 22:34:05 -04:00
Joe Jevnik 5664d80c92 Merge pull request #1219 from quantopian/suggest-ingest
ENH: suggest running ingest if no data exists
2016-05-20 12:38:26 -04:00