Crypto arbitrage bot — How to automate strategies on OKX

OKX’s trading bot features a mode to simplify placing orders to take advantage of arbitrage opportunities between different trading instruments. This tutorial will focus on the arbitrage order trading bot, which is just one of our powerful automated trading strategies. To learn more about our other crypto trading bots, check out this dedicated guide

Discrepancies between spot and futures contract prices can present profitable situations for traders that take simultaneous positions in both instruments. This is known as spread arbitrage. Similarly, longing an asset in the spot market and shorting it with a perpetual swap provides an opportunity to profit via funding rate payments. This is known as funding rate arbitrage. 

If you’ve never traded futures or perpetual swaps before, we recommend you read OKX’s tutorials about each product before attempting to use the arbitrage bot. This will help you understand the risks when trading futures or perpetual swaps.

A quick intro to trading bots

Trading bots have become invaluable tools in the crypto space, offering traders automated solutions to enhance their portfolio diversification efforts. These bots provide consistency, discipline, and the ability to execute trades without being influenced by emotions.

Trading bots have many functions that cater to different trading styles and risk tolerances. Some bots use advanced algorithms to analyze market data and make swift decisions, while others focus on executing predefined strategies. These bots automate the trading process, allowing traders to take advantage of market opportunities 24/7 without constant monitoring.

By using trading bots, you can diversify your portfolio more effectively. These bots can implement complex trading strategies that would be challenging to execute manually, such as arbitrage trading or dollar-cost averaging.

With the ability to execute trades automatically based on predefined rules, trading bots provide consistency and help traders avoid emotional decision-making, leading to more disciplined and growth-focused trading practices.

OKX provides a wide selection of trading bots to match your needs and preferences. Our trading bots allow you to tailor your strategies to your trading styles and risk appetite.

How to set up OKX’s arbitrage trading bot

First, select Arbitrage order from the list of trading bot strategies. 

Then, tap the trading pairs at the top to select the arbitrage bot you want to use. 

To profit from perpetual swap funding rate payments, tap Fees. To arbitrage the spread between two instruments, tap Spreads

Funding rate arbitrage

Each funding rate — or fee — arbitrage portfolio has both a spot pair and an equivalent perpetual swap contract. When selecting a portfolio, you’ll see important information about each arbitrage portfolio here, including expected APYs and current funding rates. 

First, tap the highlighted menu and then either Crypto-margined to settle trades in your chosen cryptocurrency or USDT-margined to settle in USDT, and tap the portfolio you want to trade. 

On the order details screen, enter the details of each leg of the order, including the desired USD price and amount in the crypto asset traded in either crypto or USDT. 

The arbitrage bot will automatically select whether to buy or sell each instrument according to the portfolio selected. You can change which leg to buy and sell, but we do not recommend less-experienced traders attempt to deploy such a custom portfolio strategy. 

You can also select whether to use “Cross” or “Isolated” margin mode for your derivative trades, and the amount of leverage used for greater capital efficiency. Cross margin mode uses all account funds of the currency traded as a position’s margin. Meanwhile, the isolated margin mode uses only just funds designated as the margin position. 

Check the details and tap Both Legs to submit both orders simultaneously. 

If the funding rate is positive, you want to be shorting the perpetual contract, as long positions will pay you to keep it open. Conversely, if the funding rate is negative, you want to long the perpetual swap to earn funding rate payments from short positions. 

The strategy is low risk, as the two positions cancel each other out. However, if the funding rate goes against you for a prolonged period, you will pay the opposite side of the perpetual position and may lose money overall. Adding leverage to a position will also increase its risk profile. 

Spread arbitrage

Spread arbitrage can be performed between two futures contracts or a futures contract and spot position. In spread arbitrage, we take opposite positions in two markets, profiting from price differences.  

Let’s assume the BTC spot price is currently $50,000, and a futures contract is priced at $50,100. If we buy 1 BTC in the spot market and short sell the futures contract, we will profit with minimal risk no matter the price when the futures contract settles. 

For example, the spot price at settlement is $55,000. We can sell our spot position for a $5,000 profit — minus trading fees. Meanwhile, our futures position will lose money because we agreed to sell BTC for $50,100 at settlement. OKX sells the BTC on our behalf to honor the futures contract, losing us $4,900. So, we have $5,000 in profit from our spot position and a loss of $4,900 from the futures contract, resulting in a net position of just under $100 — minus the trading fees.  

If the price went the other way, we’d still profit. Let’s say the price dropped to $45,000. Our spot position would lose $5,000. However, our futures position would sell BTC at $50,100 above the spot price, locking in a $100 profit (minus trading fees). The only real risk with this strategy is that the price moves so much that your futures position is liquidated. You can read more about OKX’s liquidation rules here. 

From the arbitrage portfolio screen, tap Spreads. Then, choose either Crypto-margined or USDT-margined, and tap the second menu to choose the instruments that will comprise your arbitrage bot strategy. Tap Derivatives-spot or Derivatives-derivatives according to your preference. 

Then, choose your arbitrage strategy portfolio. You’ll see various details about the expected profitability of each arbitrage portfolio to help inform your decision.  

Next, fill in your order details for both legs of the order. The portfolio chosen will determine the order type for each leg — either Buy or Sell. Again, you can change the order types for each leg, but we do not recommend that less-experienced traders attempt this. 

You can choose between “Cross” and “Isolated” margin mode for your derivatives positions. Cross margin mode uses all account funds of the currency traded as a position’s margin. Meanwhile, the isolated margin mode uses only funds designated as the margin position.

You can also add leverage to your order using the multiplier option. Although leverage can increase your potential profits versus your starting capital, it also increases your liquidation risk. 

For each leg of the trade, enter the price for your limit order and the amount in the crypto asset or USDT. Alternatively, you can enter your desired spread size using the “Spread rate” option between the two legs. 

You can further customize your trades using the order types Queuing, Surpassed, BBO and Market. Tap the Set price menu to tweak the “Queuing” and “Surpassed” parameters. These two order types will create a range in which your order will be filled — useful to ensure both legs of the arbitrage are filled at favorable prices. 

When you are happy with your orders, tap Both legs to place them simultaneously. You can also use the checkbox to immediately place a market order for the second leg as soon as the initial order fills, guaranteeing that both legs are placed. However, this may reduce the overall spread size, impacting the strategy’s profitability.    

You can check on and close arbitrage trading bot positions in the trade history section at the bottom of the trading screen. Tap Bot, and then Arbitrage order to view current profits and close open positions. 

Deploy powerful automated crypto arbitrage strategies with ease on OKX

OKX’s trading bots simplify deploying even complex strategies with just a few taps or clicks. The arbitrage order trading bot makes it incredibly easy to profit from price discrepancies between instruments and funding rate payments. Give it a try today and add spread or funding rate arbitrage to your trading strategy arsenal. Game on!

Дисклеймер
Материалы предоставлены исключительно в ознакомительных целях и могут включать информацию о продуктах, которые недоступны в вашем регионе. Они не являются инвестиционным советом или рекомендацией, предложением или приглашением к покупке, продаже или удержанию криптовалюты / цифровых активов, советом в финансовой, бухгалтерской, юридической или налоговой сфере. Криптовалютные и цифровые активы, в том числе стейблкоины, сопряжены с высокими рисками и подвержены сильным ценовым колебаниям. Тщательно оцените финансовое состояние и определите, подходит ли вам торговля и удерживание цифровых активов. По вопросам, связанным с вашими конкретными обстоятельствами, обращайтесь к специалистам в области законодательства, налогов или инвестиций. Информация, представленная на этой странице (включая рыночные и статистические данные, если таковые имеются), предназначена исключительно для ознакомления. При подготовке статьи были приняты все меры предосторожности, однако автор не несет ответственности за фактические ошибки и упущения.

© OKX, 2025. Эту статью можно копировать и распространять как полностью, так и в цитатах объемом не более 100 слов, при условии некоммерческого использования. При любом копировании или распространении всей статьи должно быть указано: «Разрешение на использование получено от владельца авторских прав на эту статью — © OKX, 2025. Цитаты должны содержать ссылку на название статьи и ее автора, например: «Название статьи, [имя автора, если указано], © OKX, 2025». Часть контента может быть создана с использованием инструментов искусственного интеллекта (ИИ). Создание производных материалов и любое другое использование данной статьи не допускается.

Похожие статьи

Показать еще
trade-academy-beginner-4
Order Types

What are iceberg orders?

An iceberg order is an algorithmic order allowing users to slice large orders into multiple small orders. These orders will be placed on the market according to their preferred mode (quick execution/price-speed balance/passive queuing). When one of the smaller orders has been completely filled, or the level has been changed from the initial orders, the system will check the depth and place the order accordingly.
18 июл. 2025 г.
2
Forward Contracts vs. Futures Contracts What Are the Differences
Trading tools
Trading guide
Trading basics

How to use the iceberg trading bot

What are iceberg orders? Iceberg orders are large buys or sells broken down into many smaller orders. They may be useful when making a significant trade relative to the size of a given market. Even small orders can risk moving the asset price in an illiquid market, resulting in less favorable entry or exit prices for traders. Iceberg orders are designed to mask large orders and limit the impact of price slippage.
18 июл. 2025 г.
7
The Four Pillars of Engineering Management
Order Types

Time-Weighted Average Price (TWAP) Strategy: A Comprehensive Guide

TWAP, or Time-Weighted Average Price, is a popular trading strategy that is used by traders and investors aiming to minimize market impact and achieve a more accurate average price for an instrument o
18 июл. 2025 г.
Generic tokens thumbnail
DeFi
Staking

Top 13 ways to earn passive income from crypto in 2025

Cryptocurrencies have become increasingly popular over the past decade. Crypto assets such as Bitcoin, Ethereum, and other altcoins, have gained widespread adoption and recognition. However, the crypto market is known for being highly volatile. With that being said, trading isn't the only ways you can earn income in the world of crypto. Now, market participants are able to earn passive income with relatively little effort.
17 июл. 2025 г.
Средний
77
Generic charts thumbnail
Technical analysis

Divergence Pattern explained: Understanding the basics

Cryptocurrencies have grown to become one of the most popular assets to trade in recent years, due the opportunities they present. However, these opportunities are only rewarding because they come wit
15 июл. 2025 г.
2
P2P vs. DEX blog
Web3
P2P

P2P vs. DEX: How should you swap your crypto?

The OKX Wallet offers two powerful ways to swap assets: DEX and P2P. While both are easy and secure, they each come with different benefits. Let's dive into which one might be best for you. What's a Decentralized Exchange (DEX) swap?
15 июл. 2025 г.
3
Показать еще