Commit Graph

5611 Commits

Author SHA1 Message Date
Maya Tydykov 7f4f6b72b7 Merge pull request #1535 from quantopian/small-updates-for-estimates
MAINT: small updates to fix deprecation warnings
2016-10-12 14:41:51 -04:00
Maya Tydykov 45829df029 MAINT: small updates to fix deprecation warnings 2016-10-12 14:21:11 -04:00
Scott Sanderson bd83e250af Merge pull request #1534 from quantopian/allow-kwargs-to-assert-equal-for-pandas-stuff
BUG/TEST: Forward kwargs to assert_series_equal.
2016-10-12 14:16:07 -04:00
Scott Sanderson 9720803d03 BUG/TEST: Forward kwargs to assert_series_equal. 2016-10-11 21:29:41 -04:00
Eddie Hebert 04c6209a0b Merge pull request #1533 from quantopian/current-chain
ENH: Add current chain for continuous futures.
2016-10-11 16:37:09 -04:00
Eddie Hebert ca8950bf9c ENH: Add current chain for continuous futures.
Add `chain`field to current, as well as supporting methods in DataPortal
and OrderedContracts.

Enables the following example:

```
from zipline.api import continuous_future

def initialize(context):
    context.primary_cl = continuous_future('CL', offset=0, roll='calendar')
    schedule_function(print_current_chain)

def print_current_chain(context, data):
    chain = data.current_chain(context.primary_cl)
    print 'datetime={0}'.format(get_datetime())
    print 'primary={0}'.format(chain[0])
    print 'secondary={0}'.format(chain[1])
    print 'tertiary={0}'.format(chain[2])
```

```
datetime=2015-12-23 14:31:00+00:00
primary=Future(1058201602 [CLG16])
secondary=Future(1058201603 [CLH16])
tertiary=Future(1058201604 [CLJ16])
```

Also:
- make return types of OrderedContracts methods compatible across
architectures. (Noticed while adding `active_chain` method.)
- Add year suffix to future contract names in test data.
2016-10-11 16:16:16 -04:00
Joe Jevnik 0d7662df52 Merge pull request #1531 from quantopian/assert-slice-equal
TST: Adds assert_equal dispatch for slices
2016-10-11 11:14:23 -04:00
Maya Tydykov fe00452b7b Merge pull request #1525 from quantopian/fix_estimates_overwrites_bug
Fix estimates overwrites bug
2016-10-10 09:02:40 -04:00
Maya Tydykov 4efe99017a TST: add test condition to check for bug 2016-10-10 08:41:02 -04:00
Richard Frank 00a053cc38 DOC: Updated example notebook for latest zipline cell magic 2016-10-09 22:12:20 -04:00
Scott Sanderson acc46f5fe3 Merge pull request #1530 from quantopian/add-specific-assets
ENH: Add `SpecificAssets` filter.
2016-10-09 14:09:14 -04:00
Scott Sanderson d0c10e0567 DOC: Add a sentence with uses for SpecificAssets. 2016-10-09 13:41:10 -04:00
Scott Sanderson 46a0e86125 STY: Remove unused imports. 2016-10-09 13:18:18 -04:00
Scott Sanderson 83c80087c0 MAINT: Just require an iterable of assets. 2016-10-09 12:36:52 -04:00
Eddie Hebert 3ab251c90c Merge pull request #1529 from quantopian/current-contract
ENH: Add continuous future current contract.
2016-10-07 23:39:01 -04:00
Joe Jevnik 8e26368d4e TST: Adds assert_equal dispatch for slices 2016-10-07 18:57:05 -04:00
Eddie Hebert ec6f298972 ENH: Add continuous future current contract.
Add the ability for an algorithm to request the current contract for a
future chain via `data.current`.

e.g.:
```
data.current(ContinuousFuture('CL', offset=0, roll='calendar'),
'contract')
```
2016-10-07 18:26:23 -04:00
Scott Sanderson f874e670c4 ENH: Add SpecificAssets filter.
Adds a filter that matches a set of assets.  Mainly useful for testing
and debugging.
2016-10-07 18:11:01 -04:00
Andrew Daniels eba02da271 ENH: Adds last_available_{session, minute} args to DataPortal (#1528)
This allows optionally setting the last available dts in the DataPortal
explicitly. If these args aren't provided, we fall back to inferring
these from the underlying readers, which was the previous behavior.
2016-10-06 20:46:54 -04:00
Andrew Liang 03d77b34b4 Merge pull request #1527 from quantopian/fix_restrictions
BUG: Restrictions passed into HistoricalRestrictions not sorted correctly
2016-10-05 15:02:50 -04:00
Scott Sanderson 8465ea18d0 TEST: Simplify testing of restriction orderings. 2016-10-05 14:42:17 -04:00
Andrew Liang b0aba20a6e BUG: Restrictions passed into HistoricalRestrictions not sorted correctly 2016-10-05 14:09:26 -04:00
Ana Ruelas 08df8dfbf2 Merge pull request #1524 from quantopian/empyrical-bump
ENH: Empyrical bump
2016-10-05 13:25:32 -04:00
Ana Ruelas afc4a278e6 ENH: Empyrical bump 2016-10-05 12:54:16 -04:00
Maya Tydykov 76f152ada6 BUG: append overwrites to list rather than replacing with new list 2016-10-05 12:47:25 -04:00
Eddie Hebert 78de318753 Merge pull request #1523 from quantopian/dispatch-reader-passes-asset
MAINT: Pass through asset instead of sid.
2016-10-04 15:01:48 -04:00
Eddie Hebert bda8bb6d47 MAINT: Pass through asset instead of sid.
When dispatching to sub readers in dispatch reader, pass along the asset
object, instead of extracting the sid.

The in development reader for continuous futures values besides `sid`
are needed from the `ContinuousFuture` object.
2016-10-04 14:39:23 -04:00
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
Andrew Liang ea99962979 Merge pull request #1487 from quantopian/rlist
Create in-memory restricted list
2016-10-03 16:01:39 -04:00
Scott Sanderson 4448a9fa49 MAINT: Add kwarg-based helper for coerce. 2016-10-03 13:12:52 -04:00
Andrew Liang c5ee71afe6 DOC: Clean up Restrictions documentation 2016-09-30 16:35:24 -04:00
Andrew Liang 2104a35af8 ENH: _UnionRestrictions for combining multiple Restrictions 2016-09-30 16:35:24 -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
Scott Sanderson d47144dfb8 DOC: Rename NoopRestrictions to NoRestrictions. 2016-09-30 16:35:23 -04:00
Scott Sanderson cfce14ed9b DOC: Update docstring for set_restrictions. 2016-09-30 16:35:23 -04:00
Scott Sanderson 523b05ef3f TEST: Clarify test_restrictions a bit.
- Use parameter_space instead of `parameterized.expand`.
- Use a timedelta instead of concatenating strings.
- Use a (possibly no-op) scramble function instead of reordering list
  literals.
- Use `freeze_dt, unfreeze_dt, re_freeze_dt` instead of `dts[n]`.
- Rename `assert_vectorized_results` to `assert_all_restrictions`.
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 5e276d0e72 TEST: Modify tests for extra BarData parameter
Introducing a WithCreateBarData fixture which allows for the
creation of a BarData using only the `simulation_dt_func` and
`restrictions` params. Assumes that each suite uses the same
`data_portal`, `data_frequency` and `trading_calendar`
2016-09-29 10:11:15 -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
Andrew Liang b70084c6bf ENH: can_trade should take restricted list into account
Additionally, create an option for a violation of a 'do not order'
trading control to log an error instead of failing
2016-09-29 10:11:14 -04:00
Andrew Liang 0119aba410 ENH: A point-in-time restricted list with restrictions stored in memory
An ABC Restrictions defines a group of restrictions responsible
for returning restriction information for sids on certain dts. An
InMemoryRestrictions is a point-in-time group of such restrictions,
with all restrictions and their dates passed in upon instantiation.
A StaticRestrictedList takes a list of sids, restricting them at all
dates
2016-09-27 18:19:51 -04:00
Maya Tydykov 12357a8082 Merge pull request #1396 from quantopian/add_estimates_quarter_loader_to_pipeline
Add estimates quarter loader to pipeline
2016-09-27 17:18:16 -04:00
Maya Tydykov f528c01ca9 TST: add test for changing event dates and adjustments
BUG: get column names from column dict

BUG: fix name map
2016-09-27 16:53:36 -04:00
Scott Sanderson 4a22afd29a Merge pull request #1514 from fzagarzazu/fix-dockerfile
Docker build failure - Add Tini and set version range for numpy
2016-09-27 12:18:17 -04:00
Joe Jevnik 8d2e6446ee PERF: only query for the columns requested + metadata
BUG: choose last event date for quarter shift
2016-09-27 09:54:46 -04:00
Joe Jevnik bdce6ae493 PERF: vectorize earnings estimates 2016-09-27 09:54:46 -04:00