Commit Graph
100 Commits
Author SHA1 Message Date
Scott SandersonandGitHub 970428f133 Merge pull request #1834 from quantopian/multiple-output-factor-window-safe
ENH: Match window_safe status of multi output factor with factor
2017-06-08 08:36:26 -07:00
Scott Sanderson be4e1b975d TEST: Add test for window_safe propagation. 2017-06-08 10:59:56 -04:00
Scott SandersonandGitHub 1e4a094fec Merge pull request #1833 from quantopian/labelarray-map
Add support for relabeling classifiers.
2017-06-07 17:57:18 -07:00
Scott Sanderson dd857aa4d7 MAINT: Make _sortable_sentinel a singleton. 2017-06-07 20:17:58 -04:00
Scott Sanderson 4cfbb12ab5 DOC: Fix typo in docstring. 2017-06-07 18:22:30 -04:00
Scott Sanderson 61feedbd16 TST: Add test for missing values in relabel. 2017-06-07 18:21:13 -04:00
Scott Sanderson 3b8a6b543e BUG: Fix NoneType comparisons in PY3. 2017-06-07 18:21:03 -04:00
Scott Sanderson 09cc54e08a ENH: Improve error message on bad return. 2017-06-07 17:07:19 -04:00
Scott Sanderson 709735de51 TEST: Test map returning None. 2017-06-07 15:28:15 -04:00
Scott Sanderson 3ed396b08c MAINT: s/NotImplementedError/TypeError. 2017-06-07 15:23:27 -04:00
Scott Sanderson 6bb31b2544 TEST: Test map ignores missing with None. 2017-06-07 14:16:17 -04:00
Scott Sanderson 5b9d5fecfb ENH: Add relabel method to string classifiers.
- Adds a `map` method to `LabelArray` that maps a unary function over
  the categories of a LabelArray, shrinking the underyling codes if
  possible.

- Adds a new `.relabel` method to string-dtype classifiers that maps a
  unary function over the unique elements of the underlying LabelArray.
  This is useful for things like cleaning noisy label data.
2017-06-07 13:14:12 -04:00
Scott Sanderson 15a0b05681 MAINT: Add validator to validate_column.
Who validates the validators?
2017-06-07 11:50:37 -04:00
Scott Sanderson ae97d97920 MAINT: Simplify ArrayPredicate.
Just use `params` instead of custom `_init` and `_static_identity`.
2017-06-07 11:49:37 -04:00
Scott SandersonandGitHub beba243e2e Merge pull request #1802 from Peque/calendar_bug
Fix bug in TradingCalendar initialization
2017-05-22 16:47:51 -07:00
Scott SandersonandGitHub 5115b14557 Merge pull request #1794 from Peque/peque
Fix docstring in TradingEnvironment class
2017-05-19 05:52:56 -07:00
Scott SandersonandGitHub ca26208569 Merge pull request #1791 from quantopian/cleanup-latest-flake8
MAINT/STY: Upgrade flake8 and fix new failures.
2017-05-15 11:39:51 -07:00
Scott Sanderson 22df0a9cb9 MAINT/STY: Upgrade flake8 and fix new failures. 2017-05-15 11:45:04 -04:00
Scott SandersonandGitHub c20807a0c7 Merge pull request #1750 from quantopian/remove-batch-otp
MAINT: batch_order_target_percent -> batch_market_order.
2017-05-11 11:30:35 -07:00
Scott Sanderson f0601a9e3c MAINT: Mark .ipynb files as binary.
Makes `git grep` not print the binary content of png files.
2017-05-09 13:52:57 -04:00
Scott Sanderson d653820be3 MAINT: batch_order_target_percent -> batch_market_order.
The only downstream contex that was using batch_order_target_percent
already had all necessary prices, so calling batch_order_target_percent
was wasteful.
2017-05-09 13:52:57 -04:00
Scott SandersonandGitHub 3c4f6e69f3 Merge pull request #1764 from quantopian/fix-docstring-typo2
DOC: Close backticks in docstring.
2017-04-25 22:52:28 -04:00
Scott Sanderson 3bcd4d4ac0 DOC: Close backticks in docstring. 2017-04-25 22:32:11 -04:00
Scott SandersonandGitHub b8b504b724 Merge pull request #1740 from quantopian/guarantee-can-trade-order
BUG: Return from can_trade in same order as input.
2017-04-04 18:39:53 -04:00
Scott Sanderson fb3efc6d75 MAINT: Guarantee bool dtype for can_trade. 2017-04-04 17:26:38 -04:00
Scott Sanderson f3aba5f281 BUG: Return from can_trade in same order as input.
This matches the behavior of history and data.current.
2017-04-04 17:12:21 -04:00
Scott SandersonandGitHub 799fbe8a83 Merge pull request #1693 from quantopian/nat-for-dtype-enh
ENH: make NaT_for_dtype coerce the input to a dtype
2017-02-28 23:32:54 -05:00
Scott SandersonandGitHub 2fb90b4a25 Merge pull request #1667 from quantopian/pricing-fixture-cleanups
Pricing fixture cleanups
2017-01-31 10:32:17 -05:00
Scott Sanderson bd7f3ad100 MAINT: Raise LookupError instead of KeyError.
KeyError calls __repr__ on its input, which makes it really unpleasant
to read multi-line strings.
2017-01-30 22:13:18 -05:00
Scott Sanderson c092e4db4d DOC: Update out of date docstring. 2017-01-30 13:33:21 -05:00
Scott Sanderson b2bacec241 ENH: Align daily/minute bar lookbacks by default.
When EQUITY_DAILY_BAR_SOURCE_FROM_MINUTE is set, use
EQUITY_MINUTE_BAR_LOOKBACK_DAYS as the default value for
EQUITY_DAILY_BAR_LOOKBACK_DAYS.

Without this, trying to run a minutely backtest in a test setting only
EQUITY_MINUTE_BAR_LOOKBACK_DAYS and EQUITY_DAILY_BAR_SOURCE_FROM_MINUTE
fails because the benchmark creation process makes a daily history call
for the entire period of the backtest, which then fails because the
equity daily bar calendar is shorter than the equity minute bar
calendar.

I can't imagine a circumstance in which you'd want the daily bar
calendar to be shorter than the minute bar calendar when you're sourcing
daily bars from minutes, so this change makes that the default behavior
unless it's explicitly overridden.
2017-01-30 13:28:00 -05:00
Scott Sanderson e8b8b0afef BUG: Fix bad error handling in history loader.
Fixes a bug where we'd fail to raise an error if the start/end of a
history window call don't aren't in the loader's calendar.

We were started dropping this error after a previous change swapped out
calls to `index.get_loc` with calls to `index.searchsorted` to avoid
creating hash tables in pandas.
2017-01-30 13:23:47 -05:00
Scott Sanderson 0c5f88e2f6 ENH: Add direct methods for session start/end.
Rather than having to do 'start, _ = cal.open_and_close_for_session(dt)'
to get just the start, we can now do 'start = cal.session_start(dt)'.
2017-01-30 13:00:45 -05:00
Scott SandersonandGitHub 790f307485 Merge pull request #1645 from quantopian/nitpick-some-more-why-dont-you
STY: Simplify style in conditional.
2017-01-12 22:26:21 -05:00
Scott Sanderson bb1b3e39e7 STY: Simplify style in conditional. 2017-01-12 22:03:35 -05:00
Scott SandersonandGitHub 54d78d002d Merge pull request #1627 from quantopian/vectorized-symbol-map
ENH: Add vectorized lookup_symbol.
2016-12-28 15:10:14 -05:00
Scott Sanderson e9b378fdda DOC: Add note on lookup_symbols. 2016-12-28 14:43:15 -05:00
Scott Sanderson 64029a9e7e TEST: Tweaks to vectorized symbol tests.
- Test against an empty list.
- Don't test empty share class lookups.
- Add another comprehension test for completeness.
2016-12-28 14:40:18 -05:00
Scott Sanderson 876b9c74c9 ENH: Add vectorized lookup_symbol.
Currently only supports one as_of date.c
2016-12-28 12:31:50 -05:00
Scott SandersonandGitHub 74df429057 Merge pull request #1588 from quantopian/randc-built-in-factors
ENH: Add MACD, MA, and AnnVol as built in factors
2016-11-28 16:18:58 -05:00
Scott SandersonandGitHub 37f58264cd Merge pull request #1603 from quantopian/randc-built-in-factors-twekas
Randc built in factors twekas
2016-11-28 15:30:40 -05:00
Scott Sanderson ee230c807f DOC: Docstring updates. 2016-11-28 15:29:36 -05:00
Scott Sanderson 4210a2f80f MAINT: Tweaks/cleanups in technical.py.
- Use `expect_bounded` to check inputs.
- Add tests for expected failures from `MACDSignal`.
- Use `float64` instead of `float` in a few places.  This prevents
  diverging behavior on 32-bit systems.
- Docstring edits.
2016-11-28 13:02:40 -05:00
Scott Sanderson d140d585c2 MAINT: Put exponential_weights where it's used.
`math_utils` is mostly a shim around bottleneck imports.  If we need
this somewhere else, it probably belongs in `numpy_utils`.
2016-11-28 13:02:40 -05:00
Scott Sanderson c05635333e STY: Put whitespace between operators. 2016-11-28 12:57:03 -05:00
Scott Sanderson 52958a0340 TEST: Use parameter_space for randomized tests.
- Use a RandomState with a seed so that we have repeatible results.
- Use `randint` instead of `random_integers.` `random_integers` is
  deprecated.
- Use `parameter_space` to test multiple period lengths.
2016-11-28 12:57:03 -05:00
Scott SandersonandGitHub 84e7c03147 Merge pull request #1599 from quantopian/memory-savings
Memory savings
2016-11-28 10:52:23 -05:00
Scott Sanderson 9f28b7cede MAINT: Hit more dataframe indexers. 2016-11-22 17:11:04 -05:00
Scott Sanderson 16e78bbccd BUG: sys.exc_clear is py2 only. 2016-11-22 16:34:53 -05:00
Scott Sanderson 7a5f5da6b2 MAINT: Use lazyval instead of two decorators. 2016-11-22 14:26:58 -05:00
Scott Sanderson 8aacac1cb6 PERF: Use searchsorted instead of get_loc.
On pandas < 18, `get_loc` triggers allocation of a large hash table, so
we don't want to call get_loc on minutely `DatetimeIndex`es.
2016-11-22 14:26:58 -05:00
Scott Sanderson 52ed9093eb PERF: Deterministically GC pipeline results.
Any DataFrame that's had `.loc` or `.iloc `called on it participates in
a cycle, which means they're not immediately garbage collected when they
go out of scope.  This matters for pipeline results because they consume
multiple megabytes per column, which means that a pipeline result with
many columns can hold take up over 100MB.  By manually breaking
DataFrame cycles, we can ensure that we never hold multiple pipeline
results in memory at once.
2016-11-22 14:26:58 -05:00
Scott SandersonandAna Ruelas 7f762d02bf MAINT: Use fancy default for window_length. 2016-11-21 14:24:28 -05:00
Scott SandersonandGitHub c89c618ccf Merge pull request #1574 from quantopian/make-corrcoefs-window-safe
ENH: Mark statistical terms as window_safe.
2016-11-01 12:49:27 -04:00
Scott Sanderson df78f57a51 ENH: Mark statistical terms as window_safe. 2016-11-01 12:16:34 -04:00
Scott SandersonandGitHub 88ff033288 Merge pull request #1573 from quantopian/rename-specific-assets
MAINT: Rename `SpecificAssets` to `StaticAssets`.
2016-11-01 12:15:10 -04:00
Scott Sanderson 1b9b3c1a29 MAINT: Rename SpecificAssets to StaticAssets.
This better reflects the intended usage of accepting a fixed set of
predetermined assets.
2016-11-01 11:01:36 -04:00
Scott SandersonandJohn Ricklefs 2536ad29c3 STY: Put 0 at the end. (#1569) 2016-10-28 15:14:22 -04:00
Scott SandersonandJoe Jevnik bb2d25e67c ENH: Allow windows of NumericalExpression.
If all the inputs to an expr are window-safe, then the expr is itself
window-safe.
2016-10-28 15:04:18 -04:00
Scott SandersonandJoe Jevnik 582c44a4aa TEST: Add more populate_initial_workspace tests.
- Tests different pipeline lengths and window lengths.
- Tests a term that depends on a window of a term that's been
  precomputed.
2016-10-28 15:04:18 -04:00
Scott SandersonandJoe Jevnik 13c8139d45 WIP: Add Alias expression. 2016-10-28 15:04:18 -04:00
Scott SandersonandGitHub 5ecb5c3754 Merge pull request #1568 from quantopian/fix-microoptimizations
Fix microoptimizations
2016-10-28 14:57:43 -04:00
Scott Sanderson 21a3f1a7ed MAINT: Consolidate data_portal names.
Rename _get_daily_window_for_sids to _get_daily_window_data.
Rename _get_minute_window_for_assets to _get_minute_window_data.
Rename _get_daily_data to get_daily_spot_value.
2016-10-28 14:35:05 -04:00
Scott Sanderson 8ccef7b9ab DOC: Comment on outdated code. 2016-10-28 14:06:35 -04:00
Scott Sanderson 1fbc17d281 BUG: Raise SidsNotFound in retrieve_asset. 2016-10-28 14:05:49 -04:00
Scott SandersonandGitHub 285b5f7d77 Merge pull request #1561 from quantopian/micro-optimizations-2
Micro optimizations 2
2016-10-28 10:36:33 -04:00
Scott Sanderson 70cc6022f9 PERF: Call concatenate directly instead of hstack.
Avoids a couple function calls in a hot path.
2016-10-26 23:49:48 -04:00
Scott Sanderson 9e3eebc892 PERF: Don't round until after we hstack. 2016-10-26 23:30:12 -04:00
Scott Sanderson 25c78de356 MAINT/PERF: Remove redundant method call.
`_get_minute_window_data` was just forwarding its input to a method with
the same signature.
2016-10-26 23:28:34 -04:00
Scott Sanderson 5547cca779 PERF: Pull out loop-invariant code.
This shaves off 20 out of 160 seconds for an algorithm that makes a
large number of large universe, short window_length `history()` calls.
2016-10-26 23:27:33 -04:00
Scott Sanderson 9d10e28d09 PERF: Use vectorized assignment into dataframe.
This is a dramatic speedup (~25% in local benchmarks) for history calls
with a large number of assets and a short window length.
2016-10-26 21:10:40 -04:00
Scott Sanderson 502fbf5357 PERF: Refactor AdjustedArrayWindow.
Make `__next__` and `seek` share code instead of seek() calling
`__next__`.  This avoids having to make a large number of integer
comparisons and `asanyarray` calls when seeking more than one tick
forward.
2016-10-26 17:32:27 -04:00
Scott Sanderson 85fcf0ba9b BUG: Return NaT instead of None in daily reader. 2016-10-26 17:32:27 -04:00
Scott Sanderson 20531fb9c1 PERF: Vectorize assignments in get_history_window. 2016-10-26 17:32:27 -04:00
Scott Sanderson 73cc580e0b PERF: Remove attribute access in inner loop. 2016-10-26 17:32:27 -04:00
Scott Sanderson 35a72f63a4 MAINT: Auto-rebuild templated cython files. 2016-10-26 16:44:07 -04:00
Scott Sanderson a56fc707ed PERF: Try cache on scalar asset lookups.
This provides a 15% speedup for an algo that calls `data.current` with
1000 every minute.
2016-10-26 15:22:28 -04:00
Scott SandersonandEddie Hebert 554bc01539 MAINT: Alternate AdjustedArray boundary conditions.
Avoids the need for a special sentinel value, and means that we only
have to have one branch instead of two in the inner loop.
2016-10-17 14:23:39 -04:00
Scott SandersonandEddie Hebert 0244f03411 DOC: Fix typo in comment. 2016-10-17 14:23:39 -04:00
Scott SandersonandEddie Hebert 9738c14271 MAINT: Use perspective_offset in more tests.
- Refactor `test_adjusted_array` to test a range of perspective_offsets in
  all tests.

- Make perspective_offset a parameter to `AdjustedArray.traverse`
  instead of `AdjustedArray`.
2016-10-17 14:23:39 -04:00
Scott SandersonandGitHub 48b43c0775 Merge pull request #1537 from quantopian/allow-partials-in-assert-equal
BUG: Allow partials in assert_equal.
2016-10-12 19:28:35 -04:00
Scott Sanderson dc18fa3b45 BUG: Allow partials in assert_equal. 2016-10-12 19:06:56 -04:00
Scott SandersonandGitHub 9dc61dba1a Merge pull request #1536 from quantopian/allow-name-override-in-preprocessors
ENH: Name overrides in preprocessor factories.
2016-10-12 17:00:56 -04:00
Scott Sanderson 053206327b ENH: Name overrides in preprocessor factories.
Allows ``__funcname`` to be passed to preprocessors like expect_types
and expect_dtypes to override the name displayed in error messages.
This is useful for providing clearer errors for ``__init__`` and
``__new__`` methods in classes.
2016-10-12 15:50:10 -04:00
Scott SandersonandGitHub 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
Scott SandersonandGitHub 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
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
Scott Sanderson 8465ea18d0 TEST: Simplify testing of restriction orderings. 2016-10-05 14:42:17 -04:00
Scott SandersonandGitHub 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
Scott SandersonandAndrew Liang 7700987abc STY: Remove extra whitespace. 2016-09-30 16:35:24 -04:00
Scott SandersonandAndrew Liang 5b91175651 DOC: Fix docstring typo. 2016-09-30 16:35:24 -04:00
Scott SandersonandAndrew Liang 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 SandersonandAndrew Liang 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 SandersonandAndrew Liang d47144dfb8 DOC: Rename NoopRestrictions to NoRestrictions. 2016-09-30 16:35:23 -04:00
Scott SandersonandAndrew Liang cfce14ed9b DOC: Update docstring for set_restrictions. 2016-09-30 16:35:23 -04:00