diff --git a/docs/source/live-trading.rst b/docs/source/live-trading.rst index 133be76bf..f6a6a6c6e 100644 --- a/docs/source/live-trading.rst +++ b/docs/source/live-trading.rst @@ -6,8 +6,8 @@ Supported Exchanges ^^^^^^^^^^^^^^^^^^^ Since version 0.4, Catalyst integrated with `CCXT `_, -a cryptocurrency trading library with support for more than 90 exchanges. The -range of CCXT and Catalyst support for each of those exchanges varies greatly. +a cryptocurrency trading library with support for more than 130 exchanges. The +range of CCXT and Catalyst support for each of those exchanges varies greatly. The most supported exchanges are as follows: The exchanges available for backtesting are fully supported in live mode: @@ -20,10 +20,10 @@ The exchanges available for backtesting are fully supported in live mode: Additionally, we have successfully tested in live mode the following exchanges: - GDAX, id = ``gdax`` -- Huobi Pro, id = ``huobipro`` -- OKEX, id = ``okex`` - HitBTC, id = ``hitbtc`` +- Huobi Pro, id = ``huobipro`` - KuCoin, id = ``kucoin`` +- OKEX, id = ``okex`` As Catalyst is currently in Alpha and is under active development, you are encouraged to thoroughly test any exchange in *paper trading* mode before trading @@ -34,22 +34,22 @@ Paper Trading vs Live Trading modes Catalyst currently supports three different modes in which you can execute your trading algorithm. The first is **backtesting**, which is covered extensively in -the tutorial, and uses historical data to run your algorithm. There is no -interaction with the exchange in backtesting mode, and this is the first mode +the tutorial, and uses historical data to run your algorithm. There is no +interaction with the exchange in backtesting mode, and this is the first mode that you should test any new algorithm. Once you are confident with the simulations that you have obtained with your algorithm in backtesting, you may switch to live trading, where you have two different modes: -* **Paper Trading**: The simulated algorithm runs in real time, and fetches - pricing data in real time from the exchange, but the orders never reach the +* **Paper Trading**: The simulated algorithm runs in real time, and fetches + pricing data in real time from the exchange, but the orders never reach the exchange, and are instead kept within Catalyst and simulated. No real currency is bought or sold. Think of it as a `backtesting happening in real time`. * **Live Trading**: This is the proper live trading mode in which an algorithm - runs in real time, fetching pricing data from live exchanges and placing - orders against the exchange. Real currency is transacted on the exchange + runs in real time, fetching pricing data from live exchanges and placing + orders against the exchange. Real currency is transacted on the exchange driven by the algorithm. These three modes are controlled by the following variables: @@ -94,7 +94,11 @@ Note that the `bitfinex` part in the directory above corresponds to the id of th exchange as defined in the "Supported Exchanges" section above. Attempting to run an algorithm where the targeted exchange is missing its ``auth.json`` file will create the directory structure and create an empty -auth.json file, but will result in an error. +``auth.json`` file, but will result in an error. + +It is also possible to specify a different authentication file name using +``auth_aliases`` argument provided to the catalyst client or +`run_algorithm() `_ interface. Currency Symbols ^^^^^^^^^^^^^^^^ @@ -108,7 +112,7 @@ Exchanges tend to use their own convention to represent currencies Trading pairs are also inconsistent. For example, Bitfinex puts the base currency before the quote currency without a separator, Bittrex puts the quote currency first and uses a dash -seperator. +separator. Here is the Catalyst convention: @@ -131,8 +135,8 @@ Here are some examples: Note that the trading pairs are always referenced in the same manner. However, not all trading pairs are available on all exchanges. An error will occur if the specified trading pair is not trading -on the exchange. To check which currency pairs are available on each -of the supported exchanges, see +on the exchange. To check which currency pairs are available on each +of the supported exchanges, see `Catalyst Market Coverage `_. Trading an Algorithm @@ -141,12 +145,12 @@ There is no special convention to follow when writing an algorithm for live trading. The same algorithm should work in backtest and live execution mode without modification. -What differs are the arguments provided to the catalyst client or +What differs are the arguments provided to the catalyst client or the ``run_algorithm()`` interface. Here is the same example in both interfaces: .. code-block:: bash - catalyst live -f my_algo_code -x bitfinex -c btc -n my_algo_name + catalyst live -f my_algo_code -x bitfinex -c btc -n my_algo_name .. code-block:: python @@ -168,8 +172,8 @@ Here is the breakdown of the new arguments: It has to be lower or equal to the amount of quote currency available for trading on the exchange. For illustration, order_target_percent(asset, 1) will order the capital_base amount specified here of the specified asset. -- ``exchange_name``: The name of the targeted exchange. See the - `CCXT Supported Exchanges `_ +- ``exchange_name``: The name of the targeted exchange. See the + `CCXT Supported Exchanges `_ for the full list. - ``algo_namespace``: A arbitrary label assigned to your algorithm for data storage purposes. @@ -177,7 +181,7 @@ Here is the breakdown of the new arguments: statistics of your algorithm. Currently, the quote currency of all trading pairs of your algorithm must match this value. - ``simulate_orders``: Enables the paper trading mode, in which orders are - simulated in Catalyst instead of processed on the exchange. It defaults to + simulated in Catalyst instead of processed on the exchange. It defaults to ``True``. - ``end_date``: When setting the end_date to a time in the **future**, it will schedule the live algo to finish gracefully at the specified date. @@ -191,6 +195,13 @@ In live trading the ``handle_data()`` function is called once every minute. Here is a complete algorithm for reference: `Buy Low and Sell High `_ +The ``catalyst live`` command offers additional parameters. +You can learn more by running the following from the command line: + +.. code-block:: bash + + catalyst live --help + Algorithm State ^^^^^^^^^^^^^^^ @@ -206,16 +217,6 @@ Cleaning the state can be achieved by running: catalyst clean-algo -n my-algo-namespace - -The `catalyst live` command offers additional parameters. -You can learn more by running the following from the command line: - -.. code-block:: bash - - catalyst live --help - - - Commissions ^^^^^^^^^^^ @@ -251,5 +252,6 @@ be returned: context.exchanges['bitfinex'].get_orderbook(symbol('etc_btc'), order_type='all', limit=10) -It is possible to retrieve only the bids or the asks from the order book by passing 'bids' of 'asks' in the order_type -(by default this parameter recieve the 'all' value). \ No newline at end of file +It is possible to retrieve only the bids or the asks from the order book by +passing ``'bids'`` or ``'asks'`` in the ``order_type`` argument +(by default this parameter receives the ``'all'`` value). \ No newline at end of file