Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add engine docs #1826

Merged
merged 7 commits into from
Jun 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 51 additions & 30 deletions docs/source/appendix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,50 +176,58 @@ Pipeline API
:members:
:member-order: groupwise

.. autoclass:: zipline.pipeline.filters.Filter
:members: __and__, __or__
:exclude-members: dtype

.. autoclass:: zipline.pipeline.factors.Factor
:members: top, bottom, rank, percentile_between, isnan, notnan, isfinite,
eq, __add__, __sub__, __mul__, __div__, __mod__, __pow__, __lt__,
:members: bottom, deciles, demean, linear_regression, pearsonr,
percentile_between, quantiles, quartiles, quintiles, rank,
spearmanr, top, winsorize, zscore, isnan, notnan, isfinite, eq,
__add__, __sub__, __mul__, __div__, __mod__, __pow__, __lt__,
__le__, __ne__, __ge__, __gt__
:exclude-members: dtype
:member-order: bysource

.. autoclass:: zipline.pipeline.factors.Latest
.. autoclass:: zipline.pipeline.term.Term
:members:
:exclude-members: compute_extra_rows, dependencies, inputs, mask, windowed

.. autoclass:: zipline.pipeline.factors.MaxDrawdown
:members:
.. autoclass:: zipline.pipeline.data.USEquityPricing
:members: open, high, low, close, volume
:undoc-members:

.. autoclass:: zipline.pipeline.factors.Returns
:members:
Built-in Factors
````````````````

.. autoclass:: zipline.pipeline.factors.RSI
.. autoclass:: zipline.pipeline.factors.AverageDollarVolume
:members:

.. autoclass:: zipline.pipeline.factors.BusinessDaysUntilNextEarnings
.. autoclass:: zipline.pipeline.factors.BollingerBands
:members:

.. autoclass:: zipline.pipeline.factors.BusinessDaysSincePreviousEarnings
.. autoclass:: zipline.pipeline.factors.BusinessDaysSincePreviousEvent
:members:

.. autoclass:: zipline.pipeline.factors.SimpleMovingAverage
.. autoclass:: zipline.pipeline.factors.BusinessDaysUntilNextEvent
:members:

.. autoclass:: zipline.pipeline.factors.VWAP
.. autoclass:: zipline.pipeline.factors.ExponentialWeightedMovingAverage
:members:

.. autoclass:: zipline.pipeline.factors.WeightedAverageValue
.. autoclass:: zipline.pipeline.factors.ExponentialWeightedMovingStdDev
:members:

.. autoclass:: zipline.pipeline.factors.ExponentialWeightedMovingAverage
.. autoclass:: zipline.pipeline.factors.Latest
:members:

.. autoclass:: zipline.pipeline.factors.ExponentialWeightedMovingStdDev
.. autoclass:: zipline.pipeline.factors.MaxDrawdown
:members:

.. autoclass:: zipline.pipeline.factors.AverageDollarVolume
.. autoclass:: zipline.pipeline.factors.Returns
:members:

.. autoclass:: zipline.pipeline.factors.BollingerBands
.. autoclass:: zipline.pipeline.factors.RollingLinearRegressionOfReturns
:members:

.. autoclass:: zipline.pipeline.factors.RollingPearsonOfReturns
Expand All @@ -228,21 +236,37 @@ Pipeline API
.. autoclass:: zipline.pipeline.factors.RollingSpearmanOfReturns
:members:

.. autoclass:: zipline.pipeline.factors.RollingLinearRegressionOfReturns
.. autoclass:: zipline.pipeline.factors.RSI
:members:

.. autoclass:: zipline.pipeline.filters.Filter
:members: __and__, __or__
:exclude-members: dtype
.. autoclass:: zipline.pipeline.factors.SimpleMovingAverage
:members:

.. autoclass:: zipline.pipeline.data.EarningsCalendar
:members: next_announcement, previous_announcement
:undoc-members:
.. autoclass:: zipline.pipeline.factors.VWAP
:members:

.. autoclass:: zipline.pipeline.data.USEquityPricing
:members: open, high, low, close, volume
:undoc-members:
.. autoclass:: zipline.pipeline.factors.WeightedAverageValue
:members:

Pipeline Engine
```````````````

.. autoclass:: zipline.pipeline.engine.PipelineEngine
:members: run_pipeline, run_chunked_pipeline
:member-order: bysource

.. autoclass:: zipline.pipeline.engine.SimplePipelineEngine
:members: __init__, run_pipeline, run_chunked_pipeline
:member-order: bysource

.. autofunction:: zipline.pipeline.engine.default_populate_initial_workspace

Data Loaders
````````````

.. autoclass:: zipline.pipeline.loaders.equity_pricing_loader.USEquityPricingLoader
:members: __init__, from_files, load_adjusted_array
:member-order: bysource

Asset Metadata
~~~~~~~~~~~~~~
Expand Down Expand Up @@ -308,9 +332,6 @@ Readers
.. autoclass:: zipline.assets.AssetFinder
:members:

.. autoclass:: zipline.assets.AssetFinderCachedEquities
:members:

.. autoclass:: zipline.data.data_portal.DataPortal
:members:

Expand Down
4 changes: 2 additions & 2 deletions docs/source/bundles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,13 @@ have.
help some bundles generate queries for the days needed.

``start_session``
````````````
`````````````````

``start_session`` is a :class:`pandas.Timestamp` object indicating the first
day that the bundle should load data for.

``end_session``
````````````
```````````````

``end_session`` is a :class:`pandas.Timestamp` object indicating the last day
that the bundle should load data for.
Expand Down
8 changes: 4 additions & 4 deletions docs/source/whatsnew/1.0.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Enhancements
- Disallow regressions of length 1. (:issue:`1466`)

Experimental
~~~~~~~~~~~
~~~~~~~~~~~~

- Add support for comingled Future and Equity history windows, and enable other
Future data access via data portal. (:issue:`1435`) (:issue:`1432`)
Expand Down Expand Up @@ -111,7 +111,7 @@ Bug Fixes

- Alpha and sharpe ratio are now annualized. (:issue:`1322`)

- Fix units during reading and writing of daily bar ``first_trading_day ``
- Fix units during reading and writing of daily bar ``first_trading_day``
attribute. (:issue:`1245`)

- Optional dispatch modules, when missing, no longer cause a `NameError`.
Expand All @@ -131,7 +131,7 @@ Bug Fixes

- Fix ``AverageDollarVolume`` NaN handling. (:issue:`1309`)

Performance
Performance
~~~~~~~~~~~

- Performance improvements to blaze core loader. (:issue:`1227`)
Expand All @@ -157,7 +157,7 @@ Testing
fixtures. (:issue:`1243`)

Data Format Changes
~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~

- ``BcolzDailyBarReader`` and ``BcolzDailyBarWriter`` use trading calendar instance,
instead of trading days serialized to ``JSON``. (:issue:`1330`)
Expand Down
4 changes: 2 additions & 2 deletions tests/pipeline/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def rowwise_rank(array, mask=None):
Take a 2D array and return the 0-indexed sorted position of each element in
the array for each row.

Example
-------
Examples
--------
In [5]: data
Out[5]:
array([[-0.141, -1.103, -1.0171, 0.7812, 0.07 ],
Expand Down
4 changes: 2 additions & 2 deletions tests/pipeline/test_term.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ def to_dict(l):
"""
Convert a list to a dict with keys drawn from '0', '1', '2', ...

Example
-------
Examples
--------
>>> to_dict([2, 3, 4]) # doctest: +SKIP
{'0': 2, '1': 3, '2': 4}
"""
Expand Down
4 changes: 3 additions & 1 deletion zipline/data/data_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,9 @@ def get_current_future_chain(self, continuous_future, dt):
Retrieves the future chain for the contract at the given `dt` according
the `continuous_future` specification.

Returns:
Returns
-------

future_chain : list[Future]
A list of active futures, where the first index is the current
contract specified by the continuous future definition, the second
Expand Down
60 changes: 30 additions & 30 deletions zipline/data/minute_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ def _sid_subdir_path(sid):
The number in each directory is designed to support at least 100000
equities.

Parameters:
-----------
Parameters
----------
sid : int
Asset identifier.

Returns:
--------
Returns
-------
out : string
A path for the bcolz rootdir, including subdirectory prefixes based on
the padded string representation of the given sid.
Expand Down Expand Up @@ -517,13 +517,13 @@ def ohlc_ratio_for_sid(self, sid):

def sidpath(self, sid):
"""
Parameters:
-----------
Parameters
----------
sid : int
Asset identifier.

Returns:
--------
Returns
-------
out : string
Full path to the bcolz rootdir for the given sid.
"""
Expand All @@ -532,13 +532,13 @@ def sidpath(self, sid):

def last_date_in_output_for_sid(self, sid):
"""
Parameters:
-----------
Parameters
----------
sid : int
Asset identifier.

Returns:
--------
Returns
-------
out : pd.Timestamp
The midnight of the last date written in to the output for the
given sid.
Expand All @@ -561,8 +561,8 @@ def _init_ctable(self, path):
"""
Create empty ctable for given path.

Parameters:
-----------
Parameters
----------
path : string
The path to rootdir of the new ctable.
"""
Expand Down Expand Up @@ -624,8 +624,8 @@ def pad(self, sid, date):
including the specified date) will be padded with `minute_per_day`
worth of zeros

Parameters:
-----------
Parameters
----------
sid : int
The asset identifier for the data being written.
date : datetime-like
Expand Down Expand Up @@ -703,8 +703,8 @@ def write_sid(self, sid, df, invalid_data_behavior='warn'):
If the length of the bcolz ctable is not exactly to the date before
the first day provided, fill the ctable with 0s up to that date.

Parameters:
-----------
Parameters
----------
sid : int
The asset identifer for the data being written.
df : pd.DataFrame
Expand Down Expand Up @@ -736,8 +736,8 @@ def write_cols(self, sid, dts, cols, invalid_data_behavior='warn'):
If the length of the bcolz ctable is not exactly to the date before
the first day provided, fill the ctable with 0s up to that date.

Parameters:
-----------
Parameters
----------
sid : int
The asset identifier for the data being written.
dts : datetime64 array
Expand All @@ -763,8 +763,8 @@ def _write_cols(self, sid, dts, cols, invalid_data_behavior):
"""
Internal method for `write_cols` and `write`.

Parameters:
-----------
Parameters
----------
sid : int
The asset identifier for the data being written.
dts : datetime64 array
Expand Down Expand Up @@ -887,8 +887,8 @@ class BcolzMinuteBarReader(MinuteBarReader):
"""
Reader for data written by BcolzMinuteBarWriter

Parameters:
-----------
Parameters
----------
rootdir : string
The root directory containing the metadata and asset bcolz
directories.
Expand Down Expand Up @@ -980,8 +980,8 @@ def _minutes_to_exclude(self):
based on the regular period of minutes per day and the market close
do not match.

Returns:
--------
Returns
-------
List of DatetimeIndex representing the minutes to exclude because
of early closes.
"""
Expand Down Expand Up @@ -1080,8 +1080,8 @@ def get_value(self, sid, dt, field):
"""
Retrieve the pricing info for the given sid, dt, and field.

Parameters:
-----------
Parameters
----------
sid : int
Asset identifier.
dt : datetime-like
Expand All @@ -1090,8 +1090,8 @@ def get_value(self, sid, dt, field):
The type of pricing data to retrieve.
('open', 'high', 'low', 'close', 'volume')

Returns:
--------
Returns
-------
out : float|int

The market data for the given sid, dt, and field coordinates.
Expand Down
4 changes: 2 additions & 2 deletions zipline/lib/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def naive_grouped_rowwise_apply(data,
Array into which to write output. If not supplied, a new array of the
same shape as ``data`` is allocated and returned.

Example
-------
Examples
--------
>>> data = np.array([[1., 2., 3.],
... [2., 3., 4.],
... [5., 6., 7.]])
Expand Down
4 changes: 2 additions & 2 deletions zipline/pipeline/api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def restrict_to_dtype(dtype, message_template):
`message_template.format` will be called with keyword arguments
`method_name`, `expected_dtype`, and `received_dtype`.

Usage
-----
Examples
--------
@restrict_to_dtype(
dtype=float64_dtype,
message_template=(
Expand Down
Loading