Commit graph

1875 commits

Author SHA1 Message Date
Richard Frank
94841eb948 BUG: Check for no_benchmark was flipped 2020-08-24 10:05:16 -04:00
gerrymanoim
c7df2e69f4
BLD: Try github actions again (#2743)
* BLD: Try github actions again

* new requirements for p36

* fix code different across numpy versions

* silence the correct warnings for tests to run

* MAINT: Use loc instead of deprecated ix

* comment out windows for now

Co-authored-by: Richard Frank <rich@quantopian.com>
2020-08-17 12:05:36 -04:00
Richard Frank
54698f9c7a DOC: Updated http links to https 2020-08-17 10:17:46 -04:00
Freddie Vargus
95b3c03e27 MAINT: Rebuild example data with pandas 0.22.0
for alpha calculation change
2020-07-23 12:04:18 -04:00
Freddie Vargus
b53fdb2da7 MAINT: Update example data 2020-07-23 12:01:42 -04:00
Richard Frank
bc9e754181 TST: Test that sharpe calculation succeeds with 0.0 benchmark 2020-07-16 10:36:04 -04:00
Richard Frank
b661d075e4 ENH: Support Pipeline arithmetic that combines more than 32 terms 2020-06-23 19:50:47 -04:00
Joe Jevnik
0b7a2945ec ENH: add Factor.clip method 2020-05-14 14:32:41 -04:00
Scott Sanderson
a4e63feeef ENH: Adds several methods to Factor for daily summary statistics.
The following methods are supported:

- mean
- median
- stddev
- max
- min
- sum
- notnull_count

Each of these methods produces a term with ndim=1, meaning that it produces a
single scalar value per day.
2020-04-29 12:08:55 -04:00
Scott Sanderson
890b7564f5 TEST: Fix int64 expected type on windows. 2020-04-27 13:19:07 -04:00
Scott Sanderson
f678f278ae TEST: Add explicit tests for Filter.if_else. 2020-04-27 12:50:14 -04:00
Scott Sanderson
d8a17557f4 BUG: Fix failure on 32 bit windows. 2020-04-27 12:50:14 -04:00
Scott Sanderson
5dc629a11d TEST: Actual for realz fix error message test. 2020-04-27 10:21:45 -04:00
Scott Sanderson
c15d684261 TEST: Actually fix error message in test. 2020-04-24 17:44:15 -04:00
Scott Sanderson
891744f6b9 MAINT: Use unicode to make error messages match in py2/3. 2020-04-24 13:57:24 -04:00
Scott Sanderson
0eb0bc3ce5 ENH: Add Filter.if_else() and ComputableTerm.fillna().
- Adds a new method, `Filter.if_else()`, that wraps `np.where`. This allows
  users to create expressions that conditionally draw from the outputs of one
  of two terms. This is implemented using the newly-standardized "universal"
  term machinery, similarly to downsample() and alias(), and Slice.

- Adds a new method, `ComputableTerm.fillna()`, implemented in terms of
  `if_else()`. `fillna` allows users to fill missing data with either a
  constant value, or values from another term. It supports both 2d and 1d
  terms.

- As part of the implementation of `fillna()`, adds a new universal mixin for
  creating constant terms.
2020-04-24 10:44:01 -04:00
Scott Sanderson
f21c2f8fb4 MAINT: Use universal mixin machinery for Slice. 2020-04-23 17:55:29 -04:00
Scott Sanderson
2a44ca708d BUG: Use NumExprFactor instead of NumericalExpression in test.
NumericalExpression isn't well-formed on its own.
2020-04-23 17:46:09 -04:00
samatix
1da88f8196 Merge branch 'benchmark' into benchmark2
* benchmark:
  STY: Flake8 style amendments
2020-04-20 15:20:05 +02:00
samatix
b32f55409e STY: Flake8 style amendments 2020-04-20 15:16:28 +02:00
Ayoub ENNASSIRI
7651c05dc7
Merge branch 'master' into benchmark 2020-04-20 14:30:36 +02:00
Scott Sanderson
66f144379d MAINT: Updates to fix tests. 2020-04-17 10:19:44 -04:00
Scott Sanderson
464145b8a6 ENH: Rework benchmark handling for zipline CLI.
Reworks how we choose a benchmark source for the zipline CLI and
zipline.utils.run_algo.run_algorithm. The logic for choosing a benchmark is now
consolidated in a new `BenchmarkSpec` class.

Benchmarks can be configured from several possible options:

- An in-memory series can be passed as `benchmark_returns`. This is mostly
  useful for testing, or for use with `run_algorithm`.
- A path or file-like object can be passed as `benchmark_file`.
- A sid can be passed as `benchmark_sid`
- A symbol can be passed as `benchmark_symbol`.
- `no_benchmark` can be passed to use a dummy benchmark of all zero returns.

`BenchmarkSpec` takes all the parameters listed above, and "resolves" them into
either a sid or a series of benchmark returns, which are forwarded to
TradingAlgorithm, which already takes `benchmark_returns` or
`benchmark_sid`. If none of the above parameters are passed, we log a warning,
emit None for both values, and assume that the algorithm will call
`set_benchmark` in its `initialize` method.
2020-04-16 14:49:55 -04:00
Scott Sanderson
df0c4fe932 ENH: Add mask argument to Factor.peer_count. 2020-04-07 09:40:06 -04:00
samatix
11e7d05cee STY Flake8 style changes 2020-04-05 23:41:40 +02:00
samatix
fabf897a58 TEST Adding tests for the new benchmark parameters. I used mock functions as I couldn't find in the test fixtures a way to call run_algo. 2020-04-05 23:30:49 +02:00
David Michalowicz
e4d4e912bf ENH: Inform pipeline columns of currency awareness 2020-02-26 15:23:11 -05:00
Tim Gates
25e2e039e3
Fix simple typo: unfortunatly -> unfortunately
Closes #2655
2020-02-16 19:09:13 +11:00
Scott Sanderson
94c936c0db PERF: Avoid unnecessary copy in LabelArray.
Avoid making an extra copy of non-C-contiguous arrays when factorizing inputs
to LabelArray. This requires taking care to ensure that we use the same memory
order both when ravelling and unravelling the input arrays.
2020-02-06 17:59:07 -05:00
Scott Sanderson
8195f3a5d2
Merge pull request #2644 from quantopian/ffill-past-fx-end
MAINT: Forward-fill fx rates past file end.
2020-02-04 18:54:16 -05:00
Scott Sanderson
2546708d0e MAINT: Forward-fill fx rates past file end.
If an FX rate query requests a date that's greater than the last date in the fx
rate file, forward-fill from the last value in the file rather than raising an
error.

We do this for a few reasons:

1. We'd like to gracefully handle the possibility of an FX rates file that's
   older than another input file.

2. Relative to other non-erroring behaviors, forward-filling is the simplest
   thing to implement. Specifically, it's what the implementation prior to this
   change would do naturally if there weren't an explicit check to prevent it.

3. For an FX rates file containing prices on a 24/5 calendar, some amount of
   forward-filling is required to handle any market with a non-weekday date.
2020-02-04 18:23:53 -05:00
David Michalowicz
7c654eff7b
Merge pull request #2643 from quantopian/q-py36
Python 3.6 Support
2020-02-04 16:27:28 -05:00
Scott Sanderson
b43b558475
Merge pull request #2622 from samatix/assertregex
DEP: Replacing the assertRaisesRegexp which is deprecated by assertRaisesRegex
2020-02-04 14:45:19 -05:00
samatix
9340f38e78 DEP: Add a condition to use self.assertRaisesRegexp for python 2.7 2020-02-04 20:12:46 +01:00
Miguel Sánchez de León Peque
7fc7bc5933 TST: Fix tests for Python 3.6 compatibility
While testing examples, positions are not in the expected order.
2020-02-04 10:55:16 -05:00
peterhbromley
1abcb34a65
Merge pull request #2638 from quantopian/fix-examples-imports
MAINT: Stop always importing all zipline examples
2020-02-04 10:30:15 -05:00
Scott Sanderson
008d71970e
Merge pull request #2640 from quantopian/fx-changes-for-estimates
MAINT: Clarify edge case handling for FX Rate Readers.
2020-01-31 14:02:21 -05:00
Scott Sanderson
3841944fae BUG: Use value from loop. 2020-01-30 11:05:10 -05:00
Scott Sanderson
7f4baa6bd5 TEST: Add test coverage for loading fx rates of None.
We should always return NaN on a request to load None as an FX rate.
2020-01-30 11:03:33 -05:00
Scott Sanderson
a7e089809e MAINT: Clarify handling of edge cases in fx readers.
- When reading before the start of data, return NaN. We do this because it's
  hard to reliably apply a lower bound to the queried dates in core-loader
  style pipeline loaders.

- When reading an unknown base currency, return NaN. We might get data from
  third parties with unknown currencies. Doing so should not be an error.

- When reading after the end of data, emit an error rather than forward-filling
  forever. We may want to revisit this in the future.
2020-01-30 10:10:40 -05:00
Scott Sanderson
0a01e241d2
Merge pull request #2626 from quantopian/remove-external-data-deps
MAINT: Remove treasury curves.
2020-01-28 13:58:19 -05:00
peterhbromley
eee999c154 MAINT: Stop always importing all examples 2020-01-28 13:20:03 -05:00
Scott Sanderson
d943e4bcd2 MAINT: Remove treasury curves. 2020-01-21 12:39:02 -05:00
Scott Sanderson
0c36b2f774 BUG: Fix moved import. 2020-01-21 11:32:16 -05:00
Scott Sanderson
7eeaafbc69
Merge pull request #2071 from quantopian/speedup-pearson
PERF: Speedup RollingPearson
2020-01-21 10:57:37 -05:00
samatix
86ddd6072f DEP: Replacing the assertRaisesRegexp which is deprecated by assertRaisesRegex
This deprecation will enable the upgrade to add support for python 3.7 and higher
2020-01-19 10:46:31 +01:00
Scott Sanderson
c6bb9768b6 ENH: Add get_rates_columnar method to FXRatesReader. 2020-01-15 11:09:03 -05:00
Scott Sanderson
b842b87e8e TEST: Add test coverage for get_rate_scalar. 2020-01-14 16:05:44 -05:00
Scott Sanderson
b7d4d787ee BUG: Fix crash in pipeline with all currency-converted data.
Fixes a bug where we would crash when trying to run a pipeline that contained
only currency-converted data.
2020-01-13 17:43:58 -05:00
Scott Sanderson
13777f9fdf MAINT: Use object arrays with None for currency codes.
Rather than trying to use S3s everywhere, which is annoying in Python 3 and
makes it harder to represent missing data, just use object arrays with None as
the missing value. This is the representation we want anyway for loading
currency data in pipelines, and the main downsides are performance (which
doesn't appear to be meaningfully affected) and difficulty with sorting, which
we don't need to do (at least right now).
2020-01-11 12:23:13 -05:00