From dfe21dc1deeea36cd682668d74464a4898f1b3dd Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Wed, 18 Nov 2015 22:44:20 -0500 Subject: [PATCH 1/8] DOC: Add whatsnew for isnan and friends. --- docs/source/whatsnew/0.8.4.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/whatsnew/0.8.4.txt b/docs/source/whatsnew/0.8.4.txt index 6c493c52..6265a6a1 100644 --- a/docs/source/whatsnew/0.8.4.txt +++ b/docs/source/whatsnew/0.8.4.txt @@ -19,6 +19,8 @@ Enhancements passed to :class:`~zipline.algorithm.TradingAlgorithm` by the keyword argument ``create_event_context`` (:issue:`828`). +* Added `isnan`, `notnan`, and `isfinite` methods to `Factor` (:issue:`861`). + Experimental Features ~~~~~~~~~~~~~~~~~~~~~ From 1524944eddb1b22033202782710ef926980600c9 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Wed, 18 Nov 2015 23:58:59 -0500 Subject: [PATCH 2/8] DOC: Many docs improvements. - Generate links to sourcecode via the Sphinx `viewcode` extension. - Generate reference docs for Asset/Equity/Future, AssetFinder, and AssetDBWriter. - Generate reference docs for Pipeline API classes. - Fix broken links and formatting issues in the 0.8.4 whatsnew. - Use embedsignature in _assets.pyx so that the signatures of Asset subclasses are inspectable. --- docs/source/appendix.rst | 62 +++++++++++++++++++++++++++++++--- docs/source/conf.py | 1 + docs/source/whatsnew/0.8.4.txt | 15 +++++--- zipline/assets/_assets.pyx | 1 + zipline/assets/assets.py | 18 +++++++++- zipline/pipeline/pipeline.py | 2 +- 6 files changed, 88 insertions(+), 11 deletions(-) diff --git a/docs/source/appendix.rst b/docs/source/appendix.rst index 73152222..473cd0fa 100644 --- a/docs/source/appendix.rst +++ b/docs/source/appendix.rst @@ -1,8 +1,62 @@ -Zipline API ------------ +API Reference +------------- -For each of these api functions, the ``self`` argument is implicitly the current -:class:`~zipline.algorithm.TradingAlgorithm` +Algorithm API +~~~~~~~~~~~~~ + +The following methods are available for use in the ``initialize``, +``handle_data`` and ``before_trading_start`` API functions. + +In all listed functions, the ``self`` argument is implicitly the +currently-executing :class:`~zipline.algorithm.TradingAlgorithm` instance. .. automodule:: zipline.api :members: + +.. autoclass:: zipline.algorithm.TradingAlgorithm + +Pipeline API +~~~~~~~~~~~~ + +.. autoclass:: zipline.pipeline.Pipeline + :members: + :member-order: groupwise + +.. autoclass:: zipline.pipeline.CustomFactor + :members: + :member-order: groupwise + +.. autoclass:: zipline.pipeline.factors.Factor + :members: top, bottom, rank, percentile_between, isnan, notnan, isfinite, + eq, __add__, __sub__, __mul__, __div__, __mod__, __pow__, __lt__, + __le__, __ne__, __ge__, __gt__ + :exclude-members: dtype + :member-order: bysource + +.. autoclass:: zipline.pipeline.filters.Filter + :members: __and__, __or__ + :exclude-members: dtype + +Asset Metadata +~~~~~~~~~~~~~~ + +.. autoclass:: zipline.assets.assets.Asset + :members: + +.. autoclass:: zipline.assets.assets.Equity + :members: + +.. autoclass:: zipline.assets.assets.Future + :members: + +.. autoclass:: zipline.assets.assets.AssetFinder + :members: + +.. autoclass:: zipline.assets.assets.AssetFinderCachedEquities + :members: + +.. autoclass:: zipline.assets.asset_writer.AssetDBWriter + :members: + +.. autoclass:: zipline.assets.assets.AssetConvertible + :members: diff --git a/docs/source/conf.py b/docs/source/conf.py index db83801b..06dae84c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,6 +15,7 @@ extensions = [ 'sphinx.ext.doctest', 'sphinx.ext.extlinks', 'sphinx.ext.autosummary', + 'sphinx.ext.viewcode', ] diff --git a/docs/source/whatsnew/0.8.4.txt b/docs/source/whatsnew/0.8.4.txt index 6265a6a1..c61cce9f 100644 --- a/docs/source/whatsnew/0.8.4.txt +++ b/docs/source/whatsnew/0.8.4.txt @@ -19,7 +19,10 @@ Enhancements passed to :class:`~zipline.algorithm.TradingAlgorithm` by the keyword argument ``create_event_context`` (:issue:`828`). -* Added `isnan`, `notnan`, and `isfinite` methods to `Factor` (:issue:`861`). +.. py:currentmodule:: zipline.pipeline.factors + +* Added :meth:`~Factor.isnan`, :meth:`~Factor.notnan` and + :meth:`~Factor.isfinite` methods to :class:`Factor` (:issue:`861`). Experimental Features ~~~~~~~~~~~~~~~~~~~~~ @@ -40,10 +43,12 @@ Bug Fixes Performance ~~~~~~~~~~~ -* Speeds up `AssetFinder.lookup_symbol` by adding an extension, -`AssetFinderCachedEquities`, that loads equities into dictionaries and -then directs `lookup_symbol` to these dictionaries to find matching equities - (:issue:`830`). +.. py:currentmodule:: zipline.assets.assets + +* Speeds up :meth:`AssetFinder.lookup_symbol` by adding an extension, + :class:`AssetFinderCachedEquities`, that loads equities into dictionaries and + then directs :meth:`AssetFinder.lookup_symbol` to these dictionaries to find + matching equities (:issue:`830`). Maintenance and Refactorings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/zipline/assets/_assets.pyx b/zipline/assets/_assets.pyx index 376f0cf5..fbac1d86 100644 --- a/zipline/assets/_assets.pyx +++ b/zipline/assets/_assets.pyx @@ -1,3 +1,4 @@ +# cython: embedsignature=True # # Copyright 2015 Quantopian, Inc. # diff --git a/zipline/assets/assets.py b/zipline/assets/assets.py index 045f18f4..43d79024 100644 --- a/zipline/assets/assets.py +++ b/zipline/assets/assets.py @@ -76,9 +76,25 @@ def _convert_asset_timestamp_fields(dict_): class AssetFinder(object): + """ + An AssetFinder is an interface to a database of Asset metadata written by + an ``AssetDBWriter``. + This class provides methods for looking up assets by unique integer id or + by symbol. For historical reasons, we refer to these unique ids as 'sids'. + + Parameters + ---------- + engine : str or SQLAlchemy.engine + An engine with a connection to the asset database to use, or a string + that can be parsed by SQLAlchemy as a URI. + + See Also + -------- + :class:`zipline.assets.asset_writer.AssetDBWriter` + """ # Token used as a substitute for pickling objects that contain a - # reference to an AssetFinder + # reference to an AssetFinder. PERSISTENT_TOKEN = "" def __init__(self, engine): diff --git a/zipline/pipeline/pipeline.py b/zipline/pipeline/pipeline.py index d64166d6..dbd627aa 100644 --- a/zipline/pipeline/pipeline.py +++ b/zipline/pipeline/pipeline.py @@ -17,7 +17,7 @@ class Pipeline(object): To compute a pipeline in the context of a TradingAlgorithm, users must call ``attach_pipeline`` in their ``initialize`` function to register that the pipeline should be computed each trading day. The outputs of a pipeline on - a given day can be accessed by calling ``pipeline_outputs`` in + a given day can be accessed by calling ``pipeline_output`` in ``handle_data`` or ``before_trading_start``. Parameters From e812a1c7a8d37b8eba1e64d6f6bc18e8d33d8cae Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Thu, 19 Nov 2015 00:13:31 -0500 Subject: [PATCH 3/8] DOC: Document updates to documentation. --- docs/source/whatsnew/0.8.4.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/whatsnew/0.8.4.txt b/docs/source/whatsnew/0.8.4.txt index c61cce9f..ae6a72bc 100644 --- a/docs/source/whatsnew/0.8.4.txt +++ b/docs/source/whatsnew/0.8.4.txt @@ -68,6 +68,8 @@ Documentation ~~~~~~~~~~~~~ * Document the release process for developers (:issue:`835`). +* Added reference docs for the Pipeline API. (:issue:`864`). +* Added reference docs for Asset Metadata APIs. (:issue:`864`). Miscellaneous ~~~~~~~~~~~~~ From b71327d69437cb1212c4304758f0cca0a9007e14 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Thu, 19 Nov 2015 00:46:41 -0500 Subject: [PATCH 4/8] STY: Oxford comma. --- docs/source/appendix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/appendix.rst b/docs/source/appendix.rst index 473cd0fa..e73d5102 100644 --- a/docs/source/appendix.rst +++ b/docs/source/appendix.rst @@ -5,7 +5,7 @@ Algorithm API ~~~~~~~~~~~~~ The following methods are available for use in the ``initialize``, -``handle_data`` and ``before_trading_start`` API functions. +``handle_data``, and ``before_trading_start`` API functions. In all listed functions, the ``self`` argument is implicitly the currently-executing :class:`~zipline.algorithm.TradingAlgorithm` instance. From 7f9856d129146742e4d254c29ed2281a7e58046d Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Thu, 19 Nov 2015 00:47:35 -0500 Subject: [PATCH 5/8] DOC: Add active development section to releases. --- docs/source/releases.rst | 2 ++ docs/source/whatsnew/0.8.4.txt | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/source/releases.rst b/docs/source/releases.rst index 124096d4..c7b22755 100644 --- a/docs/source/releases.rst +++ b/docs/source/releases.rst @@ -2,6 +2,8 @@ Release Notes ============= +.. include:: whatsnew/0.8.4.txt + .. include:: whatsnew/0.8.3.txt .. include:: whatsnew/0.8.0.txt diff --git a/docs/source/whatsnew/0.8.4.txt b/docs/source/whatsnew/0.8.4.txt index ae6a72bc..24af1d0e 100644 --- a/docs/source/whatsnew/0.8.4.txt +++ b/docs/source/whatsnew/0.8.4.txt @@ -1,9 +1,13 @@ -Release 0.8.4 -------------- +Development +----------- :Release: 0.8.4 :Date: TBD +.. warning:: + This release is still under active development. All changes listed are + subject to change at any time. + Highlights ~~~~~~~~~~ From 8503c91339abc54db37025ce627b6533198f3936 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Thu, 19 Nov 2015 00:49:00 -0500 Subject: [PATCH 6/8] DOC: Verb choice. --- docs/source/whatsnew/0.8.4.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/whatsnew/0.8.4.txt b/docs/source/whatsnew/0.8.4.txt index 24af1d0e..8869510c 100644 --- a/docs/source/whatsnew/0.8.4.txt +++ b/docs/source/whatsnew/0.8.4.txt @@ -16,7 +16,7 @@ None Enhancements ~~~~~~~~~~~~ -* Adds a way for users to specify context manager to use when executing the +* Adds a way for users to provide a context manager to use when executing the scheduled functions (including ``handle_data``). This context manager will be passed the :class:`~zipline.protocol.BarData` object for the bar and will be used for the duration of all of the functions scheduled to run. This can be From 3100a60dd40e59ffaaab0299e265583edc865454 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Thu, 19 Nov 2015 00:49:12 -0500 Subject: [PATCH 7/8] DOC: Use absolute paths. --- docs/source/whatsnew/0.8.4.txt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/source/whatsnew/0.8.4.txt b/docs/source/whatsnew/0.8.4.txt index 8869510c..f1cd26db 100644 --- a/docs/source/whatsnew/0.8.4.txt +++ b/docs/source/whatsnew/0.8.4.txt @@ -23,10 +23,10 @@ Enhancements passed to :class:`~zipline.algorithm.TradingAlgorithm` by the keyword argument ``create_event_context`` (:issue:`828`). -.. py:currentmodule:: zipline.pipeline.factors - -* Added :meth:`~Factor.isnan`, :meth:`~Factor.notnan` and - :meth:`~Factor.isfinite` methods to :class:`Factor` (:issue:`861`). +* Added :meth:`~zipline.pipeline.factors.Factor.isnan`, + :meth:`~zipline.pipeline.factors.Factor.notnan` and + :meth:`~zipline.pipeline.factors.Factor.isfinite` methods to + :class:`zipline.pipeline.factors.Factor` (:issue:`861`). Experimental Features ~~~~~~~~~~~~~~~~~~~~~ @@ -47,12 +47,11 @@ Bug Fixes Performance ~~~~~~~~~~~ -.. py:currentmodule:: zipline.assets.assets - -* Speeds up :meth:`AssetFinder.lookup_symbol` by adding an extension, - :class:`AssetFinderCachedEquities`, that loads equities into dictionaries and - then directs :meth:`AssetFinder.lookup_symbol` to these dictionaries to find - matching equities (:issue:`830`). +* Speeds up :meth:`~zipline.assets.assets.AssetFinder.lookup_symbol` by adding + an extension, :class:`~zipline.assets.assets.AssetFinderCachedEquities`, that + loads equities into dictionaries and then directs + :meth:`~zipline.assets.assets.AssetFinder.lookup_symbol` to these dictionaries + to find matching equities (:issue:`830`). Maintenance and Refactorings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 7098462cd9c53072bb0851ba6eaf83a8e1da0c1f Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Thu, 19 Nov 2015 00:54:55 -0500 Subject: [PATCH 8/8] DOC: Document more documentation improvements. --- docs/source/whatsnew/0.8.4.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/whatsnew/0.8.4.txt b/docs/source/whatsnew/0.8.4.txt index f1cd26db..e399bc7b 100644 --- a/docs/source/whatsnew/0.8.4.txt +++ b/docs/source/whatsnew/0.8.4.txt @@ -73,6 +73,8 @@ Documentation * Document the release process for developers (:issue:`835`). * Added reference docs for the Pipeline API. (:issue:`864`). * Added reference docs for Asset Metadata APIs. (:issue:`864`). +* Generated documentation now includes links to source code for many classes + and functions. (:issue:`864`). Miscellaneous ~~~~~~~~~~~~~