Commit Graph

4424 Commits

Author SHA1 Message Date
Scott Sanderson 548e0675be Merge pull request #1466 from quantopian/disallow-length-1-regressions
ENH: Dont allow length=1 regressions/correlations.
2016-09-02 15:49:03 -04:00
Eddie Hebert ddcba8733d Merge pull request #1464 from quantopian/add-coverage-for-last-traded-dt
TST: Add direct coverage for get last traded dt
2016-09-02 14:59:21 -04:00
Scott Sanderson b946c657b7 Merge pull request #1420 from quantopian/add-cython-cleanup
MAINT: Add script to clean out compiled files.
2016-09-02 14:16:18 -04:00
Scott Sanderson b0a93d57a0 DOC: Clarify expect_bounded docstring. 2016-09-02 13:33:55 -04:00
Eddie Hebert 948d813b84 TST: Add direct coverage for get last traded dt
Check that both an equity and future can return expected values for
`get_last_traded_dt`.
2016-09-02 13:19:46 -04:00
Eddie Hebert d7eb845c7f Merge pull request #1465 from quantopian/remove-unused-adjustments-in-data-portal
MAINT: Remove unused data portal methods.
2016-09-02 13:15:12 -04:00
Scott Sanderson 28bca7cbd7 DEV: Find .c and .so files with regex. 2016-09-02 12:56:36 -04:00
Scott Sanderson 12101c55c8 STY: Don't assign variables that won't be created. 2016-09-02 12:53:01 -04:00
Scott Sanderson 8b2446aec6 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
Eddie Hebert 1269250dde MAINT: Remove unused data portal methods.
The apply adjustments behavior had been moved to the `HistoryLoader`
class.
2016-09-02 12:12:22 -04:00
Ana Ruelas 8f3e0cbfb2 Merge pull request #1463 from quantopian/rm-risk-adjustments
BUG: Do not adjust returns for sharpe and sortino
2016-09-02 11:32:02 -04:00
Ana Ruelas ec7e4f2333 BUG: Do not adjust returns for sharpe and sortino 2016-09-02 10:41:50 -04:00
Eddie Hebert c5c7a4ac4a Merge pull request #1460 from quantopian/daily-aggregator-corner-cases
TST/BUG: Full coverage on resample module.
2016-09-01 17:24:56 -04:00
John Ricklefs 8595ca81cb Merge pull request #1459 from quantopian/target_cash_capital_change_from_raw_cash
BUG/ENH: Fix behavior of 'target' capital changes
2016-09-01 16:54:56 -04:00
Eddie Hebert baff6a84bc TST/BUG: Full coverage on resample module.
test_resample now fully covers the resample module.

Fix a bug exposed by increased coverage, where daily aggregation on
`high` would return `nan` for an asset instead of 1) during the
course of day `1d` history was called on non-consecutive minutes and 2)
either, a) the value for the previously inspected dt was `nan` or b)
there were only `nan`s between the previous and current dt.

`low` had a similar bug which was only triggered if the value for the
previously inspected dt was `nan`.
2016-09-01 16:41:45 -04:00
John Ricklefs 0d40b84550 ENH: Allow passing additional adjustments to calculate_capital_changes
If subclasses have additional capital change information that
is required to correctly calculate the target values for
cash capital changes, it can now be provided via
"portfolio_value_adjustment".
2016-09-01 16:04:46 -04:00
John Ricklefs 3ab907ee4f BUG: Capital change deltas rely on cash, not portfolio_value
The value of holdings is irrelevant when altering the
capital base of the current perf period.
2016-09-01 15:19:55 -04:00
Eddie Hebert e2300c73bf Merge pull request #1458 from quantopian/cover-all-public-methods-on-resample
TST/BUG: Cover all reindex session public methods.
2016-09-01 14:20:19 -04:00
Eddie Hebert 59d06a1883 TST/BUG: Cover all reindex session public methods.
Increase coverage on `ReindexSessionBarReader` so that all methods which
are considered part of the interface are covered by `test_resample`.

Fix bug in `get_value`, exposed by increased coverage, where the
`NoDataOnDate` exception was bubbling from the bcolz reader all the way
up when a session which was a holidy on the underlying reader was passed
to the reindex reader. (The reindex reader should return nan/0 in that
case.)

Also, move location of data index exceptions so that they are agnostic
to bcolz/us_equity_pricing; since the exception is now used by the
resample module to fix aforementioned bug.
2016-09-01 11:51:00 -04:00
Jean Bredeche 95329180bd Merge pull request #1408 from quantopian/really-can-i-trade-how-about-now
ENH: Update can_trade to check exchange time
2016-08-31 22:04:06 -04:00
Jean Bredeche 46c0c064fe ENH: Update can_trade to check exchange time
BarData now takes the trading calendar as a parameter.

can_trade now checks if the asset’s exchange is open at the current or
next market minute (defined by the given trading calendar).
2016-08-31 21:22:06 -04:00
Eddie Hebert af75a1f67c Merge pull request #1457 from quantopian/allow-last-date-for-session-get-last-traded-dt
TST: Fix get_last_traded_dt on bcolz daily reader.
2016-08-31 15:53:36 -04:00
Jean Bredeche af20cdbe9d Merge pull request #1456 from quantopian/future-chain-cleanup
ENH: Simplified implementation of FutureChain object (not user-facing API)
2016-08-31 15:36:57 -04:00
Eddie Hebert 1bebad5b68 TST: Fix get_last_traded_dt on bcolz daily reader.
Remove special handling for the last session of an asset, which was
moving the last traded back a session.

If the asset has data on a session, `get_last_traded_dt` should always
return that session if it is the parameter to the method.
2016-08-31 14:59:58 -04:00
Jean Bredeche d1160439d2 ENH: Simplified implementation of FutureChain object (not user-facing API).
No longer auto-updates its internal as-of date, instead requires an explicit
as-of date from the consumer.

Take a static list of contracts (instead of needing an assetfinder).

Instead of the as_of method, the user-facing API now lets you pass in an
offset, which is defined as an integral number of sessions.
2016-08-31 14:44:02 -04:00
Jean Bredeche f5d6bfca4d Merge pull request #1455 from quantopian/cache-future-chain-lookups
ENH: Put a cache in front of future chain lookups
2016-08-31 11:26:14 -04:00
Jean Bredeche 8d61e16df9 ENH: Put a cache in front of future chain lookups
Cache the last 100 rootsymbol/session pairs, since future chains never
change inside a session.
2016-08-31 10:40:11 -04:00
Eddie Hebert 8863d007ce Merge pull request #1452 from quantopian/begin-cover-reindex-resample
TST: Increase coverage for  reindex reader methods
2016-08-31 10:31:14 -04:00
Ana Ruelas 22de78fdb5 Merge pull request #1450 from quantopian/empyrical-v-update
Empyrical v update
2016-08-30 20:29:28 -04:00
Jean Bredeche a813f245e2 Merge pull request #1451 from quantopian/zero-means-zero
ENH: Avoid unnecessary work with missing data.
2016-08-30 20:07:25 -04:00
Jean Bredeche a37141fb98 ENH: Avoid unnecessary work with missing data. 2016-08-30 17:16:08 -04:00
Eddie Hebert 544dda115c TST: Increase coverage for reindex reader methods
Add direct coverage on last_available_dt.

Also move reader creation into the instance fixture.

This patch attempted to add coverage on `get_last_traded_dt`, but in doing
so, revealed a bug in `BcolzDailyBarReader.get_last_traded_dt` when
requesting the last trading session of an asset.
When that is fixed, the skip can be removed.
2016-08-30 16:43:58 -04:00
Ana Ruelas 3698362030 BLD: Update to empyrical 0.1.11 2016-08-30 16:41:57 -04:00
Jean Bredeche e574b7b042 Merge pull request #1442 from quantopian/schedule-all-the-hours
ENH: Let event offsets be up to 12 hours.
2016-08-30 16:34:23 -04:00
Eddie Hebert 624b4659f1 Merge pull request #1446 from quantopian/use-us-futures-in-test-resample
TST: Use futures cal in resample suite.
2016-08-30 10:24:18 -04:00
Richard Frank 9919d47898 BLD: Tag empyrical conda packages with numpy version 2016-08-29 17:12:05 -04:00
John Ricklefs 674a6200b4 Merge pull request #1437 from quantopian/empyrical_perf
PERF: Reduce calculations performed by empyrical
2016-08-29 16:20:41 -04:00
Eddie Hebert bce159f275 TST: Use futures cal in resample suite.
Instead of CME, use the futures cal, which should now be the standard
calendar throughout; though some tests remain to be ported.
2016-08-29 15:43:39 -04:00
Eddie Hebert 5b333df10e Merge pull request #1445 from quantopian/cover-resample-first-trading-day
TST: Cover resample bar first_trading_day method.
2016-08-29 15:38:07 -04:00
Ana Ruelas c984cdb247 TST: Rebuild example data due to changes in beta calculation 2016-08-29 15:11:37 -04:00
Andrew Daniels 60c485c1ed ENH: Adds table_len method to BcolzMinuteBarReader (#1436)
To get the length of the underlying table for a given sid.
2016-08-29 15:07:08 -04:00
Eddie Hebert 7146edbe7d TST: Cover resample bar first_trading_day method.
Add a test to directly cover the first_trading_day method via the
`test_resample` suite. (The lack of coverage was exposed when testing
against real data.)

Also, refactor resample bar tests so that session bar reader is set up
in instance fixture.
2016-08-29 15:00:08 -04:00
Eddie Hebert 50e175bad2 Merge pull request #1444 from quantopian/use-session-label-on-daily
BUG: Use session label instead of date for 1d.
2016-08-29 14:05:39 -04:00
Eddie Hebert 5dfd2286b3 BUG: Use session label instead of date for 1d.
`1d` history calls were failing on key errors when using the
`us_futures` calendar, because of timestamps occuring before a midnight
would present the wrong midnight (i.e. the midnight before the session,
instead of the following midnight, which is the label for the current
session.)

Tests will follow when bringing up coverage on resample and data portal
modules.
2016-08-29 13:25:14 -04:00
Ana Ruelas 74ee33fd58 MAINT: Update conda recipe for empyrical 2016-08-29 13:07:25 -04:00
John Ricklefs e22edbebae PERF: Send pre-adjusted returns to information_ratio 2016-08-29 12:13:19 -04:00
John Ricklefs c713d4798f PERF: Risk-adjust returns series once before calling empyrical
This prevents empyrical from having to subtract
the risk-free rate from the returns in each
individual method.
2016-08-29 12:13:19 -04:00
John Ricklefs 201e72aee1 PERF: Pass known calculations into empyrical methods
For example, to prevent `alpha` from internally calling
`beta` a second time, pass the previously-calculated
`beta` value in.

Requires empyrical 0.1.10 from pypi
2016-08-29 12:13:19 -04:00
Jean Bredeche e0cdc7bc3a ENH: Let event offsets be up to 12 hours. 2016-08-29 09:33:40 -04:00
Jean Bredeche 339417d27f Merge pull request #1441 from quantopian/cherry-pick-futures--stuff
ENH: Merging a few futures-related changes
2016-08-28 22:00:31 -04:00