mirror of
https://github.com/wassname/catalyst.git
synced 2026-10-29 13:00:42 +08:00
DOC: Updated Jupyter documentation
This commit is contained in:
1 parent
3fac06b0eb
commit
a1d5832db6
4 files changed
+32
-23
No files matched your search
+15
-10
@@ -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
@@ -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
@@ -253,8 +253,7 @@
|
||||
|
||||
<div class="section" id="catalyst-jupyter-notebook">
|
||||
<h1>Catalyst & 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
@@ -1 +1 @@
|
||||
Search.setIndex({envversion:46,filenames:["appendix","beginner-tutorial","bundles","development-guidelines","example-algos","index","install","jupyter","live-trading","naming-convention","release-process","releases","resources","utilities","videos"],objects:{"zipline.data.bundles":{bundles:[0,0,1,""]}},objnames:{"0":["py","data","Python data"]},objtypes:{"0":"py:data"},terms:{"000000e":1,"1000th":7,"15t":4,"1st":1,"30t":4,"328842e":1,"340mb":11,"380954e":1,"40mb":11,"460mb":11,"505275d6646a41f3856b22b16678d":1,"536708e":1,"5min":[4,7],"650729e":1,"7869f7828fa140328eb40477bb7d":1,"998236e":1,"998677e":1,"999120e":1,"999558e":1,"99mb":11,"__file__":[4,13],"__future__":4,"__main__":[1,4],"__name__":[1,4],"__wrapped__":10,"_tkinter":1,"boolean":[2,8],"case":[1,2,3,6,13],"class":[3,10],"default":1,"export":10,"final":[1,2,3],"float":[1,11],"import":[1,2,4,7,10,13],"int":2,"long":[1,2,4],"new":1,"public":11,"return":[1,4,8,10,11,12],"short":[1,3,4],"static":10,"throw":11,"true":[1,4,7,8],"try":[4,6],"var":1,"while":[6,10,11],aapl:2,abil:2,abl:[1,2,6],abner:4,about:[1,2,5,6],abov:[1,3,4,6,8,9,10],accept:[2,6,10],accord:10,accordingli:[1,4],account:[2,4,5,7,11],acevedo:4,acquir:[2,6],across:[5,9,11],activ:[6,10],actual:7,add:[1,2,3,6,10,13],addit:[1,3,5,6,11],address:10,adjust:[2,4,11],administr:6,advantag:6,afford:[4,7],aforement:1,after:[1,2,4,6,7,10],again:1,against:[1,5,8,11,14],agre:4,ahead:1,aim:[4,12],algebra:[4,6],algo:[1,2,4,11],algo_namespac:[1,4,8],algo_volatil:[1,7],algofil:[1,2],algorith:1,algorithm_period_return:[1,4,7],algotext:1,alia:4,alias:4,all:[0,1,2,3,4,5,6,7,8,9,10,11],allow:[1,2,5,6],along:2,alongsid:1,alpha:[1,4,6,7],alreadi:[1,2,3,6,7],also:[1,2,3,4,5,6,7,8,10],altern:[1,6,9],although:1,alwai:[2,8,9,10],amount:[1,4,7,11],amp_btc:9,anaconda:[1,6,10],analog:1,analysi:[1,4,5,10,11,12],analyst:12,analyt:[5,6],analyz:[1,4,7,8,11,13],ani:[1,2,4,6,7,9,10,13],anonym:2,anoth:[1,2,4,7],anymor:1,anyth:[1,6,10],apach:4,appar:1,appear:[2,10],append:10,appli:[1,4],applic:[1,4],appropri:[1,3,4],approxim:[4,7],appveyor:10,apt:[1,6],arang:[1,4],arbitrari:8,arbitrarili:1,arch:6,architectur:1,ardr_btc:9,arg:[1,10],argument:[0,1,2,7,8,10],argv:13,around:[5,10],arrai:[4,6],art:5,articl:[3,4],ask:[1,3],asmatrix:4,assess:1,asset_nam:[4,7],assetdbwrit:2,assign:[1,8],assimil:1,assist:6,assum:[1,3,4,6],astyp:4,atla:6,attempt:[2,8],attribut:[4,10],auth:[8,11],auto:11,avail:1,avoid:[1,2,4],awar:10,ax1:[1,4,7],ax2:[1,4,7],ax3:[1,4,7],ax4:[1,4,7],ax5:[4,7],ax6:[4,7],axhlin:4,axi:4,ayala:4,back:[3,6,9],backbon:4,backend:6,bah:4,bar:[1,4,11],bar_count:[1,4],base:[1,2,4,5,6,7,8,14],base_curr:[1,4,8,9,13],base_pric:[1,4],basenam:[4,13],basi:[4,11],batch:6,batteri:1,bch_btc:9,bch_eth:9,bch_usdt:9,bcn_btc:9,bcn_xmr:9,bcolz:2,bcolzdailybarread:2,bcolzdailybarwrit:2,bcolzminutebarread:2,bcolzminutebarwrit:2,bcy_btc:9,be62ff77760c4599abaac43be9cc9:1,bear:[1,4],beautifi:1,becaus:[6,7,10,11],been:[0,1,2,6,10],befor:[1,2,4,6,8,11],before_trading_start:[0,4],beggin:4,begin:[1,4,6],behavior:0,bela_btc:9,believ:1,below:[1,4,6,7,13],benchmark:[4,5,7,11],benchmark_period_return:[1,4,7],benchmark_volatil:[1,7],benefit:1,best:[3,5,6],beta:[1,4,7],better:1,between:[1,3,4,5,9],bfill:4,bia:1,big:6,bin:[4,6],binari:[6,10],bit:[3,6],bitcoin:[1,4,5,8,9,13],bitcoin_usd_asset:8,bitfinex:[1,4,5,7,8,11],bittrex:[1,4,5,8,11,14],bld:3,blk_btc:9,blk_xmr:9,blockchain:9,blotter:13,blue:1,bodi:3,book:1,both:[1,3,8,9,10],bought:1,bound:1,breakdown:8,brew:6,brother:6,brows:6,browser:[3,7,10],btc:1,btc_usd:[1,4,7,8,9],btc_usdt:[4,5,9,13],btcd_btc:9,btcd_xmr:9,btm_btc:9,bts_btc:9,bug:[2,3],bui:1,build:[1,3,6,10],build_ext:3,burst_btc:9,button:[6,10],buy_and_hodl:[4,11],buy_btc_simpl:[1,4],buy_btc_simple_out:[1,4],buy_df:[1,4],buy_low_sell_high:11,calcul:[1,3,4,8],call:[1,2,3,4],can:[1,2,3,4,5,6,8,9,10,11,13],can_trad:[1,4,11],cancel_ord:[4,7],candl:[1,9,11],candle_s:4,candlestick:4,cannot:[1,4,6],canon:3,capit:[1,4,7],capital_bas:[1,4,11,13],capital_us:[1,7],captur:1,cash:[1,2,3,4,7,11],catalyst_dev:[1,5,6],caus:[0,1,2,3],cell:7,cert:11,certian:0,chanc:1,chang:[1,3,4,5,6,7,10,11],channel:[1,5,6],charact:3,charg:1,chart:[1,4,6],check:[1,2,3,4,6,7,8,9],checker:10,checkout:[3,10],choic:10,choos:[1,4,6,9,10,13],chosen:[1,13],chunk:[1,11],circumv:6,clam_btc:9,classic:[1,4],classifi:1,clean:[2,6,10,11],clear:2,cli:[1,4,7,11,13],click:[6,10],client:8,clone:3,close:[1,4,7,13],cmap:4,cmd:[1,6],code:[1,4,6,10,11,13],codebas:3,coin:[4,7,11],collect:[1,2,4],color:[4,7],colorbar:4,colour:4,column:[1,2,4,7],com:[1,2,3,8],combin:[6,8],come:[2,6],comment:1,common:1,commonli:1,commun:[6,12],comp:4,compar:[1,4,5],comparison:11,compat:[5,11],compil:[6,10,11],complement:4,complet:8,complex:[1,6],complianc:4,complimentari:13,comprehens:11,compress:[1,11],comput:[1,4,6,11,12],concept:1,conda:1,conda_build_matrix:10,condit:4,config:6,configur:[1,6,11],congratul:6,consid:[1,4],consist:[1,9],constant:7,constraint:2,consum:10,contain:[1,2,3,4,6,7],content:1,context:[1,4,7,13],continLine truncated
|
||||
Search.setIndex({envversion:46,filenames:["appendix","beginner-tutorial","bundles","development-guidelines","example-algos","index","install","jupyter","live-trading","naming-convention","release-process","releases","resources","utilities","videos"],objects:{"zipline.data.bundles":{bundles:[0,0,1,""]}},objnames:{"0":["py","data","Python data"]},objtypes:{"0":"py:data"},terms:{"000000e":1,"1000th":7,"15t":4,"1st":1,"30t":4,"328842e":1,"340mb":11,"380954e":1,"40mb":11,"460mb":11,"505275d6646a41f3856b22b16678d":1,"536708e":1,"5min":[4,7],"650729e":1,"7869f7828fa140328eb40477bb7d":1,"998236e":1,"998677e":1,"999120e":1,"999558e":1,"99mb":11,"__file__":[4,13],"__future__":4,"__main__":[1,4],"__name__":[1,4],"__wrapped__":10,"_tkinter":1,"boolean":[2,8],"case":[1,2,3,6,13],"class":[3,10],"default":1,"export":10,"final":[1,2,3],"float":[1,11],"import":[1,2,4,7,10,13],"int":2,"long":[1,2,4],"new":1,"public":11,"return":[1,4,8,10,11,12],"short":[1,3,4],"static":10,"throw":11,"true":[1,4,7,8],"try":[4,6],"var":1,"while":[6,10,11],aapl:2,abil:2,abl:[1,2,6],abner:4,about:[1,2,5,6],abov:[1,3,4,6,8,9,10],accept:[2,6,10],accord:10,accordingli:[1,4],account:[2,4,5,7,11],acevedo:4,acquir:[2,6],across:[5,9,11],activ:[6,10],actual:7,add:[1,2,3,6,10,13],addit:[1,3,5,6,11],address:10,adjust:[2,4,11],administr:6,advantag:6,afford:[4,7],aforement:1,after:[1,2,4,6,7,10],again:1,against:[1,5,8,11,14],agre:4,ahead:1,aim:[4,12],algebra:[4,6],algo:[1,2,4,11],algo_namespac:[1,4,8],algo_volatil:[1,7],algofil:[1,2],algorith:1,algorithm_period_return:[1,4,7],algotext:1,alia:4,alias:4,all:[0,1,2,3,4,5,6,7,8,9,10,11],allow:[1,2,5,6],along:2,alongsid:1,alpha:[1,4,6,7],alreadi:[1,2,3,6,7],also:[1,2,3,4,5,6,7,8,10],altern:[1,6,9],although:1,alwai:[2,8,9,10],amount:[1,4,7,11],amp_btc:9,anaconda:[1,6,10],analog:1,analysi:[1,4,5,10,11,12],analyst:12,analyt:[5,6],analyz:[1,4,7,8,11,13],ani:[1,2,4,6,7,9,10,13],anonym:2,anoth:[1,2,4,7],anymor:1,anyth:[1,6,10],apach:4,appar:1,appear:[2,10],append:10,appli:[1,4],applic:[1,4],appropri:[1,3,4],approxim:[4,7],appveyor:10,apt:[1,6],arang:[1,4],arbitrari:8,arbitrarili:1,arch:6,architectur:1,ardr_btc:9,arg:[1,10],argument:[0,1,2,7,8,10],argv:13,around:[5,10],arrai:[4,6],art:5,articl:[3,4],ask:[1,3],asmatrix:4,assess:1,asset_nam:[4,7],assetdbwrit:2,assign:[1,8],assimil:1,assist:6,assum:[1,3,4,6],astyp:4,atla:6,attempt:[2,8],attribut:[4,10],auth:[8,11],auto:11,avail:1,avoid:[1,2,4],awar:10,ax1:[1,4,7],ax2:[1,4,7],ax3:[1,4,7],ax4:[1,4,7],ax5:[4,7],ax6:[4,7],axhlin:4,axi:4,ayala:4,back:[3,6,9],backbon:4,backend:6,bah:4,bar:[1,4,11],bar_count:[1,4],base:[1,2,4,5,6,7,8,14],base_curr:[1,4,8,9,13],base_pric:[1,4],basenam:[4,13],basi:[4,11],batch:6,batteri:1,bch_btc:9,bch_eth:9,bch_usdt:9,bcn_btc:9,bcn_xmr:9,bcolz:2,bcolzdailybarread:2,bcolzdailybarwrit:2,bcolzminutebarread:2,bcolzminutebarwrit:2,bcy_btc:9,be62ff77760c4599abaac43be9cc9:1,bear:[1,4],beautifi:1,becaus:[6,7,10,11],been:[0,1,2,6,10],befor:[1,2,4,6,7,8,11],before_trading_start:[0,4],beggin:4,begin:[1,4,6],behavior:0,bela_btc:9,believ:1,below:[1,4,6,7,13],benchmark:[4,5,7,11],benchmark_period_return:[1,4,7],benchmark_volatil:[1,7],benefit:1,best:[3,5,6],beta:[1,4,7],better:1,between:[1,3,4,5,9],bfill:4,bia:1,big:6,bin:[4,6],binari:[6,10],bit:[3,6],bitcoin:[1,4,5,8,9,13],bitcoin_usd_asset:8,bitfinex:[1,4,5,7,8,11],bittrex:[1,4,5,8,11,14],bld:3,blk_btc:9,blk_xmr:9,blockchain:9,blotter:13,blue:1,bodi:3,book:1,both:[1,3,8,9,10],bought:1,bound:1,breakdown:8,brew:6,brother:6,brows:6,browser:[3,7,10],btc:1,btc_usd:[1,4,7,8,9],btc_usdt:[4,5,9,13],btcd_btc:9,btcd_xmr:9,btm_btc:9,bts_btc:9,bug:[2,3],bui:1,build:[1,3,6,10],build_ext:3,burst_btc:9,button:[6,10],buy_and_hodl:[4,11],buy_btc_simpl:[1,4],buy_btc_simple_out:[1,4],buy_df:[1,4],buy_low_sell_high:11,calcul:[1,3,4,8],call:[1,2,3,4],can:[1,2,3,4,5,6,8,9,10,11,13],can_trad:[1,4,11],cancel_ord:[4,7],candl:[1,9,11],candle_s:4,candlestick:4,cannot:[1,4,6],canon:3,capit:[1,4,7],capital_bas:[1,4,11,13],capital_us:[1,7],captur:1,cash:[1,2,3,4,7,11],catalyst_dev:[1,5,6],caus:[0,1,2,3],cell:7,cert:11,certian:0,chanc:1,chang:[1,3,4,5,6,7,10,11],channel:[1,5,6],charact:3,charg:1,chart:[1,4,6],check:[1,2,3,4,6,7,8,9],checker:10,checkout:[3,10],choic:10,choos:[1,4,6,9,10,13],chosen:[1,13],chunk:[1,11],circumv:6,clam_btc:9,classic:[1,4],classifi:1,clean:[2,6,10,11],clear:2,cli:[1,4,7,11,13],click:[6,10],client:8,clone:3,close:[1,4,7,13],cmap:4,cmd:[1,6],code:[1,4,6,10,11,13],codebas:3,coin:[4,7,11],collect:[1,2,4],color:[4,7],colorbar:4,colour:4,column:[1,2,4,7],com:[1,2,3,8],combin:[6,8],come:[2,6],comment:1,common:1,commonli:1,commun:[6,12],comp:4,compar:[1,4,5],comparison:11,compat:[5,11],compil:[6,10,11],complement:4,complet:8,complex:[1,6],complianc:4,complimentari:13,comprehens:11,compress:[1,11],comput:[1,4,6,11,12],concept:1,conda:1,conda_build_matrix:10,condit:4,config:6,configur:[1,6,11],congratul:6,consid:[1,4],consist:[1,9],constant:7,constraint:2,consum:10,contain:[1,2,3,4,6,7],content:1,context:[1,4,7,13],contLine truncated
|
||||
Reference in new issue
Block a user