DOC: Updated Jupyter documentation

This commit is contained in:
Victor Grau Serrat
2017-12-11 15:53:34 -07:00
parent 3fac06b0eb
commit a1d5832db6
4 changed files with 32 additions and 23 deletions
+15 -10
View File
@@ -1,8 +1,7 @@
Catalyst & Jupyter Notebook
===========================
(Feel free to check out the actual Notebook file
`here <https://github.com/enigmampc/catalyst-docs/blob/master/docs/running_catalyst_in_jupyter_notebook.ipynb>`__)
(`This is actual Notebook <https://github.com/enigmampc/catalyst/blob/master/catalyst/examples/running_catalyst_in_jupyter_notebook.ipynb>`_ referenced in the text below)
The `Jupyter Notebook <https://jupyter.org/>`__ is a very powerful
browser-based interface to a Python interpreter. As it is already the
@@ -33,11 +32,19 @@ the interface through which you will interact with Jupyter Notebook.
Running Algorithms
^^^^^^^^^^^^^^^^^^
To use it you have to write your algorithm in a cell and let
``catalyst`` know that it is supposed to run this algorithm. This is
done via the ``%%catalyst`` IPython magic command that is available
after you import ``catalyst`` from within the Notebook. This magic takes
the same arguments as the command line interface. Thus to run the
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
catalyst ingest-exchange -x bitfinex -i btc_usd
To use Catalyst inside a Jupyter Noebook, you have to write your algorithm in a
cell and let the Jupyter know that it is supposed to execute this algorithm with
Catalyst. This is done via the ``%%catalyst`` IPython magic command that is
available after you import ``catalyst`` from within the Notebook. This magic
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 ``catalyst`` to register the magic.
@@ -58,7 +65,7 @@ functions.
.. code:: python
%%catalyst --start 2015-3-2 --end 2017-6-28 --capital-base 100000 -x bitfinex
%%catalyst --start 2015-3-2 --end 2017-6-28 --capital-base 100000 -x bitfinex -c usd
from catalyst.finance.slippage import VolumeShareSlippage
@@ -199,8 +206,6 @@ functions.
.. figure:: https://i.imgur.com/DS5w47q.png
:alt: png
png
.. raw:: html
<div>
+2 -2
View File
@@ -32,7 +32,7 @@
<link rel="top" title="Catalyst 0.3 documentation" href="index.html"/>
<link rel="next" title="Catalyst Beginner Tutorial" href="beginner-tutorial.html"/>
<link rel="prev" title="Table of Contents" href="index.html"/>
<link rel="prev" title="Overview" href="index.html"/>
<script src="_static/js/modernizr.min.js"></script>
@@ -640,7 +640,7 @@ and you get a hint on how to solve it.</li>
<a href="beginner-tutorial.html" class="btn btn-neutral float-right" title="Catalyst Beginner Tutorial" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="index.html" class="btn btn-neutral" title="Table of Contents" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="index.html" class="btn btn-neutral" title="Overview" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
+14 -10
View File
@@ -253,8 +253,7 @@
<div class="section" id="catalyst-jupyter-notebook">
<h1>Catalyst &amp; Jupyter Notebook<a class="headerlink" href="#catalyst-jupyter-notebook" title="Permalink to this headline"></a></h1>
<p>(Feel free to check out the actual Notebook file
<a class="reference external" href="https://github.com/enigmampc/catalyst-docs/blob/master/docs/running_catalyst_in_jupyter_notebook.ipynb">here</a>)</p>
<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
de-facto interface for most quantitative researchers, <code class="docutils literal"><span class="pre">catalyst</span></code>
@@ -277,11 +276,17 @@ the interface through which you will interact with Jupyter Notebook.</p>
</div>
<div class="section" id="running-algorithms">
<h2>Running Algorithms<a class="headerlink" href="#running-algorithms" title="Permalink to this headline"></a></h2>
<p>To use it you have to write your algorithm in a cell and let
<code class="docutils literal"><span class="pre">catalyst</span></code> know that it is supposed to run this algorithm. This is
done via the <code class="docutils literal"><span class="pre">%%catalyst</span></code> IPython magic command that is available
after you import <code class="docutils literal"><span class="pre">catalyst</span></code> from within the Notebook. This magic takes
the same arguments as the command line interface. Thus to run the
<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>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
cell and let the Jupyter know that it is supposed to execute this algorithm with
Catalyst. This is done via the <code class="docutils literal"><span class="pre">%%catalyst</span></code> IPython magic command that is
available after you import <code class="docutils literal"><span class="pre">catalyst</span></code> from within the Notebook. This magic
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>
@@ -296,7 +301,7 @@ importing <code class="docutils literal"><span class="pre">catalyst</span></code
<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>%%catalyst --start 2015-3-2 --end 2017-6-28 --capital-base 100000 -x bitfinex
<div class="code python highlight-python"><div class="highlight"><pre>%%catalyst --start 2015-3-2 --end 2017-6-28 --capital-base 100000 -x bitfinex -c usd
from catalyst.finance.slippage import VolumeShareSlippage
@@ -434,9 +439,8 @@ def analyze(context=None, results=None):
[2017-08-11 07:19:54.620430] INFO: Performance: last close: 2017-06-28 23:59:00+00:00
</pre></div>
</div>
<div class="figure" id="id1">
<div class="figure">
<img alt="png" src="https://i.imgur.com/DS5w47q.png" />
<p class="caption"><span class="caption-text">png</span></p>
</div>
<div><table border="1" class="dataframe"><thead><tr style="text-align: right;"><th></th><th><p>algo_volatility</p>
</th><th><p>algorithm_period_return</p>
+1 -1
View File
File diff suppressed because one or more lines are too long