diff --git a/docs/live-trading-wiki.md b/docs/live-trading-wiki.md deleted file mode 100644 index a7dbd9f1..00000000 --- a/docs/live-trading-wiki.md +++ /dev/null @@ -1,105 +0,0 @@ -

Live Trading

-This document explains how to get started with live trading. - -

Supported Exchanges

-Catalyst can trade against these exchanges: - -* Bitfinex, id=`bitfinex` -* Bittrex, id=`bittrex` - -

Authentication

-Most exchanges require key/token combination for authentication. By -convention, Catalyst uses an "auth.json" file to hold this data. - -This example illustrates the convention using the Bitfinex exchange. -Here is how to generate key and secret values for bitfinex: -https://docs.bitfinex.com/v1/docs/api-access. Most exchanges follow -a similar process. - -The auth.json file: -```json -{ - "name": "bitfinex", - "key": "my-key", - "secret": "my-secret" -} -``` - -The file goes here: -``` -~/.catalyst/data/exchanges/bitfinex/auth.json -``` - -Note that the 'bitfinex' directory corresponds to the id of the Bitfinex -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 but result -in an error. - -

Currency Symbols

-Catalyst introduces a universal convention to reference -trading pairs and individual currencies. This -is required to ensure that the `symbol()` api predictably -returns the correct asset regardless of the targeted exchange. - -Exchanges tend to use their own convention to represent currencies -(e.g. XBT and BTC both represent Bitcoin on different exchanges). -Trading pairs are also inconsistent. For example, Bitfinex -puts the market currency before the base currency without a -separator, Bittrex puts the base currency first and uses a dash -seperator. - -Here is the Catalyst convention: - -*[Market Currency]_[Base Currency]* all lowercase. - -Currency symbols (e.g. btc, eth, ltc) follow the Bittrex convention. - -Here are some examples: -```python -# With Bitfinex -bitcoin_usd_asset = symbol('btc_usd') -ethereum_bitcoin_asset = symbol('eth_btc') - -# With Bittrex -ethereum_bitcoin_asset = symbol('eth_btc') -neo_ethereum_asset = symbol('neo_eth) -``` - -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. - -

Trading an Algorithm

-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 -`run_algorithm()` interface. Here is example: - -```python -run_algorithm( - initialize=initialize, - handle_data=handle_data, - analyze=analyze, - exchange_name='bitfinex', - live=True, - algo_namespace='my_algo_trading_xrp', - base_currency='btc' -) -``` - -Here is the breakdown of the new arguments: -* live: Boolean flag which enables live trading. -* exchange_name: The name of the targeted exchange - (supported values: *bitfinex*, *bittrex*). -* algo_namespace: A arbitrary label assigned to your algorithm for - data storage purposes. -* base_currency: The base currency used to calculate the - statistics of your algorithm. Currently, the base currency of all - trading pairs of your algorithm must match this value. - -Here is a complete algorithm for reference: -[Buy Low and Sell High](../catalyst/examples/buy_low_sell_high_live.py) diff --git a/docs/source/index.rst b/docs/source/index.rst index f0efbd6d..a4554bda 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -9,6 +9,7 @@ Table of Contents install beginner-tutorial + live-trading naming-convention videos development-guidelines diff --git a/docs/source/live-trading.rst b/docs/source/live-trading.rst new file mode 100644 index 00000000..7a471d68 --- /dev/null +++ b/docs/source/live-trading.rst @@ -0,0 +1,118 @@ +Live Trading +============ +This document explains how to get started with live trading. + +Supported Exchanges +^^^^^^^^^^^^^^^^^^^ +Catalyst can trade against these exchanges: + +- Bitfinex, id= ``bitfinex`` +- Bittrex, id= ``bittrex`` +- Poloniex, id= ``poloniex`` + +Authentication +^^^^^^^^^^^^^^ +Most exchanges require token key/secret combination for authentication. By +convention, Catalyst uses an ``auth.json`` file to hold this data. + +This example illustrates the convention using the *Bitfinex* exchange. +Here is how to generate key and secret values for the Bitfinex exchange: +https://docs.bitfinex.com/v1/docs/api-access. Most exchanges follow +a similar process. + +The auth.json file: + +.. code-block:: json + + { + "name": "bitfinex", + "key": "my-key", + "secret": "my-secret" + } + + +The file goes here: ``~/.catalyst/data/exchanges/bitfinex/auth.json`` + +Note that the `bitfinex` part in the directory above corresponds to the id of the Bitfinex +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. + +Currency Symbols +^^^^^^^^^^^^^^^^ +Catalyst introduces a universal convention to reference +trading pairs and individual currencies. This +is required to ensure that the ``symbol()`` api predictably +returns the correct asset regardless of the targeted exchange. + +Exchanges tend to use their own convention to represent currencies +(e.g. XBT and BTC both represent Bitcoin on different exchanges). +Trading pairs are also inconsistent. For example, Bitfinex +puts the market currency before the base currency without a +separator, Bittrex puts the base currency first and uses a dash +seperator. + +Here is the Catalyst convention: + +*[Market Currency]_[Base Currency]* all lowercase. + +Currency symbols (e.g. btc, eth, ltc) follow the Bittrex convention. + +Here are some examples: + +.. code-block:: json + + # With Bitfinex + bitcoin_usd_asset = symbol('btc_usd') + ethereum_bitcoin_asset = symbol('eth_btc') + + # With Bittrex + ethereum_bitcoin_asset = symbol('eth_btc') + neo_ethereum_asset = symbol('neo_eth) + +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 `Catalyst Market Coverage `_