How it Works¶
The diagram below illustrates how arbitrage works. The transaction involves two exchanges: Exchange A and Exchange B. Hummingbot monitors the prices on both exchanges and transacts when a profit opportunity arises.
An opportunity arises when Hummingbot can buy on one exchange at a lower price and sell on the other exchange at a higher price.
- Similar to cross-exchange market making, you will need to hold inventory on two exchanges (a primary and secondary exchange), in order to be able to trade and capture price differentials (i.e. buy low on one exchange, sell high on the other).
- You will also need some Ethereum to pay gas for transactions on a DEX (if applicable).
Configuration Parameters and Walkthrough¶
The following walks through all the steps when running
create command. These parameters are fields in Hummingbot configuration files (located in the
/conf folder, e.g.
||Enter an exchange you would like to trade on.|
||Enter another exchange you would like to trade on.|
||Enter the token trading pair for the primary exchange.|
||Enter the token trading pair for the secondary exchange.|
||Minimum profitability target required to execute trades.|
Tip: Autocomplete Inputs during Configuration
When going through the command line config process, pressing
<TAB> at a prompt will display valid available inputs.
The following parameters are fields in Hummingbot configuration files (located in the
/conf folder, e.g.
|secondary_to_primary_base_conversion_rate||Specifies conversion rate for secondary quote asset value to primary quote asset value.|
|secondary_to_primary_quote_conversion_rate||Specifies conversion rate for secondary quote asset value to primary quote asset value.|
Exchange Rate Conversion¶
From past versions of Hummingbot it uses CoinGecko and CoinCap public APIs to fetch asset prices. However, this dependency caused issues for users when those APIs were unavailable. Starting on version 0.28.0, Hummingbot uses exchange order books to perform necessary conversions rather than data feeds.
When you run strategies on multiple exchanges, there may be instances where you need to utilize an exchange rate to convert between assets.
In particular, you may need to convert the value of one stablecoin to another when you use different stablecoins in multi-legged strategy like arbitrage.
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-USDT pair on Binance. Using exchange rates for USDT and DAI against ETH allows Hummingbot to take into account differences in prices.
1 2 3 4 5 6
maker_market: bamboo_relay taker_market: binance maker_market_trading_pair: WETH-DAI taker_market_trading_pair: ETH-USDT secondary_to_primary_base_conversion_rate: 1 secondary_to_primary_quote_conversion_rate: 1
By default secondary to primary base conversion rate and secondary to primary quote conversion rate value are both
Our maker base asset is WETH and taker is ETH. 1 WETH is worth 0.99 ETH (1 / 0.99) so we will set the
secondary_to_primary_base_conversion_rate value to 1.01.
While our maker quote asset is DAI, taker is USDT and 1 DAI is worth 1.01 USDT (1 / 1.01). similar to the calculation we did for the base asset. In this case, we will set the
secondary_to_primary_quote_conversion_rate to 0.99.
To configure a parameter value without going through the prompts, input command as
config [ key ] [ value ]. These can be reconfigured without stopping the bot however, it will only take effect after restarting the strategy.
config secondary_to_primary_base_conversion_rate: 1.01 config secondary_to_primary_quote_conversion_rate: 0.99