Commit graph

3 commits

Author SHA1 Message Date
samatix
b32f55409e STY: Flake8 style amendments 2020-04-20 15:16:28 +02: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
Jacob Nazarenko
ce69ad0e28
ENH: custom class registration support (#2210)
Adds support for registration of custom classes and specification of custom command line arguments. See the description of #2210 for more information.
2018-07-12 17:58:59 -04:00