Git Product home page Git Product logo

cex-dex-arbitrage-anatomy's Introduction

Code for the "CEX/DEX arbitrage anatomy" simulations

This repository contains Python code for the artice "CEX/DEX arbitrage anatomy".

The code is used to produce the graphs in the published article.

For visualization, it uses Matplotlib in combination with the ING theme.

Assumptions

It assumes:

  • A DEX with deep liquidity of $1 billion. This is large, but not unrealistic, as the ETH/USDC 0.05% pool on Uniswap v3 mainnet has a comparable virtual liquidity depth.
  • The DEX has a xy=k pool with a stable / volatile asset pair.
  • The volatility of the volatile asset is either 50% per year, or 5% per day (~90% per year) depending on the simulation. This matches the performance of ETH is less or more volatile periods.
  • The base fee of arbitrage transactions is constant and does not depend on the price action
  • The swap fees are not compounding.

It also makes the standard assumptions behing the LVR model.

  • There is a CEX which trades the volatile asset.
  • The traders are not required to pay any trading fees on the CEX.
  • The liquidity on the CEX is infinitely deep.
  • There is a CEX/DEX arbitrager that has unlimited amount of stable assets, fast connections to both CEX and DEX, and will take all profitable trades at their maximum volume.

Contents

  • simple_examples.py - intuition-building examples directly discussed in the article.
  • simulation_examples.py - examples on which the article's graphs are based.
  • replication.py - code that aims to replicate and extend the Table 1 from the paper "Automated Market Making and Arbitrage Profits in the Presence of Fees".

Simulations

The current implementation of price path simulations has significant RAM usage and may require several minutes to complete.

cex-dex-arbitrage-anatomy's People

Contributors

atiselsts avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.