Commit Graph

1257 Commits

Author SHA1 Message Date
Scott Sanderson 30a1eb66ea MAINT: Use explicit floats in np.full. 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 7e2230a763 STY: Fix flake8 failures. 2016-09-20 17:12:07 -04:00
Scott Sanderson 72806620ea DOC: Note where cleanup happens. 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 0ff13e7fdc Revert "MAINT: Remove support for custom string Column missing values."
This reverts commit 1b1e842e2339d6d0ee40cdfe34dcd27b4e4a7c0c.
2016-09-20 17:12:07 -04:00
Scott Sanderson 16f4944232 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 ca54721058 MAINT: Pandas compat for rolling_*. 2016-09-20 17:12:07 -04:00
Scott Sanderson a39a6e1bbf MAINT: Pass float to np.full explicitly. 2016-09-20 17:12:07 -04:00
Scott Sanderson 0c550dc592 MAINT: Fix warnings from numpy labelarray methods. 2016-09-20 17:12:07 -04:00
Scott Sanderson 758ed0fffa MAINT: Pass float explicitly. 2016-09-20 17:12:07 -04:00
Scott Sanderson b5fd0cdbfa MAINT: Use sort_values() instead of sort().
pd.DataFrame.sort() is deprecated.
2016-09-20 17:12:07 -04:00
Scott Sanderson d265abbbf1 MAINT: Use dataframe.iteritems instead of iterkv.
iterkv is deprecated.
2016-09-20 17:12:07 -04:00
Scott Sanderson 7fbde3227c MAINT/TEST: Clarify test_events.
- Refer to ``sessions`` instead of periods.
- Use ``toolz.concat`` instead of an O(N ** 2) sequence of appends.
2016-09-20 17:12:07 -04:00
Scott Sanderson 989d21514c MAINT: Pass float to np.full explicitly. 2016-09-20 17:12:07 -04:00
Scott Sanderson 40ef039e46 TEST/MAINT: Silence no_checkpoints warning. 2016-09-20 17:12:07 -04:00
Scott Sanderson 2772975e2d MAINT: Use float in np.full. 2016-09-20 17:12:07 -04:00
Scott Sanderson b188381747 MAINT: Pass explicit dtype to np.full. 2016-09-20 17:12:07 -04:00
Scott Sanderson f494003c18 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 36e4f70499 MAINT: Fix numpy deprecation warnings. 2016-09-20 16:24:55 -04:00
Scott Sanderson 77146ef489 MAINT: Explicitly use float64 in test. 2016-09-20 16:24:54 -04:00
Scott Sanderson 135080db84 MAINT: Don't use .loc with integers. 2016-09-20 16:24:54 -04:00
Andrew Daniels 95e07f2735 ENH: Adds truncate method to BcolzMinuteBarWriter (#1499) 2016-09-19 13:02:48 -04:00
Jean Bredeche ae0d41af6f 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
Jean Bredeche a5693d0589 MAINT: Add BarReader base class for both minute and session readers 2016-09-14 13:47:12 -04:00
Richard Frank df07f67614 Merge pull request #1467 from quantopian/check_param-string_types
Check param string types
2016-09-08 14:59:38 -04:00
Kathryn Glowinski 4a00e69212 More Fuzzy Symbol Fixes (#1475)
* REF: More options before raise MultiFound.

* TST: Checks corner case for fuzzy matching.
2016-09-08 14:52:57 -04:00
Scott Sanderson 1ccc9e4b64 Merge pull request #1471 from quantopian/fix-slow-startup
PERF: Remove import-time calendar creations.
2016-09-08 10:21:00 -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
Joe Jevnik cf2abf10e2 Merge pull request #1449 from quantopian/getitem-is-not-getattr
MAINT: remove __getitem__ as alias of __getattr__
2016-09-06 13:48:17 -04:00
kglowinski d7b3c54860 BUG: Handle case with mult symbol options for same sid. 2016-09-06 10:12:01 -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
John Ricklefs c09f7ab04c Revert "BUG: Capital change deltas rely on cash, not portfolio_value" (#1470)
This reverts commit 5b1aa5ec55.

The paradigm is: we're calculating a new capital base for the
performance period. We are therefore using the total
portfolio_value, not just the cash, to calculate the
difference from the specified target as the algorithm
has meaningful holdings.
2016-09-05 14:12:04 -04:00
Richard Frank a4e495dd24 BUG: Fix up check_parameters usage of string_types
and corresponding tests
2016-09-02 16:47:32 -04:00
Scott Sanderson 9a301dc59b 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 e8e054fbd0 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
Scott Sanderson c84b5ada36 STY: Don't assign variables that won't be created. 2016-09-02 12:53:01 -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
Ana Ruelas 9063cb3ce4 BUG: Do not adjust returns for sharpe and sortino 2016-09-02 10:41:50 -04:00
Eddie Hebert 22dead208a 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
Eddie Hebert 5e3b949fc6 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 311284475a 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 5b1aa5ec55 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 d463a9855b 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 fbd3774278 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 6c805b013a 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
Eddie Hebert 151c3e45a7 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 38ff7e5aa7 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
Joe Jevnik 1714b2d03a MAINT: remove __getitem__ as alias of __getattr__ 2016-08-31 12:38:20 -04:00