• bitcoin
    Bitcoin(BTC)
    $0.00 4.63%24H
  • ethereum
    Ethereum(ETH)
    $0.00 7.65%24H
  • binance-coin
    Binance Coin(BNB)
    $0.00 8.29%24H
  • usd-coin
    USD Coin(USDC)
    $0.00 -0.04%24H
  • cardano
    Cardano(ADA)
    $0.00 5.58%24H
  • chainlink
    Chainlink(LINK)
    $0.00 7.66%24H
  • bitcoin-cash
    Bitcoin Cash(BCH)
    $0.00 5.04%24H
  • stellar
    Stellar(XLM)
    $0.00 4.19%24H
  • vechain
    VeChain(VET)
    $0.00 7.84%24H
  • tezos
    Tezos(XTZ)
    $0.00 5.65%24H
  • eosdac
    eosDAC(EOSDAC)
    $0.00 3.34%24H
Crypto Currency Bazaar 4u
  • INVESTMENTS
    • Crypto General
    • Masternodes
    • Mining Projects
    • NFTS Investments
    • Invest In ICO
    • Exchanges
    • Staking Yeild Farming
  • WORLD
  • USA
  • CANADA
  • JAPAN
  • UK
  • UAE
  • INDIA
  • MORE
    • BRAZIL
    • AUSTRALIA
    • EL SALVADOR
    • CENTRAL AMERCIA
    • SOUTH AMERICA
    • AFRICA
    • EUROPE
    • ASIA
    • OCEANIA
    • ICO
  • Login
  • BLOCKCHAIN
  • BITCOIN
  • ETHEREUM
  • NFTS
  • ALTCOIN
  • MINING
  • VIDEOS
  • LIVERATES
  • SHOP
  • CLASSIFIEDS
  • ADVERTISE
  • SUBMIT PRESS RELEASE
HealthNews
No Result
View All Result
Home USA

Quantitative Crypto Insight: an analysis of triangular arbitrage transactions in Uniswap v2 | by Coinbase | Feb, 2022

CB4U by CB4U
February 8, 2022
in USA
0
Quantitative Crypto Insight: an analysis of triangular arbitrage transactions in Uniswap v2 | by Coinbase | Feb, 2022
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter

By Indra Rustandi, Nabil Benbada, Yao Ma

Arbitrage defined

In traditional finance, an arbitrage is an opportunity to make a positive gain with virtually no risk involved by taking advantage of pricing discrepancies that are present in the markets. These pricing discrepancies are an indication that some inefficiencies are present in the markets.

Arbitrageurs will exploit these opportunities to make a profit and thus remove the pricing discrepancies, bringing back the markets to a more efficient state.

Triangular arbitrage in TradFi

In FX markets, a typical arbitrage trade is the triangular arbitrage which involves at least 3 currencies:

This arbitrage would take advantage of any deviation in price between the above three pairs.

Here, in an efficient market, we should always have:

In this example:

Here, any deviation from this equilibrium will lead to an arbitrage opportunity. For example, if Euro was cheaper relative to USD.

Triangular arbitrage DeFi: Uniswap

Uniswap is a decentralized exchange venue that allows two kinds of activities:

  1. Provide liquidity of a given pair of ERC-20 tokens
  2. Swap one ERC-20 token for another ERC-20 token

For the remainder of the post, we will focus on the second version of Uniswap (Uniswap v2), first deployed in May 2020. And since we are interested in triangular arbitrage, let us first explain how a swap is priced.

Uniswap belongs to the category of “constant-product market”. In this category, the product of the liquidities of the two ERC-20 tokens in the pair of interest is constant:

For illustration purposes, say token A is WETH while token B is USDC, and we have in the WETH-USDC pool 1,000 WETH and 3,000,000 USDC. Then,

Assume now that we want to swap 1 WETH to USDC, how much USDC can we obtain? Our trade would increase the liquidity for WETH to 1,001 WETH. In order to maintain the constant product, we have:

So the amount of USDC that we receive in the swap is:

So in our swap, we receive an effective WETH/USDC rate of 2,997.

A few things to note here:

  • This example doesn’t include fees to focus on the pricing.
  • The effective WETH/USDC rate can change when we swap a different amount of WETH. This is called slippage. In this example, the effective price “slipped” by 3 USDC or 0.1%.
  • Our WETH/USDC rate is purely determined by the liquidities available in the venue and is not dependent on how WETH/USDC is quoted on other venues. This is yet another possible source of arbitrage, albeit one that is beyond the scope of this post.

Triangular arbitrage opportunities in Uniswap v2

Based on the discussion so far on both triangular arbitrage and Uniswap, a natural question is how prevalent triangular arbitrage opportunities are in Uniswap v2. We try to answer this question indirectly by analyzing Uniswap v2 swap trades that take advantage of triangular arbitrage opportunities. More specifically, we focus on the following characteristics:

  • All the trades are executed in the same transaction to reduce the risk of prices moving and affecting the arbitrage opportunities.
  • All the trades involve only Uniswap v2. With this, we miss triangular arbitrage trades that involve multiple venues (e.g. simultaneous swaps on Uniswap and Sushiswap).
  • All the tokens involved in the trades offset except for one token: the gain token, for which the sender will gain more at the end of the trade series.

After analyzing over 68 million Uniswap v2 swaps since Uniswap v2 was deployed until the end of 2021, we found 1,371,122 swaps grouped in 429,315 transactions taking advantage of triangular arbitrage opportunities in Uniswap v2.

On a monthly basis, we see a pronounced peak in October 2020, while the number of trades taking advantage of triangular arbitrage opportunities have been decreasing since. There are many factors that might have caused this (rise of competing DEXes, arbitrage opportunities mechanically decreasing due to the market becoming more efficient…). We are currently exploring these leads to try and explain this behavior.

Next, we see which tokens are most often used as gain tokens. WETH is the clear front runner here with 417,229 trades. 2nd-4th place are occupied by stablecoins: USDC, USDT, DAI. In total, we identified 123 distinct tokens used as gain tokens, but the top four tokens account for more than 99% of the trades.

How many legs were typically used to trade these opportunities? A majority of these trades were done using three legs. Quite a significant number also involved up to 6 legs.

How profitable are these trades? For WETH, a high proportion of the 417,229 trades involving WETH are profitable (about 94% when accounting for gas). The most profitable trade gained around 280 WETH, but the average and median gas-adjusted gains are much smaller (average: 0.08 WETH, median: 0.012 WETH).

For USDC, the trade with the most gain accumulated more than 14,000 USDC, but on average, the gain was around 97 USDC, while the median gain was almost 28 USDC.

Let us now consider the individual addresses (without revealing any specific ones) behind these trades. We found that these trades were initiated by 4,784 unique addresses, the most active of which initiated more than 16,000 trades. In total, 94 unique addresses initiated more than 1,000 trades each. When using WETH as the gain token, the most profitable address managed to accumulate more than 1,100 WETH as a result of its trades; in the case of USDC as the gain token, the most profitable address accumulated almost 35,000 in USDC.

Arbitrage trade execution

Last but not least, let us now discuss at a high level how these triangular arbitrage opportunities are detected and how the corresponding trades are executed.

We need to monitor the prices, likely using an automated process, in the Uniswap v2 pools. Given the prices for various pairs, an algorithm can run a search to see which combinations of pairs give rise to triangular arbitrage opportunities, potentially also incorporating opportunities identified from pending transactions in the mempool.

Once opportunities are identified, then we move to the execution aspect. One key consideration is minimizing slippage, and it naturally leads toward having the swaps being executed within a single transaction. Another consideration is avoiding front-running or sandwich attacks, for which Flashbots Auction can be beneficial.

Future directions

Here, we have just scratched the surface in terms of understanding and maximizing the potential of decentralized finance. We, as part of the Data Science Quantitative Research team, aim to get a good holistic understanding of this space from a quantitative perspective that can be used to drive new Coinbase products. We are looking for people that are passionate in this effort, so if you are interested in Data Science and in particular Quantitative Research in crypto, come join us.

The analysis makes use of the Uniswap v2 subgraph made available through the Graph Protocol. Thanks to Luke Youngblood and Xavier Lu for their contribution and feedback.

Advertisement Banner
Previous Post

Data Shows Bitfinex Hack Woke Up Largest Ever 5yr+ Bitcoin Supply

Next Post

Learn What Happens When Veteran 3D Designer Peter Dennelis Enters the NFT Space / Majestic Bears NFT

CB4U

CB4U

Next Post
Learn What Happens When Veteran 3D Designer Peter Dennelis Enters the NFT Space / Majestic Bears NFT

Learn What Happens When Veteran 3D Designer Peter Dennelis Enters the NFT Space / Majestic Bears NFT

Discussion about this post

RECOMMENDED

Vantage Bank Enables More Bitcoin Adoption Through BTC Saving Plans

Vantage Bank Enables More Bitcoin Adoption Through BTC Saving Plans

3 months ago
Over $370M Liquidated in a Day as Bitcoin Price Slumps to $28K

Over $370M Liquidated in a Day as Bitcoin Price Slumps to $28K

1 month ago

DON'T MISS

When Will The Crypto Bear Market End?! BEST Predictions!

When Will The Crypto Bear Market End?! BEST Predictions!

June 26, 2022
Bitcoin Regains Some Luster With 15% Rally To $21,700

Bitcoin Regains Some Luster With 15% Rally To $21,700

June 26, 2022
Shiba Inu Retains The Largest Token Position Among Top ETH Whales

Shiba Inu Retains The Largest Token Position Among Top ETH Whales

June 26, 2022
ApeCoin Value Prediction for June 26: APE/USD Ascends to Higher Value Mark

ApeCoin Value Prediction for June 26: APE/USD Ascends to Higher Value Mark

June 26, 2022
Crypto Currency Bazaar 4u

The Cryptocurrency Bazaar 4U was founded in 2020 for providing the most trusted information for the Crypto enthusiasts covering a broad range of news about blockchain technology, cryptocurrency assets, emerging fintech trends in the decentralized space, and other related wide array of information surrounding this emerging technology.Our team provides the most up-to-date and accurate news from different sources in this space comprising of unbiased news, in-depth analytics, detailed cryptocurrency price charts, and insightful opinion pieces is the basis of our editorial content.

POPULAR POSTS

When Will The Crypto Bear Market End?! BEST Predictions!

When Will The Crypto Bear Market End?! BEST Predictions!

June 26, 2022
Bitcoin Regains Some Luster With 15% Rally To $21,700

Bitcoin Regains Some Luster With 15% Rally To $21,700

June 26, 2022
Shiba Inu Retains The Largest Token Position Among Top ETH Whales

Shiba Inu Retains The Largest Token Position Among Top ETH Whales

June 26, 2022

Categories

  • AFRICA
  • ALTCOIN
  • ASIA
  • AUSTRALIA
  • BITCOIN
  • BLOCKCHAIN
  • BRAZIL
  • CANADA
  • CENTRAL AMERCIA
  • CRYPTO GENERAL
  • EL SALVADOR
  • ETHEREUM
  • EUROPE
  • EXCHANGES
  • ICO
  • INDIA
  • INVERST IN ICO
  • INVESTMENTS
  • JAPAN
  • MASTERNODES
  • MINING
  • MINING PROJECTS
  • NFTS
  • NFTS INVESTMENTS
  • OCEANIA
  • SINGAPORE
  • SOUTH AMERICA
  • STAKING & YEILD FARMING
  • UAE
  • UK
  • Uncategorized
  • USA
  • VIDEOS
  • WORLD
  • CONTACT US
  • DISCLAIMER
  • PRIVACY POLICY
  • ABOUT US
  • CLASSIFIED
  • ADVERTISE
  • SUBMIT PRESS RELEASE

© cryptocurrencybazaar4u.io

No Result
View All Result
  • BLOCKCHAIN
  • BITCOIN
  • ETHEREUM
  • NFTS
  • ALTCOIN
  • MINING
  • VIDEOS
  • LIVERATES
  • SHOP
  • CLASSIFIEDS
  • ADVERTISE
  • SUBMIT PRESS RELEASE

© cryptocurrencybazaar4u.io

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
  • bitcoin
    Bitcoin(BTC)
    $0.00 4.63%24H
  • ethereum
    Ethereum(ETH)
    $0.00 7.65%24H
  • binance-coin
    Binance Coin(BNB)
    $0.00 8.29%24H
  • usd-coin
    USD Coin(USDC)
    $0.00 -0.04%24H
  • cardano
    Cardano(ADA)
    $0.00 5.58%24H
  • chainlink
    Chainlink(LINK)
    $0.00 7.66%24H
  • bitcoin-cash
    Bitcoin Cash(BCH)
    $0.00 5.04%24H
  • stellar
    Stellar(XLM)
    $0.00 4.19%24H
  • vechain
    VeChain(VET)
    $0.00 7.84%24H
  • tezos
    Tezos(XTZ)
    $0.00 5.65%24H
  • eosdac
    eosDAC(EOSDAC)
    $0.00 3.34%24H