Skip to content
All library documents

Spot–Perpetual Arbitrage Using Spread Thresholds

Article Hummingbot docs

Summary

This strategy monitors the price difference between a spot market and a perpetual derivatives market. When the spread reaches a configured opening threshold, it places a spot order and opens an opposing perpetual position. It then watches the spread and closes both legs after it crosses a separate convergence threshold.

The configuration covers connectors and markets, order size, leverage, opening and closing thresholds, slippage buffers for each leg, and a delay before the next cycle. The document provides an operational outline and sample default settings, but no backtest, fee model, or profitability evidence. It does not explain funding payments, basis risk, execution failures, or how thresholds should be calibrated, so the strategy’s real-world returns and risks cannot be inferred from the description alone.

Key ideas

  • The strategy opens opposing spot and perpetual positions when their price spread exceeds an opening threshold.
  • It closes both legs when the spread reaches a separate convergence threshold.
  • Users configure markets, order size, leverage, thresholds, slippage buffers, and a cycle delay.
  • The outline does not quantify fees, funding, execution risk, or strategy performance.

Tags

Full text
# `spot_perpetual_arbitrage`


# `spot_perpetual_arbitrage`

## 📁 Strategy Info

* Folder: [/hummingbot/strategy/spot_perpetual_arbitrage](https://github.com/hummingbot/hummingbot/tree/master/hummingbot/strategy/spot_perpetual_arbitrage)
* Configs: [spot_perpetual_arbitrage_config_map.py](https://github.com/hummingbot/hummingbot/tree/master/hummingbot/strategy/spot_perpetual_arbitrage/spot_perpetual_arbitrage_config_map.py)
* Maintainer: None

## 📝 Summary

This strategy looks at the price on the spot connector and the price on the derivative connector. Then it calculates the spread between the two connectors. The key features for this strategy are `min_divergence` and `min_convergence`.

When the spread between spot and derivative markets reaches a value above `min_divergence`, the first part of the operation will be executed, creating a buy/sell order on the spot connector, while opening an opposing long/short position on the derivative connector.

With the position open, the bot will scan the prices on both connectors, and once the price spread between them reaches a value below `min_convergence`, the bot will close both positions.

## 🏦 Exchanges supported

* SPOT CLOB CEX
* PERP CLOB CEX

## 🛠️ Strategy configs

| Parameter                    | Type        | Default     | Prompt New? | Prompt                                                 |
|------------------------------|-------------|-------------|-------------|--------------------------------------------------------|
| `spot_connector` | string | | True | Enter a spot connector (Exchange/AMM) |
| `spot_market` | string | | True | Enter the token trading pair you would like to trade on [spot_connector] |
| `perpetual_connector` | string | | True | Enter a derivative name (Exchange/AMM) |
| `perpetual_market` | string | | True | Enter the token trading pair you would like to trade on [derivative_connector] |
| `order_amount` | decimal | | True | What is the amount of [base_asset] per order? |
| `perpetual_leverage` | int | 1 | True | How much leverage would you like to use on the derivative exchange? |
| `min_opening_arbitrage_pct` | decimal | 1 | True | What is the minimum spread between the spot and derivative market price before starting an arbitrage? |
| `min_closing_arbitrage_pct` | decimal | 0.1 | True | What is the minimum spread between the spot and derivative market price before closing an existing arbitrage? |
| `spot_market_slippage_buffer` | decimal | 0.05 | True | How much buffer do you want to add to the price to account for slippage for orders on the spot market |
| `perpetual_market_slippage_buffer` | decimal | 0.05 | True | How much buffer do you want to add to the price to account for slippage for orders on the derivative market |
| `next_arbitrage_cycle_delay` | float | 120 | False | How long do you want the strategy to wait to cool off from an arbitrage cycle (in seconds) |

## 📓 Description

[Trading logic](https://github.com/hummingbot/hummingbot/blob/master/hummingbot/strategy/spot_perpetual_arbitrage/spot_perpetual_arbitrage.py)

## ℹ️ More Resources


:fontawesome-brands-youtube: [Spot-Perpetual Arbitrage Strategy Demo | Hummingbot Live](https://www.youtube.com/watch?v=hJPmAy-Ellk): A live demo on how you can set parameters to run the spot-perpetual arbitrage strategy

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.