Blockpour: Arbitrage Your Alpha

Unlike centralized exchanges (CEX), which uses the order book model for market making, a decentralized exchange (DEX) relies on an algorithmic market maker to determine the price of its assets. As we’ve discussed in an earlier article titled “AMMs: A Formula Made Simple,” when assets are swapped within a DEX, the ratio of coins in a liquidity pool becomes unbalanced.

The price of a token within a trading pair can fluctuate widely depending on the volume of the transaction. This can result in discrepancies between the price of an asset across CEXs and DEXs.

Current Decentralized Finance (DeFi) markets are siloed, allowing them to report different values for the same assets and behave differently within similar market conditions.

The price discrepancies are where arbitrage opportunities emerge.

There are numerous reasons why arbitrage opportunities arise. Here are the most important ones:

  • Variations in liquidity for the same asset across different platforms
  • Forced delays on asset deposits or withdrawals from exchanges
  • Thin order books
  • Differing crypto-fiat exchange rates

1 — Types of Arbitrage:

1.1 Simple arbitrage:

https://currency.com/crypto-arbitrage-everything-you-need-to-know

This type of arbitrage is typically performed by sending assets between two exchanges.

For example:

I buy 1 $ETH on Coinbase for $1050

I transfer 1 $ETH from Coinbase to Binance

I sell 1 $ETH on Binance for $1060

I net $10 in profit

To avoid extensive time constraints, transfer fees, slippage, spread etc, some arbitrageurs hold multiple currencies on various exchanges.

For example:

I have 10,000 $USDT on Binance

I have 10 $ETH on Coinbase

$ETH is at $1000 on Binance

$ETH is at $1100 on Coinbase

I buy 10 $ETH (using USDT) on Binance

I sell 10 $ETH on Coinbase

At the end of the sequence of trades, I still own 10 $ETH, but I made $1000 due to the spread between the two exchanges

1.2 Triangular arbitrage

https://medium.com/geekculture/automated-triangular-arbitrage-of-cryptos-in-4-steps-a678f7b01ce7

1.2.1 Fiat triangular arbitrage:

This arbitrage is typically executed between CEXs in local or regional markets (spatial arbitrage). The method is performed using three assets between two trading pairs to generate a profit.

For example:

Utilizing the trading pairs $BTC/$USD and $BTC/$KRW

Buy 1 $BTC for $20,000 on Coinbase

Send 1 $BTC to Upbit from Coinbase

Sell 1 $BTC for $20,100 worth of KRW on Upbit

Convert $KRW to $USD for $100 profit

1.2.2 Crypto triangular arbitrage:

This type of arbitrage typically happens within a single DEX, eliminating transfer fees and allowing you to take advantage of the three mispriced pairs.

For example:

A) $ETH/$USDC

B) $USDC/$USDT

C) $USDT/$ETH

In pool A: 1 $ETH costs 1,500 $USDC

In pool B: 1 $USDC costs 1 $USDT

In pool C: 1 $ETH costs 1,000 $USDT

In pool A, swap 1 $ETH for 1,500 $USDC

In pool B, swap 1,500 $USDC for 1,500 $USDT

In pool C, swap 1,500 $USDT for $1.5 ETH & make 0.5 $ETH in net profit

1.3 Convergence arbitrage

Convergence arbitrage occurs on the premise that prices will eventually converge. Buy on an exchange where the coin is undervalued and then short that asset on an exchange where it is overvalued. Shorting an asset essentially refers to placing an order that expects the price of the asset to fall.

Ex:

Buy 1 $BTC on Gemini for $20,000

Sell 1 $BTC on Kraken for $20,010

When prices eventually converge, you would have made a $10 net profit

1.4 “Cash and Carry” arbitrage

This arbitrage is typically executed on futures markets. It is basically done by going long in a spot market by holding an asset and shorting it on the futures market. The trade is concluded by closing the long position and pocketing the value difference.

For example:

$BTC futures contract on Chicago Mercantile Exchange (CME) is $20,100

$BTC spot on Binance is $20,000

You buy 1 $BTC on Binance

You short 1 $BTC on CME

When your futures contract expires, you deliver 1 $BTC to CME and get paid $20,100

for a $100 profit

1.5 Statistical arbitrage

https://youtu.be/aaNgZpSIm0U

Statistical arbitrage involves using quantitative data models to trade crypto. Traders can utilize an arbitration bot to trade different cryptocurrencies at once by using statistical and econometric techniques to provide execution signals.

For example:

Find two asset pairs that are historically highly correlated and co-integrated in price action. When the spread widens between the two, buy the cheaper asset and sell the expensive asset. Then, wait for the spread to revert to its average to make a profit.

1.6 Yield arbitrage

Yield arbitrage strategies are mainly executed on 2 types of products:

  • Lending/borrowing
  • Staking

Because liquidity is highly fragmented between blockchains, yield rates between assets on different platforms can vary significantly. Below is an example of an interest rate arbitrage, which can be executed on a single platform or cross-platforms.

Ex:

Borrow APR of $FTM is 10%

Lend APR of $MATIC is 15%

Suppose you hold $MATIC

You collateralize $MATIC to borrow $FTM

You swap $FTM for $MATIC

You lend your recently acquired $MATIC

You net a 5% profit on the spread

2 — Arbitrage Location

2.1 Single platform

Single platform arbitrage is when you leverage the differences in rates during liquidity pool swaps.

Ex:

Borrow APR of $HBAR is 10% on a DeFi lending platform

Lend APR of $SOL is 15%

You borrow $HBAR against $SOL and net a profit

2.2 Cross-platform

Arbitrage across platforms can happen between DEXs and CEXs equally.

Ex:

Fantom Pool A: 1 $ETH costs 1,500 $USDC

Polygon Pool B: 1 $USDC costs 1 $USDT

Polygon Pool C: 1 $ETH costs 1,000 $USDT

In pool A, swap 1 $ETH for 1,500 $USDC

In pool B, swap 1,500 $USDC for $USDT

In pool C, swap 1,500 $USDT for $1.5 ETH
Net 0.5 $ETH profit.

Cross-platform arbitrage has incentivized the emergence of novel ways to optimize trades and different trading bot behaviors.

3 — Arbitrage smart contracts

https://jamesbachini.com/dex-arbitrage/

Smart contracts are Turing-complete, and thus enable one to ‘encode’ within a single transaction an arbitrary number of orders to be atomically executed. Traditionally, the success of multi-legged arbitrage was probabilistic as individual legs had a higher probability of failure (‘legging risk’). DeFi allows for a higher probability of success since these legs are either executed atomically or fully canceled should one not work. Unlike in traditional markets, complex orders within a single transaction have now become possible. Here are a few ways smart contracts are being leveraged.

3.1 Smart contracts that leverage gas tokens, flash loans, mempool transaction replacement, and trade batching (multiple trades across one or more DEXs wrapped into a single transaction).

3.2 Smart contracts that only leverage trade batching to wrap multiple trades across one or multiple DEXs into a single transaction.

3.3 Smart contracts that mainly leverage two-point arbitrage on different exchanges using separate transactions (may use other techniques like gas tokens).

4 — Arbitrage mechanisms

Below are a few mechanisms arbitrageurs use to leverage their funds and fully take advantage of potential arbitrage opportunities while reducing their losses.

4.1 Separate transactions

A simple technique where the arbitrageur buys and sells an asset in two transactions in quick succession with the expectation of net profit. This technique becomes less profitable when more sophisticated arbitrageurs implement automated mechanisms.

4.2 Trade batching

A technique that allows the fast execution of complex queries and batching multiple swaps into a single transaction. This method ensures that all orders in the sequence get filled or the trade does not take place. This ensures that the trades are profitable before executing them. Typically, a solidity smart contract is used as a relay between a trading bot controller and the exchanges. The entire transaction could be reverted while only losing the transaction fee.

4.3 Flash loans

A technique utilized in conjunction with trade batching which allows you to borrow funds and pay back your loan in one single transaction. Using this mechanism, arbitrageurs avoid the allocation of extra funds to trade and generate profit, and they borrow and return funds via flash loans without having to worry about providing collateral.

4.4 Gas tokens

A technique that allows arbitrageurs to reduce the transaction fees on their smart contracts. When the Ethereum network is less busy and gas prices are low, arbitrageurs mint gas tokens cheaply. They burn these tokens when performing arbitrage at higher gas prices instead of paying current higher prices.

4.5 Mempool transaction replacement

A front-running prevention technique allows an arbitrageur to create a simple transaction with a higher gas price which, when confirmed, cancels their initial arbitrage transaction. When a user reissues an unconfirmed transaction on the same (account, nonce) pair with a higher gas price, a miner will prefer the reissued transaction. It’s an exit strategy to reduce the arbitrageur’s potential losses when front-run by other arbitrageurs and decides not to outbid them.

4.6 Pure revenue/ batched transaction

These blockchain transactions issue multiple trades automatically through a smart contract, allowing bots to trade across DEXs through proxy contracts with an all-or-nothing failure model.

For example, a smart contract proxy could execute a trade buying token A for 2 $FTM, and another trade selling it for 3 $FTM. If both orders are on different DEXs, executing both guarantees a revenue of 1 $FTM.

4.7 Priority gas auctions (PGAs)

Blockchain transactions consume gas. The more gas fees you pay for a transaction, the higher the chances it will get picked from the mempool by a miner or validator to be included in the next block for confirmation. This ignites an auction race for block space inclusion by traders and results in bidding wars between bots.

  • Blind raising is a strategy that involves a trader raising bids under a predetermined schedule, irrespective of other traders’ bids’ history.
  • Counterbidding is a strategy that involves a trader outbidding another trader’s bidding strategy.

Below are a few trading bot behaviors that have been spotted on DEXs:

a) Compete:

• Bot 1 submits transactions with a nominal gas fee.

• Bot 2 submits the same transaction with a higher gas fee.

• Bot 1 notices Bot 2 and modifies its transaction to include a higher gas fee, etc.

Ultimately, one bot wins the auction, or the opportunity becomes unprofitable, canceling the bidding entirely.

b) Cooperate:

In this scenario, bots collaborate to maximize their profits through ‘grim-trigger’ cooperative strategies. If a bot tries to front-run, the other bot in the auction will immediately raise its bid to the maximum amount, thereby eliminating all profitability from the auction. The expected payoff from adhering to such cooperative strategies is larger than the expected payoff from deviating, achieving a Nash equilibrium.

Arbitrage your alpha

Blockpour aggregates real-time live data from DEXs on six blockchain networks in the market today including Ethereum, Polygon, Avalanche, Fantom, Optimism, and Moonbeam. This data gives traders immediate insight into token pairs’ current prices and more.

Using the above techniques in tandem with Blockpour’s data might allow professional arbitrageurs to effectively spot real-time arbitrage opportunities that arise and immediately act upon them.

Here’s an example of how this might work:

In Blockpour’s web application search box, type in any token you’d like to explore. Let’s choose the $MIM token as an example.

You’ll be directed to the $MIM token dashboard, which summarizes a few token metrics.

The relevant ones for discovering arbitrage opportunities are:

  • Highest 24 hr volume on Trader Joe
  • Lowest 24 hr average price on SpookySwap
  • Highest Trade Count on Trader Joe

Since the average lowest price was registered on SpookySwap, we connected our wallet to that exchange to investigate further and discovered that the swap price for USDC/MIM = $1.008.

On the other hand, if we connect to Trader Joe, where the most volume was registered, we discover that the swap price for USDC/MIM = $1.00525

This discrepancy in price between the two exchanges could be an arbitrage opportunity to act upon, depending on risk factors that should include slippage, fees, gas costs, liquidation, implicit market volatility, smart contract risk and rate changes between different platforms. Visit Blockpour to explore the tools shown above!

About Blockpour

Blockpour is a multi-chain data analytics platform that provides traders with the tools and metrics they need to navigate the world of DeFi. Crypto traders can leverage Blockpour’s next-to-real-time multi-chain data feeds and intuitive interface to identify trends across DeFi and discover their alpha. To learn more about Blockpour, check out our website and follow us on Twitter and LinkedIn.

Disclaimer

The above article is for informational purposes only and is not financial advice. Blockpour is a data aggregation and analytics platform only and does not provide financial advice or services of any kind.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Blockpour

Blockpour

22 Followers

Blockpour brings real-time decentralised data across multiple networks for you to view, compare, and track token data.