Commit Graph

2986 Commits

Author SHA1 Message Date
jkleint 82273e296f Propagate exceptions in loader to prevent variable reference before use
`data.loader.ensure_benchmark_data()` was trying to use data after an exception was raised loading it.  The code was logging and swallowing exceptions; this re-raises.
2016-09-23 15:55:55 -07:00
Andrew Daniels db0eabe82a PERF: Replace get_loc calls in calc_dividend_ratios with get_indexer (#1510)
We can make a single vectorized call outside of the loop, instead of
repeatedly calling get_loc inside it.
2016-09-22 19:05:43 -04:00
Scott Sanderson 171736f2de Merge pull request #1508 from quantopian/forward-window-safety-in-demean
BUG: F.window_safe implies f.demean().window_safe.
2016-09-22 13:50:30 -04:00
Scott Sanderson bddb453272 BUG: F.window_safe implies f.demean().window_safe. 2016-09-22 12:41:50 -04:00
Andrew Daniels f1919dc3af BUG: Makes NoData{Before, After}Date subclass NoDataOnDate (#1507)
This allows us to catch and handle all three of these exceptions in
`calc_dividend_ratios`.
2016-09-22 11:43:43 -04:00
Andrew Daniels a5c7e93540 Merge pull request #1500 from quantopian/make-metadata-optional
MAINT: Adds option for minute bar writer to not write metadata
2016-09-21 12:40:19 -04:00
Eddie Hebert 25517e2b15 Merge pull request #1502 from quantopian/remove-future-chain
MAINT: Remove `future_chain` API method.
2016-09-21 11:44:57 -04:00
Andrew Daniels 96cc6b6588 MAINT: Adds option for minute bar writer to not write metadata
With the addition of the truncate function, there are cases where we'll
want to construct a BcolzMinuteBarWriter to call truncate, without
gathering all the metadata. This commit adds a write_metadata arg to its
init, which is True by default. If False is specified, no metadata is
written.

Requires adding logic to truncate to update end_session in metadata to
the truncate date.
2016-09-21 11:31:54 -04:00
Eddie Hebert 9fd8ddda53 MAINT: Remove future_chain API method.
`future_chain` will be replaced by the as yet to be implemented method,
`data.current_chain`

Also removing `FutureChain` which will be replaced by another version
which only supports indexing and iteration.
2016-09-21 11:08:34 -04:00
Eddie Hebert 9e0ef02ff6 Merge pull request #1494 from quantopian/remove-unused-update-dividends
MAINT: Remove unused method.
2016-09-21 10:36:12 -04:00
Scott Sanderson a9faf94945 PERF: Remove or defer calls to get_loc on large indices.
Mitigation for https://github.com/quantopian/zipline/issues/1503.
2016-09-21 06:18:31 -04:00
Scott Sanderson 9cc2ecf8d5 BUG: Remove set_trace and add test coverage. 2016-09-20 17:46:27 -04:00
Scott Sanderson c5936b86d6 MAINT: Silence bad perf warning from pandas. 2016-09-20 17:12:09 -04:00
Scott Sanderson ab9a5d7060 MAINT: Use randint instead of random_integers. 2016-09-20 17:12:09 -04:00
Scott Sanderson 2522ca28ae BUG: Don't fail on integral floats in event rules.
Coerce and warn instead.
2016-09-20 17:12:08 -04:00
Scott Sanderson 5370948196 MAINT: Use sort_values instead of sort(). 2016-09-20 17:12:08 -04:00
Scott Sanderson ce76acce46 MAINT: Use df.resample().apply(). 2016-09-20 17:12:08 -04:00
Scott Sanderson 46cf54b180 MAINT: Remove outdated compat code. 2016-09-20 17:12:07 -04:00
Scott Sanderson 4ba064dae7 MAINT: Don't make datetime64 from tz-aware Timestamp.
It's slow and deprecated.
2016-09-20 17:12:07 -04:00
Scott Sanderson f24db9c30c DOC: Typo in comment. 2016-09-20 17:12:07 -04:00
Scott Sanderson b639555404 MAINT: Use errors='coerce'.
coerce=True is deprecated.
2016-09-20 17:12:07 -04:00
Scott Sanderson 493e18252d MAINT: Temporarily ignore pandas warnings in categoricals.
Pandas 0.18 doesn't like having null-ish values in categoricals.  Fixing
this properly requires re-thinking the semantics for missing_value on
pipeline terms, so we're punting on that until after we've upgraded to
0.18.
2016-09-20 17:12:07 -04:00
Scott Sanderson a9c02935c6 Revert "MAINT: Remove support for custom string Column missing values."
This reverts commit 1b1e842e2339d6d0ee40cdfe34dcd27b4e4a7c0c.
2016-09-20 17:12:07 -04:00
Scott Sanderson ed365dc5fe MAINT: Remove support for custom string Column missing values.
Pandas 0.18 deprecated passing "null-ish" values to pd.categorical.  The
expectation, instead, is that you use categorical's native support for
missing data, which means the user will always get NaN's for missing
entries of the categorical.

A follow-up to this change should probably drop support for custom
missing values entirely and to use LabelArray/categorical for integer
data.
2016-09-20 17:12:07 -04:00
Scott Sanderson da8ed8919e MAINT: Pandas compat for rolling_*. 2016-09-20 17:12:07 -04:00
Scott Sanderson 4c3c2fd13c MAINT: Don't use convert_objects().
It's not necessary, and it's deprecated.
2016-09-20 17:12:07 -04:00
Scott Sanderson af5f4be17c MAINT: Fix warnings from numpy on NaT comparison. 2016-09-20 17:12:07 -04:00
Scott Sanderson b9c2e8c1c6 MAINT: Use sort_values instead of sort().
Sort is deprecated.
2016-09-20 17:12:07 -04:00
Scott Sanderson 9aa866e434 MAINT: Use sort_values() instead of sort().
pd.DataFrame.sort() is deprecated.
2016-09-20 17:12:07 -04:00
Scott Sanderson f30fc28b5c MAINT: Pass float explicitly to numpy. 2016-09-20 17:12:07 -04:00
Scott Sanderson 74277490d5 BUG: Use arrays for week/month group calculations.
In pandas 0.18, the behavior of ``nth()`` changed so that Grouper no
longer can be easily used to recover group labels.

Instead of using the built-in grouper behavior, we use a groupby on two
arrays we build ourselves.  This recovers the original behavior, and is
about 2x faster as a bonus.
2016-09-20 17:12:07 -04:00
Scott Sanderson dafe49fcca MAINT: Fix failures/warnings in test_api_shim.py
- Fixes a warning on indexing with a float that ultimately came from
  pd.Timedelta.total_seconds().  Adds ``timedelta_to_integral_seconds``
  and ``timedelta_to_integral_minutes()`` functions and replaces various
  usages of ``int(delta.total_seconds())`` with them.

- Fixes a warnings triggered in ``_create_daily_stats`` from
  passing tz-aware datetimes to np.datetime64.
2016-09-20 17:12:07 -04:00
Scott Sanderson e43a3e8b1b MAINT: Use arange instead of rolling_count.
It's faster, and rolling_count is deprecated.
2016-09-20 16:24:55 -04:00
Scott Sanderson e33c42b3a9 MAINT: Update fetcher for pandas 0.18.
- Remove support for usecols=[].
- Use sort_values instead of sort().
- Use errors='coerce' instead of coerce=True.
2016-09-20 16:24:55 -04:00
Scott Sanderson 61a56492e6 ENH: Make INT_DTYPES_BY_SIZE_BYTES ordered. 2016-09-20 16:24:55 -04:00
Scott Sanderson fc3eac36aa DOC: Update LabelArray docstring. 2016-09-20 16:24:55 -04:00
Scott Sanderson b06ef66f44 DOC: Remove out of date comment. 2016-09-20 16:24:55 -04:00
Richard Frank ef04fe3a9b PERF: Use empyrical with ndarrays instead of Series 2016-09-19 15:51:06 -04:00
Richard Frank 73a61caaeb MAINT: Removing unused array and unused attribute 2016-09-19 15:19:30 -04:00
Jean Bredeche 8048cdcfb0 PERF: Be smarter about counting the number of minutes across a contiguous bunch of sessions. 2016-09-19 13:25:03 -04:00
Andrew Daniels 4a2faa3e13 ENH: Adds truncate method to BcolzMinuteBarWriter (#1499) 2016-09-19 13:02:48 -04:00
Eddie Hebert 6486e64530 Revert "Merge pull request #1490 from quantopian/use-load-adjustments-for-history"
This reverts commit 86c7635b45, reversing
changes made to c77f2b92df.

Some real world cases hit errors with this change, due to the new offset
logic attempting to create Adjustments with invalid parameters.

Will identify exact conditions that cause this error and add as a test
case before remerging.
2016-09-19 08:53:31 -04:00
Eddie Hebert 7b74257f28 MAINT: Remove unused method.
Dividends are read from AdjustmentReader.
2016-09-16 16:50:10 -04:00
Jean Bredeche 31cbdde7f0 PERF: Save up to 75% of the calls to minute_to_session_label
One year NYSE test that buys a lot triggers 492,963 calls to
minute_to_session_label.  Only 98924 ~(390 * 252) make it past the
cache and trigger the heavier computation.
2016-09-16 15:18:50 -04:00
Jean Bredeche a7f345e651 ENH: Switching from cachetools.LRUCache to lru-dict's LRU cache.
lru-dict is written in C and seems much more performant.
2016-09-16 11:03:13 -04:00
Eddie Hebert f2a1263d90 Merge pull request #1490 from quantopian/use-load-adjustments-for-history
MAiNT: Use load_adjustments for history.
2016-09-15 16:01:23 -04:00
Jean Bredeche ed08f25224 Merge pull request #1488 from quantopian/who-said-you-could-forward-fill-stop-that
ENH: Make reader.get_value raise NoDataOnDate if the date is not in the calendar.
2016-09-15 15:41:36 -04:00
Eddie Hebert 1d06a779b3 MAiNT: Use load_adjustments for history.
Instead of `HistoryLoader` containing separate adjustment calculation
logic, use `SQLiteAdjustmentReader.load_adjustments`.

This change required the addition of two offset parameters to
`load_adjustments` since the perspective on the data from within
`schedule_function` is skewed from how Pipeline looks at historical
data.

This is working towards creating an `AdjustmentReader` abc which
`SQLiteAdjustmentReader` and a upcoming continuous future adjustment
reader will share.
2016-09-15 15:32:10 -04:00
Jean Bredeche 0fd35e7fd1 ENH: Make reader.get_value raise NoDataOnDate if the date is not in the calendar.
DataPortal now catches the NoDataOnDate exception and returns nan for
OHLC and 0 for V.

Price is still forward filled, unchanged.
2016-09-14 22:21:43 -04:00
Scott Sanderson 7ac024fb5c Merge pull request #1484 from quantopian/refcount-pipelines
PERF: Release unneeded pipeline terms.
2016-09-14 20:24:10 -04:00