Code Monkey home page Code Monkey logo

amm-simulator's Introduction

AMM-Simulator

Introduction

An asynchronous object-oriented program to simulate constant product AMM LP position on OKEx. An LP position that satisfies x*y=k is equivalent to an infinite grid trading bot. It sells spot when the price rises and buys spot when the price drops, passively by the help of traders and arbitrageurs. LP on a DEX earns trading fees and liquidity mining rewards. The trading fees are subject to the fee rate, the volume on the trading pair and the share of pool. On the other hand, a copy of LP on CEX doesn't earn trading fees. It costs trading fees to mimic the LP on CEX. However, it generates profit by selling high and buying low. The APR is purely the result of price action and can be used to deduce the realized volatility.

Chinese and English support, completed with annotations and docstrings.

Features

  • Simulate an AMM LP position on CEX;
  • Calculate the APR and realized volatility.

Installation

Install Python 3.8+ and required packages.

python setup.py install or pip install -r requirements.txt

Install MongoDB.

Paste API keys in config.py (use account 3 for demo trading).

Set language='cn' for Chinese and language='en' for English in config.py.

Simply python main.py.

Disclaimer

The author does not assume responsibilities for the use of this program, nor is warranty granted.

amm-simulator's People

Contributors

aureliano90 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.