MAINT: removing many warnings from building docs

This commit is contained in:
Victor Grau Serrat
2018-02-09 00:13:43 -07:00
parent dbf004ed27
commit e6fa2827e2
51 changed files with 8669 additions and 5543 deletions
+371
View File
@@ -0,0 +1,371 @@
API Reference
-------------
Running a Backtest
~~~~~~~~~~~~~~~~~~
.. autofunction:: catalyst.run_algorithm(...)
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.
Data Object
```````````
.. autoclass:: catalyst.protocol.BarData
:members:
Scheduling Functions
````````````````````
.. autofunction:: catalyst.api.schedule_function
.. autoclass:: catalyst.api.date_rules
:members:
:undoc-members:
.. autoclass:: catalyst.api.time_rules
:members:
Orders
``````
.. autofunction:: catalyst.api.order
.. autofunction:: catalyst.api.order_value
.. autofunction:: catalyst.api.order_percent
.. autofunction:: catalyst.api.order_target
.. autofunction:: catalyst.api.order_target_value
.. autofunction:: catalyst.api.order_target_percent
.. autoclass:: catalyst.finance.execution.ExecutionStyle
:members:
.. autoclass:: catalyst.finance.execution.MarketOrder
.. autoclass:: catalyst.finance.execution.LimitOrder
.. autoclass:: catalyst.finance.execution.StopOrder
.. autoclass:: catalyst.finance.execution.StopLimitOrder
.. autofunction:: catalyst.api.get_order
.. autofunction:: catalyst.api.get_open_orders
.. autofunction:: catalyst.api.cancel_order
Order Cancellation Policies
'''''''''''''''''''''''''''
.. autofunction:: catalyst.api.set_cancel_policy
.. autoclass:: catalyst.finance.cancel_policy.CancelPolicy
:members:
.. autofunction:: catalyst.api.EODCancel
.. autofunction:: catalyst.api.NeverCancel
Assets
``````
.. autofunction:: catalyst.api.symbol
.. autofunction:: catalyst.api.symbols
.. autofunction:: catalyst.api.set_symbol_lookup_date
.. autofunction:: catalyst.api.sid
Trading Controls
````````````````
zipline provides trading controls to help ensure that the algorithm is
performing as expected. The functions help protect the algorithm from certian
bugs that could cause undesirable behavior when trading with real money.
.. autofunction:: catalyst.api.set_do_not_order_list
.. autofunction:: catalyst.api.set_long_only
.. autofunction:: catalyst.api.set_max_leverage
.. autofunction:: catalyst.api.set_max_order_count
.. autofunction:: catalyst.api.set_max_order_size
.. autofunction:: catalyst.api.set_max_position_size
Simulation Parameters
`````````````````````
.. autofunction:: catalyst.api.set_benchmark
Commission Models
'''''''''''''''''
.. autofunction:: catalyst.api.set_commission
.. autoclass:: catalyst.finance.commission.CommissionModel
:members:
.. autoclass:: catalyst.finance.commission.PerShare
.. autoclass:: catalyst.finance.commission.PerTrade
.. autoclass:: catalyst.finance.commission.PerDollar
Slippage Models
'''''''''''''''
.. autofunction:: catalyst.api.set_slippage
.. autoclass:: catalyst.finance.slippage.SlippageModel
:members:
.. autoclass:: catalyst.finance.slippage.FixedSlippage
.. autoclass:: catalyst.finance.slippage.VolumeShareSlippage
Pipeline
````````
Not supported yet.
.. For more information, see :ref:`pipeline-api`
.. .. autofunction:: catalyst.api.attach_pipeline
.. .. autofunction:: catalyst.api.pipeline_output
Miscellaneous
`````````````
.. autofunction:: catalyst.api.record
.. autofunction:: catalyst.api.get_environment
.. autofunction:: catalyst.api.fetch_csv
.. _pipeline-api:
.. Pipeline API
.. ~~~~~~~~~~~~
.. .. autoclass:: zipline.pipeline.Pipeline
.. :members:
.. :member-order: groupwise
.. .. autoclass:: zipline.pipeline.CustomFactor
.. :members:
.. :member-order: groupwise
.. .. autoclass:: zipline.pipeline.filters.Filter
.. :members: __and__, __or__
.. :exclude-members: dtype
.. .. autoclass:: zipline.pipeline.factors.Factor
.. :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.term.Term
.. :members:
.. :exclude-members: compute_extra_rows, dependencies, inputs, mask, windowed
.. .. autoclass:: zipline.pipeline.data.USEquityPricing
.. :members: open, high, low, close, volume
.. :undoc-members:
.. Built-in Factors
.. ````````````````
.. .. autoclass:: zipline.pipeline.factors.AverageDollarVolume
.. :members:
.. .. autoclass:: zipline.pipeline.factors.BollingerBands
.. :members:
.. .. autoclass:: zipline.pipeline.factors.BusinessDaysSincePreviousEvent
.. :members:
.. .. autoclass:: zipline.pipeline.factors.BusinessDaysUntilNextEvent
.. :members:
.. .. autoclass:: zipline.pipeline.factors.ExponentialWeightedMovingAverage
.. :members:
.. .. autoclass:: zipline.pipeline.factors.ExponentialWeightedMovingStdDev
.. :members:
.. .. autoclass:: zipline.pipeline.factors.Latest
.. :members:
.. .. autoclass:: zipline.pipeline.factors.MaxDrawdown
.. :members:
.. .. autoclass:: zipline.pipeline.factors.Returns
.. :members:
.. .. autoclass:: zipline.pipeline.factors.RollingLinearRegressionOfReturns
.. :members:
.. .. autoclass:: zipline.pipeline.factors.RollingPearsonOfReturns
.. :members:
.. .. autoclass:: zipline.pipeline.factors.RollingSpearmanOfReturns
.. :members:
.. .. autoclass:: zipline.pipeline.factors.RSI
.. :members:
.. .. autoclass:: zipline.pipeline.factors.SimpleMovingAverage
.. :members:
.. .. autoclass:: zipline.pipeline.factors.VWAP
.. :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
~~~~~~~~~~~~~~
.. autoclass:: catalyst.assets.Asset
:members:
.. autoclass:: catalyst.assets.AssetConvertible
:members:
Trading Calendar API
~~~~~~~~~~~~~~~~~~~~
.. autofunction:: catalyst.utils.calendars.get_calendar
.. autoclass:: catalyst.utils.calendars.TradingCalendar
:members:
.. autofunction:: catalyst.utils.calendars.register_calendar
.. autofunction:: catalyst.utils.calendars.register_calendar_type
.. autofunction:: catalyst.utils.calendars.deregister_calendar
.. autofunction:: catalyst.utils.calendars.clear_calendars
Data API
~~~~~~~~
.. Writers
.. ```````
.. .. autoclass:: zipline.data.minute_bars.BcolzMinuteBarWriter
.. :members:
.. .. autoclass:: zipline.data.us_equity_pricing.BcolzDailyBarWriter
.. :members:
.. .. autoclass:: zipline.data.us_equity_pricing.SQLiteAdjustmentWriter
.. :members:
.. .. autoclass:: zipline.assets.AssetDBWriter
.. :members:
.. Readers
.. ```````
.. .. autoclass:: zipline.data.minute_bars.BcolzMinuteBarReader
.. :members:
.. .. autoclass:: zipline.data.us_equity_pricing.BcolzDailyBarReader
.. :members:
.. .. autoclass:: zipline.data.us_equity_pricing.SQLiteAdjustmentReader
.. :members:
.. .. autoclass:: zipline.assets.AssetFinder
.. :members:
.. .. autoclass:: zipline.data.data_portal.DataPortal
.. :members:
.. Bundles
.. ```````
.. .. autofunction:: zipline.data.bundles.register
.. .. autofunction:: zipline.data.bundles.ingest(name, environ=os.environ, date=None, show_progress=True)
.. .. autofunction:: zipline.data.bundles.load(name, environ=os.environ, date=None)
.. .. autofunction:: zipline.data.bundles.unregister
.. .. data:: zipline.data.bundles.bundles
.. The bundles that have been registered as a mapping from bundle name to bundle
.. data. This mapping is immutable and should only be updated through
.. :func:`~zipline.data.bundles.register` or
.. :func:`~zipline.data.bundles.unregister`.
.. .. autofunction:: zipline.data.bundles.yahoo_equities
Utilities
~~~~~~~~~
Caching
```````
.. autoclass:: catalyst.utils.cache.CachedObject
.. autoclass:: catalyst.utils.cache.ExpiringCache
.. autoclass:: catalyst.utils.cache.dataframe_cache
.. autoclass:: catalyst.utils.cache.working_file
.. autoclass:: catalyst.utils.cache.working_dir
Command Line
````````````
.. autofunction:: catalyst.utils.cli.maybe_show_progress
-377
View File
@@ -1,377 +0,0 @@
API Reference
-------------
Running a Backtest
~~~~~~~~~~~~~~~~~~
.. autofunction:: zipline.run_algorithm(...)
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.
Data Object
```````````
.. autoclass:: zipline.protocol.BarData
:members:
Scheduling Functions
````````````````````
.. autofunction:: zipline.api.schedule_function
.. autoclass:: zipline.api.date_rules
:members:
:undoc-members:
.. autoclass:: zipline.api.time_rules
:members:
Orders
``````
.. autofunction:: zipline.api.order
.. autofunction:: zipline.api.order_value
.. autofunction:: zipline.api.order_percent
.. autofunction:: zipline.api.order_target
.. autofunction:: zipline.api.order_target_value
.. autofunction:: zipline.api.order_target_percent
.. autoclass:: zipline.finance.execution.ExecutionStyle
:members:
.. autoclass:: zipline.finance.execution.MarketOrder
.. autoclass:: zipline.finance.execution.LimitOrder
.. autoclass:: zipline.finance.execution.StopOrder
.. autoclass:: zipline.finance.execution.StopLimitOrder
.. autofunction:: zipline.api.get_order
.. autofunction:: zipline.api.get_open_orders
.. autofunction:: zipline.api.cancel_order
Order Cancellation Policies
'''''''''''''''''''''''''''
.. autofunction:: zipline.api.set_cancel_policy
.. autoclass:: zipline.finance.cancel_policy.CancelPolicy
:members:
.. autofunction:: zipline.api.EODCancel
.. autofunction:: zipline.api.NeverCancel
Assets
``````
.. autofunction:: zipline.api.symbol
.. autofunction:: zipline.api.symbols
.. autofunction:: zipline.api.future_symbol
.. autofunction:: zipline.api.set_symbol_lookup_date
.. autofunction:: zipline.api.sid
Trading Controls
````````````````
Zipline provides trading controls to help ensure that the algorithm is
performing as expected. The functions help protect the algorithm from certian
bugs that could cause undesirable behavior when trading with real money.
.. autofunction:: zipline.api.set_do_not_order_list
.. autofunction:: zipline.api.set_long_only
.. autofunction:: zipline.api.set_max_leverage
.. autofunction:: zipline.api.set_max_order_count
.. autofunction:: zipline.api.set_max_order_size
.. autofunction:: zipline.api.set_max_position_size
Simulation Parameters
`````````````````````
.. autofunction:: zipline.api.set_benchmark
Commission Models
'''''''''''''''''
.. autofunction:: zipline.api.set_commission
.. autoclass:: zipline.finance.commission.CommissionModel
:members:
.. autoclass:: zipline.finance.commission.PerShare
.. autoclass:: zipline.finance.commission.PerTrade
.. autoclass:: zipline.finance.commission.PerDollar
Slippage Models
'''''''''''''''
.. autofunction:: zipline.api.set_slippage
.. autoclass:: zipline.finance.slippage.SlippageModel
:members:
.. autoclass:: zipline.finance.slippage.FixedSlippage
.. autoclass:: zipline.finance.slippage.VolumeShareSlippage
Pipeline
````````
For more information, see :ref:`pipeline-api`
.. autofunction:: zipline.api.attach_pipeline
.. autofunction:: zipline.api.pipeline_output
Miscellaneous
`````````````
.. autofunction:: zipline.api.record
.. autofunction:: zipline.api.get_environment
.. autofunction:: zipline.api.fetch_csv
.. _pipeline-api:
Pipeline API
~~~~~~~~~~~~
.. autoclass:: zipline.pipeline.Pipeline
:members:
:member-order: groupwise
.. autoclass:: zipline.pipeline.CustomFactor
:members:
:member-order: groupwise
.. autoclass:: zipline.pipeline.filters.Filter
:members: __and__, __or__
:exclude-members: dtype
.. autoclass:: zipline.pipeline.factors.Factor
: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.term.Term
:members:
:exclude-members: compute_extra_rows, dependencies, inputs, mask, windowed
.. autoclass:: zipline.pipeline.data.USEquityPricing
:members: open, high, low, close, volume
:undoc-members:
Built-in Factors
````````````````
.. autoclass:: zipline.pipeline.factors.AverageDollarVolume
:members:
.. autoclass:: zipline.pipeline.factors.BollingerBands
:members:
.. autoclass:: zipline.pipeline.factors.BusinessDaysSincePreviousEvent
:members:
.. autoclass:: zipline.pipeline.factors.BusinessDaysUntilNextEvent
:members:
.. autoclass:: zipline.pipeline.factors.ExponentialWeightedMovingAverage
:members:
.. autoclass:: zipline.pipeline.factors.ExponentialWeightedMovingStdDev
:members:
.. autoclass:: zipline.pipeline.factors.Latest
:members:
.. autoclass:: zipline.pipeline.factors.MaxDrawdown
:members:
.. autoclass:: zipline.pipeline.factors.Returns
:members:
.. autoclass:: zipline.pipeline.factors.RollingLinearRegressionOfReturns
:members:
.. autoclass:: zipline.pipeline.factors.RollingPearsonOfReturns
:members:
.. autoclass:: zipline.pipeline.factors.RollingSpearmanOfReturns
:members:
.. autoclass:: zipline.pipeline.factors.RSI
:members:
.. autoclass:: zipline.pipeline.factors.SimpleMovingAverage
:members:
.. autoclass:: zipline.pipeline.factors.VWAP
: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
~~~~~~~~~~~~~~
.. autoclass:: zipline.assets.Asset
:members:
.. autoclass:: zipline.assets.Equity
:members:
.. autoclass:: zipline.assets.Future
:members:
.. autoclass:: zipline.assets.AssetConvertible
:members:
Trading Calendar API
~~~~~~~~~~~~~~~~~~~~
.. autofunction:: zipline.utils.calendars.get_calendar
.. autoclass:: zipline.utils.calendars.TradingCalendar
:members:
.. autofunction:: zipline.utils.calendars.register_calendar
.. autofunction:: zipline.utils.calendars.register_calendar_type
.. autofunction:: zipline.utils.calendars.deregister_calendar
.. autofunction:: zipline.utils.calendars.clear_calendars
Data API
~~~~~~~~
Writers
```````
.. autoclass:: zipline.data.minute_bars.BcolzMinuteBarWriter
:members:
.. autoclass:: zipline.data.us_equity_pricing.BcolzDailyBarWriter
:members:
.. autoclass:: zipline.data.us_equity_pricing.SQLiteAdjustmentWriter
:members:
.. autoclass:: zipline.assets.AssetDBWriter
:members:
Readers
```````
.. autoclass:: zipline.data.minute_bars.BcolzMinuteBarReader
:members:
.. autoclass:: zipline.data.us_equity_pricing.BcolzDailyBarReader
:members:
.. autoclass:: zipline.data.us_equity_pricing.SQLiteAdjustmentReader
:members:
.. autoclass:: zipline.assets.AssetFinder
:members:
.. autoclass:: zipline.data.data_portal.DataPortal
:members:
Bundles
```````
.. autofunction:: zipline.data.bundles.register
.. autofunction:: zipline.data.bundles.ingest(name, environ=os.environ, date=None, show_progress=True)
.. autofunction:: zipline.data.bundles.load(name, environ=os.environ, date=None)
.. autofunction:: zipline.data.bundles.unregister
.. data:: zipline.data.bundles.bundles
The bundles that have been registered as a mapping from bundle name to bundle
data. This mapping is immutable and should only be updated through
:func:`~zipline.data.bundles.register` or
:func:`~zipline.data.bundles.unregister`.
.. autofunction:: zipline.data.bundles.yahoo_equities
Utilities
~~~~~~~~~
Caching
```````
.. autoclass:: zipline.utils.cache.CachedObject
.. autoclass:: zipline.utils.cache.ExpiringCache
.. autoclass:: zipline.utils.cache.dataframe_cache
.. autoclass:: zipline.utils.cache.working_file
.. autoclass:: zipline.utils.cache.working_dir
Command Line
````````````
.. autofunction:: zipline.utils.cli.maybe_show_progress
@@ -168,7 +168,7 @@ We'll start with the CLI, and introduce the ``run_algorithm()`` in the last
example of this tutorial. Some of the :doc:`example algorithms <example-algos>`
provide instructions on how to run them both from the CLI, and using the
:func:`~catalyst.run_algorithm` function. For the third method, refer to the
corresponding section on :doc:`Catalyst & Jupyter Notebook <jupyter>` after you
corresponding section on :ref:`Catalyst & Jupyter Notebook <jupyter>` after you
have assimilated the contents of this tutorial.
Command line interface
@@ -473,6 +473,7 @@ Which we execute by running:
</div>
|
There is a row for each trading day, starting on the first day of our
simulation Jan 1st, 2016. In the columns you can find various
information about the state of your algorithm. The column
@@ -518,7 +519,7 @@ alongside enigma-catalyst (with the exception of the ``Conda`` install, where it
was included by default inside the conda environment we created). If for any
reason you don't have it installed, you can add it by running:
.. code-block:: python
.. code-block:: bash
(catalyst)$ pip install matplotlib
@@ -806,6 +807,7 @@ the ``scikit-learn`` functions require ``numpy.ndarray``\ s rather than
``pandas.DataFrame``\ s, so you can simply pass the underlying
``ndarray`` of a ``DataFrame`` via ``.values``).
.. _jupyter:
Jupyter Notebook
~~~~~~~~~~~~~~~~
@@ -826,13 +828,13 @@ In order to use Jupyter Notebook, you first have to install it inside your
environment. It's available as ``pip`` package, so regardless of how you
installed Catalyst, go inside your catalyst environemnt and run:
.. code:: bash
.. code-block:: bash
(catalyst)$ pip install jupyter
Once you have Jupyter Notebook installed, every time you want to use it run:
.. code:: bash
.. code-block:: bash
(catalyst)$ jupyter notebook
@@ -846,7 +848,7 @@ Before running your algorithms inside the Jupyter Notebook, remember to ingest
the data from the command line interface (CLI). In the example below, you would
need to run first:
.. code:: bash
.. code-block:: bash
catalyst ingest-exchange -x bitfinex -i btc_usd
@@ -36,25 +36,15 @@ Finally, you can build the C extensions by running:
$ python setup.py build_ext --inplace
.. To finish, make sure `tests`__ pass.
Development with Docker
-----------------------
.. __ #style-guide-running-tests
If you want to work with zipline using a `Docker`__ container, you'll need to
build the ``Dockerfile`` in the Zipline root directory, and then build
``Dockerfile-dev``. Instructions for building both containers can be found in
``Dockerfile`` and ``Dockerfile-dev``, respectively.
.. If you get an error running nosetests after setting up a fresh virtualenv, please try running
.. code-block
.. # where zipline is the name of your virtualenv
.. $ deactivate zipline
.. $ workon zipline
.. Development with Docker
.. -----------------------
..If you want to work with zipline using a `Docker`__ container, you'll need to build the ``Dockerfile`` in the Zipline root directory, and then build ``Dockerfile-dev``. Instructions for building both containers can be found in ``Dockerfile`` and ``Dockerfile-dev``, respectively.
.. __ https://docs.docker.com/get-started/
__ https://docs.docker.com/get-started/
Git Branching Structure
-----------------------
@@ -1,4 +1,5 @@
|
Example Algorithms
==================
@@ -1,6 +1,8 @@
.. include:: ../../README.rst
|
|
Table of Contents
-----------------
@@ -298,7 +298,7 @@ Troubleshooting ``pip`` Install
.. _pipenv:
Installing with ``pipenv``
-------------------------
--------------------------
Installing Catalyst via ``pipenv`` is perhaps easier that installing it via
``pip`` itself but you need to install ``pipenv`` first via ``pip``.
@@ -476,6 +476,7 @@ mentioned above are as follows:
default you get 0 as the Value Data)
|
- **The installer has encountered an unexpected error installing this package.
This may indicate a problem with this package. The error code is 2503.**
@@ -113,7 +113,7 @@ Currency symbols (e.g. btc, eth, ltc) follow the Bittrex convention.
Here are some examples:
.. code-block:: json
.. code:: python
# With Bitfinex
bitcoin_usd_asset = symbol('btc_usd')
+73 -24
View File
@@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -52,6 +52,8 @@ div.sphinxsidebar {
width: 230px;
margin-left: -100%;
font-size: 90%;
word-wrap: break-word;
overflow-wrap : break-word;
}
div.sphinxsidebar ul {
@@ -83,10 +85,6 @@ div.sphinxsidebar #searchbox input[type="text"] {
width: 170px;
}
div.sphinxsidebar #searchbox input[type="submit"] {
width: 30px;
}
img {
border: 0;
max-width: 100%;
@@ -124,6 +122,8 @@ ul.keywordmatches li.goodmatch a {
table.contentstable {
width: 90%;
margin-left: auto;
margin-right: auto;
}
table.contentstable p.biglink {
@@ -151,9 +151,14 @@ table.indextable td {
vertical-align: top;
}
table.indextable dl, table.indextable dd {
table.indextable ul {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
}
table.indextable > tbody > tr > td > ul {
padding-left: 0em;
}
table.indextable tr.pcap {
@@ -185,8 +190,22 @@ div.genindex-jumpbox {
padding: 0.4em;
}
/* -- domain module index --------------------------------------------------- */
table.modindextable td {
padding: 2px;
border-collapse: collapse;
}
/* -- general body styles --------------------------------------------------- */
div.body p, div.body dd, div.body li, div.body blockquote {
-moz-hyphens: auto;
-ms-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
a.headerlink {
visibility: hidden;
}
@@ -212,10 +231,6 @@ div.body td {
text-align: left;
}
.field-list ul {
padding-left: 1em;
}
.first {
margin-top: 0 !important;
}
@@ -317,6 +332,11 @@ table.docutils {
border-collapse: collapse;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
table caption span.caption-number {
font-style: italic;
}
@@ -332,10 +352,6 @@ table.docutils td, table.docutils th {
border-bottom: 1px solid #aaa;
}
table.field-list td, table.field-list th {
border: 0 !important;
}
table.footnote td, table.footnote th {
border: 0 !important;
}
@@ -372,6 +388,27 @@ div.figure p.caption span.caption-number {
div.figure p.caption span.caption-text {
}
/* -- field list styles ----------------------------------------------------- */
table.field-list td, table.field-list th {
border: 0 !important;
}
.field-list ul {
margin: 0;
padding-left: 1em;
}
.field-list p {
margin: 0;
}
.field-name {
-moz-hyphens: manual;
-ms-hyphens: manual;
-webkit-hyphens: manual;
hyphens: manual;
}
/* -- other body styles ----------------------------------------------------- */
@@ -413,24 +450,19 @@ dd {
margin-left: 30px;
}
dt:target, .highlighted {
dt:target, span.highlighted {
background-color: #fbe54e;
}
rect.highlighted {
fill: #fbe54e;
}
dl.glossary dt {
font-weight: bold;
font-size: 1.1em;
}
.field-list ul {
margin: 0;
padding-left: 1em;
}
.field-list p {
margin: 0;
}
.optional {
font-size: 1.3em;
}
@@ -489,6 +521,13 @@ pre {
overflow-y: hidden; /* fixes display issues on Chrome browsers */
}
span.pre {
-moz-hyphens: none;
-ms-hyphens: none;
-webkit-hyphens: none;
hyphens: none;
}
td.linenos pre {
padding: 5px 0px;
border: 0;
@@ -580,6 +619,16 @@ span.eqno {
float: right;
}
span.eqno a.headerlink {
position: relative;
left: 0px;
z-index: 1;
}
div.math:hover a.headerlink {
visibility: visible;
}
/* -- printout stylesheet --------------------------------------------------- */
@media print {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 641 B

+65 -17
View File
@@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for all documentation.
*
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -45,7 +45,7 @@ jQuery.urlencode = encodeURIComponent;
* it will always return arrays of strings for the value parts.
*/
jQuery.getQueryParameters = function(s) {
if (typeof s == 'undefined')
if (typeof s === 'undefined')
s = document.location.search;
var parts = s.substr(s.indexOf('?') + 1).split('&');
var result = {};
@@ -66,29 +66,53 @@ jQuery.getQueryParameters = function(s) {
* span elements with the given class name.
*/
jQuery.fn.highlightText = function(text, className) {
function highlight(node) {
if (node.nodeType == 3) {
function highlight(node, addItems) {
if (node.nodeType === 3) {
var val = node.nodeValue;
var pos = val.toLowerCase().indexOf(text);
if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
var span = document.createElement("span");
span.className = className;
var span;
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.className = className;
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling));
node.nodeValue = val.substr(0, pos);
if (isInSVG) {
var bbox = span.getBBox();
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute('class', className);
var parentOfText = node.parentNode.parentNode;
addItems.push({
"parent": node.parentNode,
"target": rect});
}
}
}
else if (!jQuery(node).is("button, select, textarea")) {
jQuery.each(node.childNodes, function() {
highlight(this);
highlight(this, addItems);
});
}
}
return this.each(function() {
highlight(this);
var addItems = [];
var result = this.each(function() {
highlight(this, addItems);
});
for (var i = 0; i < addItems.length; ++i) {
jQuery(addItems[i].parent).before(addItems[i].target);
}
return result;
};
/*
@@ -124,27 +148,28 @@ var Documentation = {
this.fixFirefoxAnchorBug();
this.highlightSearchWords();
this.initIndexTable();
},
/**
* i18n support
*/
TRANSLATIONS : {},
PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; },
LOCALE : 'unknown',
// gettext and ngettext don't access this so that the functions
// can safely bound to a different name (_ = Documentation.gettext)
gettext : function(string) {
var translated = Documentation.TRANSLATIONS[string];
if (typeof translated == 'undefined')
if (typeof translated === 'undefined')
return string;
return (typeof translated == 'string') ? translated : translated[0];
return (typeof translated === 'string') ? translated : translated[0];
},
ngettext : function(singular, plural, n) {
var translated = Documentation.TRANSLATIONS[singular];
if (typeof translated == 'undefined')
if (typeof translated === 'undefined')
return (n == 1) ? singular : plural;
return translated[Documentation.PLURALEXPR(n)];
},
@@ -179,7 +204,7 @@ var Documentation = {
* see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
*/
fixFirefoxAnchorBug : function() {
if (document.location.hash)
if (document.location.hash && $.browser.mozilla)
window.setTimeout(function() {
document.location.href += '';
}, 10);
@@ -215,7 +240,7 @@ var Documentation = {
var src = $(this).attr('src');
var idnum = $(this).attr('id').substr(7);
$('tr.cg-' + idnum).toggle();
if (src.substr(-9) == 'minus.png')
if (src.substr(-9) === 'minus.png')
$(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
else
$(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
@@ -247,11 +272,34 @@ var Documentation = {
var path = document.location.pathname;
var parts = path.split(/\//);
$.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
if (this == '..')
if (this === '..')
parts.pop();
});
var url = parts.join('/');
return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
},
initOnKeyListeners: function() {
$(document).keyup(function(event) {
var activeElementType = document.activeElement.tagName;
// don't navigate when in search box or textarea
if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') {
switch (event.keyCode) {
case 37: // left
var prevHref = $('link[rel="prev"]').prop('href');
if (prevHref) {
window.location.href = prevHref;
return false;
}
case 39: // right
var nextHref = $('link[rel="next"]').prop('href');
if (nextHref) {
window.location.href = nextHref;
return false;
}
}
}
});
}
};
@@ -260,4 +308,4 @@ _ = Documentation.gettext;
$(document).ready(function() {
Documentation.init();
});
});
Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 222 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 202 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.
File diff suppressed because it is too large Load Diff
+4 -4
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 90 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 90 B

+117 -7
View File
@@ -2,9 +2,9 @@
* searchtools.js_t
* ~~~~~~~~~~~~~~~~
*
* Sphinx JavaScript utilties for the full-text search.
* Sphinx JavaScript utilities for the full-text search.
*
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -226,6 +226,106 @@ var Scorer = {
};
var splitChars = (function() {
var result = {};
var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648,
1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702,
2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971,
2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345,
3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761,
3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823,
4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125,
8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695,
11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587,
43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141];
var i, j, start, end;
for (i = 0; i < singles.length; i++) {
result[singles[i]] = true;
}
var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709],
[722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161],
[1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568],
[1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807],
[1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047],
[2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383],
[2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450],
[2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547],
[2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673],
[2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820],
[2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946],
[2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023],
[3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173],
[3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332],
[3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481],
[3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718],
[3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791],
[3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095],
[4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205],
[4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687],
[4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968],
[4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869],
[5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102],
[6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271],
[6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592],
[6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822],
[6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167],
[7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959],
[7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143],
[8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318],
[8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483],
[8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101],
[10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567],
[11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292],
[12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444],
[12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783],
[12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311],
[19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511],
[42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774],
[42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071],
[43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263],
[43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519],
[43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647],
[43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967],
[44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295],
[57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274],
[64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007],
[65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381],
[65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]];
for (i = 0; i < ranges.length; i++) {
start = ranges[i][0];
end = ranges[i][1];
for (j = start; j <= end; j++) {
result[j] = true;
}
}
return result;
})();
function splitQuery(query) {
var result = [];
var start = -1;
for (var i = 0; i < query.length; i++) {
if (splitChars[query.charCodeAt(i)]) {
if (start !== -1) {
result.push(query.slice(start, i));
start = -1;
}
} else if (start === -1) {
start = i;
}
}
if (start !== -1) {
result.push(query.slice(start));
}
return result;
}
/**
* Search Module
*/
@@ -324,7 +424,7 @@ var Search = {
var searchterms = [];
var excluded = [];
var hlterms = [];
var tmp = query.split(/\s+/);
var tmp = splitQuery(query);
var objectterms = [];
for (i = 0; i < tmp.length; i++) {
if (tmp[i] !== "") {
@@ -338,6 +438,10 @@ var Search = {
}
// stem the word
var word = stemmer.stemWord(tmp[i].toLowerCase());
// prevent stemmer from cutting word smaller than two chars
if(word.length < 3 && tmp[i].length >= 3) {
word = tmp[i];
}
var toAppend;
// select the correct list
if (word[0] == '-') {
@@ -435,7 +539,11 @@ var Search = {
displayNextItem();
});
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[0] + '.txt',
var suffix = DOCUMENTATION_OPTIONS.SOURCELINK_SUFFIX;
if (suffix === undefined) {
suffix = '.txt';
}
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5] + (item[5].slice(-suffix.length) === suffix ? '' : suffix),
dataType: "text",
complete: function(jqxhr, textstatus) {
var data = jqxhr.responseText;
@@ -474,6 +582,7 @@ var Search = {
*/
performObjectSearch : function(object, otherterms) {
var filenames = this._index.filenames;
var docnames = this._index.docnames;
var objects = this._index.objects;
var objnames = this._index.objnames;
var titles = this._index.titles;
@@ -527,7 +636,7 @@ var Search = {
} else {
score += Scorer.objPrioDefault;
}
results.push([filenames[match[0]], fullname, '#'+anchor, descr, score]);
results.push([docnames[match[0]], fullname, '#'+anchor, descr, score, filenames[match[0]]]);
}
}
}
@@ -539,6 +648,7 @@ var Search = {
* search for full-text terms in the index
*/
performTermsSearch : function(searchterms, excluded, terms, titleterms) {
var docnames = this._index.docnames;
var filenames = this._index.filenames;
var titles = this._index.titles;
@@ -613,7 +723,7 @@ var Search = {
// select one (max) score for the file.
// for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
results.push([filenames[file], titles[file], '', null, score]);
results.push([docnames[file], titles[file], '', null, score, filenames[file]]);
}
}
return results;
@@ -623,7 +733,7 @@ var Search = {
* helper function to return a node containing the
* search summary for a given text. keywords is a list
* of stemmed words, hlwords is the list of normal, unstemmed
* words. the first one is used to find the occurance, the
* words. the first one is used to find the occurrence, the
* latter for highlighting it.
*/
makeSearchSummary : function(text, keywords, hlwords) {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

After

Width:  |  Height:  |  Size: 214 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

After

Width:  |  Height:  |  Size: 203 B

+2 -2
View File
@@ -2,9 +2,9 @@
* websupport.js
* ~~~~~~~~~~~~~
*
* sphinx.websupport utilties for all documentation.
* sphinx.websupport utilities for all documentation.
*
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
+2602 -38
View File
File diff suppressed because it is too large Load Diff
+197 -194
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
<link rel="next" title="Live Trading" href="live-trading.html"/>
<link rel="prev" title="Install" href="install.html"/>
@@ -85,7 +88,7 @@
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="install.html">Install</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Catalyst Beginner Tutorial</a><ul>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Catalyst Beginner Tutorial</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#basics">Basics</a></li>
<li class="toctree-l2"><a class="reference internal" href="#my-first-algorithm">My first algorithm</a></li>
<li class="toctree-l2"><a class="reference internal" href="#ingesting-data">Ingesting data</a></li>
@@ -163,7 +166,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/beginner-tutorial.txt" rel="nofollow"> View page source</a>
<a href="_sources/beginner-tutorial.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -199,7 +202,7 @@ marketplace, Catalyst empowers users to share and curate data and
build profitable, data-driven investment strategies.</li>
</ul>
<p>This tutorial assumes that you have Catalyst correctly installed, see the
<a class="reference internal" href="install.html"><em>Install</em></a> section if you haven&#8217;t set up Catalyst yet.</p>
<a class="reference internal" href="install.html"><span class="doc">Install</span></a> section if you havent set up Catalyst yet.</p>
<p>Every <code class="docutils literal"><span class="pre">catalyst</span></code> algorithm consists of at least two functions you have to
define:</p>
<ul class="simple">
@@ -211,7 +214,7 @@ define:</p>
<code class="docutils literal"><span class="pre">context</span></code> is a persistent namespace for you to store variables you
need to access from one algorithm iteration to the next.</p>
<p>After the algorithm has been initialized, <code class="docutils literal"><span class="pre">catalyst</span></code> calls the
<code class="docutils literal"><span class="pre">handle_data()</span></code> function on each iteration, that&#8217;s one per day (daily) or
<code class="docutils literal"><span class="pre">handle_data()</span></code> function on each iteration, thats one per day (daily) or
once every minute (minute), depending on the frequency we choose to run our
simulation. On every iteration, <code class="docutils literal"><span class="pre">handle_data()</span></code> passes the same <code class="docutils literal"><span class="pre">context</span></code>
variable and an event-frame called <code class="docutils literal"><span class="pre">data</span></code> containing the current trading bar
@@ -261,7 +264,7 @@ Marketplace), and stores it locally to make it available at runtime.</p>
</div>
<p>This instructs Catalyst to download pricing data from the <code class="docutils literal"><span class="pre">Bitfinex</span></code> exchange
for the <code class="docutils literal"><span class="pre">btc_usd</span></code> currency pair (this follows from the simple algorithm
presented above where we want to trade <code class="docutils literal"><span class="pre">btc_usd</span></code>), and we&#8217;re choosing to test
presented above where we want to trade <code class="docutils literal"><span class="pre">btc_usd</span></code>), and were choosing to test
our algorithm using historical pricing data from the Bitfinex exchange. By
default, Catalyst assumes that you want data with <code class="docutils literal"><span class="pre">daily</span></code> frequency (one candle
bar per day). If you want instead <code class="docutils literal"><span class="pre">minute</span></code> frequency (one candle bar for every
@@ -269,15 +272,15 @@ minute), you would need to specify it as follows:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>catalyst ingest-exchange -x bitfinex -i btc_usd -f minute
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span></span>Ingesting exchange bundle bitfinex...
[====================================] Ingesting daily price data on bitfinex: 100%
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">Ingesting</span> <span class="n">exchange</span> <span class="n">bundle</span> <span class="n">bitfinex</span><span class="o">...</span>
<span class="p">[</span><span class="o">====================================</span><span class="p">]</span> <span class="n">Ingesting</span> <span class="n">daily</span> <span class="n">price</span> <span class="n">data</span> <span class="n">on</span> <span class="n">bitfinex</span><span class="p">:</span> <span class="mi">100</span><span class="o">%</span>
</pre></div>
</div>
<p>We believe it is important for you to have a high-level understanding of how
data is managed, hence the following overview:</p>
<ul class="simple">
<li>Pricing data is split and packaged into <code class="docutils literal"><span class="pre">bundles</span></code>: chunks of data organized
as time series that are kept up to date daily on Enigma&#8217;s servers. Catalyst
as time series that are kept up to date daily on Enigmas servers. Catalyst
downloads the requested bundles and reconstructs the full dataset in your
hard drive.</li>
<li>Pricing data is provided in <code class="docutils literal"><span class="pre">daily</span></code> and <code class="docutils literal"><span class="pre">minute</span></code> resolution. Those are
@@ -302,7 +305,7 @@ following from the command line:</p>
</div>
<div class="section" id="running-the-algorithm">
<h2>Running the algorithm<a class="headerlink" href="#running-the-algorithm" title="Permalink to this headline"></a></h2>
<p>You can now test your algorithm using cryptoassets&#8217; historical pricing data,
<p>You can now test your algorithm using cryptoassets historical pricing data,
<code class="docutils literal"><span class="pre">catalyst</span></code> provides three interfaces:</p>
<ul class="simple">
<li>A command-line interface (CLI),</li>
@@ -310,11 +313,11 @@ following from the command line:</p>
Python scripts,</li>
<li>and the <code class="docutils literal"><span class="pre">Jupyter</span> <span class="pre">Notebook</span></code> magic.</li>
</ul>
<p>We&#8217;ll start with the CLI, and introduce the <code class="docutils literal"><span class="pre">run_algorithm()</span></code> in the last
example of this tutorial. Some of the <a class="reference internal" href="example-algos.html"><em>example algorithms</em></a>
<p>Well start with the CLI, and introduce the <code class="docutils literal"><span class="pre">run_algorithm()</span></code> in the last
example of this tutorial. Some of the <a class="reference internal" href="example-algos.html"><span class="doc">example algorithms</span></a>
provide instructions on how to run them both from the CLI, and using the
<a class="reference internal" href="appendix.html#catalyst.run_algorithm" title="catalyst.run_algorithm"><code class="xref py py-func docutils literal"><span class="pre">run_algorithm()</span></code></a> function. For the third method, refer to the
corresponding section on <code class="xref doc docutils literal"><span class="pre">Catalyst</span> <span class="pre">&amp;</span> <span class="pre">Jupyter</span> <span class="pre">Notebook</span></code> after you
corresponding section on <a class="reference internal" href="#jupyter"><span class="std std-ref">Catalyst &amp; Jupyter Notebook</span></a> after you
have assimilated the contents of this tutorial.</p>
<div class="section" id="command-line-interface">
<h3>Command line interface<a class="headerlink" href="#command-line-interface" title="Permalink to this headline"></a></h3>
@@ -325,18 +328,18 @@ or the Terminal application on MacOS).</p>
</pre></div>
</div>
<p>This is the resulting output, simplified for eductional purposes:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>Usage: catalyst [OPTIONS] COMMAND [ARGS]...
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">Usage</span><span class="p">:</span> <span class="n">catalyst</span> <span class="p">[</span><span class="n">OPTIONS</span><span class="p">]</span> <span class="n">COMMAND</span> <span class="p">[</span><span class="n">ARGS</span><span class="p">]</span><span class="o">...</span>
Top level catalyst entry point.
<span class="n">Top</span> <span class="n">level</span> <span class="n">catalyst</span> <span class="n">entry</span> <span class="n">point</span><span class="o">.</span>
Options:
--version Show the version and exit.
--help Show this message and exit.
<span class="n">Options</span><span class="p">:</span>
<span class="o">--</span><span class="n">version</span> <span class="n">Show</span> <span class="n">the</span> <span class="n">version</span> <span class="ow">and</span> <span class="nb">exit</span><span class="o">.</span>
<span class="o">--</span><span class="n">help</span> <span class="n">Show</span> <span class="n">this</span> <span class="n">message</span> <span class="ow">and</span> <span class="nb">exit</span><span class="o">.</span>
Commands:
ingest-exchange Ingest data for the given exchange.
live Trade live with the given algorithm.
run Run a backtest for the given algorithm.
<span class="n">Commands</span><span class="p">:</span>
<span class="n">ingest</span><span class="o">-</span><span class="n">exchange</span> <span class="n">Ingest</span> <span class="n">data</span> <span class="k">for</span> <span class="n">the</span> <span class="n">given</span> <span class="n">exchange</span><span class="o">.</span>
<span class="n">live</span> <span class="n">Trade</span> <span class="n">live</span> <span class="k">with</span> <span class="n">the</span> <span class="n">given</span> <span class="n">algorithm</span><span class="o">.</span>
<span class="n">run</span> <span class="n">Run</span> <span class="n">a</span> <span class="n">backtest</span> <span class="k">for</span> <span class="n">the</span> <span class="n">given</span> <span class="n">algorithm</span><span class="o">.</span>
</pre></div>
</div>
<p>There are three main modes you can run on Catalyst. The first being
@@ -344,46 +347,46 @@ Commands:
section. The second is <code class="docutils literal"><span class="pre">live</span></code> to use your algorithm to trade live against a
given exchange, and the third mode <code class="docutils literal"><span class="pre">run</span></code> is to backtest your algorithm before
trading live with it.</p>
<p>Let&#8217;s start with backtesting, so run this other command to learn more about
<p>Lets start with backtesting, so run this other command to learn more about
the available options:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ catalyst run --help
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span></span>Usage: catalyst run [OPTIONS]
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">Usage</span><span class="p">:</span> <span class="n">catalyst</span> <span class="n">run</span> <span class="p">[</span><span class="n">OPTIONS</span><span class="p">]</span>
Run a backtest for the given algorithm.
<span class="n">Run</span> <span class="n">a</span> <span class="n">backtest</span> <span class="k">for</span> <span class="n">the</span> <span class="n">given</span> <span class="n">algorithm</span><span class="o">.</span>
Options:
-f, --algofile FILENAME The file that contains the algorithm to run.
-t, --algotext TEXT The algorithm script to run.
-D, --define TEXT Define a name to be bound in the namespace
before executing the algotext. For example
&#39;-Dname=value&#39;. The value may be any python
expression. These are evaluated in order so
they may refer to previously defined names.
--data-frequency [daily|minute]
The data frequency of the simulation.
[default: daily]
--capital-base FLOAT The starting capital for the simulation.
[default: 10000000.0]
-b, --bundle BUNDLE-NAME The data bundle to use for the simulation.
[default: poloniex]
--bundle-timestamp TIMESTAMP The date to lookup data on or before.
[default: &lt;current-time&gt;]
-s, --start DATE The start date of the simulation.
-e, --end DATE The end date of the simulation.
-o, --output FILENAME The location to write the perf data. If this
is &#39;-&#39; the perf will be written to stdout.
[default: -]
--print-algo / --no-print-algo Print the algorithm to stdout.
-x, --exchange-name [poloniex|bitfinex|bittrex]
The name of the targeted exchange
(supported: bitfinex, bittrex, poloniex).
-n, --algo-namespace TEXT A label assigned to the algorithm for data
storage purposes.
-c, --base-currency TEXT The base currency used to calculate
statistics (e.g. usd, btc, eth).
--help Show this message and exit.
<span class="n">Options</span><span class="p">:</span>
<span class="o">-</span><span class="n">f</span><span class="p">,</span> <span class="o">--</span><span class="n">algofile</span> <span class="n">FILENAME</span> <span class="n">The</span> <span class="nb">file</span> <span class="n">that</span> <span class="n">contains</span> <span class="n">the</span> <span class="n">algorithm</span> <span class="n">to</span> <span class="n">run</span><span class="o">.</span>
<span class="o">-</span><span class="n">t</span><span class="p">,</span> <span class="o">--</span><span class="n">algotext</span> <span class="n">TEXT</span> <span class="n">The</span> <span class="n">algorithm</span> <span class="n">script</span> <span class="n">to</span> <span class="n">run</span><span class="o">.</span>
<span class="o">-</span><span class="n">D</span><span class="p">,</span> <span class="o">--</span><span class="n">define</span> <span class="n">TEXT</span> <span class="n">Define</span> <span class="n">a</span> <span class="n">name</span> <span class="n">to</span> <span class="n">be</span> <span class="n">bound</span> <span class="ow">in</span> <span class="n">the</span> <span class="n">namespace</span>
<span class="n">before</span> <span class="n">executing</span> <span class="n">the</span> <span class="n">algotext</span><span class="o">.</span> <span class="n">For</span> <span class="n">example</span>
<span class="s1">&#39;-Dname=value&#39;</span><span class="o">.</span> <span class="n">The</span> <span class="n">value</span> <span class="n">may</span> <span class="n">be</span> <span class="nb">any</span> <span class="n">python</span>
<span class="n">expression</span><span class="o">.</span> <span class="n">These</span> <span class="n">are</span> <span class="n">evaluated</span> <span class="ow">in</span> <span class="n">order</span> <span class="n">so</span>
<span class="n">they</span> <span class="n">may</span> <span class="n">refer</span> <span class="n">to</span> <span class="n">previously</span> <span class="n">defined</span> <span class="n">names</span><span class="o">.</span>
<span class="o">--</span><span class="n">data</span><span class="o">-</span><span class="n">frequency</span> <span class="p">[</span><span class="n">daily</span><span class="o">|</span><span class="n">minute</span><span class="p">]</span>
<span class="n">The</span> <span class="n">data</span> <span class="n">frequency</span> <span class="n">of</span> <span class="n">the</span> <span class="n">simulation</span><span class="o">.</span>
<span class="p">[</span><span class="n">default</span><span class="p">:</span> <span class="n">daily</span><span class="p">]</span>
<span class="o">--</span><span class="n">capital</span><span class="o">-</span><span class="n">base</span> <span class="n">FLOAT</span> <span class="n">The</span> <span class="n">starting</span> <span class="n">capital</span> <span class="k">for</span> <span class="n">the</span> <span class="n">simulation</span><span class="o">.</span>
<span class="p">[</span><span class="n">default</span><span class="p">:</span> <span class="mf">10000000.0</span><span class="p">]</span>
<span class="o">-</span><span class="n">b</span><span class="p">,</span> <span class="o">--</span><span class="n">bundle</span> <span class="n">BUNDLE</span><span class="o">-</span><span class="n">NAME</span> <span class="n">The</span> <span class="n">data</span> <span class="n">bundle</span> <span class="n">to</span> <span class="n">use</span> <span class="k">for</span> <span class="n">the</span> <span class="n">simulation</span><span class="o">.</span>
<span class="p">[</span><span class="n">default</span><span class="p">:</span> <span class="n">poloniex</span><span class="p">]</span>
<span class="o">--</span><span class="n">bundle</span><span class="o">-</span><span class="n">timestamp</span> <span class="n">TIMESTAMP</span> <span class="n">The</span> <span class="n">date</span> <span class="n">to</span> <span class="n">lookup</span> <span class="n">data</span> <span class="n">on</span> <span class="ow">or</span> <span class="n">before</span><span class="o">.</span>
<span class="p">[</span><span class="n">default</span><span class="p">:</span> <span class="o">&lt;</span><span class="n">current</span><span class="o">-</span><span class="n">time</span><span class="o">&gt;</span><span class="p">]</span>
<span class="o">-</span><span class="n">s</span><span class="p">,</span> <span class="o">--</span><span class="n">start</span> <span class="n">DATE</span> <span class="n">The</span> <span class="n">start</span> <span class="n">date</span> <span class="n">of</span> <span class="n">the</span> <span class="n">simulation</span><span class="o">.</span>
<span class="o">-</span><span class="n">e</span><span class="p">,</span> <span class="o">--</span><span class="n">end</span> <span class="n">DATE</span> <span class="n">The</span> <span class="n">end</span> <span class="n">date</span> <span class="n">of</span> <span class="n">the</span> <span class="n">simulation</span><span class="o">.</span>
<span class="o">-</span><span class="n">o</span><span class="p">,</span> <span class="o">--</span><span class="n">output</span> <span class="n">FILENAME</span> <span class="n">The</span> <span class="n">location</span> <span class="n">to</span> <span class="n">write</span> <span class="n">the</span> <span class="n">perf</span> <span class="n">data</span><span class="o">.</span> <span class="n">If</span> <span class="n">this</span>
<span class="ow">is</span> <span class="s1">&#39;-&#39;</span> <span class="n">the</span> <span class="n">perf</span> <span class="n">will</span> <span class="n">be</span> <span class="n">written</span> <span class="n">to</span> <span class="n">stdout</span><span class="o">.</span>
<span class="p">[</span><span class="n">default</span><span class="p">:</span> <span class="o">-</span><span class="p">]</span>
<span class="o">--</span><span class="k">print</span><span class="o">-</span><span class="n">algo</span> <span class="o">/</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="k">print</span><span class="o">-</span><span class="n">algo</span> <span class="n">Print</span> <span class="n">the</span> <span class="n">algorithm</span> <span class="n">to</span> <span class="n">stdout</span><span class="o">.</span>
<span class="o">-</span><span class="n">x</span><span class="p">,</span> <span class="o">--</span><span class="n">exchange</span><span class="o">-</span><span class="n">name</span> <span class="p">[</span><span class="n">poloniex</span><span class="o">|</span><span class="n">bitfinex</span><span class="o">|</span><span class="n">bittrex</span><span class="p">]</span>
<span class="n">The</span> <span class="n">name</span> <span class="n">of</span> <span class="n">the</span> <span class="n">targeted</span> <span class="n">exchange</span>
<span class="p">(</span><span class="n">supported</span><span class="p">:</span> <span class="n">bitfinex</span><span class="p">,</span> <span class="n">bittrex</span><span class="p">,</span> <span class="n">poloniex</span><span class="p">)</span><span class="o">.</span>
<span class="o">-</span><span class="n">n</span><span class="p">,</span> <span class="o">--</span><span class="n">algo</span><span class="o">-</span><span class="n">namespace</span> <span class="n">TEXT</span> <span class="n">A</span> <span class="n">label</span> <span class="n">assigned</span> <span class="n">to</span> <span class="n">the</span> <span class="n">algorithm</span> <span class="k">for</span> <span class="n">data</span>
<span class="n">storage</span> <span class="n">purposes</span><span class="o">.</span>
<span class="o">-</span><span class="n">c</span><span class="p">,</span> <span class="o">--</span><span class="n">base</span><span class="o">-</span><span class="n">currency</span> <span class="n">TEXT</span> <span class="n">The</span> <span class="n">base</span> <span class="n">currency</span> <span class="n">used</span> <span class="n">to</span> <span class="n">calculate</span>
<span class="n">statistics</span> <span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">g</span><span class="o">.</span> <span class="n">usd</span><span class="p">,</span> <span class="n">btc</span><span class="p">,</span> <span class="n">eth</span><span class="p">)</span><span class="o">.</span>
<span class="o">--</span><span class="n">help</span> <span class="n">Show</span> <span class="n">this</span> <span class="n">message</span> <span class="ow">and</span> <span class="nb">exit</span><span class="o">.</span>
</pre></div>
</div>
<p>As you can see there are a couple of flags that specify where to find your
@@ -396,18 +399,18 @@ performance metrics of your algorithm so that you can analyze how it performed.
This is done via the <code class="docutils literal"><span class="pre">--output</span></code> flag and will cause it to write the
performance <code class="docutils literal"><span class="pre">DataFrame</span></code> in the pickle Python file format. Note that you can
also define a configuration file with these parameters that you can then
conveniently pass to the <code class="docutils literal"><span class="pre">-c</span></code> option so that you don&#8217;t have to supply the
conveniently pass to the <code class="docutils literal"><span class="pre">-c</span></code> option so that you dont have to supply the
command line args all the time.</p>
<p>Thus, to execute our algorithm from above and save the results to
<code class="docutils literal"><span class="pre">buy_btc_simple_out.pickle</span></code> we would call <code class="docutils literal"><span class="pre">catalyst</span> <span class="pre">run</span></code> as follows:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>catalyst run -f buy_btc_simple.py -x bitfinex --start <span class="m">2016</span>-1-1 --end <span class="m">2017</span>-9-30 -c usd --capital-base <span class="m">100000</span> -o buy_btc_simple_out.pickle
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span></span>INFO: run_algo: running algo in backtest mode
INFO: exchange_algorithm: initialized trading algorithm in backtest mode
INFO: Performance: Simulated 639 trading days out of 639.
INFO: Performance: first open: 2016-01-01 00:00:00+00:00
INFO: Performance: last close: 2017-09-30 23:59:00+00:00
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">INFO</span><span class="p">:</span> <span class="n">run_algo</span><span class="p">:</span> <span class="n">running</span> <span class="n">algo</span> <span class="ow">in</span> <span class="n">backtest</span> <span class="n">mode</span>
<span class="n">INFO</span><span class="p">:</span> <span class="n">exchange_algorithm</span><span class="p">:</span> <span class="n">initialized</span> <span class="n">trading</span> <span class="n">algorithm</span> <span class="ow">in</span> <span class="n">backtest</span> <span class="n">mode</span>
<span class="n">INFO</span><span class="p">:</span> <span class="n">Performance</span><span class="p">:</span> <span class="n">Simulated</span> <span class="mi">639</span> <span class="n">trading</span> <span class="n">days</span> <span class="n">out</span> <span class="n">of</span> <span class="mf">639.</span>
<span class="n">INFO</span><span class="p">:</span> <span class="n">Performance</span><span class="p">:</span> <span class="n">first</span> <span class="nb">open</span><span class="p">:</span> <span class="mi">2016</span><span class="o">-</span><span class="mo">01</span><span class="o">-</span><span class="mo">01</span> <span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="o">+</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span>
<span class="n">INFO</span><span class="p">:</span> <span class="n">Performance</span><span class="p">:</span> <span class="n">last</span> <span class="n">close</span><span class="p">:</span> <span class="mi">2017</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">30</span> <span class="mi">23</span><span class="p">:</span><span class="mi">59</span><span class="p">:</span><span class="mo">00</span><span class="o">+</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span>
</pre></div>
</div>
<p><code class="docutils literal"><span class="pre">run</span></code> first calls the <code class="docutils literal"><span class="pre">initialize()</span></code> function, and then
@@ -422,11 +425,11 @@ applying the slippage model which models the influence of your order on
the stock price, so your algorithm will be charged more than just the
asset price. (Note, that you can also change the commission and
slippage model that <code class="docutils literal"><span class="pre">catalyst</span></code> uses).</p>
<p>Let&#8217;s take a quick look at the performance <code class="docutils literal"><span class="pre">DataFrame</span></code>. For this, we write
different Python script&#8211;let&#8217;s call it <code class="docutils literal"><span class="pre">print_results.py</span></code>&#8211;and we make use of
<p>Lets take a quick look at the performance <code class="docutils literal"><span class="pre">DataFrame</span></code>. For this, we write
different Python scriptlets call it <code class="docutils literal"><span class="pre">print_results.py</span></code>and we make use of
the fantastic <code class="docutils literal"><span class="pre">pandas</span></code> library to print the first ten rows. Note that
<code class="docutils literal"><span class="pre">catalyst</span></code> makes heavy usage of <a class="reference external" href="http://pandas.pydata.org/">pandas</a>,
especially for data analysis and outputting so it&#8217;s worth spending some time to
especially for data analysis and outputting so its worth spending some time to
learn it.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">pandas</span> <span class="kn">as</span> <span class="nn">pd</span>
<span class="n">perf</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_pickle</span><span class="p">(</span><span class="s1">&#39;buy_btc_simple_out.pickle&#39;</span><span class="p">)</span> <span class="c1"># read in perf DataFrame</span>
@@ -605,7 +608,7 @@ as how <code class="docutils literal"><span class="pre">initialize()</span></cod
variables: <code class="docutils literal"><span class="pre">context</span></code>, which we discussed at the very beginning, and <code class="docutils literal"><span class="pre">perf</span></code>,
which is the pandas dataframe containing the performance data for our algorithm
that we reviewed above. Inside the <code class="docutils literal"><span class="pre">analyze()</span></code> function is where we can
analyze and visualize the results of our strategy. Here&#8217;s the revised simple
analyze and visualize the results of our strategy. Heres the revised simple
algorithm (note the addition of Line 1, and Lines 11-18)</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="kn">as</span> <span class="nn">plt</span>
<span class="kn">from</span> <span class="nn">catalyst.api</span> <span class="kn">import</span> <span class="n">order</span><span class="p">,</span> <span class="n">record</span><span class="p">,</span> <span class="n">symbol</span>
@@ -631,11 +634,11 @@ algorithm (note the addition of Line 1, and Lines 11-18)</p>
<a class="reference external" href="https://matplotlib.org/">matplotlib</a>, which you might recall we installed
alongside enigma-catalyst (with the exception of the <code class="docutils literal"><span class="pre">Conda</span></code> install, where it
was included by default inside the conda environment we created). If for any
reason you don&#8217;t have it installed, you can add it by running:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>(catalyst)$ pip install matplotlib
reason you dont have it installed, you can add it by running:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>catalyst<span class="o">)</span>$ pip install matplotlib
</pre></div>
</div>
<p>If everything works well, you&#8217;ll see the following chart:</p>
<p>If everything works well, youll see the following chart:</p>
<img alt="https://s3.amazonaws.com/enigmaco-docs/github.io/buy_btc_simple_graph.png" src="https://s3.amazonaws.com/enigmaco-docs/github.io/buy_btc_simple_graph.png" />
<p>Our algorithm performance as assessed by the <code class="docutils literal"><span class="pre">portfolio_value</span></code> closely
matches that of the bitcoin price. This is not surprising as our algorithm
@@ -645,7 +648,7 @@ only bought bitcoin every chance it got.</p>
results refer to <a class="reference external" href="install.html#macos-virtualenv-matplotlib">MacOS + Matplotlib</a>.
Alternatively, some users have reported the following error when running an algo
in a Linux environment:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>ImportError: No module named _tkinter, please install the python-tk package
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="ne">ImportError</span><span class="p">:</span> <span class="n">No</span> <span class="n">module</span> <span class="n">named</span> <span class="n">_tkinter</span><span class="p">,</span> <span class="n">please</span> <span class="n">install</span> <span class="n">the</span> <span class="n">python</span><span class="o">-</span><span class="n">tk</span> <span class="n">package</span>
</pre></div>
</div>
<p>Which can easily solved by running (in Ubuntu/Debian-based systems):</p>
@@ -659,10 +662,10 @@ in a Linux environment:</p>
<span id="history"></span><h2>Access to previous prices using <code class="docutils literal"><span class="pre">history</span></code><a class="headerlink" href="#access-to-previous-prices-using-history" title="Permalink to this headline"></a></h2>
<div class="section" id="working-example-dual-moving-average-cross-over">
<h3>Working example: Dual Moving Average Cross-Over<a class="headerlink" href="#working-example-dual-moving-average-cross-over" title="Permalink to this headline"></a></h3>
<p>The Dual Moving Average (DMA) is a classic momentum strategy. It&#8217;s
<p>The Dual Moving Average (DMA) is a classic momentum strategy. Its
probably not used by any serious trader anymore but is still very
instructive. The basic idea is that we compute two rolling or moving
averages (mavg) &#8211; one with a longer window that is supposed to capture
averages (mavg) one with a longer window that is supposed to capture
long-term trends and one shorter window that is supposed to capture
short-term trends. Once the short-mavg crosses the long-mavg from below
we assume that the stock price has upwards momentum and long the stock.
@@ -676,7 +679,7 @@ for daily or <code class="docutils literal"><span class="pre">'1m'</span></code>
minute-level data when using <code class="docutils literal"><span class="pre">1m</span></code>). This is a function we use in the
<code class="docutils literal"><span class="pre">handle_data()</span></code> section.</p>
<p>You will note that the code below is substantially longer than the previous
examples. Don&#8217;t get overwhelmed by it as the logic is fairly simple and easy to
examples. Dont get overwhelmed by it as the logic is fairly simple and easy to
follow. Most of the added some complexity has been added to beautify the output,
which you can skim through for now. A copy of this algorithm is available in
the <code class="docutils literal"><span class="pre">examples</span></code> directory:
@@ -856,7 +859,7 @@ execute this file as a Python script:</p>
<p>A few comments on the code above:</p>
<blockquote>
<div><p>At the beginning of our code, we import a number of Python libraries that we
will be using in different parts of our script. It&#8217;s good practice to keep all
will be using in different parts of our script. Its good practice to keep all
imports at the beginning of the file, as they are available globally
throughout our script. All the libraries imported in this example are already
present in your environment since they are prerequisites for the Catalyst
@@ -896,7 +899,7 @@ the <code class="docutils literal"><span class="pre">scikit-learn</span></code>
</div>
</div>
<div class="section" id="jupyter-notebook">
<h2>Jupyter Notebook<a class="headerlink" href="#jupyter-notebook" title="Permalink to this headline"></a></h2>
<span id="jupyter"></span><h2>Jupyter Notebook<a class="headerlink" href="#jupyter-notebook" title="Permalink to this headline"></a></h2>
<p>(<a class="reference external" href="https://github.com/enigmampc/catalyst/blob/master/catalyst/examples/running_catalyst_in_jupyter_notebook.ipynb">This is actual Notebook</a> referenced in the text below)</p>
<p>The <a class="reference external" href="https://jupyter.org/">Jupyter Notebook</a> is a very powerful
browser-based interface to a Python interpreter. As it is already the
@@ -907,16 +910,16 @@ running algorithms through the command line.</p>
<div class="section" id="install">
<h3>Install<a class="headerlink" href="#install" title="Permalink to this headline"></a></h3>
<p>In order to use Jupyter Notebook, you first have to install it inside your
environment. It&#8217;s available as <code class="docutils literal"><span class="pre">pip</span></code> package, so regardless of how you
environment. Its available as <code class="docutils literal"><span class="pre">pip</span></code> package, so regardless of how you
installed Catalyst, go inside your catalyst environemnt and run:</p>
<div class="code bash highlight-python"><div class="highlight"><pre><span></span>(catalyst)$ pip install jupyter
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>catalyst<span class="o">)</span>$ pip install jupyter
</pre></div>
</div>
<p>Once you have Jupyter Notebook installed, every time you want to use it run:</p>
<div class="code bash highlight-python"><div class="highlight"><pre><span></span>(catalyst)$ jupyter notebook
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>catalyst<span class="o">)</span>$ jupyter notebook
</pre></div>
</div>
<p>A local server will launch, and will open a new window on your browser. That&#8217;s
<p>A local server will launch, and will open a new window on your browser. Thats
the interface through which you will interact with Jupyter Notebook.</p>
</div>
<div class="section" id="running-algorithms">
@@ -924,7 +927,7 @@ the interface through which you will interact with Jupyter Notebook.</p>
<p>Before running your algorithms inside the Jupyter Notebook, remember to ingest
the data from the command line interface (CLI). In the example below, you would
need to run first:</p>
<div class="code bash highlight-python"><div class="highlight"><pre><span></span>catalyst ingest-exchange -x bitfinex -i btc_usd
<div class="highlight-bash"><div class="highlight"><pre><span></span>catalyst ingest-exchange -x bitfinex -i btc_usd
</pre></div>
</div>
<p>To use Catalyst inside a Jupyter Noebook, you have to write your algorithm in a
@@ -935,152 +938,152 @@ takes the same arguments as the command line interface. Thus to run the
algorithm just supply the same parameters as the CLI but without the -f
and -o arguments. We just have to execute the following cell after
importing <code class="docutils literal"><span class="pre">catalyst</span></code> to register the magic.</p>
<div class="code python highlight-python"><div class="highlight"><pre><span></span># Register the catalyst magic
%load_ext catalyst
<div class="code python highlight-python"><div class="highlight"><pre><span></span><span class="c1"># Register the catalyst magic</span>
<span class="o">%</span><span class="n">load_ext</span> <span class="n">catalyst</span>
</pre></div>
</div>
<div class="code python highlight-python"><div class="highlight"><pre><span></span># Setup matplotlib to display graphs inline in this Notebook
%matplotlib inline
<div class="code python highlight-python"><div class="highlight"><pre><span></span><span class="c1"># Setup matplotlib to display graphs inline in this Notebook</span>
<span class="o">%</span><span class="n">matplotlib</span> <span class="n">inline</span>
</pre></div>
</div>
<p>Note below that we do not have to specify an input file (-f) since the
magic will use the contents of the cell and look for your algorithm
functions.</p>
<div class="code python highlight-python"><div class="highlight"><pre><span></span>%%catalyst --start 2015-3-2 --end 2017-6-28 --capital-base 100000 -x bitfinex -c usd
<div class="code python highlight-python"><div class="highlight"><pre><span></span><span class="o">%%</span><span class="n">catalyst</span> <span class="o">--</span><span class="n">start</span> <span class="mi">2015</span><span class="o">-</span><span class="mi">3</span><span class="o">-</span><span class="mi">2</span> <span class="o">--</span><span class="n">end</span> <span class="mi">2017</span><span class="o">-</span><span class="mi">6</span><span class="o">-</span><span class="mi">28</span> <span class="o">--</span><span class="n">capital</span><span class="o">-</span><span class="n">base</span> <span class="mi">100000</span> <span class="o">-</span><span class="n">x</span> <span class="n">bitfinex</span> <span class="o">-</span><span class="n">c</span> <span class="n">usd</span>
from catalyst.finance.slippage import VolumeShareSlippage
<span class="kn">from</span> <span class="nn">catalyst.finance.slippage</span> <span class="kn">import</span> <span class="n">VolumeShareSlippage</span>
from catalyst.api import (
order_target_value,
symbol,
record,
cancel_order,
get_open_orders,
)
<span class="kn">from</span> <span class="nn">catalyst.api</span> <span class="kn">import</span> <span class="p">(</span>
<span class="n">order_target_value</span><span class="p">,</span>
<span class="n">symbol</span><span class="p">,</span>
<span class="n">record</span><span class="p">,</span>
<span class="n">cancel_order</span><span class="p">,</span>
<span class="n">get_open_orders</span><span class="p">,</span>
<span class="p">)</span>
def initialize(context):
context.ASSET_NAME = &#39;btc_usd&#39;
context.TARGET_HODL_RATIO = 0.8
context.RESERVE_RATIO = 1.0 - context.TARGET_HODL_RATIO
<span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">context</span><span class="p">):</span>
<span class="n">context</span><span class="o">.</span><span class="n">ASSET_NAME</span> <span class="o">=</span> <span class="s1">&#39;btc_usd&#39;</span>
<span class="n">context</span><span class="o">.</span><span class="n">TARGET_HODL_RATIO</span> <span class="o">=</span> <span class="mf">0.8</span>
<span class="n">context</span><span class="o">.</span><span class="n">RESERVE_RATIO</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">-</span> <span class="n">context</span><span class="o">.</span><span class="n">TARGET_HODL_RATIO</span>
# For all trading pairs in the poloniex bundle, the default denomination
# currently supported by Catalyst is 1/1000th of a full coin. Use this
# constant to scale the price of up to that of a full coin if desired.
context.TICK_SIZE = 1000.0
<span class="c1"># For all trading pairs in the poloniex bundle, the default denomination</span>
<span class="c1"># currently supported by Catalyst is 1/1000th of a full coin. Use this</span>
<span class="c1"># constant to scale the price of up to that of a full coin if desired.</span>
<span class="n">context</span><span class="o">.</span><span class="n">TICK_SIZE</span> <span class="o">=</span> <span class="mf">1000.0</span>
context.is_buying = True
context.asset = symbol(context.ASSET_NAME)
<span class="n">context</span><span class="o">.</span><span class="n">is_buying</span> <span class="o">=</span> <span class="bp">True</span>
<span class="n">context</span><span class="o">.</span><span class="n">asset</span> <span class="o">=</span> <span class="n">symbol</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">ASSET_NAME</span><span class="p">)</span>
context.i = 0
<span class="n">context</span><span class="o">.</span><span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
def handle_data(context, data):
context.i += 1
<span class="k">def</span> <span class="nf">handle_data</span><span class="p">(</span><span class="n">context</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="n">context</span><span class="o">.</span><span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
starting_cash = context.portfolio.starting_cash
target_hodl_value = context.TARGET_HODL_RATIO * starting_cash
reserve_value = context.RESERVE_RATIO * starting_cash
<span class="n">starting_cash</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">portfolio</span><span class="o">.</span><span class="n">starting_cash</span>
<span class="n">target_hodl_value</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">TARGET_HODL_RATIO</span> <span class="o">*</span> <span class="n">starting_cash</span>
<span class="n">reserve_value</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">RESERVE_RATIO</span> <span class="o">*</span> <span class="n">starting_cash</span>
# Cancel any outstanding orders
orders = get_open_orders(context.asset) or []
for order in orders:
cancel_order(order)
<span class="c1"># Cancel any outstanding orders</span>
<span class="n">orders</span> <span class="o">=</span> <span class="n">get_open_orders</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">asset</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">order</span> <span class="ow">in</span> <span class="n">orders</span><span class="p">:</span>
<span class="n">cancel_order</span><span class="p">(</span><span class="n">order</span><span class="p">)</span>
# Stop buying after passing the reserve threshold
cash = context.portfolio.cash
if cash &lt;= reserve_value:
context.is_buying = False
<span class="c1"># Stop buying after passing the reserve threshold</span>
<span class="n">cash</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">portfolio</span><span class="o">.</span><span class="n">cash</span>
<span class="k">if</span> <span class="n">cash</span> <span class="o">&lt;=</span> <span class="n">reserve_value</span><span class="p">:</span>
<span class="n">context</span><span class="o">.</span><span class="n">is_buying</span> <span class="o">=</span> <span class="bp">False</span>
# Retrieve current asset price from pricing data
price = data.current(context.asset, &#39;price&#39;)
<span class="c1"># Retrieve current asset price from pricing data</span>
<span class="n">price</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">current</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">asset</span><span class="p">,</span> <span class="s1">&#39;price&#39;</span><span class="p">)</span>
# Check if still buying and could (approximately) afford another purchase
if context.is_buying and cash &gt; price:
# Place order to make position in asset equal to target_hodl_value
order_target_value(
context.asset,
target_hodl_value,
limit_price=price*1.1,
)
<span class="c1"># Check if still buying and could (approximately) afford another purchase</span>
<span class="k">if</span> <span class="n">context</span><span class="o">.</span><span class="n">is_buying</span> <span class="ow">and</span> <span class="n">cash</span> <span class="o">&gt;</span> <span class="n">price</span><span class="p">:</span>
<span class="c1"># Place order to make position in asset equal to target_hodl_value</span>
<span class="n">order_target_value</span><span class="p">(</span>
<span class="n">context</span><span class="o">.</span><span class="n">asset</span><span class="p">,</span>
<span class="n">target_hodl_value</span><span class="p">,</span>
<span class="n">limit_price</span><span class="o">=</span><span class="n">price</span><span class="o">*</span><span class="mf">1.1</span><span class="p">,</span>
<span class="p">)</span>
record(
price=price,
volume=data.current(context.asset, &#39;volume&#39;),
cash=cash,
starting_cash=context.portfolio.starting_cash,
leverage=context.account.leverage,
)
<span class="n">record</span><span class="p">(</span>
<span class="n">price</span><span class="o">=</span><span class="n">price</span><span class="p">,</span>
<span class="n">volume</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">current</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">asset</span><span class="p">,</span> <span class="s1">&#39;volume&#39;</span><span class="p">),</span>
<span class="n">cash</span><span class="o">=</span><span class="n">cash</span><span class="p">,</span>
<span class="n">starting_cash</span><span class="o">=</span><span class="n">context</span><span class="o">.</span><span class="n">portfolio</span><span class="o">.</span><span class="n">starting_cash</span><span class="p">,</span>
<span class="n">leverage</span><span class="o">=</span><span class="n">context</span><span class="o">.</span><span class="n">account</span><span class="o">.</span><span class="n">leverage</span><span class="p">,</span>
<span class="p">)</span>
def analyze(context=None, results=None):
import matplotlib.pyplot as plt
<span class="k">def</span> <span class="nf">analyze</span><span class="p">(</span><span class="n">context</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">results</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="kn">as</span> <span class="nn">plt</span>
# Plot the portfolio and asset data.
ax1 = plt.subplot(611)
results[[&#39;portfolio_value&#39;]].plot(ax=ax1)
ax1.set_ylabel(&#39;Portfolio Value (USD)&#39;)
<span class="c1"># Plot the portfolio and asset data.</span>
<span class="n">ax1</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot</span><span class="p">(</span><span class="mi">611</span><span class="p">)</span>
<span class="n">results</span><span class="p">[[</span><span class="s1">&#39;portfolio_value&#39;</span><span class="p">]]</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax1</span><span class="p">)</span>
<span class="n">ax1</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s1">&#39;Portfolio Value (USD)&#39;</span><span class="p">)</span>
ax2 = plt.subplot(612, sharex=ax1)
ax2.set_ylabel(&#39;{asset} (USD)&#39;.format(asset=context.ASSET_NAME))
(context.TICK_SIZE * results[[&#39;price&#39;]]).plot(ax=ax2)
<span class="n">ax2</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot</span><span class="p">(</span><span class="mi">612</span><span class="p">,</span> <span class="n">sharex</span><span class="o">=</span><span class="n">ax1</span><span class="p">)</span>
<span class="n">ax2</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s1">&#39;{asset} (USD)&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">asset</span><span class="o">=</span><span class="n">context</span><span class="o">.</span><span class="n">ASSET_NAME</span><span class="p">))</span>
<span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">TICK_SIZE</span> <span class="o">*</span> <span class="n">results</span><span class="p">[[</span><span class="s1">&#39;price&#39;</span><span class="p">]])</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax2</span><span class="p">)</span>
trans = results.ix[[t != [] for t in results.transactions]]
buys = trans.ix[
[t[0][&#39;amount&#39;] &gt; 0 for t in trans.transactions]
]
ax2.plot(
buys.index,
context.TICK_SIZE * results.price[buys.index],
&#39;^&#39;,
markersize=10,
color=&#39;g&#39;,
)
<span class="n">trans</span> <span class="o">=</span> <span class="n">results</span><span class="o">.</span><span class="n">ix</span><span class="p">[[</span><span class="n">t</span> <span class="o">!=</span> <span class="p">[]</span> <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">results</span><span class="o">.</span><span class="n">transactions</span><span class="p">]]</span>
<span class="n">buys</span> <span class="o">=</span> <span class="n">trans</span><span class="o">.</span><span class="n">ix</span><span class="p">[</span>
<span class="p">[</span><span class="n">t</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">&#39;amount&#39;</span><span class="p">]</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">trans</span><span class="o">.</span><span class="n">transactions</span><span class="p">]</span>
<span class="p">]</span>
<span class="n">ax2</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span>
<span class="n">buys</span><span class="o">.</span><span class="n">index</span><span class="p">,</span>
<span class="n">context</span><span class="o">.</span><span class="n">TICK_SIZE</span> <span class="o">*</span> <span class="n">results</span><span class="o">.</span><span class="n">price</span><span class="p">[</span><span class="n">buys</span><span class="o">.</span><span class="n">index</span><span class="p">],</span>
<span class="s1">&#39;^&#39;</span><span class="p">,</span>
<span class="n">markersize</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span>
<span class="n">color</span><span class="o">=</span><span class="s1">&#39;g&#39;</span><span class="p">,</span>
<span class="p">)</span>
ax3 = plt.subplot(613, sharex=ax1)
results[[&#39;leverage&#39;, &#39;alpha&#39;, &#39;beta&#39;]].plot(ax=ax3)
ax3.set_ylabel(&#39;Leverage &#39;)
<span class="n">ax3</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot</span><span class="p">(</span><span class="mi">613</span><span class="p">,</span> <span class="n">sharex</span><span class="o">=</span><span class="n">ax1</span><span class="p">)</span>
<span class="n">results</span><span class="p">[[</span><span class="s1">&#39;leverage&#39;</span><span class="p">,</span> <span class="s1">&#39;alpha&#39;</span><span class="p">,</span> <span class="s1">&#39;beta&#39;</span><span class="p">]]</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax3</span><span class="p">)</span>
<span class="n">ax3</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s1">&#39;Leverage &#39;</span><span class="p">)</span>
ax4 = plt.subplot(614, sharex=ax1)
results[[&#39;starting_cash&#39;, &#39;cash&#39;]].plot(ax=ax4)
ax4.set_ylabel(&#39;Cash (USD)&#39;)
<span class="n">ax4</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot</span><span class="p">(</span><span class="mi">614</span><span class="p">,</span> <span class="n">sharex</span><span class="o">=</span><span class="n">ax1</span><span class="p">)</span>
<span class="n">results</span><span class="p">[[</span><span class="s1">&#39;starting_cash&#39;</span><span class="p">,</span> <span class="s1">&#39;cash&#39;</span><span class="p">]]</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax4</span><span class="p">)</span>
<span class="n">ax4</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s1">&#39;Cash (USD)&#39;</span><span class="p">)</span>
results[[
&#39;treasury&#39;,
&#39;algorithm&#39;,
&#39;benchmark&#39;,
]] = results[[
&#39;treasury_period_return&#39;,
&#39;algorithm_period_return&#39;,
&#39;benchmark_period_return&#39;,
]]
<span class="n">results</span><span class="p">[[</span>
<span class="s1">&#39;treasury&#39;</span><span class="p">,</span>
<span class="s1">&#39;algorithm&#39;</span><span class="p">,</span>
<span class="s1">&#39;benchmark&#39;</span><span class="p">,</span>
<span class="p">]]</span> <span class="o">=</span> <span class="n">results</span><span class="p">[[</span>
<span class="s1">&#39;treasury_period_return&#39;</span><span class="p">,</span>
<span class="s1">&#39;algorithm_period_return&#39;</span><span class="p">,</span>
<span class="s1">&#39;benchmark_period_return&#39;</span><span class="p">,</span>
<span class="p">]]</span>
ax5 = plt.subplot(615, sharex=ax1)
results[[
&#39;treasury&#39;,
&#39;algorithm&#39;,
&#39;benchmark&#39;,
]].plot(ax=ax5)
ax5.set_ylabel(&#39;Percent Change&#39;)
<span class="n">ax5</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot</span><span class="p">(</span><span class="mi">615</span><span class="p">,</span> <span class="n">sharex</span><span class="o">=</span><span class="n">ax1</span><span class="p">)</span>
<span class="n">results</span><span class="p">[[</span>
<span class="s1">&#39;treasury&#39;</span><span class="p">,</span>
<span class="s1">&#39;algorithm&#39;</span><span class="p">,</span>
<span class="s1">&#39;benchmark&#39;</span><span class="p">,</span>
<span class="p">]]</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax5</span><span class="p">)</span>
<span class="n">ax5</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s1">&#39;Percent Change&#39;</span><span class="p">)</span>
ax6 = plt.subplot(616, sharex=ax1)
results[[&#39;volume&#39;]].plot(ax=ax6)
ax6.set_ylabel(&#39;Volume (mCoins/5min)&#39;)
<span class="n">ax6</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot</span><span class="p">(</span><span class="mi">616</span><span class="p">,</span> <span class="n">sharex</span><span class="o">=</span><span class="n">ax1</span><span class="p">)</span>
<span class="n">results</span><span class="p">[[</span><span class="s1">&#39;volume&#39;</span><span class="p">]]</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax6</span><span class="p">)</span>
<span class="n">ax6</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s1">&#39;Volume (mCoins/5min)&#39;</span><span class="p">)</span>
plt.legend(loc=3)
<span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
# Show the plot.
plt.gcf().set_size_inches(18, 8)
plt.show()
<span class="c1"># Show the plot.</span>
<span class="n">plt</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">set_size_inches</span><span class="p">(</span><span class="mi">18</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span></span>[2017-08-11 07:19:46.411748] INFO: Loader: Loading benchmark data for &#39;USDT_BTC&#39; from 1989-12-31 00:00:00+00:00 to 2017-08-09 00:00:00+00:00
[2017-08-11 07:19:46.418983] INFO: Loader: Loading data for /Users/&lt;snipped&gt;/.catalyst/data/USDT_BTC_benchmark.csv failed with error [Unknown string format].
[2017-08-11 07:19:46.419740] INFO: Loader: Cache at /Users/&lt;snipped&gt;/.catalyst/data/USDT_BTC_benchmark.csv does not have data from 1990-01-01 00:00:00+00:00 to 2017-08-09 00:00:00+00:00.
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="p">[</span><span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">11</span> <span class="mo">07</span><span class="p">:</span><span class="mi">19</span><span class="p">:</span><span class="mf">46.411748</span><span class="p">]</span> <span class="n">INFO</span><span class="p">:</span> <span class="n">Loader</span><span class="p">:</span> <span class="n">Loading</span> <span class="n">benchmark</span> <span class="n">data</span> <span class="k">for</span> <span class="s1">&#39;USDT_BTC&#39;</span> <span class="kn">from</span> <span class="mi">1989</span><span class="o">-</span><span class="mi">12</span><span class="o">-</span><span class="mi">31</span> <span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="o">+</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span> <span class="n">to</span> <span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">09</span> <span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="o">+</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span>
<span class="p">[</span><span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">11</span> <span class="mo">07</span><span class="p">:</span><span class="mi">19</span><span class="p">:</span><span class="mf">46.418983</span><span class="p">]</span> <span class="n">INFO</span><span class="p">:</span> <span class="n">Loader</span><span class="p">:</span> <span class="n">Loading</span> <span class="n">data</span> <span class="k">for</span> <span class="o">/</span><span class="n">Users</span><span class="o">/&lt;</span><span class="n">snipped</span><span class="o">&gt;/.</span><span class="n">catalyst</span><span class="o">/</span><span class="n">data</span><span class="o">/</span><span class="n">USDT_BTC_benchmark</span><span class="o">.</span><span class="n">csv</span> <span class="n">failed</span> <span class="k">with</span> <span class="n">error</span> <span class="p">[</span><span class="n">Unknown</span> <span class="n">string</span> <span class="n">format</span><span class="p">]</span><span class="o">.</span>
<span class="p">[</span><span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">11</span> <span class="mo">07</span><span class="p">:</span><span class="mi">19</span><span class="p">:</span><span class="mf">46.419740</span><span class="p">]</span> <span class="n">INFO</span><span class="p">:</span> <span class="n">Loader</span><span class="p">:</span> <span class="n">Cache</span> <span class="n">at</span> <span class="o">/</span><span class="n">Users</span><span class="o">/&lt;</span><span class="n">snipped</span><span class="o">&gt;/.</span><span class="n">catalyst</span><span class="o">/</span><span class="n">data</span><span class="o">/</span><span class="n">USDT_BTC_benchmark</span><span class="o">.</span><span class="n">csv</span> <span class="n">does</span> <span class="ow">not</span> <span class="n">have</span> <span class="n">data</span> <span class="kn">from</span> <span class="mi">1990</span><span class="o">-</span><span class="mo">01</span><span class="o">-</span><span class="mo">01</span> <span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="o">+</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span> <span class="n">to</span> <span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">09</span> <span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="o">+</span><span class="mo">00</span><span class="p">:</span><span class="mf">00.</span>
[2017-08-11 07:19:46.420770] INFO: Loader: Downloading benchmark data for &#39;USDT_BTC&#39; from 1989-12-31 00:00:00+00:00 to 2017-08-09 00:00:00+00:00
[2017-08-11 07:19:50.060244] WARNING: Loader: Still don&#39;t have expected data after redownload!
[2017-08-11 07:19:50.097334] WARNING: Loader: Refusing to download new treasury data because a download succeeded at 2017-08-11 06:56:49+00:00.
[2017-08-11 07:19:54.618399] INFO: Performance: Simulated 851 trading days out of 851.
[2017-08-11 07:19:54.619301] INFO: Performance: first open: 2015-03-01 00:00:00+00:00
[2017-08-11 07:19:54.620430] INFO: Performance: last close: 2017-06-28 23:59:00+00:00
<span class="p">[</span><span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">11</span> <span class="mo">07</span><span class="p">:</span><span class="mi">19</span><span class="p">:</span><span class="mf">46.420770</span><span class="p">]</span> <span class="n">INFO</span><span class="p">:</span> <span class="n">Loader</span><span class="p">:</span> <span class="n">Downloading</span> <span class="n">benchmark</span> <span class="n">data</span> <span class="k">for</span> <span class="s1">&#39;USDT_BTC&#39;</span> <span class="kn">from</span> <span class="mi">1989</span><span class="o">-</span><span class="mi">12</span><span class="o">-</span><span class="mi">31</span> <span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="o">+</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span> <span class="n">to</span> <span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">09</span> <span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="o">+</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span>
<span class="p">[</span><span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">11</span> <span class="mo">07</span><span class="p">:</span><span class="mi">19</span><span class="p">:</span><span class="mf">50.060244</span><span class="p">]</span> <span class="n">WARNING</span><span class="p">:</span> <span class="n">Loader</span><span class="p">:</span> <span class="n">Still</span> <span class="n">don</span><span class="s1">&#39;t have expected data after redownload!</span>
<span class="p">[</span><span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">11</span> <span class="mo">07</span><span class="p">:</span><span class="mi">19</span><span class="p">:</span><span class="mf">50.097334</span><span class="p">]</span> <span class="n">WARNING</span><span class="p">:</span> <span class="n">Loader</span><span class="p">:</span> <span class="n">Refusing</span> <span class="n">to</span> <span class="n">download</span> <span class="n">new</span> <span class="n">treasury</span> <span class="n">data</span> <span class="n">because</span> <span class="n">a</span> <span class="n">download</span> <span class="n">succeeded</span> <span class="n">at</span> <span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">11</span> <span class="mo">06</span><span class="p">:</span><span class="mi">56</span><span class="p">:</span><span class="mi">49</span><span class="o">+</span><span class="mo">00</span><span class="p">:</span><span class="mf">00.</span>
<span class="p">[</span><span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">11</span> <span class="mo">07</span><span class="p">:</span><span class="mi">19</span><span class="p">:</span><span class="mf">54.618399</span><span class="p">]</span> <span class="n">INFO</span><span class="p">:</span> <span class="n">Performance</span><span class="p">:</span> <span class="n">Simulated</span> <span class="mi">851</span> <span class="n">trading</span> <span class="n">days</span> <span class="n">out</span> <span class="n">of</span> <span class="mf">851.</span>
<span class="p">[</span><span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">11</span> <span class="mo">07</span><span class="p">:</span><span class="mi">19</span><span class="p">:</span><span class="mf">54.619301</span><span class="p">]</span> <span class="n">INFO</span><span class="p">:</span> <span class="n">Performance</span><span class="p">:</span> <span class="n">first</span> <span class="nb">open</span><span class="p">:</span> <span class="mi">2015</span><span class="o">-</span><span class="mo">03</span><span class="o">-</span><span class="mo">01</span> <span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span><span class="o">+</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span>
<span class="p">[</span><span class="mi">2017</span><span class="o">-</span><span class="mi">08</span><span class="o">-</span><span class="mi">11</span> <span class="mo">07</span><span class="p">:</span><span class="mi">19</span><span class="p">:</span><span class="mf">54.620430</span><span class="p">]</span> <span class="n">INFO</span><span class="p">:</span> <span class="n">Performance</span><span class="p">:</span> <span class="n">last</span> <span class="n">close</span><span class="p">:</span> <span class="mi">2017</span><span class="o">-</span><span class="mo">06</span><span class="o">-</span><span class="mi">28</span> <span class="mi">23</span><span class="p">:</span><span class="mi">59</span><span class="p">:</span><span class="mo">00</span><span class="o">+</span><span class="mo">00</span><span class="p">:</span><span class="mo">00</span>
</pre></div>
</div>
<div class="figure">
@@ -2450,7 +2453,7 @@ def analyze(context=None, results=None):
</td><td><p>7.135895</p>
</td><td><p>9.470831</p>
</td></tr></tbody></table><p><p>851 rows × 45 columns</p>
</p></div><p>Also, instead of defining an output file we are accessing it via the “_&#8221;
</p></div><p>Also, instead of defining an output file we are accessing it via the “_
variable that will be created in the name space and contain the
performance DataFrame.</p>
<div class="code python highlight-python"><div class="highlight"><pre><span></span><span class="n">_</span><span class="o">.</span><span class="n">head</span><span class="p">()</span>
@@ -2594,7 +2597,7 @@ performance DataFrame.</p>
<h2>Next steps<a class="headerlink" href="#next-steps" title="Permalink to this headline"></a></h2>
<p>We hope that this tutorial gave you a little insight into the
architecture, API, and features of Catalyst. For next steps, check
out some of the other <a class="reference internal" href="example-algos.html"><em>example algorithms</em></a>.</p>
out some of the other <a class="reference internal" href="example-algos.html"><span class="doc">example algorithms</span></a>.</p>
<p>Feel free to ask questions on the <code class="docutils literal"><span class="pre">#catalyst_dev</span></code> channel of our
<a class="reference external" href="https://discord.gg/SJK32GY">Discord group</a> and report
problems on our <a class="reference external" href="https://github.com/enigmampc/catalyst/issues">GitHub issue tracker</a>.</p>
@@ -2649,7 +2652,7 @@ problems on our <a class="reference external" href="https://github.com/enigmampc
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+16 -13
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
@@ -142,7 +145,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/bundles.txt" rel="nofollow"> View page source</a>
<a href="_sources/bundles.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -197,7 +200,7 @@ involve downloading and processing a lot of data. This can be run with:</p>
</pre></div>
</div>
<p>where <code class="docutils literal"><span class="pre">&lt;bundle&gt;</span></code> is the name of the bundle to ingest, defaulting to
<a class="reference internal" href="#quantopian-quandl-mirror"><span>quantopian-quandl</span></a>.</p>
<a class="reference internal" href="#quantopian-quandl-mirror"><span class="std std-ref">quantopian-quandl</span></a>.</p>
</div>
<div class="section" id="old-data">
<h2>Old Data<a class="headerlink" href="#old-data" title="Permalink to this headline"></a></h2>
@@ -208,7 +211,7 @@ copies. Running a backtest with an old ingestion makes it easier to reproduce
backtest results later.</p>
<p>One drawback of saving all of the data by default is that the data directory
may grow quite large even if you do not want to use the data. As shown earlier,
we can list all of the ingestions with the <a class="reference internal" href="#bundles-command"><span>bundles command</span></a>. To solve the problem of leaking old data there is another
we can list all of the ingestions with the <a class="reference internal" href="#bundles-command"><span class="std std-ref">bundles command</span></a>. To solve the problem of leaking old data there is another
command: <code class="docutils literal"><span class="pre">clean</span></code>, which will clear data bundles based on some time
constraints.</p>
<p>For example:</p>
@@ -247,7 +250,7 @@ current day to use the most recent data.</p>
<h2>Default Data Bundles<a class="headerlink" href="#default-data-bundles" title="Permalink to this headline"></a></h2>
<div class="section" id="quandl-wiki-bundle">
<span id="quandl-data-bundle"></span><h3>Quandl WIKI Bundle<a class="headerlink" href="#quandl-wiki-bundle" title="Permalink to this headline"></a></h3>
<p>By default zipline comes with the <code class="docutils literal"><span class="pre">quandl</span></code> data bundle which uses quandl&#8217;s
<p>By default zipline comes with the <code class="docutils literal"><span class="pre">quandl</span></code> data bundle which uses quandls
<a class="reference external" href="https://www.quandl.com/data/WIKI">WIKI dataset</a>. The quandl data bundle
includes daily pricing data, splits, cash dividends, and asset metadata. To
ingest the <code class="docutils literal"><span class="pre">quandl</span></code> data bundle we recommend creating an account on quandl.com
@@ -313,7 +316,7 @@ different names.</p>
zipline. To add a new bundle, one must implement an <code class="docutils literal"><span class="pre">ingest</span></code> function.</p>
<p>The <code class="docutils literal"><span class="pre">ingest</span></code> function is responsible for loading the data into memory and
passing it to a set of writer objects provided by zipline to convert the data to
zipline&#8217;s internal format. The ingest function may work by downloading data from
ziplines internal format. The ingest function may work by downloading data from
a remote location like the <code class="docutils literal"><span class="pre">quandl</span></code> bundle or yahoo bundles or it may just
load files that are already on the machine. The function is provided with
writers that will write the data to the correct location transactionally. If an
@@ -354,7 +357,7 @@ docs for write.</p>
<h3><code class="docutils literal"><span class="pre">minute_bar_writer</span></code><a class="headerlink" href="#minute-bar-writer" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal"><span class="pre">minute_bar_writer</span></code> is an instance of
<code class="xref py py-class docutils literal"><span class="pre">BcolzMinuteBarWriter</span></code>. This writer is used to
convert data to zipline&#8217;s internal bcolz format to later be read by a
convert data to ziplines internal bcolz format to later be read by a
<code class="xref py py-class docutils literal"><span class="pre">BcolzMinuteBarReader</span></code>. If minute data is
provided, users should call
<code class="xref py py-meth docutils literal"><span class="pre">write()</span></code> with an iterable of
@@ -376,7 +379,7 @@ as the dates are strictly increasing.</p>
<h3><code class="docutils literal"><span class="pre">daily_bar_writer</span></code><a class="headerlink" href="#daily-bar-writer" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal"><span class="pre">daily_bar_writer</span></code> is an instance of
<code class="xref py py-class docutils literal"><span class="pre">BcolzDailyBarWriter</span></code>. This writer is
used to convert data into zipline&#8217;s internal bcolz format to later be read by a
used to convert data into ziplines internal bcolz format to later be read by a
<code class="xref py py-class docutils literal"><span class="pre">BcolzDailyBarReader</span></code>. If daily data is
provided, users should call
<code class="xref py py-meth docutils literal"><span class="pre">write()</span></code> with an iterable of
@@ -413,12 +416,12 @@ help some bundles generate queries for the days needed.</p>
</div>
<div class="section" id="start-session">
<h3><code class="docutils literal"><span class="pre">start_session</span></code><a class="headerlink" href="#start-session" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal"><span class="pre">start_session</span></code> is a <code class="xref py py-class docutils literal"><span class="pre">pandas.Timestamp</span></code> object indicating the first
<p><code class="docutils literal"><span class="pre">start_session</span></code> is a <a class="reference external" href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Timestamp.html#pandas.Timestamp" title="(in pandas v0.22.0)"><code class="xref py py-class docutils literal"><span class="pre">pandas.Timestamp</span></code></a> object indicating the first
day that the bundle should load data for.</p>
</div>
<div class="section" id="end-session">
<h3><code class="docutils literal"><span class="pre">end_session</span></code><a class="headerlink" href="#end-session" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal"><span class="pre">end_session</span></code> is a <code class="xref py py-class docutils literal"><span class="pre">pandas.Timestamp</span></code> object indicating the last day
<p><code class="docutils literal"><span class="pre">end_session</span></code> is a <a class="reference external" href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Timestamp.html#pandas.Timestamp" title="(in pandas v0.22.0)"><code class="xref py py-class docutils literal"><span class="pre">pandas.Timestamp</span></code></a> object indicating the last day
that the bundle should load data for.</p>
</div>
<div class="section" id="cache">
@@ -426,7 +429,7 @@ that the bundle should load data for.</p>
<p><code class="docutils literal"><span class="pre">cache</span></code> is an instance of <code class="xref py py-class docutils literal"><span class="pre">dataframe_cache</span></code>. This
object is a mapping from strings to dataframes. This object is provided in case
an ingestion crashes part way through. The idea is that the ingest function
should check the cache for raw data, if it doesn&#8217;t exist in the cache, it should
should check the cache for raw data, if it doesnt exist in the cache, it should
acquire it and then store it in the cache. Then it can parse and write the
data. The cache will be cleared only after a successful load, this prevents the
ingest function from needing to redownload all the data if there is some bug in
@@ -436,7 +439,7 @@ from another local file, then there is no need to use this cache.</p>
<div class="section" id="show-progress">
<h3><code class="docutils literal"><span class="pre">show_progress</span></code><a class="headerlink" href="#show-progress" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal"><span class="pre">show_progress</span></code> is a boolean indicating that the user would like to receive
feedback about the ingest function&#8217;s progress fetching and writing the
feedback about the ingest functions progress fetching and writing the
data. Some examples for where to show how many files you have downloaded out of
the total needed, or how far into some data conversion the ingest function
is. One tool that may help with implementing <code class="docutils literal"><span class="pre">show_progress</span></code> for a loop is
@@ -449,7 +452,7 @@ forwarded to <code class="docutils literal"><span class="pre">minute_bar_writer.
written. <code class="docutils literal"><span class="pre">output_dir</span></code> will be some subdirectory of <code class="docutils literal"><span class="pre">$ZIPLINE_ROOT</span></code> and will
contain the time of the start of the current ingestion. This can be used to
directly move resources here if for some reason your ingest function can produce
it&#8217;s own outputs without the writers. For example, the <code class="docutils literal"><span class="pre">quantopian:quandl</span></code>
its own outputs without the writers. For example, the <code class="docutils literal"><span class="pre">quantopian:quandl</span></code>
bundle uses this to directly untar the bundle into the <code class="docutils literal"><span class="pre">output_dir</span></code>.</p>
</div>
</div>
@@ -494,7 +497,7 @@ bundle uses this to directly untar the bundle into the <code class="docutils lit
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+17 -7
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
<link rel="next" title="Release Notes" href="releases.html"/>
<link rel="prev" title="Resources" href="resources.html"/>
@@ -92,8 +95,9 @@
<li class="toctree-l1"><a class="reference internal" href="utilities.html">Utilities</a></li>
<li class="toctree-l1"><a class="reference internal" href="videos.html">Videos</a></li>
<li class="toctree-l1"><a class="reference internal" href="resources.html">Resources</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Development Guidelines</a><ul>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Development Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#creating-a-development-environment">Creating a Development Environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="#development-with-docker">Development with Docker</a></li>
<li class="toctree-l2"><a class="reference internal" href="#git-branching-structure">Git Branching Structure</a></li>
<li class="toctree-l2"><a class="reference internal" href="#contributing-to-the-docs">Contributing to the Docs</a></li>
<li class="toctree-l2"><a class="reference internal" href="#commit-messages">Commit messages</a></li>
@@ -151,7 +155,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/development-guidelines.txt" rel="nofollow"> View page source</a>
<a href="_sources/development-guidelines.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -170,7 +174,7 @@
<p>All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome. We <a class="reference external" href="https://github.com/enigmampc/catalyst/issues">track issues</a> on <a class="reference external" href="https://github.com/enigmampc/catalyst">GitHub</a> and also have a <a class="reference external" href="https://discord.gg/SJK32GY">discord group</a> where you can ask questions.</p>
<div class="section" id="creating-a-development-environment">
<h2>Creating a Development Environment<a class="headerlink" href="#creating-a-development-environment" title="Permalink to this headline"></a></h2>
<p>First, you&#8217;ll need to clone Catalyst by running:</p>
<p>First, youll need to clone Catalyst by running:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ git clone git@github.com:enigmampc/catalyst.git
</pre></div>
</div>
@@ -178,7 +182,7 @@
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ git checkout -b some-short-descriptive-name
</pre></div>
</div>
<p>If you don&#8217;t already have them, you&#8217;ll need some C library dependencies. You can follow the <a class="reference external" href="install.html">install guide</a> to get the appropriate dependencies.</p>
<p>If you dont already have them, youll need some C library dependencies. You can follow the <a class="reference external" href="install.html">install guide</a> to get the appropriate dependencies.</p>
<p>The following section assumes you already have virtualenvwrapper and pip installed on your system. Suggested installation of Python library dependencies used for development:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ mkvirtualenv catalyst
$ ./etc/ordered_pip.sh ./etc/requirements.txt
@@ -190,7 +194,13 @@ $ pip install -r ./etc/requirements_blaze.txt
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ python setup.py build_ext --inplace
</pre></div>
</div>
<p>..If you want to work with zipline using a <a href="#id1"><span class="problematic" id="id2">`Docker`__</span></a> container, you&#8217;ll need to build the <code class="docutils literal"><span class="pre">Dockerfile</span></code> in the Zipline root directory, and then build <code class="docutils literal"><span class="pre">Dockerfile-dev</span></code>. Instructions for building both containers can be found in <code class="docutils literal"><span class="pre">Dockerfile</span></code> and <code class="docutils literal"><span class="pre">Dockerfile-dev</span></code>, respectively.</p>
</div>
<div class="section" id="development-with-docker">
<h2>Development with Docker<a class="headerlink" href="#development-with-docker" title="Permalink to this headline"></a></h2>
<p>If you want to work with zipline using a <a class="reference external" href="https://docs.docker.com/get-started/">Docker</a> container, youll need to
build the <code class="docutils literal"><span class="pre">Dockerfile</span></code> in the Zipline root directory, and then build
<code class="docutils literal"><span class="pre">Dockerfile-dev</span></code>. Instructions for building both containers can be found in
<code class="docutils literal"><span class="pre">Dockerfile</span></code> and <code class="docutils literal"><span class="pre">Dockerfile-dev</span></code>, respectively.</p>
</div>
<div class="section" id="git-branching-structure">
<h2>Git Branching Structure<a class="headerlink" href="#git-branching-structure" title="Permalink to this headline"></a></h2>
@@ -199,7 +209,7 @@ $ pip install -r ./etc/requirements_blaze.txt
</div>
<div class="section" id="contributing-to-the-docs">
<h2>Contributing to the Docs<a class="headerlink" href="#contributing-to-the-docs" title="Permalink to this headline"></a></h2>
<p>If you&#8217;d like to contribute to the documentation on enigmampc.github.io, you can navigate to <code class="docutils literal"><span class="pre">docs/source/</span></code> where each <a class="reference external" href="https://en.wikipedia.org/wiki/ReStructuredText">reStructuredText</a> file is a separate section there. To add a section, create a new file called <code class="docutils literal"><span class="pre">some-descriptive-name.rst</span></code> and add <code class="docutils literal"><span class="pre">some-descriptive-name</span></code> to <code class="docutils literal"><span class="pre">index.rst</span></code>. To edit a section, simply open up one of the existing files, make your changes, and save them.</p>
<p>If youd like to contribute to the documentation on enigmampc.github.io, you can navigate to <code class="docutils literal"><span class="pre">docs/source/</span></code> where each <a class="reference external" href="https://en.wikipedia.org/wiki/ReStructuredText">reStructuredText</a> file is a separate section there. To add a section, create a new file called <code class="docutils literal"><span class="pre">some-descriptive-name.rst</span></code> and add <code class="docutils literal"><span class="pre">some-descriptive-name</span></code> to <code class="docutils literal"><span class="pre">index.rst</span></code>. To edit a section, simply open up one of the existing files, make your changes, and save them.</p>
<p>We use <a class="reference external" href="http://www.sphinx-doc.org/en/stable/">Sphinx</a> to generate documentation for Catalyst, which you will need to install by running:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install -r ./etc/requirements_docs.txt
</pre></div>
@@ -315,7 +325,7 @@ the algorithm has little cash on hand.
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+16 -13
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
<link rel="next" title="Utilities" href="utilities.html"/>
<link rel="prev" title="Features" href="features.html"/>
@@ -88,7 +91,7 @@
<li class="toctree-l1"><a class="reference internal" href="beginner-tutorial.html">Catalyst Beginner Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="live-trading.html">Live Trading</a></li>
<li class="toctree-l1"><a class="reference internal" href="features.html">Features</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Example Algorithms</a><ul>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Example Algorithms</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#overview">Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="#buy-btc-simple-algorithm">Buy BTC Simple Algorithm</a></li>
<li class="toctree-l2"><a class="reference internal" href="#buy-and-hodl-algorithm">Buy and Hodl Algorithm</a></li>
@@ -153,7 +156,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/example-algos.txt" rel="nofollow"> View page source</a>
<a href="_sources/example-algos.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -177,29 +180,29 @@ using Catalyst.</p>
<div class="section" id="overview">
<h2>Overview<a class="headerlink" href="#overview" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><a class="reference internal" href="#buy-btc-simple"><span>Buy BTC Simple</span></a>: The simplest algorithm that introduces
<li><a class="reference internal" href="#buy-btc-simple"><span class="std std-ref">Buy BTC Simple</span></a>: The simplest algorithm that introduces
the <code class="docutils literal"><span class="pre">initialize()</span></code> and <code class="docutils literal"><span class="pre">handle_data()</span></code> functions, and is used in the
<a class="reference internal" href="beginner-tutorial.html"><em>beginner tutorial</em></a> to show how to run catalyst
<a class="reference internal" href="beginner-tutorial.html"><span class="doc">beginner tutorial</span></a> to show how to run catalyst
for the first time.</li>
<li><a class="reference internal" href="#buy-and-hodl"><span>Buy and Hodl</span></a>: A very straightforward <em>buy and hold</em> that
<li><a class="reference internal" href="#buy-and-hodl"><span class="std std-ref">Buy and Hodl</span></a>: A very straightforward <em>buy and hold</em> that
makes one single buy at the very beginning. Introduces the notions of
<code class="docutils literal"><span class="pre">cash</span></code>, management of outstanding <code class="docutils literal"><span class="pre">orders</span></code>, and <code class="docutils literal"><span class="pre">order_target_value</span></code>
to place orders. It also introduces the <code class="docutils literal"><span class="pre">analyze()</span></code> function to visualize
the performance of our strategy using the external library <code class="docutils literal"><span class="pre">matplotlib</span></code>.</li>
<li><a class="reference internal" href="#dual-moving-average"><span>Dual Moving Average Crossover</span></a>: A classic momentum
<li><a class="reference internal" href="#dual-moving-average"><span class="std std-ref">Dual Moving Average Crossover</span></a>: A classic momentum
strategy used in the second part of the
<a class="reference external" href="beginner-tutorial.html#history">beginner tutorial</a> to introduce the
<code class="docutils literal"><span class="pre">data.history()</span></code> function. It makes a heavy use of <code class="docutils literal"><span class="pre">matplotlib</span></code> library
in the <code class="docutils literal"><span class="pre">analyze()</span></code> function to chart the performance of the algorithm.</li>
<li><a class="reference internal" href="#mean-reversion"><span>Mean Reversion Algorithm</span></a>: Another simple momentum
<li><a class="reference internal" href="#mean-reversion"><span class="std std-ref">Mean Reversion Algorithm</span></a>: Another simple momentum
strategy that is used in our
<a class="reference external" href="videos.html#backtesting-a-strategy">two-part video tutorial</a> to show how
to get started in backtesting and live trading with Catalyst.</li>
<li><a class="reference internal" href="#simple-universe"><span>Simple Universe</span></a>: This code provides the &#8216;universe&#8217;
<li><a class="reference internal" href="#simple-universe"><span class="std std-ref">Simple Universe</span></a>: This code provides the universe
of available trading pairs on a given exchange on any given day. You can use
this code to dynamically select which currency pairs you want to trade each
day of your strategy. This example does not make any trades.</li>
<li><a class="reference internal" href="#portfolio-optimization"><span>Portfolio Optimization</span></a>: Use this code to
<li><a class="reference internal" href="#portfolio-optimization"><span class="std std-ref">Portfolio Optimization</span></a>: Use this code to
execute a portfolio optimization model. This strategy will select the
portfolio with the maximum Sharpe Ratio. The parameters are set to use 180
days of historical data and rebalance every 30 days. This code was used in
@@ -261,7 +264,7 @@ end of the file:</p>
plot the resulting performance using the matplotlib library. You can choose any
date interval with the <code class="docutils literal"><span class="pre">--start</span></code> and <code class="docutils literal"><span class="pre">--end</span></code> parameters, but bear in mind
that 2015-3-1 is the earliest date that Catalyst supports (if you choose an
earlier date, you&#8217;ll get an error), and the most recent date you can choose is
earlier date, youll get an error), and the most recent date you can choose is
one day prior to the current date.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="ch">#!/usr/bin/env python</span>
<span class="c1">#</span>
@@ -581,8 +584,8 @@ one day prior to the current date.</p>
<span id="mean-reversion"></span><h2>Mean Reversion Algorithm<a class="headerlink" href="#mean-reversion-algorithm" title="Permalink to this headline"></a></h2>
<p>Source code: <a class="reference external" href="https://github.com/enigmampc/catalyst/blob/master/catalyst/examples/mean_reversion_simple.py">examples/mean_reversion_simple.py</a></p>
<p>This algorithm is based on a simple momentum strategy. When the cryptoasset goes
up quickly, we&#8217;re going to buy; when it goes down quickly, we&#8217;re going to sell.
Hopefully, we&#8217;ll ride the waves.</p>
up quickly, were going to buy; when it goes down quickly, were going to sell.
Hopefully, well ride the waves.</p>
<p>We are choosing to backtest this trading algorithm with the <code class="docutils literal"><span class="pre">neo_usd</span></code> currency
pairon the <code class="docutils literal"><span class="pre">Bitfinex</span></code> exchange. Thus, first ingest the historical pricing data
that we need, with minute resolution:</p>
@@ -1227,7 +1230,7 @@ in writting the following article:
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+30 -27
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
<link rel="next" title="Example Algorithms" href="example-algos.html"/>
<link rel="prev" title="Live Trading" href="live-trading.html"/>
@@ -87,7 +90,7 @@
<li class="toctree-l1"><a class="reference internal" href="install.html">Install</a></li>
<li class="toctree-l1"><a class="reference internal" href="beginner-tutorial.html">Catalyst Beginner Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="live-trading.html">Live Trading</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Features</a><ul>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Features</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#current-functionality">Current Functionality</a></li>
<li class="toctree-l2"><a class="reference internal" href="#upcoming-features">Upcoming features</a></li>
<li class="toctree-l2"><a class="reference internal" href="#naming-convention">Naming Convention</a></li>
@@ -149,7 +152,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/features.txt" rel="nofollow"> View page source</a>
<a href="_sources/features.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -184,7 +187,7 @@ details.</li>
structure in backtesting and paper trading.</li>
<li>Standardized naming convention for all asset pairs trading on any exchange in
the form <code class="docutils literal"><span class="pre">{market_currency}_{base_currency}</span></code>. See
<a class="reference internal" href="#naming"><span>Naming Convention</span></a>.</li>
<a class="reference internal" href="#naming"><span class="std std-ref">Naming Convention</span></a>.</li>
<li>Output of performance statistics based on Pandas DataFrames to integrate
nicely into the existing PyData ecosystem.</li>
<li>Support for accessing multiple exchanges per algorithm, which opens the door
@@ -201,7 +204,7 @@ can be specified through <code class="docutils literal"><span class="pre">set_be
<li>Support for Python2 and Python3.</li>
</ul>
<p>For additional details on the functionality added on recent releases, see the
<a class="reference internal" href="releases.html"><em>Release Notes</em></a>.</p>
<a class="reference internal" href="releases.html"><span class="doc">Release Notes</span></a>.</p>
</div>
<div class="section" id="upcoming-features">
<h2>Upcoming features<a class="headerlink" href="#upcoming-features" title="Permalink to this headline"></a></h2>
@@ -236,26 +239,26 @@ of that pair not found in the given exchange, and a list of pairs available on t
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ catalyst ingest-exchange -x poloniex -i btc_usd
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span></span>Ingesting exchange bundle poloniex...
Error traceback: /Volumes/Data/Users/victoris/Desktop/Enigma/user-install/catalyst-dev/catalyst/exchange/exchange.py (line 175)
SymbolNotFoundOnExchange: Symbol btc_usd not found on exchange Poloniex.
Choose from: [&#39;rep_usdt&#39;, &#39;gno_btc&#39;, &#39;xvc_btc&#39;, &#39;pink_btc&#39;, &#39;sys_btc&#39;,
&#39;emc2_btc&#39;, &#39;rads_btc&#39;, &#39;note_btc&#39;, &#39;maid_btc&#39;, &#39;bch_btc&#39;, &#39;gnt_btc&#39;,
&#39;bcn_btc&#39;, &#39;rep_btc&#39;, &#39;bcy_btc&#39;, &#39;cvc_btc&#39;, &#39;nxt_xmr&#39;, &#39;zec_usdt&#39;,
&#39;fct_btc&#39;, &#39;gas_btc&#39;, &#39;pot_btc&#39;, &#39;eth_usdt&#39;, &#39;btc_usdt&#39;, &#39;lbc_btc&#39;,
&#39;dcr_btc&#39;, &#39;etc_usdt&#39;, &#39;omg_eth&#39;, &#39;amp_btc&#39;, &#39;xpm_btc&#39;, &#39;nxt_btc&#39;,
&#39;vtc_btc&#39;, &#39;steem_eth&#39;, &#39;blk_xmr&#39;, &#39;pasc_btc&#39;, &#39;zec_xmr&#39;, &#39;grc_btc&#39;,
&#39;nxc_btc&#39;, &#39;btcd_btc&#39;, &#39;ltc_btc&#39;, &#39;dash_btc&#39;, &#39;naut_btc&#39;, &#39;zec_eth&#39;,
&#39;zec_btc&#39;, &#39;burst_btc&#39;, &#39;zrx_eth&#39;, &#39;bela_btc&#39;, &#39;steem_btc&#39;, &#39;etc_btc&#39;,
&#39;eth_btc&#39;, &#39;huc_btc&#39;, &#39;strat_btc&#39;, &#39;lsk_btc&#39;, &#39;exp_btc&#39;, &#39;clam_btc&#39;,
&#39;rep_eth&#39;, &#39;dash_xmr&#39;, &#39;cvc_eth&#39;, &#39;bch_usdt&#39;, &#39;zrx_btc&#39;, &#39;dash_usdt&#39;,
&#39;blk_btc&#39;, &#39;xrp_btc&#39;, &#39;nxt_usdt&#39;, &#39;neos_btc&#39;, &#39;omg_btc&#39;, &#39;bts_btc&#39;,
&#39;doge_btc&#39;, &#39;gnt_eth&#39;, &#39;sbd_btc&#39;, &#39;gno_eth&#39;, &#39;xcp_btc&#39;, &#39;ltc_usdt&#39;,
&#39;btm_btc&#39;, &#39;xmr_usdt&#39;, &#39;lsk_eth&#39;, &#39;omni_btc&#39;, &#39;nav_btc&#39;, &#39;fldc_btc&#39;,
&#39;ppc_btc&#39;, &#39;xbc_btc&#39;, &#39;dgb_btc&#39;, &#39;sc_btc&#39;, &#39;btcd_xmr&#39;, &#39;vrc_btc&#39;,
&#39;ric_btc&#39;, &#39;str_btc&#39;, &#39;maid_xmr&#39;, &#39;xmr_btc&#39;, &#39;sjcx_btc&#39;, &#39;via_btc&#39;,
&#39;xem_btc&#39;, &#39;nmc_btc&#39;, &#39;etc_eth&#39;, &#39;ltc_xmr&#39;, &#39;ardr_btc&#39;, &#39;gas_eth&#39;,
&#39;flo_btc&#39;, &#39;xrp_usdt&#39;, &#39;game_btc&#39;, &#39;bch_eth&#39;, &#39;bcn_xmr&#39;, &#39;str_usdt&#39;]
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">Ingesting</span> <span class="n">exchange</span> <span class="n">bundle</span> <span class="n">poloniex</span><span class="o">...</span>
<span class="n">Error</span> <span class="n">traceback</span><span class="p">:</span> <span class="o">/</span><span class="n">Volumes</span><span class="o">/</span><span class="n">Data</span><span class="o">/</span><span class="n">Users</span><span class="o">/</span><span class="n">victoris</span><span class="o">/</span><span class="n">Desktop</span><span class="o">/</span><span class="n">Enigma</span><span class="o">/</span><span class="n">user</span><span class="o">-</span><span class="n">install</span><span class="o">/</span><span class="n">catalyst</span><span class="o">-</span><span class="n">dev</span><span class="o">/</span><span class="n">catalyst</span><span class="o">/</span><span class="n">exchange</span><span class="o">/</span><span class="n">exchange</span><span class="o">.</span><span class="n">py</span> <span class="p">(</span><span class="n">line</span> <span class="mi">175</span><span class="p">)</span>
<span class="n">SymbolNotFoundOnExchange</span><span class="p">:</span> <span class="n">Symbol</span> <span class="n">btc_usd</span> <span class="ow">not</span> <span class="n">found</span> <span class="n">on</span> <span class="n">exchange</span> <span class="n">Poloniex</span><span class="o">.</span>
<span class="n">Choose</span> <span class="n">from</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;rep_usdt&#39;</span><span class="p">,</span> <span class="s1">&#39;gno_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;xvc_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;pink_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;sys_btc&#39;</span><span class="p">,</span>
<span class="s1">&#39;emc2_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;rads_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;note_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;maid_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;bch_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;gnt_btc&#39;</span><span class="p">,</span>
<span class="s1">&#39;bcn_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;rep_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;bcy_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;cvc_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;nxt_xmr&#39;</span><span class="p">,</span> <span class="s1">&#39;zec_usdt&#39;</span><span class="p">,</span>
<span class="s1">&#39;fct_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;gas_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;pot_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;eth_usdt&#39;</span><span class="p">,</span> <span class="s1">&#39;btc_usdt&#39;</span><span class="p">,</span> <span class="s1">&#39;lbc_btc&#39;</span><span class="p">,</span>
<span class="s1">&#39;dcr_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;etc_usdt&#39;</span><span class="p">,</span> <span class="s1">&#39;omg_eth&#39;</span><span class="p">,</span> <span class="s1">&#39;amp_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;xpm_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;nxt_btc&#39;</span><span class="p">,</span>
<span class="s1">&#39;vtc_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;steem_eth&#39;</span><span class="p">,</span> <span class="s1">&#39;blk_xmr&#39;</span><span class="p">,</span> <span class="s1">&#39;pasc_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;zec_xmr&#39;</span><span class="p">,</span> <span class="s1">&#39;grc_btc&#39;</span><span class="p">,</span>
<span class="s1">&#39;nxc_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;btcd_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;ltc_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;dash_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;naut_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;zec_eth&#39;</span><span class="p">,</span>
<span class="s1">&#39;zec_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;burst_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;zrx_eth&#39;</span><span class="p">,</span> <span class="s1">&#39;bela_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;steem_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;etc_btc&#39;</span><span class="p">,</span>
<span class="s1">&#39;eth_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;huc_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;strat_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;lsk_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;exp_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;clam_btc&#39;</span><span class="p">,</span>
<span class="s1">&#39;rep_eth&#39;</span><span class="p">,</span> <span class="s1">&#39;dash_xmr&#39;</span><span class="p">,</span> <span class="s1">&#39;cvc_eth&#39;</span><span class="p">,</span> <span class="s1">&#39;bch_usdt&#39;</span><span class="p">,</span> <span class="s1">&#39;zrx_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;dash_usdt&#39;</span><span class="p">,</span>
<span class="s1">&#39;blk_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;xrp_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;nxt_usdt&#39;</span><span class="p">,</span> <span class="s1">&#39;neos_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;omg_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;bts_btc&#39;</span><span class="p">,</span>
<span class="s1">&#39;doge_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;gnt_eth&#39;</span><span class="p">,</span> <span class="s1">&#39;sbd_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;gno_eth&#39;</span><span class="p">,</span> <span class="s1">&#39;xcp_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;ltc_usdt&#39;</span><span class="p">,</span>
<span class="s1">&#39;btm_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;xmr_usdt&#39;</span><span class="p">,</span> <span class="s1">&#39;lsk_eth&#39;</span><span class="p">,</span> <span class="s1">&#39;omni_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;nav_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;fldc_btc&#39;</span><span class="p">,</span>
<span class="s1">&#39;ppc_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;xbc_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;dgb_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;sc_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;btcd_xmr&#39;</span><span class="p">,</span> <span class="s1">&#39;vrc_btc&#39;</span><span class="p">,</span>
<span class="s1">&#39;ric_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;str_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;maid_xmr&#39;</span><span class="p">,</span> <span class="s1">&#39;xmr_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;sjcx_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;via_btc&#39;</span><span class="p">,</span>
<span class="s1">&#39;xem_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;nmc_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;etc_eth&#39;</span><span class="p">,</span> <span class="s1">&#39;ltc_xmr&#39;</span><span class="p">,</span> <span class="s1">&#39;ardr_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;gas_eth&#39;</span><span class="p">,</span>
<span class="s1">&#39;flo_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;xrp_usdt&#39;</span><span class="p">,</span> <span class="s1">&#39;game_btc&#39;</span><span class="p">,</span> <span class="s1">&#39;bch_eth&#39;</span><span class="p">,</span> <span class="s1">&#39;bcn_xmr&#39;</span><span class="p">,</span> <span class="s1">&#39;str_usdt&#39;</span><span class="p">]</span>
</pre></div>
</div>
<p>In the example above, exchange Poloniex does not use USD, but uses instead the
@@ -266,8 +269,8 @@ or any other cryptocurrency. Given its 1:1 mapping to the USD, is a viable alter
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ catalyst ingest-exchange -x poloniex -i btc_usdt
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span></span>Ingesting exchange bundle poloniex...
[====================================] Fetching poloniex daily candles: : 100%
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">Ingesting</span> <span class="n">exchange</span> <span class="n">bundle</span> <span class="n">poloniex</span><span class="o">...</span>
<span class="p">[</span><span class="o">====================================</span><span class="p">]</span> <span class="n">Fetching</span> <span class="n">poloniex</span> <span class="n">daily</span> <span class="n">candles</span><span class="p">:</span> <span class="p">:</span> <span class="mi">100</span><span class="o">%</span>
</pre></div>
</div>
</div>
@@ -321,7 +324,7 @@ or any other cryptocurrency. Given its 1:1 mapping to the USD, is a viable alter
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+379 -8
View File
@@ -33,6 +33,9 @@
<link rel="index" title="Index"
href="#"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
@@ -158,17 +161,385 @@
<h1 id="index">Index</h1>
<div class="genindex-jumpbox">
<a href="#Z"><strong>Z</strong></a>
<a href="#A"><strong>A</strong></a>
| <a href="#B"><strong>B</strong></a>
| <a href="#C"><strong>C</strong></a>
| <a href="#D"><strong>D</strong></a>
| <a href="#E"><strong>E</strong></a>
| <a href="#F"><strong>F</strong></a>
| <a href="#G"><strong>G</strong></a>
| <a href="#H"><strong>H</strong></a>
| <a href="#I"><strong>I</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#N"><strong>N</strong></a>
| <a href="#O"><strong>O</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#R"><strong>R</strong></a>
| <a href="#S"><strong>S</strong></a>
| <a href="#T"><strong>T</strong></a>
| <a href="#V"><strong>V</strong></a>
| <a href="#W"><strong>W</strong></a>
</div>
<h2 id="Z">Z</h2>
<h2 id="A">A</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="appendix.html#zipline.data.bundles.bundles">zipline.data.bundles.bundles (built-in variable)</a>
</dt>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.assets.Asset">Asset (class in catalyst.assets)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.assets.AssetConvertible">AssetConvertible (class in catalyst.assets)</a>
</li>
</ul></td>
</tr></table>
</dl></td>
<h2 id="B">B</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.protocol.BarData">BarData (class in catalyst.protocol)</a>
</li>
</ul></td>
</tr></table>
<h2 id="C">C</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.utils.cache.CachedObject">CachedObject (class in catalyst.utils.cache)</a>
</li>
<li><a href="appendix.html#catalyst.finance.commission.CommissionModel.calculate">calculate() (catalyst.finance.commission.CommissionModel method)</a>
</li>
<li><a href="appendix.html#catalyst.protocol.BarData.can_trade">can_trade() (catalyst.protocol.BarData method)</a>
</li>
<li><a href="appendix.html#catalyst.api.cancel_order">cancel_order() (in module catalyst.api)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.finance.cancel_policy.CancelPolicy">CancelPolicy (class in catalyst.finance.cancel_policy)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.clear_calendars">clear_calendars() (in module catalyst.utils.calendars)</a>
</li>
<li><a href="appendix.html#catalyst.finance.commission.CommissionModel">CommissionModel (class in catalyst.finance.commission)</a>
</li>
<li><a href="appendix.html#catalyst.protocol.BarData.current">current() (catalyst.protocol.BarData method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="D">D</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.utils.cache.dataframe_cache">dataframe_cache (class in catalyst.utils.cache)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.date_rules">date_rules (class in catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.deregister_calendar">deregister_calendar() (in module catalyst.utils.calendars)</a>
</li>
</ul></td>
</tr></table>
<h2 id="E">E</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.EODCancel">EODCancel() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.date_rules.every_day">every_day (catalyst.api.date_rules attribute)</a>
</li>
<li><a href="appendix.html#catalyst.api.time_rules.every_minute">every_minute (catalyst.api.time_rules attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.finance.execution.ExecutionStyle.exchange">exchange (catalyst.finance.execution.ExecutionStyle attribute)</a>
</li>
<li><a href="appendix.html#catalyst.finance.execution.ExecutionStyle">ExecutionStyle (class in catalyst.finance.execution)</a>
</li>
<li><a href="appendix.html#catalyst.utils.cache.ExpiringCache">ExpiringCache (class in catalyst.utils.cache)</a>
</li>
</ul></td>
</tr></table>
<h2 id="F">F</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.fetch_csv">fetch_csv() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.assets.Asset.first_traded">first_traded (catalyst.assets.Asset attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.finance.slippage.FixedSlippage">FixedSlippage (class in catalyst.finance.slippage)</a>
</li>
<li><a href="appendix.html#catalyst.assets.Asset.from_dict">from_dict() (catalyst.assets.Asset method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="G">G</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.utils.calendars.get_calendar">get_calendar() (in module catalyst.utils.calendars)</a>
</li>
<li><a href="appendix.html#catalyst.api.get_environment">get_environment() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.finance.execution.ExecutionStyle.get_limit_price">get_limit_price() (catalyst.finance.execution.ExecutionStyle method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.get_open_orders">get_open_orders() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.get_order">get_order() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.finance.execution.ExecutionStyle.get_stop_price">get_stop_price() (catalyst.finance.execution.ExecutionStyle method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="H">H</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.protocol.BarData.history">history() (catalyst.protocol.BarData method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="I">I</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.assets.Asset.is_alive_for_session">is_alive_for_session() (catalyst.assets.Asset method)</a>
</li>
<li><a href="appendix.html#catalyst.assets.Asset.is_exchange_open">is_exchange_open() (catalyst.assets.Asset method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.is_open_on_minute">is_open_on_minute() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.is_session">is_session() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.protocol.BarData.is_stale">is_stale() (catalyst.protocol.BarData method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.finance.execution.LimitOrder">LimitOrder (class in catalyst.finance.execution)</a>
</li>
</ul></td>
</tr></table>
<h2 id="M">M</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.time_rules.market_close">market_close (catalyst.api.time_rules attribute)</a>
</li>
<li><a href="appendix.html#catalyst.api.time_rules.market_open">market_open (catalyst.api.time_rules attribute)</a>
</li>
<li><a href="appendix.html#catalyst.finance.execution.MarketOrder">MarketOrder (class in catalyst.finance.execution)</a>
</li>
<li><a href="appendix.html#catalyst.utils.cli.maybe_show_progress">maybe_show_progress() (in module catalyst.utils.cli)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.minute_index_to_session_labels">minute_index_to_session_labels() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.minute_to_session_label">minute_to_session_label() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.minutes_count_for_sessions_in_range">minutes_count_for_sessions_in_range() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.minutes_for_session">minutes_for_session() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.minutes_for_sessions_in_range">minutes_for_sessions_in_range() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.minutes_in_range">minutes_in_range() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.api.date_rules.month_end">month_end() (catalyst.api.date_rules static method)</a>
</li>
<li><a href="appendix.html#catalyst.api.date_rules.month_start">month_start() (catalyst.api.date_rules static method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="N">N</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.NeverCancel">NeverCancel() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.next_close">next_close() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.next_minute">next_minute() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.next_open">next_open() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.next_session_label">next_session_label() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="O">O</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.open_and_close_for_session">open_and_close_for_session() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.api.order">order() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.order_percent">order_percent() (in module catalyst.api)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.order_target">order_target() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.order_target_percent">order_target_percent() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.order_target_value">order_target_value() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.order_value">order_value() (in module catalyst.api)</a>
</li>
</ul></td>
</tr></table>
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.finance.commission.PerDollar">PerDollar (class in catalyst.finance.commission)</a>
</li>
<li><a href="appendix.html#catalyst.finance.commission.PerShare">PerShare (class in catalyst.finance.commission)</a>
</li>
<li><a href="appendix.html#catalyst.finance.commission.PerTrade">PerTrade (class in catalyst.finance.commission)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.previous_close">previous_close() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.previous_minute">previous_minute() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.previous_open">previous_open() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.previous_session_label">previous_session_label() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.finance.slippage.SlippageModel.process_order">process_order() (catalyst.finance.slippage.SlippageModel method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="R">R</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.record">record() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.register_calendar">register_calendar() (in module catalyst.utils.calendars)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.utils.calendars.register_calendar_type">register_calendar_type() (in module catalyst.utils.calendars)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.regular_holidays">regular_holidays (catalyst.utils.calendars.TradingCalendar attribute)</a>
</li>
<li><a href="appendix.html#catalyst.run_algorithm">run_algorithm() (in module catalyst)</a>
</li>
</ul></td>
</tr></table>
<h2 id="S">S</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.schedule_function">schedule_function() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.session_distance">session_distance() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.sessions_in_range">sessions_in_range() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.sessions_window">sessions_window() (catalyst.utils.calendars.TradingCalendar method)</a>
</li>
<li><a href="appendix.html#catalyst.api.set_benchmark">set_benchmark() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.set_cancel_policy">set_cancel_policy() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.set_commission">set_commission() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.set_do_not_order_list">set_do_not_order_list() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.set_long_only">set_long_only() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.set_max_leverage">set_max_leverage() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.set_max_order_count">set_max_order_count() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.set_max_order_size">set_max_order_size() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.set_max_position_size">set_max_position_size() (in module catalyst.api)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.set_slippage">set_slippage() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.set_symbol_lookup_date">set_symbol_lookup_date() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.finance.cancel_policy.CancelPolicy.should_cancel">should_cancel() (catalyst.finance.cancel_policy.CancelPolicy method)</a>
</li>
<li><a href="appendix.html#catalyst.api.sid">sid() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.finance.slippage.SlippageModel">SlippageModel (class in catalyst.finance.slippage)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.special_closes">special_closes (catalyst.utils.calendars.TradingCalendar attribute)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.special_closes_adhoc">special_closes_adhoc (catalyst.utils.calendars.TradingCalendar attribute)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.special_opens">special_opens (catalyst.utils.calendars.TradingCalendar attribute)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar.special_opens_adhoc">special_opens_adhoc (catalyst.utils.calendars.TradingCalendar attribute)</a>
</li>
<li><a href="appendix.html#catalyst.finance.execution.StopLimitOrder">StopLimitOrder (class in catalyst.finance.execution)</a>
</li>
<li><a href="appendix.html#catalyst.finance.execution.StopOrder">StopOrder (class in catalyst.finance.execution)</a>
</li>
<li><a href="appendix.html#catalyst.api.symbol">symbol() (in module catalyst.api)</a>
</li>
<li><a href="appendix.html#catalyst.api.symbols">symbols() (in module catalyst.api)</a>
</li>
</ul></td>
</tr></table>
<h2 id="T">T</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.time_rules">time_rules (class in catalyst.api)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.assets.Asset.to_dict">to_dict() (catalyst.assets.Asset method)</a>
</li>
<li><a href="appendix.html#catalyst.utils.calendars.TradingCalendar">TradingCalendar (class in catalyst.utils.calendars)</a>
</li>
</ul></td>
</tr></table>
<h2 id="V">V</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.finance.slippage.VolumeShareSlippage">VolumeShareSlippage (class in catalyst.finance.slippage)</a>
</li>
</ul></td>
</tr></table>
<h2 id="W">W</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.api.date_rules.week_end">week_end() (catalyst.api.date_rules static method)</a>
</li>
<li><a href="appendix.html#catalyst.api.date_rules.week_start">week_start() (catalyst.api.date_rules static method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="appendix.html#catalyst.utils.cache.working_dir">working_dir (class in catalyst.utils.cache)</a>
</li>
<li><a href="appendix.html#catalyst.utils.cache.working_file">working_file (class in catalyst.utils.cache)</a>
</li>
</ul></td>
</tr></table>
@@ -211,7 +582,7 @@
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+6 -3
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="#"/>
<link rel="next" title="Install" href="install.html"/>
@@ -143,7 +146,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/index.txt" rel="nofollow"> View page source</a>
<a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -167,7 +170,7 @@
<p>Catalyst is an algorithmic trading library for crypto-assets written in Python.
It allows trading strategies to be easily expressed and backtested against
historical data (with daily and minute resolution), providing analytics and
insights regarding a particular strategy&#8217;s performance. Catalyst also supports
insights regarding a particular strategys performance. Catalyst also supports
live-trading of crypto-assets starting with three exchanges (Bitfinex, Bittrex,
and Poloniex) with more being added over time. Catalyst empowers users to share
and curate data and build profitable, data-driven investment strategies. Please
@@ -272,7 +275,7 @@ performance across trading algorithms.</li>
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+35 -32
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
<link rel="next" title="Catalyst Beginner Tutorial" href="beginner-tutorial.html"/>
<link rel="prev" title="Overview" href="index.html"/>
@@ -84,7 +87,7 @@
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="">Install</a><ul>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Install</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#installing-with-conda">Installing with <code class="docutils literal"><span class="pre">conda</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="#troubleshooting-conda-install">Troubleshooting <code class="docutils literal"><span class="pre">conda</span></code> Install</a></li>
</ul>
@@ -166,7 +169,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/install.txt" rel="nofollow"> View page source</a>
<a href="_sources/install.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -187,29 +190,29 @@ Like any other piece of software, Catalyst has a number of dependencies
well. We recommend using a software named <code class="docutils literal"><span class="pre">Conda</span></code> that will manage all
these dependencies for you, and set up the environment needed to get you up
and running as easily as possible. This is the recommended installation method
for Windows, MacOS and Linux. See <a class="reference internal" href="#conda"><span>Installing with Conda</span></a>.</p>
for Windows, MacOS and Linux. See <a class="reference internal" href="#conda"><span class="std std-ref">Installing with Conda</span></a>.</p>
<p>What conda does is create a pre-configured environment, and inside that
environment install Catalyst using <code class="docutils literal"><span class="pre">pip</span></code>, Python&#8217;s package manager. Thus,
environment install Catalyst using <code class="docutils literal"><span class="pre">pip</span></code>, Pythons package manager. Thus,
as an alternative installation method for MacOS and Linux, you can install
Catalyst directly with <code class="docutils literal"><span class="pre">pip</span></code> (we recommend in combination with a virtual
environemnt). See <a class="reference internal" href="#pip"><span>Installing with pip</span></a>.</p>
environemnt). See <a class="reference internal" href="#pip"><span class="std std-ref">Installing with pip</span></a>.</p>
<p>Alternatively you can install Catalyst using <code class="docutils literal"><span class="pre">pipenv</span></code> which is a mix of pip
and virtualenv. See <a class="reference internal" href="#pipenv"><span>Installing with pipenv</span></a>.</p>
and virtualenv. See <a class="reference internal" href="#pipenv"><span class="std std-ref">Installing with pipenv</span></a>.</p>
<p>Regardless of the method, each operating system (OS), has its own
prerequisites, make sure to review the corresponding sections for your system:
<a class="reference internal" href="#linux"><span>Linux</span></a>, <a class="reference internal" href="#macos"><span>MacOS</span></a> and <a class="reference internal" href="#windows"><span>Windows</span></a>.</p>
<a class="reference internal" href="#linux"><span class="std std-ref">Linux</span></a>, <a class="reference internal" href="#macos"><span class="std std-ref">MacOS</span></a> and <a class="reference internal" href="#windows"><span class="std std-ref">Windows</span></a>.</p>
<div class="section" id="installing-with-conda">
<span id="conda"></span><h2>Installing with <code class="docutils literal"><span class="pre">conda</span></code><a class="headerlink" href="#installing-with-conda" title="Permalink to this headline"></a></h2>
<p>The preferred method to install Catalyst is via the <code class="docutils literal"><span class="pre">conda</span></code> package manager,
which comes as part of Continuum Analytics&#8217; <a class="reference external" href="http://continuum.io/downloads">Anaconda</a> distribution.</p>
which comes as part of Continuum Analytics <a class="reference external" href="http://continuum.io/downloads">Anaconda</a> distribution.</p>
<p>The primary advantage of using Conda over <code class="docutils literal"><span class="pre">pip</span></code> is that conda natively
understands the complex binary dependencies of packages like <code class="docutils literal"><span class="pre">numpy</span></code> and
<code class="docutils literal"><span class="pre">scipy</span></code>. This means that <code class="docutils literal"><span class="pre">conda</span></code> can install Catalyst and its
dependencies without requiring the use of a second tool to acquire Catalyst&#8217;s
dependencies without requiring the use of a second tool to acquire Catalysts
non-Python dependencies.</p>
<blockquote>
<div>For Windows, you will first need to install the <em>Microsoft Visual C++
Compiler for Python 2.7</em>. Follow the instructions on the <a class="reference internal" href="#windows"><span>Windows</span></a> section and come back here.</div></blockquote>
Compiler for Python 2.7</em>. Follow the instructions on the <a class="reference internal" href="#windows"><span class="std std-ref">Windows</span></a> section and come back here.</div></blockquote>
<p>For instructions on how to install <code class="docutils literal"><span class="pre">conda</span></code>, see the <a class="reference external" href="http://conda.pydata.org/docs/download.html">Conda Installation
Documentation</a>. Alternatively,
you can install MiniConda, which is a smaller footprint (fewer packages and
@@ -223,18 +226,18 @@ for your Operating System.</li>
window, which should print the list of packages installed with Conda.</li>
</ol>
<blockquote>
<div>For Windows, if you accepted the default installation options, you didn&#8217;t
<div>For Windows, if you accepted the default installation options, you didnt
check an option to add Conda to the PATH, so trying to run <code class="docutils literal"><span class="pre">conda</span></code> from
a regular <code class="docutils literal"><span class="pre">Command</span> <span class="pre">Prompt</span></code> will result in the following error: <code class="docutils literal"><span class="pre">'conda'</span>
<span class="pre">is</span> <span class="pre">no</span> <span class="pre">recognized</span> <span class="pre">as</span> <span class="pre">an</span> <span class="pre">internal</span> <span class="pre">or</span> <span class="pre">external</span> <span class="pre">command,</span> <span class="pre">operatble</span> <span class="pre">program</span> <span class="pre">or</span>
<span class="pre">batch</span> <span class="pre">file</span></code>. That&#8217;s to be expected. You will nee to launch an <code class="docutils literal"><span class="pre">Anaconda</span>
<span class="pre">batch</span> <span class="pre">file</span></code>. Thats to be expected. You will nee to launch an <code class="docutils literal"><span class="pre">Anaconda</span>
<span class="pre">Prompt</span></code> that was added at installation time to your list of programs
available from the Start menu.</div></blockquote>
<p>Once either Conda or MiniConda has been set up you can install Catalyst:</p>
<ol class="arabic">
<li><p class="first">Download the file <a class="reference external" href="https://github.com/enigmampc/catalyst/blob/master/etc/python2.7-environment.yml">python2.7-environment.yml</a>.</p>
<blockquote>
<div><p>To download, simply click on the &#8216;Raw&#8217; button and save the file locally
<div><p>To download, simply click on the Raw button and save the file locally
to a folder you can remember. Make sure that the file gets saved with the
<code class="docutils literal"><span class="pre">.yml</span></code> extension, and nothing like a <code class="docutils literal"><span class="pre">.txt</span></code> file or anything else.</p>
</div></blockquote>
@@ -322,26 +325,26 @@ CPython header files for your Python installation.</li>
numerical array computing in Python. Numpy depends on having the <a class="reference external" href="http://www.netlib.org/lapack">LAPACK</a> linear algebra routines available.</li>
</ol>
<p>Because LAPACK and the CPython headers are non-Python dependencies, the
correctway to install them varies from platform to platform. If you&#8217;d rather
use a single tool to install Python and non-Python dependencies, or if you&#8217;re
correctway to install them varies from platform to platform. If youd rather
use a single tool to install Python and non-Python dependencies, or if youre
already using <a class="reference external" href="http://continuum.io/downloads">Anaconda</a> as your Python
distribution, refer to the <a class="reference internal" href="#conda"><span>Installing with Conda</span></a> section.</p>
distribution, refer to the <a class="reference internal" href="#conda"><span class="std std-ref">Installing with Conda</span></a> section.</p>
<p>If you use Python for anything other than Catalyst, we <strong>strongly</strong> recommend
that you install in a <a class="reference external" href="https://virtualenv.readthedocs.org/en/latest">virtualenv</a>. The <a class="reference external" href="http://docs.python-guide.org/en/latest/">Hitchhiker&#8217;s Guide to
Python</a> provides an <a class="reference external" href="http://docs.python-guide.org/en/latest/dev/virtualenvs/">excellent tutorial on virtualenv</a>. Here&#8217;s a
that you install in a <a class="reference external" href="https://virtualenv.readthedocs.org/en/latest">virtualenv</a>. The <a class="reference external" href="http://docs.python-guide.org/en/latest/">Hitchhikers Guide to
Python</a> provides an <a class="reference external" href="http://docs.python-guide.org/en/latest/dev/virtualenvs/">excellent tutorial on virtualenv</a>. Heres a
summarized version:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install virtualenv
$ virtualenv catalyst-venv
$ <span class="nb">source</span> ./catalyst-venv/bin/activate
</pre></div>
</div>
<p>Once you&#8217;ve installed the necessary additional dependencies for your system
(<a class="reference internal" href="#linux"><span>GNU/Linux Requirements</span></a>, <a class="reference internal" href="#macos"><span>MacOS Requirements</span></a> or <a class="reference internal" href="#windows"><span>Windows Requirements</span></a>) <strong>and have activated your virtualenv</strong>, you should be able to simply run</p>
<p>Once youve installed the necessary additional dependencies for your system
(<a class="reference internal" href="#linux"><span class="std std-ref">GNU/Linux Requirements</span></a>, <a class="reference internal" href="#macos"><span class="std std-ref">MacOS Requirements</span></a> or <a class="reference internal" href="#windows"><span class="std std-ref">Windows Requirements</span></a>) <strong>and have activated your virtualenv</strong>, you should be able to simply run</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install enigma-catalyst matplotlib
</pre></div>
</div>
<p>Note that in the command above we install two different packages. The second
one, <code class="docutils literal"><span class="pre">matplotlib</span></code> is a visualization library. While it&#8217;s not strictly
one, <code class="docutils literal"><span class="pre">matplotlib</span></code> is a visualization library. While its not strictly
required to run catalyst simulations or live trading, it comes in very handy
to visualize the performance of your algorithms, and for this reason we
recommend you install it, as well.</p>
@@ -379,7 +382,7 @@ No distributions matching the version <span class="k">for</span> enigma-catalyst
<dd><p class="first">In some systems (this error has been reported in Ubuntu), pip is configured
to only find stable versions by default. Since Catalyst is in alpha
version, pip cannot find a matching version that satisfies the installation
requirements. The solution is to include the <cite>&#8211;pre</cite> flag to include
requirements. The solution is to include the <cite>pre</cite> flag to include
pre-release and development versions:</p>
<div class="last highlight-bash"><div class="highlight"><pre><span></span>$ pip install --pre enigma-catalyst
</pre></div>
@@ -403,7 +406,7 @@ pre-release and development versions:</p>
<dd>Missing required packages</dd>
<dt><strong>Solution</strong>:</dt>
<dd><p class="first">Download <a class="reference external" href="https://github.com/enigmampc/catalyst/blob/master/etc/requirements.txt">requirements.txt</a>
(click on the <em>Raw</em> button and Right click -&gt; Save As...) and use it to
(click on the <em>Raw</em> button and Right click -&gt; Save As) and use it to
install all the required dependencies by running:</p>
<div class="last highlight-bash"><div class="highlight"><pre><span></span>$ pip install -r requirements.txt
</pre></div>
@@ -443,7 +446,7 @@ $ pipenv install enigma-catalyst matplotlib
</pre></div>
</div>
<p>Until now the workflow compared to <code class="docutils literal"><span class="pre">pip</span></code> is almost identical, the difference
is that you don&#8217;t need to load manually any virtualenv however you need to use
is that you dont need to load manually any virtualenv however you need to use
the <cite>pipenv run</cite> prefix to run the <cite>catalyst</cite> command as follows:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pipenv run catalyst --version
</pre></div>
@@ -486,12 +489,12 @@ beginning of this page.</p>
<div class="section" id="macos-requirements">
<span id="macos"></span><h2>MacOS Requirements<a class="headerlink" href="#macos-requirements" title="Permalink to this headline"></a></h2>
<p>The version of Python shipped with MacOS by default is generally out of date,
and has a number of quirks because it&#8217;s used directly by the operating system.
and has a number of quirks because its used directly by the operating system.
For these reasons, many developers choose to install and use a separate Python
installation. The <a class="reference external" href="http://docs.python-guide.org/en/latest/">Hitchhiker&#8217;s Guide to Python</a> provides an excellent guide
installation. The <a class="reference external" href="http://docs.python-guide.org/en/latest/">Hitchhikers Guide to Python</a> provides an excellent guide
to <a class="reference external" href="http://docs.python-guide.org/en/latest/">Installing Python on MacOS</a>,
which explains how to install Python with the <a class="reference external" href="http://brew.sh">Homebrew</a> manager.</p>
<p>Assuming you&#8217;ve installed Python with Homebrew, you&#8217;ll also likely need the
<p>Assuming youve installed Python with Homebrew, youll also likely need the
following brew packages:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ brew install freetype pkg-config gcc openssl
</pre></div>
@@ -528,11 +531,11 @@ about matplotlib backends, please refer to the
<p>In Windows, you will first need to install the <a class="reference external" href="https://www.microsoft.com/en-us/download/details.aspx?id=44266">Microsoft Visual C++ Compiler
for Python 2.7</a>. This
package contains the compiler and the set of system headers necessary for
producing binary wheels for Python 2.7 packages. If it&#8217;s not already in your
producing binary wheels for Python 2.7 packages. If its not already in your
system, download it and install it before proceeding to the next step.</p>
<p>Once you have the above compiler installed, the easiest and best supported way
to install Catalyst in Windows is to use <a class="reference internal" href="#conda"><span>Conda</span></a>. If you didn&#8217;t
any problems installing the compiler, jump to the <a class="reference internal" href="#conda"><span>Conda</span></a> section,
to install Catalyst in Windows is to use <a class="reference internal" href="#conda"><span class="std std-ref">Conda</span></a>. If you didnt
any problems installing the compiler, jump to the <a class="reference internal" href="#conda"><span class="std std-ref">Conda</span></a> section,
otherwise keep on reading to troubleshoot the C++ compiler installtion.</p>
<p>Some problems we have encountered installing the <strong>Visual C++ Compiler</strong>
mentioned above are as follows:</p>
@@ -540,7 +543,7 @@ mentioned above are as follows:</p>
<li><p class="first"><strong>The system administrator has set policies to prevent this installation</strong>.</p>
<p>In some systems, there is a default <em>Windows Software Restriction</em> policy
that prevents the installation of some software packages like this one.
You&#8217;ll have to change the Registry to circumvent this:</p>
Youll have to change the Registry to circumvent this:</p>
<ul class="simple">
<li>Click <code class="docutils literal"><span class="pre">Start</span></code>, and search for <code class="docutils literal"><span class="pre">regedit</span></code> and launch the
<code class="docutils literal"><span class="pre">Registry</span> <span class="pre">Editor</span></code></li>
@@ -664,7 +667,7 @@ and you get a hint on how to solve it.</li>
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+13 -10
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
<link rel="next" title="Features" href="features.html"/>
<link rel="prev" title="Catalyst Beginner Tutorial" href="beginner-tutorial.html"/>
@@ -86,7 +89,7 @@
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="install.html">Install</a></li>
<li class="toctree-l1"><a class="reference internal" href="beginner-tutorial.html">Catalyst Beginner Tutorial</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Live Trading</a><ul>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Live Trading</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#supported-exchanges">Supported Exchanges</a></li>
<li class="toctree-l2"><a class="reference internal" href="#paper-trading-vs-live-trading-modes">Paper Trading vs Live Trading modes</a></li>
<li class="toctree-l2"><a class="reference internal" href="#authentication">Authentication</a></li>
@@ -151,7 +154,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/live-trading.txt" rel="nofollow"> View page source</a>
<a href="_sources/live-trading.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -254,7 +257,7 @@ a similar process.</p>
</div>
<p>The file goes here: <code class="docutils literal"><span class="pre">~/.catalyst/data/exchanges/bitfinex/auth.json</span></code></p>
<p>Note that the <cite>bitfinex</cite> part in the directory above corresponds to the id of the Bitfinex
exchange as defined in the &#8220;Supported Exchanges&#8221; section above.
exchange as defined in the Supported Exchanges section above.
Attempting to run an algorithm where the targeted exchange is missing
its <code class="docutils literal"><span class="pre">auth.json</span></code> file will create the directory structure and create an empty
auth.json file, but will result in an error.</p>
@@ -275,13 +278,13 @@ seperator.</p>
<p><em>[Market Currency]_[Base Currency]</em> all lowercase.</p>
<p>Currency symbols (e.g. btc, eth, ltc) follow the Bittrex convention.</p>
<p>Here are some examples:</p>
<div class="highlight-json"><div class="highlight"><pre><span></span># With Bitfinex
bitcoin_usd_asset = symbol(&#39;btc_usd&#39;)
ethereum_bitcoin_asset = symbol(&#39;eth_btc&#39;)
<div class="code python highlight-python"><div class="highlight"><pre><span></span><span class="c1"># With Bitfinex</span>
<span class="n">bitcoin_usd_asset</span> <span class="o">=</span> <span class="n">symbol</span><span class="p">(</span><span class="s1">&#39;btc_usd&#39;</span><span class="p">)</span>
<span class="n">ethereum_bitcoin_asset</span> <span class="o">=</span> <span class="n">symbol</span><span class="p">(</span><span class="s1">&#39;eth_btc&#39;</span><span class="p">)</span>
# With Bittrex
ethereum_bitcoin_asset = symbol(&#39;eth_btc&#39;)
neo_ethereum_asset = symbol(&#39;neo_eth)
<span class="c1"># With Bittrex</span>
<span class="n">ethereum_bitcoin_asset</span> <span class="o">=</span> <span class="n">symbol</span><span class="p">(</span><span class="s1">&#39;eth_btc&#39;</span><span class="p">)</span>
<span class="n">neo_ethereum_asset</span> <span class="o">=</span> <span class="n">symbol</span><span class="p">(</span><span class="s1">&#39;neo_eth)</span>
</pre></div>
</div>
<p>Note that the trading pairs are always referenced in the same manner.
@@ -384,7 +387,7 @@ simulated in Catalyst instead of processed on the exchange. It defaults to
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
BIN
View File
Binary file not shown.
+31 -28
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
@@ -142,7 +145,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/release-process.txt" rel="nofollow"> View page source</a>
<a href="_sources/release-process.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -163,20 +166,20 @@
</div>
<div class="section" id="updating-the-release-notes">
<h2>Updating the Release Notes<a class="headerlink" href="#updating-the-release-notes" title="Permalink to this headline"></a></h2>
<p>When we are ready to ship a new release of zipline, edit the <a class="reference internal" href="releases.html"><em>Release Notes</em></a>
<p>When we are ready to ship a new release of zipline, edit the <a class="reference internal" href="releases.html"><span class="doc">Release Notes</span></a>
page. We will have been maintaining a whatsnew file while working on the release
with the new version. First, find that file in:
<code class="docutils literal"><span class="pre">docs/source/whatsnew/&lt;version&gt;.txt</span></code>. It will be the highest version number.
Edit the release date field to be today&#8217;s date in the format:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>&lt;month&gt; &lt;day&gt;, &lt;year&gt;
Edit the release date field to be todays date in the format:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="o">&lt;</span><span class="n">month</span><span class="o">&gt;</span> <span class="o">&lt;</span><span class="n">day</span><span class="o">&gt;</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">year</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>for example, November 6, 2015.
Remove the active development warning from the whatsnew, since it will no
longer be pending release.
Update the title of the release from &#8220;Development&#8221; to &#8220;Release x.x.x&#8221; and
update the underline of the title to match the title&#8217;s width.</p>
<p>If you are renaming the release at this point, you&#8217;ll need to git mv the file
Update the title of the release from Development” to “Release x.x.x and
update the underline of the title to match the titles width.</p>
<p>If you are renaming the release at this point, youll need to git mv the file
and also update releases.rst to reference the renamed file.</p>
<p>To build and view the docs locally, run:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">cd</span> docs
@@ -212,7 +215,7 @@ should be added to that header.</p>
<h2>Updating the <code class="docutils literal"><span class="pre">__version__</span></code><a class="headerlink" href="#updating-the-version" title="Permalink to this headline"></a></h2>
<p>We use <a class="reference external" href="https://github.com/warner/python-versioneer">versioneer</a> to
manage the <code class="docutils literal"><span class="pre">__version__</span></code> and <code class="docutils literal"><span class="pre">setup.py</span></code> version. This means that we pull
this information from our version control&#8217;s tags to ensure that they stay in
this information from our version controls tags to ensure that they stay in
sync and to have very fine grained version strings for development installs.</p>
<p>To upgrade the version use the git tag command like:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ git tag &lt;major&gt;.&lt;minor&gt;.&lt;micro&gt;
@@ -220,7 +223,7 @@ $ git push <span class="o">&amp;&amp;</span> git push --tags
</pre></div>
</div>
<p>This will push the the code and the tag information.</p>
<p>Next, click the &#8220;Draft a new release&#8221; button on the <a class="reference external" href="https://github.com/quantopian/zipline/releases">zipline releases page</a>. For the new release,
<p>Next, click the Draft a new release button on the <a class="reference external" href="https://github.com/quantopian/zipline/releases">zipline releases page</a>. For the new release,
choose the tag you just pushed, and publish the release.</p>
</div>
<div class="section" id="uploading-pypi-packages">
@@ -250,19 +253,19 @@ all the required packages.</p>
<p>Now that we have tested the package locally, it should be tested using the test
PyPI server.</p>
<p>Edit your <code class="docutils literal"><span class="pre">~/.pypirc</span></code> file to look like:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>[distutils]
index-servers =
pypi
pypitest
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">distutils</span><span class="p">]</span>
<span class="n">index</span><span class="o">-</span><span class="n">servers</span> <span class="o">=</span>
<span class="n">pypi</span>
<span class="n">pypitest</span>
[pypi]
username:
password:
<span class="p">[</span><span class="n">pypi</span><span class="p">]</span>
<span class="n">username</span><span class="p">:</span>
<span class="n">password</span><span class="p">:</span>
[pypitest]
repository: https://testpypi.python.org/pypi
username:
password:
<span class="p">[</span><span class="n">pypitest</span><span class="p">]</span>
<span class="n">repository</span><span class="p">:</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">testpypi</span><span class="o">.</span><span class="n">python</span><span class="o">.</span><span class="n">org</span><span class="o">/</span><span class="n">pypi</span>
<span class="n">username</span><span class="p">:</span>
<span class="n">password</span><span class="p">:</span>
</pre></div>
</div>
<p>after that, run:</p>
@@ -296,7 +299,7 @@ number.</p>
</div>
<div class="section" id="bdist">
<h3><code class="docutils literal"><span class="pre">bdist</span></code><a class="headerlink" href="#bdist" title="Permalink to this headline"></a></h3>
<p>Because zipline now supports multiple versions of numpy, we&#8217;re not building
<p>Because zipline now supports multiple versions of numpy, were not building
binary wheels, since they are not tagged with the version of numpy with which
they were compiled.</p>
</div>
@@ -331,10 +334,10 @@ $ git push origin gh-pages
<h2>Uploading conda packages<a class="headerlink" href="#uploading-conda-packages" title="Permalink to this headline"></a></h2>
<p>Travis and AppVeyor build zipline conda packages for us. Once they have built
and uploaded to anaconda.org the packages (and their dependencies) for the
release commit to master, we should move those packages from the &#8220;ci&#8221; label to
the &#8220;main&#8221; label. You can do this from the anaconda.org web interface. This
is also a good time to remove all the old &#8220;ci&#8221; packages from anaconda.</p>
<p>Travis and AppVeyor only build and upload linux-64 and win-64 packages. We&#8217;ll
release commit to master, we should move those packages from the “ci” label to
the “main” label. You can do this from the anaconda.org web interface. This
is also a good time to remove all the old “ci” packages from anaconda.</p>
<p>Travis and AppVeyor only build and upload linux-64 and win-64 packages. Well
need to build and upload osx-64 packages manually on an OSX machine.</p>
<p>To build the conda packages for zipline locally, run:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ python etc/conda_build_matrix.py
@@ -355,11 +358,11 @@ may be specified with the <code class="docutils literal"><span class="pre">--use
<p>Push a new commit post-release that adds the whatsnew for the next release,
which should be titled according to a micro version increment. If that next
release turns out to be a major/minor version increment, the file can be
renamed when that&#8217;s decided. You can use <code class="docutils literal"><span class="pre">docs/source/whatsnew/skeleton.txt</span></code>
renamed when thats decided. You can use <code class="docutils literal"><span class="pre">docs/source/whatsnew/skeleton.txt</span></code>
as a template for the new file.</p>
<p>Include the whatsnew file in <code class="docutils literal"><span class="pre">docs/source/releases.rst</span></code>. New releases should
appear at the top. The syntax for this is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>.. include:: whatsnew/&lt;version&gt;.txt
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">include</span><span class="p">::</span> <span class="n">whatsnew</span><span class="o">/&lt;</span><span class="n">version</span><span class="o">&gt;.</span><span class="n">txt</span>
</pre></div>
</div>
</div>
@@ -404,7 +407,7 @@ appear at the top. The syntax for this is:</p>
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+7 -4
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
<link rel="prev" title="Development Guidelines" href="development-guidelines.html"/>
@@ -92,7 +95,7 @@
<li class="toctree-l1"><a class="reference internal" href="videos.html">Videos</a></li>
<li class="toctree-l1"><a class="reference internal" href="resources.html">Resources</a></li>
<li class="toctree-l1"><a class="reference internal" href="development-guidelines.html">Development Guidelines</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Release Notes</a><ul>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Release Notes</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#version-0-5-2">Version 0.5.2</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#bug-fixes">Bug Fixes</a></li>
</ul>
@@ -240,7 +243,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/releases.txt" rel="nofollow"> View page source</a>
<a href="_sources/releases.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -591,7 +594,7 @@ missing file</li>
<h2>Version 0.2.dev5<a class="headerlink" href="#version-0-2-dev5" title="Permalink to this headline"></a></h2>
<p><strong>Release Date</strong>: 2017-10-03</p>
<ul class="simple">
<li>Fixes bug in data.history function that was formatting &#8216;volume&#8217; data as
<li>Fixes bug in data.history function that was formatting volume data as
integers, now they are returned as floats with up to 9 decimals of precision.
Data bundles redone.</li>
</ul>
@@ -729,7 +732,7 @@ exchange directly</li>
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+7 -4
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
<link rel="next" title="Development Guidelines" href="development-guidelines.html"/>
<link rel="prev" title="Videos" href="videos.html"/>
@@ -91,7 +94,7 @@
<li class="toctree-l1"><a class="reference internal" href="example-algos.html">Example Algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="utilities.html">Utilities</a></li>
<li class="toctree-l1"><a class="reference internal" href="videos.html">Videos</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Resources</a><ul>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Resources</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#related-3rd-party-apis">Related 3rd Party APIs</a></li>
</ul>
</li>
@@ -147,7 +150,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/resources.txt" rel="nofollow"> View page source</a>
<a href="_sources/resources.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -173,7 +176,7 @@ Trading Library, and the project Catalyst forked off in the spring of 2017.</li>
<li><a class="reference external" href="https://www.quantopian.com/help">Quantopian</a> provides a platform for
freelance quantitative analysts develop, test, and use trading algorithms to
buy and sell securities. They aim to create a crowd-sourced hedge fund by
fostering their community of freelance traders. Quantopian&#8217;s backtesting and
fostering their community of freelance traders. Quantopians backtesting and
live-trading engine is powered by <em>Zipline</em>.</li>
<li><a class="reference external" href="https://pandas.pydata.org/pandas-docs/stable/api.html">Pandas</a> is a Python
library providing high-performance, easy-to-use data structures and data
@@ -237,7 +240,7 @@ trading algorithms</li>
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+4 -1
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="#"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
@@ -203,7 +206,7 @@
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+1 -1
View File
File diff suppressed because one or more lines are too long
+8 -5
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
<link rel="next" title="Videos" href="videos.html"/>
<link rel="prev" title="Example Algorithms" href="example-algos.html"/>
@@ -89,7 +92,7 @@
<li class="toctree-l1"><a class="reference internal" href="live-trading.html">Live Trading</a></li>
<li class="toctree-l1"><a class="reference internal" href="features.html">Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="example-algos.html">Example Algorithms</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Utilities</a><ul>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Utilities</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#output-to-csv-file">Output to CSV file</a></li>
<li class="toctree-l2"><a class="reference internal" href="#extracting-market-data">Extracting market data</a></li>
</ul>
@@ -148,7 +151,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/utilities.txt" rel="nofollow"> View page source</a>
<a href="_sources/utilities.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -205,9 +208,9 @@ your trading algorithm, which could be the CLI or a Python Interpreter.</p>
<h2>Extracting market data<a class="headerlink" href="#extracting-market-data" title="Permalink to this headline"></a></h2>
<p>Use this script to save the price and volume data of one cryptoasset in a CSV
file, which will be saved in the same location and with the same name as your
Python file. To get custom data, simply modify the asset&#8217;s symbol and the dates.
Python file. To get custom data, simply modify the assets symbol and the dates.
Run this script directly from your development environment: python scriptname.py,
where the contents of &#8216;scriptname.py&#8217; are as follows. Two different version are
where the contents of scriptname.py are as follows. Two different version are
provided as an example for daily- and minute-resolution data respectively:</p>
<p>Simpler case for daily data</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">os</span>
@@ -352,7 +355,7 @@ provided as an example for daily- and minute-resolution data respectively:</p>
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
+7 -4
View File
@@ -32,6 +32,9 @@
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Catalyst 0.4 documentation" href="index.html"/>
<link rel="next" title="Resources" href="resources.html"/>
<link rel="prev" title="Utilities" href="utilities.html"/>
@@ -90,7 +93,7 @@
<li class="toctree-l1"><a class="reference internal" href="features.html">Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="example-algos.html">Example Algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="utilities.html">Utilities</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Videos</a><ul>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Videos</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#installation-macos">Installation: MacOS</a></li>
<li class="toctree-l2"><a class="reference internal" href="#installation-windows">Installation: Windows</a></li>
<li class="toctree-l2"><a class="reference internal" href="#backtesting-a-strategy">Backtesting a Strategy</a></li>
@@ -150,7 +153,7 @@
<li class="wy-breadcrumbs-aside">
<a href="_sources/videos.txt" rel="nofollow"> View page source</a>
<a href="_sources/videos.rst.txt" rel="nofollow"> View page source</a>
</li>
@@ -178,7 +181,7 @@
<iframe width="560" height="315" src="https://www.youtube.com/embed/H8HqcEbZmkk" frameborder="0" allowfullscreen></iframe><div class="line-block">
<div class="line"><br /></div>
</div>
<p>Where things don&#8217;t:</p>
<p>Where things dont:</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/qLkQcWlUBy8" frameborder="0" allowfullscreen></iframe><div class="line-block">
<div class="line"><br /></div>
<div class="line"><br /></div>
@@ -256,7 +259,7 @@ in the previous video, we now take it to trade live against the Bittrex exchange
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>