Commit Graph

552 Commits

Author SHA1 Message Date
Scott Sanderson 7fc39fed70 Merge pull request #1518 from quantopian/add-coerce_types
MAINT: Add kwarg-based helper for coerce.
2016-10-03 19:52:08 -04:00
Scott Sanderson 4448a9fa49 MAINT: Add kwarg-based helper for coerce. 2016-10-03 13:12:52 -04:00
Andrew Liang 3b5031a829 MAINT: Rename restrictions.py to asset_restrictions.py
For clarity as to what sort of restrictions these are
2016-09-30 16:35:24 -04:00
Scott Sanderson 7700987abc STY: Remove extra whitespace. 2016-09-30 16:35:24 -04:00
Scott Sanderson 5b91175651 DOC: Fix docstring typo. 2016-09-30 16:35:24 -04:00
Scott Sanderson d5ea9c4daa BUG: days_at_time should return UTC dates.
Adds an example and clarifies the docs.
2016-09-30 16:35:24 -04:00
Scott Sanderson 87daa75c0c MAINT: Use Timedelta instead of DateOffset.
In days_at_time, use a Timedelta instead of a DateOffset.  We were
previously using DateOffset to work around a pandas 16 bug even though
it raises a PerformanceWarning.  Now that we're on pandas 18, we can use
the much simpler Timedelta construction.
2016-09-30 16:35:23 -04:00
Andrew Liang bf8b030417 MAINT: Deprecate set_do_not_order_list
In favor of a new method `set_restrictions` which takes a Restrictions
object. Calls to `set_do_not_order_list` should raise a deprecation
warning and create an equivalent Restrictions object, with which
`set_restrictions` will be called. For convenience, create a
RestrictionsSet from which the "restrictions" version of a security
list can be accessed
2016-09-30 16:35:23 -04:00
Andrew Liang e465f64f91 MAINT: Create SecurityListRestrictions that takes a SecurityList
The SecurityList implements a non-exposed method
`current_securities(dt)` which SecurityListRestrictions calls to
determine if an asset is restricted. Deprecate the `__iter__` and
`__contains__` methods of security lists in favor of
`current_securities(dt)`
2016-09-29 10:11:14 -04:00
Scott Sanderson e86fffc4ca 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 c23dd5beaa BUG: Remove set_trace and add test coverage. 2016-09-20 17:46:27 -04:00
Scott Sanderson 70755c5416 MAINT: Silence bad perf warning from pandas. 2016-09-20 17:12:09 -04:00
Scott Sanderson d9282ef7e0 BUG: Don't fail on integral floats in event rules.
Coerce and warn instead.
2016-09-20 17:12:08 -04:00
Scott Sanderson 966c0ceedb MAINT: Remove outdated compat code. 2016-09-20 17:12:07 -04:00
Scott Sanderson 53eb1964d9 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 ca54721058 MAINT: Pandas compat for rolling_*. 2016-09-20 17:12:07 -04:00
Scott Sanderson 599d6c59ef MAINT: Fix warnings from numpy on NaT comparison. 2016-09-20 17:12:07 -04:00
Scott Sanderson 750b410a48 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 becf897da9 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 930f32f6a1 ENH: Make INT_DTYPES_BY_SIZE_BYTES ordered. 2016-09-20 16:24:55 -04:00
Jean Bredeche 87eb87525f PERF: Be smarter about counting the number of minutes across a contiguous bunch of sessions. 2016-09-19 13:25:03 -04:00
Jean Bredeche 1d2e1015c7 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
Richard Frank 3bdba2ec50 BUG: run_algorithm with no data source should default
to 'quantopian-quandl' bundle
2016-09-12 12:17:17 -04:00
Scott Sanderson 40fa6aeea4 STY: Fix flake8. 2016-09-07 21:58:15 -04:00
Scott Sanderson d6ad73e064 MAINT: Updates from Joe's PR feedback. 2016-09-07 20:42:19 -04:00
Scott Sanderson 977d1fa0b9 MAINT/TEST: Update default calendar smoketest. 2016-09-06 14:13:32 -04:00
Scott Sanderson 1ca23f2583 PERF: Remove module-scope calendar creations.
Remove module scope invocations of `get_calendar('NYSE')`, which cuts
zipline import time in half on my machine. This make the zipline CLI
noticeably more responsive, and it reduces memory consumed at import
time from 130MB to 90MB.

Before:

$ time python -c 'import zipline'

real    0m1.262s
user    0m1.128s
sys     0m0.120s

After:

$ time python -c 'import zipline'

real    0m0.676s
user    0m0.536s
sys     0m0.132s
2016-09-06 09:57:23 -04:00
Scott Sanderson 2e50a092b1 DOC: Clarify expect_bounded docstring. 2016-09-02 13:33:55 -04:00
Scott Sanderson dee715cff2 ENH: Dont allow length=1 regressions/correlations.
They're not meaningful, and they cause warnings from numpy.

Implemented in terms of a new preprocessor, `expect_bounded`, which
takes a tuple of `upper_bound` and `lower_bound`.
2016-09-02 12:49:09 -04:00
Jean Bredeche 749c2eea33 ENH: Let event offsets be up to 12 hours. 2016-08-29 09:33:40 -04:00
Jean Bredeche 7b83cbe820 ENH: Add new parameter to schedule_function that accepts a trading
calendar.
2016-08-28 21:33:42 -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 89132a6925 MAINT: Consolidate coercion to sqlite conn/eng 2016-08-24 13:24:07 -04:00
Scott Sanderson 7f575c5b0c Merge pull request #1423 from quantopian/fix-sharedoc
Fix sharedoc
2016-08-22 14:51:05 -04:00
Scott Sanderson 346a58604e MAINT: Simpler impl of pad_lines_after_first. 2016-08-22 13:14:31 -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 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
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
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
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 141a088f7f ENH: Add numpy_utils.changed_locations. 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 1d93e1c21f ENH: Add as_column to numpy_utils. 2016-08-17 16:52:09 -04:00
Jean Bredeche 7803ec6e46 ENH: Add public API to register calendars by type 2016-08-11 11:27:48 -04:00
Jean Bredeche ec441c55ea BUG: Fix HolidayCalendar init 2016-08-09 09:10:43 -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