From 5fd4ca33d33535dfb440109a4395d9e0490b33d0 Mon Sep 17 00:00:00 2001 From: Victor Grau Serrat Date: Fri, 20 Oct 2017 10:14:31 -0600 Subject: [PATCH] DOC: beginner tutorial --- catalyst/examples/buy_btc_simple.py | 8 + docs/source/beginner-tutorial.rst | 760 +++++++--------------------- docs/source/index.rst | 2 +- docs/source/welcome.rst | 9 +- 4 files changed, 207 insertions(+), 572 deletions(-) create mode 100644 catalyst/examples/buy_btc_simple.py diff --git a/catalyst/examples/buy_btc_simple.py b/catalyst/examples/buy_btc_simple.py new file mode 100644 index 00000000..f7eb8aa0 --- /dev/null +++ b/catalyst/examples/buy_btc_simple.py @@ -0,0 +1,8 @@ +from catalyst.api import order, record, symbol + +def initialize(context): + context.asset = symbol('btc_usd') + +def handle_data(context, data): + order(asset, 1) + record(btc=data.current(context.asset, 'price')) \ No newline at end of file diff --git a/docs/source/beginner-tutorial.rst b/docs/source/beginner-tutorial.rst index c2f9a07d..b3b1b133 100644 --- a/docs/source/beginner-tutorial.rst +++ b/docs/source/beginner-tutorial.rst @@ -1,608 +1,281 @@ -Zipline Beginner Tutorial -------------------------- +Catalyst Beginner Tutorial +-------------------------- Basics ~~~~~~ -Zipline is an open-source algorithmic trading simulator written in -Python. +Catalyst is an open-source algorithmic trading simulator for crypto +assets written in Python. -The source can be found at: https://github.com/quantopian/zipline +The source can be found at: https://github.com/enigmampc/catalyst Some benefits include: +- Support for several of the top crypto-exchanges by trading volume. - Realistic: slippage, transaction costs, order delays. - Stream-based: Process each event individually, avoids look-ahead bias. - Batteries included: Common transforms (moving average) as well as common risk calculations (Sharpe). - Developed and continuously updated by - `Quantopian `__ which provides an - easy-to-use web-interface to Zipline, 10 years of minute-resolution - historical US stock data, and live-trading capabilities. This - tutorial is directed at users wishing to use Zipline without using - Quantopian. If you instead want to get started on Quantopian, see - `here `__. + `Enigma MPC `__ which is building the Enigma + data marketplace protocol as well as Catalyst, the first application + that will run on our protocol. Powered by our financial data + marketplace, Catalyst empowers users to share and curate data and + build profitable, data-driven investment strategies. -This tutorial assumes that you have zipline correctly installed, see the -`installation -instructions `__ if -you haven't set up zipline yet. +This tutorial assumes that you have Catalyst correctly installed, see the +:doc:`installation instructions ` if you haven't set up +Catalyst yet. -Every ``zipline`` algorithm consists of two functions you have to +Every ``catalyst`` algorithm consists of at least two functions you have to define: * ``initialize(context)`` * ``handle_data(context, data)`` -Before the start of the algorithm, ``zipline`` calls the +Before the start of the algorithm, ``catalyst`` calls the ``initialize()`` function and passes in a ``context`` variable. ``context`` is a persistent namespace for you to store variables you need to access from one algorithm iteration to the next. -After the algorithm has been initialized, ``zipline`` calls the +After the algorithm has been initialized, ``catalyst`` calls the ``handle_data()`` function once for each event. At every call, it passes the same ``context`` variable and an event-frame called ``data`` containing the current trading bar with open, high, low, and close -(OHLC) prices as well as volume for each stock in your universe. For -more information on these functions, see the `relevant part of the -Quantopian docs `__. +(OHLC) prices as well as volume for each crypto asset in your universe. + +.. For more information on these functions, see the `relevant part of the +.. Quantopian docs `. My first algorithm ~~~~~~~~~~~~~~~~~~ Lets take a look at a very simple algorithm from the ``examples`` -directory, ``buyapple.py``: +directory, ``buy_btc.py``: .. code-block:: python - from zipline.examples import buyapple - buyapple?? - - -.. code-block:: python - - from zipline.api import order, record, symbol + from catalyst.api import order, record, symbol def initialize(context): - pass + context.asset = symbol('btc_usd') def handle_data(context, data): - order(symbol('AAPL'), 10) - record(AAPL=data.current(symbol('AAPL'), 'price')) + order(context.asset, 1) + record(btc = data.current(context.asset, 'price')) 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 -``zipline.api``. Here we are using :func:`~zipline.api.order()` which takes two -arguments: a security object, and a number specifying how many stocks you would -like to order (if negative, :func:`~zipline.api.order()` will sell/short -stocks). In this case we want to order 10 shares of Apple at each iteration. For -more documentation on ``order()``, see the `Quantopian docs -`__. +``catalyst.api``. Here we are using :func:`~catalyst.api.order()` which takes two +arguments: a cryptoasset object, and a number specifying how many assets you would +like to order (if negative, :func:`~catalyst.api.order()` will sell/short +assets). In this case we want to order 1 bitcoin at each iteration. -Finally, the :func:`~zipline.api.record` function allows you to save the value +.. For more documentation on ``order()``, see the `Quantopian docs +.. `__. + +Finally, the :func:`~catalyst.api.record` 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: ``varname=var``. After the algorithm finished running you will have access to each variable value you tracked -with :func:`~zipline.api.record` under the name you provided (we will see this -further below). You also see how we can access the current price data of the -AAPL stock in the ``data`` event frame (for more information see -`here `__. +with :func:`~catalyst.api.record` 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 ``data`` event frame. + +.. (for more information see `here `__. Running the algorithm ~~~~~~~~~~~~~~~~~~~~~ -To now test this algorithm on financial data, ``zipline`` provides three -interfaces: A command-line interface, ``IPython Notebook`` magic, and -:func:`~zipline.run_algorithm`. +To can now test this algorithm on crypto data, ``catalyst`` provides three +interfaces: -Ingesting Data +- A command-line interface, +- ``IPython Notebook`` magic, +- and :func:`~catalyst.run_algorithm`. + +Ingesting data ^^^^^^^^^^^^^^ -If you haven't ingested the data, run: -.. code-block:: bash +In previous versions of Catalyst you needed to manually ingest data before running +your algorithm to make it available at runtime. Starting with version 0.3, the +algorithm will automagically ingest the data it needs the first time that encounters +a data request for data that it doesn't have. - $ zipline ingest [-b ] +Still, we believe it is important for you to have a high-level understanding +of how data is managed: -where ```` is the name of the bundle to ingest, defaulting to -:ref:`quantopian-quandl `. +- Pricing data is split and packaged into ``bundles``: chunks of data organized + as time series that are kept up to date daily on Enigma's servers. Catalyst + downloads the bundles that needs at any given time, and reconstructs the whole + dataset in your hard drive. -you can check out the :ref:`ingesting data ` section for -more detail. +- Pricing data is provided in ``daily`` and ``minute`` resolution. Those are different + bundle datasets, and are managed separately. + +- Bundles are exchange-specific, as the pricing data is specific to the trades that + happen in each exchange. You can optionally specify which exchange you want pricing + data from. + +- Catalyst keeps track of all the downloaded bundles, so that it only has to download + them once, and will do incremental updates as needed. + +- When running in ``live trading`` mode, Catalyst will first look for historical + pricing data in the locally stored bundles. If there is anything missing, Catalyst will + hit the exchange for the most recent data, and merge it with the local bundle to make + it available for future iterations. + +If you want to learn more, check out the :ref:`ingesting data ` section +for more detail. Command line interface ^^^^^^^^^^^^^^^^^^^^^^ -After you installed zipline you should be able to execute the following +After you installed Catalyst you should be able to execute the following from your command line (e.g. ``cmd.exe`` on Windows, or the Terminal app -on OSX): +on OSX). Displaying here a simplified output for eductional purposes: .. code-block:: bash - $ zipline run --help + $ catalyst --help .. parsed-literal:: - Usage: zipline run [OPTIONS] + Usage: catalyst [OPTIONS] COMMAND [ARGS]... - Run a backtest for the given algorithm. + Top level catalyst entry point. + + Options: + --version Show the version and exit. + --help Show this message and exit. + + Commands: + ingest-exchange Ingest data for the given exchange. + live Trade live with the given algorithm. + run Run a backtest for the given algorithm. + +There are three main modes you can run on Catalyst. The first being ``ingest-exchange`` +for data ingestion, which we have summarized in the previous section. The second +is ``live`` to use your algorithm to trade live against a given exchange, and the +third mode ``run`` is to backtest your algorithm before trading live with it. + +Let's start with backtesting, so run this other command to learn more about +the available options: + +.. code-block:: bash + + $ catalyst run --help + +.. parsed-literal:: + + Usage: catalyst run [OPTIONS] + + Run a backtest for the given algorithm. + + 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 + '-Dname=value'. 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: ] + -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 '-' 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. - 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 - '-Dname=value'. The value may be any python - expression. These are evaluated in order so - they may refer to previously defined names. - --data-frequency [minute|daily] - 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: quantopian-quandl] - --bundle-timestamp TIMESTAMP The date to lookup data on or before. - [default: ] - -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 '-' the perf will be written to stdout. - [default: -] - --print-algo / --no-print-algo Print the algorithm to stdout. - --help Show this message and exit. As you can see there are a couple of flags that specify where to find your -algorithm (``-f``) as well as parameters specifying which data to use, -defaulting to the :ref:`quantopian-quandl-mirror`. There are also arguments for -the date range to run the algorithm over (``--start`` and ``--end``). Finally, -you'll want to save the performance metrics of your algorithm so that you can -analyze how it performed. This is done via the ``--output`` flag and will cause -it to write the performance ``DataFrame`` 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 ``-c`` option so that you don't have to -supply the command line args all the time (see the .conf files in the examples -directory). +algorithm (``-f``) as well as a parameter to specify which exchange to use. +There are also arguments for the date range to run the algorithm over +(``--start`` and ``--end``). Finally, you'll want to save the performance +metrics of your algorithm so that you can analyze how it performed. This is +done via the ``--output`` flag and will cause it to write the performance +``DataFrame`` 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 ``-c`` option so that you don't have to supply the command line args +all the time (see the .conf files in the examples directory). Thus, to execute our algorithm from above and save the results to -``buyapple_out.pickle`` we would call ``zipline run`` as follows: +``buy_btc_simple_out.pickle`` we would call ``catalyst run`` as follows: .. code-block:: python - zipline run -f ../../zipline/examples/buyapple.py --start 2000-1-1 --end 2014-1-1 -o buyapple_out.pickle + catalyst run -f buy_btc_simple.py -x bitfinex --start 2016-1-1 --end 2016-9-29 -o buy_simple_btc_out.pickle -.. parsed-literal:: +.. +.. parsed-literal - AAPL - [2015-11-04 22:45:32.820166] INFO: Performance: Simulated 3521 trading days out of 3521. - [2015-11-04 22:45:32.820314] INFO: Performance: first open: 2000-01-03 14:31:00+00:00 - [2015-11-04 22:45:32.820401] INFO: Performance: last close: 2013-12-31 21:00:00+00:00 +.. AAPL +.. [2015-11-04 22:45:32.820166] INFO: Performance: Simulated 3521 trading days out of 3521. +.. [2015-11-04 22:45:32.820314] INFO: Performance: first open: 2000-01-03 14:31:00+00:00 +.. [2015-11-04 22:45:32.820401] INFO: Performance: last close: 2013-12-31 21:00:00+00:00 ``run`` first calls the ``initialize()`` function, and then -streams the historical stock price day-by-day through ``handle_data()``. -After each call to ``handle_data()`` we instruct ``zipline`` to order 10 -stocks of AAPL. After the call of the ``order()`` function, ``zipline`` +streams the historical asset price day-by-day through ``handle_data()``. +After each call to ``handle_data()`` we instruct ``catalyst`` to order 1 +bitcoin. After the call of the ``order()`` function, ``catalyst`` enters the ordered stock and amount in the order book. After the -``handle_data()`` function has finished, ``zipline`` looks for any open +``handle_data()`` function has finished, ``catalyst`` looks for any open orders and tries to fill them. If the trading volume is high enough for -this stock, the order is executed after adding the commission and +this asset, the order is executed after adding the commission and 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 -stock price \* 10. (Note, that you can also change the commission and -slippage model that ``zipline`` uses, see the `Quantopian -docs `__ for more -information). +asset price. (Note, that you can also change the commission and +slippage model that ``catalyst`` uses). -Lets take a quick look at the performance ``DataFrame``. For this, we +.. see the `Quantopian docs `__ +.. for more information). + +Let's take a quick look at the performance ``DataFrame``. For this, we use ``pandas`` from inside the IPython Notebook and print the first ten -rows. Note that ``zipline`` makes heavy usage of ``pandas``, especially -for data input and outputting so it's worth spending some time to learn -it. +rows. Note that ``catalyst`` makes heavy usage of +`pandas `_, especially for data input and +outputting so it's worth spending some time to learn it. .. code-block:: python import pandas as pd - perf = pd.read_pickle('buyapple_out.pickle') # read in perf DataFrame + perf = pd.read_pickle('buy_btc_simple_out.pickle') # read in perf DataFrame perf.head() -.. raw:: html - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AAPLalgo_volatilityalgorithm_period_returnalphabenchmark_period_returnbenchmark_volatilitybetacapital_usedending_cashending_exposure...short_exposureshort_valueshorts_countsortinostarting_cashstarting_exposurestarting_valuetrading_daystransactionstreasury_period_return
2000-01-03 21:00:003.7383140.000000e+000.000000e+00-0.065800-0.0095490.0000000.0000000.0000010000000.000000.00000...0000.00000010000000.000000.000000.000001[]0.0658
2000-01-04 21:00:003.4231353.367492e-07-3.000000e-08-0.064897-0.0475280.3232290.000001-34.531359999965.4686534.23135...0000.00000010000000.000000.000000.000002[{u'order_id': u'513357725cb64a539e3dd02b47da7...0.0649
2000-01-05 21:00:003.4732294.001918e-07-9.906000e-09-0.066196-0.0456970.3293210.000001-35.032299999930.4363669.46458...0000.0000009999965.4686534.2313534.231353[{u'order_id': u'd7d4ad03cfec4d578c0d817dc3829...0.0662
2000-01-06 21:00:003.1726614.993979e-06-6.410420e-07-0.065758-0.0447850.298325-0.000006-32.026619999898.4097595.17983...000-12731.7805169999930.4363669.4645869.464584[{u'order_id': u'1fbf5e9bfd7c4d9cb2e8383e1085e...0.0657
2000-01-07 21:00:003.3229455.977002e-06-2.201900e-07-0.065206-0.0189080.3753010.000005-33.529459999864.88030132.91780...000-12629.2745839999898.4097595.1798395.179835[{u'order_id': u'9ea6b142ff09466b9113331a37437...0.0652
-

5 rows × 39 columns

-
- - - -As you can see, there is a row for each trading day, starting on the -first business day of 2000. In the columns you can find various +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 very first column -``AAPL`` was placed there by the ``record()`` function mentioned earlier -and allows us to plot the price of apple. For example, we could easily +``btc`` was placed there by the ``record()`` function mentioned earlier +and allows us to plot the price of bitcoin. For example, we could easily examine now how our portfolio value changed over time compared to the -AAPL stock price. +bitcoin price. -.. code-block:: python - - %pylab inline - figsize(12, 12) - import matplotlib.pyplot as plt - - ax1 = plt.subplot(211) - perf.portfolio_value.plot(ax=ax1) - ax1.set_ylabel('portfolio value') - ax2 = plt.subplot(212, sharex=ax1) - perf.AAPL.plot(ax=ax2) - ax2.set_ylabel('AAPL stock price') - -.. parsed-literal:: - - Populating the interactive namespace from numpy and matplotlib - -.. parsed-literal:: - - - -.. image:: tutorial_files/tutorial_11_2.png - - -As you can see, our algorithm performance as assessed by the -``portfolio_value`` closely matches that of the AAPL stock price. This -is not surprising as our algorithm only bought AAPL every chance it got. - -IPython Notebook -~~~~~~~~~~~~~~~~ - -The `IPython Notebook `__ is a very -powerful browser-based interface to a Python interpreter (this tutorial -was written in it). As it is already the de-facto interface for most -quantitative researchers ``zipline`` provides an easy way to run your -algorithm inside the Notebook without requiring you to use the CLI. - -To use it you have to write your algorithm in a cell and let ``zipline`` -know that it is supposed to run this algorithm. This is done via the -``%%zipline`` IPython magic command that is available after you -``import zipline`` from within the IPython Notebook. This magic takes -the same arguments as the command line interface described above. Thus -to run the algorithm from above with the same parameters we just have to -execute the following cell after importing ``zipline`` to register the -magic. - -.. code-block:: python - - %load_ext zipline - -.. code-block:: python - - %%zipline --start 2000-1-1 --end 2014-1-1 - from zipline.api import symbol, order, record - - def initialize(context): - pass - - def handle_data(context, data): - order(symbol('AAPL'), 10) - record(AAPL=data[symbol('AAPL')].price) - -Note that we did not have to specify an input file as above since the -magic will use the contents of the cell and look for your algorithm -functions there. Also, instead of defining an output file we are -specifying a variable name with ``-o`` that will be created in the name -space and contain the performance ``DataFrame`` we looked at above. - -.. code-block:: python - - _.head() - -.. raw:: html - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AAPLalgo_volatilityalgorithm_period_returnalphabenchmark_period_returnbenchmark_volatilitybetacapital_usedending_cashending_exposure...short_exposureshort_valueshorts_countsortinostarting_cashstarting_exposurestarting_valuetrading_daystransactionstreasury_period_return
2000-01-03 21:00:003.7383140.000000e+000.000000e+00-0.065800-0.0095490.0000000.0000000.0000010000000.000000.00000...0000.00000010000000.000000.000000.000001[]0.0658
2000-01-04 21:00:003.4231353.367492e-07-3.000000e-08-0.064897-0.0475280.3232290.000001-34.531359999965.4686534.23135...0000.00000010000000.000000.000000.000002[{u'commission': 0.3, u'amount': 10, u'sid': 0...0.0649
2000-01-05 21:00:003.4732294.001918e-07-9.906000e-09-0.066196-0.0456970.3293210.000001-35.032299999930.4363669.46458...0000.0000009999965.4686534.2313534.231353[{u'commission': 0.3, u'amount': 10, u'sid': 0...0.0662
2000-01-06 21:00:003.1726614.993979e-06-6.410420e-07-0.065758-0.0447850.298325-0.000006-32.026619999898.4097595.17983...000-12731.7805169999930.4363669.4645869.464584[{u'commission': 0.3, u'amount': 10, u'sid': 0...0.0657
2000-01-07 21:00:003.3229455.977002e-06-2.201900e-07-0.065206-0.0189080.3753010.000005-33.529459999864.88030132.91780...000-12629.2745839999898.4097595.1798395.179835[{u'commission': 0.3, u'amount': 10, u'sid': 0...0.0652
-

5 rows × 39 columns

-
+Our algorithm performance as assessed by the +``portfolio_value`` closely matches that of the bitcoin price. This +is not surprising as our algorithm only bought bitcoin every chance it got. Access to previous prices using ``history`` @@ -627,22 +300,16 @@ we need a new concept: History ``data.history()`` is a convenience function that keeps a rolling window of data for you. The first argument is the number of bars you want to collect, the second argument is the unit (either ``'1d'`` for ``'1m'`` -but note that you need to have minute-level data for using ``1m``). For -a more detailed description ``history()``'s features, see the -`Quantopian docs `__. -Let's look at the strategy which should make this clear: +but note that you need to have minute-level data for using ``1m``). This is +a function we use in the ``handle_data()`` section: .. code-block:: python - %%zipline --start 2000-1-1 --end 2012-1-1 -o dma.pickle + from catalyst.api import order, record, symbol - - from zipline.api import order_target, record, symbol - - def initialize(context): + def initialize(context): context.i = 0 - context.asset = symbol('AAPL') - + context.asset = symbol('btc_usd') def handle_data(context, data): # Skip first 300 days to get full windows @@ -665,67 +332,22 @@ Let's look at the strategy which should make this clear: order_target(context.asset, 0) # Save values for later inspection - record(AAPL=data.current(context.asset, 'price'), + record(btc=data.current(context.asset, 'price'), short_mavg=short_mavg, long_mavg=long_mavg) - def analyze(context, perf): - fig = plt.figure() - ax1 = fig.add_subplot(211) - perf.portfolio_value.plot(ax=ax1) - ax1.set_ylabel('portfolio value in $') - - ax2 = fig.add_subplot(212) - perf['AAPL'].plot(ax=ax2) - perf[['short_mavg', 'long_mavg']].plot(ax=ax2) - - perf_trans = perf.ix[[t != [] for t in perf.transactions]] - buys = perf_trans.ix[[t[0]['amount'] > 0 for t in perf_trans.transactions]] - sells = perf_trans.ix[ - [t[0]['amount'] < 0 for t in perf_trans.transactions]] - ax2.plot(buys.index, perf.short_mavg.ix[buys.index], - '^', markersize=10, color='m') - ax2.plot(sells.index, perf.short_mavg.ix[sells.index], - 'v', markersize=10, color='k') - ax2.set_ylabel('price in $') - plt.legend(loc=0) - plt.show() - -.. image:: tutorial_files/tutorial_22_1.png - -Here we are explicitly defining an ``analyze()`` function that gets -automatically called once the backtest is done (this is not possible on -Quantopian currently). - -Although it might not be directly apparent, the power of ``history()`` -(pun intended) can not be under-estimated as most algorithms make use of -prior market developments in one form or another. You could easily -devise a strategy that trains a classifier with -`scikit-learn `__ which tries to -predict future market movements based on past prices (note, that most of -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``). - -We also used the ``order_target()`` function above. This and other -functions like it can make order management and portfolio rebalancing -much easier. See the `Quantopian documentation on order -functions `__ fore -more details. - Conclusions ~~~~~~~~~~~ We hope that this tutorial gave you a little insight into the -architecture, API, and features of ``zipline``. For next steps, check +architecture, API, and features of ``catalyst``. For next steps, check out some of the -`examples `__. +`examples `__. +The natural next step would be too look into the +`buy_and_hodl `_ +example, which is a more elaborated and realistic version of the ``buy_btc_simple`` example presented in this tutorial. -Feel free to ask questions on `our mailing -list `__, report -problems on our `GitHub issue -tracker `__, -`get -involved `__, -and `checkout Quantopian `__. +Feel free to ask questions on the ``#catalyst_dev`` channel of our +`Discord group `__ and report +problems on our `GitHub issue tracker `__. diff --git a/docs/source/index.rst b/docs/source/index.rst index d3ffbfec..7d9dc349 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -8,7 +8,7 @@ Table of Contents :maxdepth: 1 install -.. beginner-tutorial + beginner-tutorial .. bundles .. development-guidelines .. appendix diff --git a/docs/source/welcome.rst b/docs/source/welcome.rst index 5cfa0473..edca29dd 100644 --- a/docs/source/welcome.rst +++ b/docs/source/welcome.rst @@ -9,8 +9,13 @@ Features ======== - Ease of use: Catalyst tries to get out of your way so that you can - focus on algorithm development. See examples provided. -- Support for several of the top crypto-exchanges by trading volume. + focus on algorithm development. See + `examples `_ + provided. +- Support for several of the top crypto-exchanges by trading volume: + `Bitfinex `_, `Bittrex `_, + and `Poloniex `_. +- Secure: You and only you have access to each exchange API keys for your accounts. - Input of historical pricing data of all crypto-assets by exchange, with daily and minute resolution. - Backtesting and live-trading functionality, with a seamless transition