Exchange Configs
Top Level Config Parameters
Exchange configurations define how to connect to an exchange for trading. Both back trading (back testing) and live trading modes require a connection to an exchange. For back trading (back testing), the connection is established with a BackTrading exchange object, while for live trading, it connects to a live exchange object, such as the BinanceSpot exchange connector. In the ATS framework, you can create custom exchange classes by extending the BaseExchange class. This allows you to implement your own back-trading or live-trading exchange classes. Any object extending from BaseExchange must include certain parameters while also allowing you to pass custom parameters specific to your exchange. (Please refer to Sample Trading Configs section to read more about how to upload Exchange Configs via the trading UI or refer to our API guide.)
The following JSON structure outlines the required parameters.
exchange.config
Configuration
exchange.config.extra
Custom parameters passed to the Exchange
object
exchange.config.plot_data_max_len
The BaseExchange object tracks data necessary for generating plots, including trade history, price history, wallet balances, and more. This parameter specifies the maximum amount of plotting data to retain in memory, measured in terms of the number of price candles. The value -1 indicates that there is no limit. Otherwise it has to be a positive integer.
exchange.config.symbol
The symbol parameter specifies the trading instrument pair.
exchange.config.symbol.base
This is the first asset in the trading pair and represents the asset being bought or sold. For example, in the trading pair BTC/USDT, BTC (Bitcoin) is the base asset. When trading, you buy or sell units of the base asset.
exchange.config.symbol.quote
This is the second asset in the trading pair and represents the value of the base asset in terms of this currency. Continuing with the BTC/USDT example, USDT (Tether) is the quote asset. It indicates how much of the quote asset is needed to purchase one unit of the base asset. For instance, if BTC/USDT = 30,000, it means 1 BTC is worth 30,000 USDT.
namespace
The namespace
parameter specifies the location of the exchange class in canonical format. For example, the value "exchanges:back_trading"
indicates that the exchange class is located at the following path:
src/exchanges/exchanges/back_trading/exchange.py
It is important to note that each class must have a file named exchange.py
containing an Exchange
class.
Back Trading Specific Configs
In this section we are going discuss about the custom parameters received by the standard BackTrading class. (These parameters are configured at "exchange.config.extra"
level as mentioned in the previous section.). The standard BackTrading class is specifically designed for Spot Trading, so the parameters are limited accordingly.
Following is a sample config in JSON format.
data_source
Location for the back trading dataset (Only CSV format is supported)
fees
Fee structure and the fee calculation class
fees.config
Fee structure for limit and market orders
fees.namespace
Canonical namespace of the standard fee calculation class (only used in backtrading since the live trading fees are connected by live exchanges).
min_trading_size
Minimum trading volume expressed in base asset.
wallet
Wallet configuration
wallet.assets
Initial size of each asset.
Last updated