When you run strategies on multiple exchanges, there may be instances where you need to utilize an exchange rate to convert between assets.
For example, if you make a market in the WETH/DAI pair on a decentralized exchange, you may want to hedge filled orders using the ETH/USD pair on Coinbase or the ETH/USDT pair on Binance. Using exchange rates for USDT and DAI against USD allows Hummingbot to take into account differences in prices between these different stablecoins.
Exchange Rate Class¶
To perform these conversions, Hummingbot includes an exchange rate class in
conf_global.yml, which is located in the
/conf directory. Here, you can either set a fixed exchange rate or provide a price feed API for Hummingbot to dynamically set the exchange rates in real-time.
In the file
conf/conf_global.yml you will find the following listed:
1 2 3 4 5 6 7 8 9 10 11 12 13
exchange_rate_conversion: - - DAI - 1.0 - coin_gecko_api - - USDT - 1.0 - coin_gecko_api - - USDC - 1.0 - coin_gecko_api - - TUSD - 1.0 - coin_gecko_api
When you run Hummingbot using DAI and/or USDT, the exchange rates are displayed in the client window when running the
Creating Custom Configurations¶
Say for instance that we modify the exchange rates class in
conf/conf_global.yml to be the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
exchange_rate_conversion: - - DAI - 0.97 - OVERRIDE - - USDT - 1.0 - OVERRIDE - - USDC - 1.0 - coin_gecko_api - - TUSD - 1.0 - coin_gecko_api - - PAX - 1.0 - coin_gecko_api
In the example above, 1 DAI is assumed to equal $0.97 USD, and 1 USDT is assumed to equal $1.00. We set a fixed exchange rate by replacing
manual and setting the desired exchange rate.
You can also add new crypto-assets. As shown in the exchange rate class above, PAX has been added which allows Hummingbot to use the PAX/USD exchange rate from CoinGecko.
You can see these custom exchange rates in the