Skip to content
All library documents

Spot AMM Arbitrage with Fees, Slippage, and Order Coordination

Article Hummingbot docs

Summary

This strategy monitors the same spot trading pair across two venues: one is an automated market maker decentralized exchange, and the other may be a centralized order-book exchange or another supported spot venue. When the price difference offers profitability above a configured minimum after transaction costs, it submits offsetting buy and sell orders to pursue the spread. The stated costs include blockchain gas and exchange fees.

Configuration choices include the venues and pair, order size, minimum profitability, and separate slippage buffers for each market. The strategy can submit both legs concurrently or wait for the first order to fill before placing the second. It also provides a timeout for canceling blockchain transactions that remain unconfirmed. These controls expose important execution tradeoffs: sequential placement risks price movement between legs, while concurrent placement still leaves fill and settlement risks. The document describes the strategy’s purpose and settings but provides no performance evidence, detailed trading logic, or guarantee that quoted opportunities remain profitable after actual execution.

Key ideas

  • The strategy compares a spot pair across two venues and seeks price differences above a configured profitability threshold.
  • It places offsetting buy and sell orders and accounts for gas and exchange fees.
  • Separate slippage buffers can be configured for each venue.
  • Order legs can be submitted together or sequentially after the first fill.
  • The description gives no performance evidence and does not establish that detected spreads survive execution.

Tags

Full text
# `amm_arb`


# `amm_arb`

## 📁 Strategy Info

* Folder: [/hummingbot/strategy/amm_arb](https://github.com/hummingbot/hummingbot/tree/master/hummingbot/strategy/amm_arb)
* Configs: [/hummingbot/strategy/amm_arb/amm_arb_config_map.py](https://github.com/hummingbot/hummingbot/blob/master/hummingbot/strategy/amm_arb/amm_arb_config_map.py)
* Maintainer: Hummingbot Foundation

## 📝 Summary

This strategy monitors prices between a trading pair (`market_1`) on a SPOT AMM DEX versus another trading pair (`market_2`) on another SPOT AMM CEX or SPOT CLOB DEX in order to identify arbitrage opportunities. It executes offsetting buy and sell orders in both markets in order to capture arbitrage opportunities with profitability higher than `min_profitability`, net of transaction costs, which include both blockchain transaction fees (gas) and exchange fees.

## 🏦 Supported Exchange Types

* SPOT CLOB CEX
* SPOT AMM DEX

## 🛠️ Strategy configs

| Parameter                    | Type        | Default     | Prompt                                                 |
|------------------------------|-------------|-------------|--------------------------------------------------------|
| `connector_1` | string | | Enter your first spot connector (Exchange/AMM) |
| `market_1` | string | | Enter the token trading pair you would like to trade on [connector_1] |
| `connector_2` | string | | Enter your second spot connector (Exchange/AMM) |
| `market_2` | string | | Enter the token trading pair you would like to trade on [connector_2] |
| `order_amount` | decimal | | What is the amount of [base_asset] per order? |
| `min_profitability` | decimal | 1 | What is the minimum profitability for you to make a trade? |
| `market_1_slippage_buffer` | decimal | 1 | How much buffer do you want to add to the price to account for slippage for orders on the first market |
| `market_2_slippage_buffer` | decimal | 0 | How much buffer do you want to add to the price to account for slippage for orders on the second market |
| `concurrent_orders_submission` | bool | False | Do you want to submit both arb orders concurrently (Yes/No) ? If No, the bot will wait for first connector order filled before submitting the other order |
| `debug_price_shim` | bool | | Do you want to enable the debug price shim for integration tests? If you don't know what it does you should keep it disabled. |
| `gateway_transaction_cancel_interval` | int | 600 | After what time should blockchain transactions be cancelled if they are not included in a block? (this only affects decentralized exchanges) (Enter time in seconds) >>> |

## 📓 Description

See [Trading logic](https://github.com/hummingbot/hummingbot/blob/master/hummingbot/strategy/amm_arb/amm_arb.py) to understand how the strategy works.

Shown in full with attribution under the source's licence. Licence: Apache-2.0

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.