# Arbitrage¶

## How it Works¶

Arbitrage is described in Strategies, with a further discussion in the Hummingbot white paper.

### Schematic¶

The diagram below illustrates how arbitrage works. The transaction involves two exchanges: Exchange A and a 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.

Figure 1: Hummingbot completes an arbitrage trade

## Prerequisites: Inventory¶

1. 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).
2. You will also need some Ethereum to pay gas for transactions on a DEX (if applicable).

## Configuration Walkthrough¶

The following walks through all the steps when running config for the first time.

Tip: Autocomplete Inputs during Configuration

When going through the command line config process, pressing <TAB> at a prompt will display valid available inputs.

Prompt Description
What is your market making strategy >>> Enter arbitrage.
Import previous configs or create a new config file? (import/create) >>> When running the bot for the first time, enter create. If you have previously initialized, enter import, which will then ask you to specify the config file location.
Enter your primary exchange name >>> Enter an exchange you would like to trade on.

Currently available options: binance, radar_relay, coinbase_pro, bamboo_relay, huobi, bittrex, dolomite, liquid, kucoin (case sensitive)
Enter your secondary exchange name >>> Enter another exchange you would like to trade on.

Currently available options: binance, radar_relay, coinbase_pro,bamboo_relay, huobi, bittrex, dolomite, liquid (case sensitive)
Enter the token symbol you would like to trade on [primary exchange name] >>> Enter the token symbol for the primary exchange.
Enter the token symbol you would like to trade on [secondary exchange name] >>> Enter the token symbol for the secondary exchange.
What is the minimum profitability for your to make a trade? (Enter 0.01 to indicate 1%) >>> This sets min_profitability (definition).

## Configuration Parameters¶

The following parameters are fields in Hummingbot configuration files (located in the /conf folder, e.g. conf/conf_arbitrage_strategy_[#].yml).

Term Definition
min_profitability An amount expressed in decimals (i.e. input of 0.01 corresponds to 1%).
Minimum required profitability in order for Hummingbot to place an order on the maker exchange.

Example: Assuming a minimum profitability threshold of 0.01 and a token symbol that has a bid price of 100 on the taker exchange (binance), Hummingbot will place a bid order on the maker exchange of 99 (or lower) to ensure a 1% (or better) profit; Hummingbot only places this order if that order is the best bid on the maker exchange.
trade_size_override An amount expressed in quote currency of maximum allowable order size. If not set, the default value is ⅙ of the aggregate value of quote and base currency balances across the maker and taker exchanges.

Example: Assuming a trade size override of 100 and a token symbol of ETH/DAI, the maximum allowable order size is one that has a value of 100 DAI.