mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-07 15:10:58 +08:00
DOC: compling the docs
This commit is contained in:
+129
-255
@@ -1,188 +1,52 @@
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Catalyst Beginner Tutorial — Catalyst 0.4 documentation</title>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Catalyst Beginner Tutorial — Catalyst 0.4 documentation</title>
|
||||
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: './',
|
||||
VERSION: '0.4',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true,
|
||||
SOURCELINK_SUFFIX: '.txt'
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
<link rel="search" title="Search" href="search.html" />
|
||||
<link rel="next" title="Live Trading" href="live-trading.html" />
|
||||
<link rel="prev" title="Install" href="install.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="live-trading.html" title="Live Trading"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="install.html" title="Install"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="index.html">Catalyst 0.4 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<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"/>
|
||||
|
||||
|
||||
<script src="_static/js/modernizr.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav" role="document">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search">
|
||||
|
||||
|
||||
|
||||
<a href="index.html" class="icon icon-home"> Catalyst
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<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-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>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#running-the-algorithm">Running the algorithm</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#command-line-interface">Command line interface</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#access-to-previous-prices-using-history">Access to previous prices using <code class="docutils literal"><span class="pre">history</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#working-example-dual-moving-average-cross-over">Working example: Dual Moving Average Cross-Over</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#jupyter-notebook">Jupyter Notebook</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#install">Install</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#running-algorithms">Running Algorithms</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#pycharm-ide">PyCharm IDE</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#id1">Install</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#setup">Setup</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#next-steps">Next steps</a></li>
|
||||
</ul>
|
||||
</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"><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"><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"><a class="reference internal" href="releases.html">Release Notes</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="index.html">Catalyst</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="index.html">Docs</a> »</li>
|
||||
|
||||
<li>Catalyst Beginner Tutorial</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
|
||||
<a href="_sources/beginner-tutorial.rst.txt" rel="nofollow"> View page source</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body" role="main">
|
||||
|
||||
<div class="section" id="catalyst-beginner-tutorial">
|
||||
<h1>Catalyst Beginner Tutorial<a class="headerlink" href="#catalyst-beginner-tutorial" title="Permalink to this headline">¶</a></h1>
|
||||
@@ -244,15 +108,15 @@ crypto asset in your universe.</p>
|
||||
</div>
|
||||
<p>As you can see, we first have to import some functions we would like to
|
||||
use. All functions commonly used in your algorithm can be found in
|
||||
<code class="docutils literal"><span class="pre">catalyst.api</span></code>. Here we are using <a class="reference internal" href="appendix.html#catalyst.api.order" title="catalyst.api.order"><code class="xref py py-func docutils literal"><span class="pre">order()</span></code></a> which takes
|
||||
<code class="docutils literal"><span class="pre">catalyst.api</span></code>. Here we are using <code class="xref py py-func docutils literal"><span class="pre">order()</span></code> which takes
|
||||
twoarguments: a cryptoasset object, and a number specifying how many assets you
|
||||
wouldlike to order (if negative, <a class="reference internal" href="appendix.html#catalyst.api.order" title="catalyst.api.order"><code class="xref py py-func docutils literal"><span class="pre">order()</span></code></a> will sell/short
|
||||
wouldlike to order (if negative, <code class="xref py py-func docutils literal"><span class="pre">order()</span></code> will sell/short
|
||||
assets). In this case we want to order 1 bitcoin at each iteration.</p>
|
||||
<p>Finally, the <a class="reference internal" href="appendix.html#catalyst.api.record" title="catalyst.api.record"><code class="xref py py-func docutils literal"><span class="pre">record()</span></code></a> function allows you to save the value
|
||||
<p>Finally, the <code class="xref py py-func docutils literal"><span class="pre">record()</span></code> function allows you to save the value
|
||||
of a variable at each iteration. You provide it with a name for the variable
|
||||
together with the variable itself: <code class="docutils literal"><span class="pre">varname=var</span></code>. After the algorithm
|
||||
finished running you will have access to each variable value you tracked
|
||||
with <a class="reference internal" href="appendix.html#catalyst.api.record" title="catalyst.api.record"><code class="xref py py-func docutils literal"><span class="pre">record()</span></code></a> under the name you provided (we will see this
|
||||
with <code class="xref py py-func docutils literal"><span class="pre">record()</span></code> under the name you provided (we will see this
|
||||
further below). You also see how we can access the current price data of
|
||||
a bitcoin in the <code class="docutils literal"><span class="pre">data</span></code> event frame.</p>
|
||||
</div>
|
||||
@@ -314,14 +178,14 @@ following from the command line:</p>
|
||||
<code class="docutils literal"><span class="pre">catalyst</span></code> provides three interfaces:</p>
|
||||
<ul class="simple">
|
||||
<li>A command-line interface (CLI),</li>
|
||||
<li>a <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> that you can call from other
|
||||
<li>a <code class="xref py py-func docutils literal"><span class="pre">run_algorithm()</span></code> that you can call from other
|
||||
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’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"><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
|
||||
<code class="xref py py-func docutils literal"><span class="pre">run_algorithm()</span></code> function. For the third method, refer to the
|
||||
corresponding section on <a class="reference internal" href="#jupyter"><span class="std std-ref">Catalyst & Jupyter Notebook</span></a> after you
|
||||
have assimilated the contents of this tutorial.</p>
|
||||
<div class="section" id="command-line-interface">
|
||||
@@ -2662,75 +2526,85 @@ problems on our <a class="reference external" href="https://github.com/enigmampc
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="articleComments">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||||
|
||||
<a href="live-trading.html" class="btn btn-neutral float-right" title="Live Trading" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
|
||||
|
||||
<a href="install.html" class="btn btn-neutral" title="Install" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018, Enigma MPC, Inc..
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Catalyst Beginner Tutorial</a><ul>
|
||||
<li><a class="reference internal" href="#basics">Basics</a></li>
|
||||
<li><a class="reference internal" href="#my-first-algorithm">My first algorithm</a></li>
|
||||
<li><a class="reference internal" href="#ingesting-data">Ingesting data</a></li>
|
||||
<li><a class="reference internal" href="#running-the-algorithm">Running the algorithm</a><ul>
|
||||
<li><a class="reference internal" href="#command-line-interface">Command line interface</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#access-to-previous-prices-using-history">Access to previous prices using <code class="docutils literal"><span class="pre">history</span></code></a><ul>
|
||||
<li><a class="reference internal" href="#working-example-dual-moving-average-cross-over">Working example: Dual Moving Average Cross-Over</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#jupyter-notebook">Jupyter Notebook</a><ul>
|
||||
<li><a class="reference internal" href="#install">Install</a></li>
|
||||
<li><a class="reference internal" href="#running-algorithms">Running Algorithms</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#pycharm-ide">PyCharm IDE</a><ul>
|
||||
<li><a class="reference internal" href="#id1">Install</a></li>
|
||||
<li><a class="reference internal" href="#setup">Setup</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#next-steps">Next steps</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'0.4',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
HAS_SOURCE: true,
|
||||
SOURCELINK_SUFFIX: '.txt'
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.StickyNav.enable();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="install.html"
|
||||
title="previous chapter">Install</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="live-trading.html"
|
||||
title="next chapter">Live Trading</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="_sources/beginner-tutorial.rst.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="searchbox" style="display: none" role="search">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="search.html" method="get">
|
||||
<div><input type="text" name="q" /></div>
|
||||
<div><input type="submit" value="Go" /></div>
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="live-trading.html" title="Live Trading"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="install.html" title="Install"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="index.html">Catalyst 0.4 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer" role="contentinfo">
|
||||
© Copyright 2018, Enigma MPC, Inc..
|
||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.6.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user