35 Commits

Author SHA1 Message Date
Conner Fromknecht 99efa7a9f3 Fixed catalyst tests except example tests 2017-06-19 14:43:10 -07:00
Scott Sanderson be4e1b975d TEST: Add test for window_safe propagation. 2017-06-08 10:59:56 -04:00
Ana Ruelas b4e97bc9d8 TST: Add tests for winsorize factor 2017-03-07 17:14:27 -05:00
Ana Ruelas 309ec73faa ENH: Add winsorize factor 2017-03-06 14:08:28 -05:00
Joe Jevnik af3e1016a0 TST: add tests for postprocess and to_workspace_value 2016-10-28 15:04:18 -04:00
Joe Jevnik c8e40a3736 ENH: Make aliases filters, factors, and classifiers to give them their methods 2016-10-28 15:04:18 -04:00
Scott Sanderson 13c8139d45 WIP: Add Alias expression. 2016-10-28 15:04:18 -04:00
Scott Sanderson 49cd8e138b BUG: F.window_safe implies f.demean().window_safe. 2016-09-22 12:41:50 -04:00
Scott Sanderson 221ec2073f STY: Flake8 cleanup. 2016-08-17 16:52:09 -04:00
Scott Sanderson a8b67d352e MAINT: Refactor in prep for downsampled terms.
- Split out extra_rows handling into an `ExecutionPlan` subclass.
  `ExecutionPlan` now requires the dates and calendar against which a
  set of terms will be computed, and now defers to a term's
  `compute_extra_rows` method when deciding how many extra rows are
  required to compute for that term. This will allow downsampled terms
  to request enough extra rows to guarantee that we can maintain consistent
  calculation dates.

  As a consequence of the above, `TermGraph` now only deals with logical
  dependencies, not with metadata surrounding extra row calculations.
  This means that TermGraph can be used to generate dependency
  visualizations in interactive contexts where we don't yet have a
  calendar or start/end dates.

- Refactored test_{filter,factor,classifier} to use check_terms instead
  of run_graph.  This makes it easier to make changes to TermGraph,
  since the testing interface is now to simply provide a dict of terms.

- Refactored BasePipelineTestCase to use fixtures to create an asset
  finder.  This fixes a potential leak of the test's asset db, which was
  not being explicitly cleaned up.

- Refactored test_technical to use BasePipelineTestCase.

- Added a new special term, `InputDates()`, which can be used to request
  date labels for inputs.  Like `AssetExists`, `InputDates` is provided
  in the initial workspace by default.

- Added a default (failing) `_compute` method to `AssetExists` which
  provides a more useful error than AttributeError.
2016-08-17 16:52:09 -04:00
Scott Sanderson 49bb8264dc ENH: Finish adding groupby to rank/top/bottom.
- Added test coverage for grouped and masked top/bottom.

- Added test coverage for grouped rank on datetime factors.

- Fixed an issue where grouped rank would fail on datetime inputs
  because unary-negative isn't defined for datetimes.  We now instead
  directly invoke a function from rank.pyx that does the normalizations
  as neeeded.

- Fixed an issue where GroupedRowTransform assumed that it produced the
  same dtype as its input.  This isn't true for rank() of a
  datetime-dtype factor.  GroupedRowTransform now takes a required dtype
  parameter.

- Similarly, fixed an issue where GroupedRowTransform assumed that its
  missing_value was the same as its parent's, which isn't true for
  rank() of a datetime-dtype factor.  GroupedRowTransform now takes a
  required dtype parameter.

- Fixed an issue where Factor.demean() and Factor.zscore() weren't
  properly cached because their static_identity included a closure that
  was dynamically generated on each invocation.  They both now always
  use a function defined at module scope.
2016-07-26 02:57:35 -04:00
Andrey Portnoy 9e3404646e add groupby to rank, top, and bottom 2016-07-25 23:53:33 -04:00
jfkirk 75e0e4723d TST: Refactors more tests to use WithTradingSchedule 2016-06-08 13:34:20 -04:00
Scott Sanderson 8b1136d9d5 ENH: Validate missing_values at term construction.
Finds bugs in several bad tests that were constructing invalid terms.
2016-05-10 19:43:56 -04:00
Scott Sanderson f7e9281b14 BUG: Fix groupby with string columns.
The previous algorithm assumed that the group labels were integers. It
produced nonsense with LabelArrays (though sadly didn't crash because
numpy promotes None and void to object).
2016-05-10 16:57:59 -04:00
Scott Sanderson 0ebb72fe0d TEST: Explicitly use int64 everywhere.
Otherwise these tests will fail on 32-bit systems.
2016-03-28 12:21:58 -04:00
Scott Sanderson 076868f5a1 MAINT: Refactor shared code into test method. 2016-03-28 11:56:15 -04:00
Scott Sanderson fe22bde998 TEST: Test uneven buckets in quantiles. 2016-03-28 11:34:58 -04:00
Scott Sanderson c6e58af51b TEST: Test quantiles with better input.
Take the log of arange so that we know we don't depend on linearity of
the input.
2016-03-28 09:24:56 -04:00
Scott Sanderson 18bd7010b5 ENH: Improve short_reprs of classifier/normalizer.
GroupedRowTransform now shows the name of its transform, and Quantiles
shows the number of quantiles.

These are used by Pipeline.show_graph().
2016-03-25 15:11:18 -04:00
Scott Sanderson 5ed1a4fcd1 ENH: Add quartiles/quintiles/deciles.
They're all syntactic sugar for the equivalent invocations of quantiles.
2016-03-25 15:11:18 -04:00
Scott Sanderson 872b84e09a ENH: Implement Factor.quantiles. 2016-03-25 15:11:18 -04:00
Scott Sanderson b85eb36da8 TEST: Add test for demean example. 2016-03-25 15:11:18 -04:00
Scott Sanderson bae78ae522 MAINT: Use clearer parameter name. 2016-03-19 17:04:28 -04:00
Scott Sanderson 53d3b0855b ENH: Add support for Classifiers.
Classifiers are computations that represent grouping keys. They can be
used in conjuction with normalization functions like ``zscore`` or
``demean`` to perform normalizations over subsets of a dataset.

Notable changes:

- Added ``demean()`` and ``zscore()`` methods to ``Factor``.

- Added a classifier versions of ``Latest`` and ``CustomTermMixin``.
  The .latest attribute of int64 dataset columns no produces a
  classifier by default.

- Added ``Everything``, a classifier that maps all data to the same
  value.

- Added ``zipline.lib.normalize``, which implements a naive, pure-Python
  grouped normalize function.  This will likely be moved to Cython in a
  subsequent PR.
2016-03-19 17:04:28 -04:00
Joe Jevnik 721dd36116 TST: move test_utils and adds test fixture classes
Renames zipline.utils.test_utils to zipline.testing

Adds zipline.testing.fixtures.ZiplineTestCase to manage setup and
teardown and adds mixins to define fixtures like an asset finder or
trading calendar.
2016-03-10 15:39:52 -05:00
Scott Sanderson f635a14289 ENH: Add isnull and notnull methods to Factor. 2016-03-07 16:19:08 -05:00
Joe Jevnik 8be903b074 STY: remove unused import 2016-02-11 18:46:42 -05:00
Scott Sanderson 5f49fa22cb MAINT: Upgrade numpy and fix warnings.
Mostly fixes ambiguous calls to numpy.full, and uses explicitly-united
NaT values.
2016-02-11 18:46:39 -05:00
Scott Sanderson 2235a53581 ENH: Add EWMA and DollarVolume factors. 2015-12-11 22:13:27 -05:00
Scott Sanderson 8220d1ee86 ENH: Adds support for different typed adjusted arrays and adds an
EarningsCalendar loader.

- Moves most of AdjustedArray back into Python. The window iterator is
  the only part that's performance-intensive.

- Adds a bootleg templating system for creating specialized versions of
  AdjustedArrayWindow for each concrete type we care about.

- Adds support for differently dtyped terms in pipeline. This allows us
  to use datetime64s which are needed in the EarningsCalendar.

- Adds EarningsCalendar dataset for the next and previous earnings
  announcements in pipeline.

- Adds in memory loader for EarningsCalendar.

- Adds blaze loader for EarningsCalendar.
2015-12-08 20:24:06 -05:00
Tim Shawver 631a1879a3 Adding a built in Returns factor to the pipeline API. 2015-12-01 13:24:41 -05:00
Scott Sanderson 1336dfc181 BUG: RSI wasn't even close to working.
Fixed and added tests.
2015-10-09 20:10:30 -04:00
Scott Sanderson 2d683961bd MAINT: More renaming.
s/FFCEngine/PipelineEngine/
s/FFCLoader/PipelineLoader/
2015-10-01 18:03:54 -04:00
Scott Sanderson f82a01841b MAINT: Rename ALL the things.
zipline.modelling.* -> zipline.pipeline.*
zipline.data.ffc.loaders -> zipline.pipeline.loaders
tests/modelling -> tests/pipeline
2015-10-01 18:03:53 -04:00