Giter Site home page Giter Site logo

chrisckwong821 / curve_finance_slippage_simulator Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 6.0 4.8 MB

simulate slippage for pool of various Amplifier(s), based on a targeted slippage(%) or a poolBalance(%)

License: GNU General Public License v3.0

Python 100.00%

curve_finance_slippage_simulator's Introduction

Curve_Finance_Slippage_Simulator

Hosted web service here kindly created by Vhjiang

simulate slippage & bonus for pool of various Amplifier(s), based on a targeted slippage(%) or a poolBalance(%) with custom size as a percentage of pool Total Value Locked (TVL).

Scripts for Swap, Withdrawal and Deposit

Install

pip install -r requirements.txt

Usage

Simulate withdrawal slippage on a targeted PoolBalance(%)

# poolBalance 80%
python3 Withdraw.py -p 80

Withdraw Slippage with 80% Pool Balance

Simulate withdrawal on a targeted Slippage(%)

# Slippage 2%
python3 Withdraw.py -s 2

Withdraw PoolBalance with 2% Slippage

Simulate withdrawal bonus on a targeted PoolBalance(%)

# the excess assets are withdrawed
python3 Withdraw.py -p 80 --bonus True

Withdraw Bonus with 80% Pool Balance

Simulate withdrawal bonus on a targeted bonus(%)

# bonus 2%
python3 Withdraw.py -s 2 --bonus True

Targeted Withdrawal Bonus 2%

Simulate Swap slippage on a targeted PoolBalance(%)

# swap excess asset with needed asset, further tilt the pool
python3 Swap.py -p 80

Swap Slippage with 80% Pool Balance

Simulate swap on a targeted Slippage(%)

# Slippage 2%
python3 Swap.py -s 2

PoolBalance with 2% Slippage

Simulate Swap bonus on a targeted PoolBalance(%)

# swap needed asset with access asset, return the pool to balance
python3 Swap.py -p 80 --bonus True

Swap Bonus with 80% Pool Balance

Simulate Swap on a targeted Bonus(%)

# Bonus 2%
python3 Swap.py -s 2 --bonus True

PoolBalance with 2% Bonus

Simulate Deposit slippage on a targeted PoolBalance(%)

# deposit excess asset
python3 Deposit.py -p 80

Swap Slippage with 80% Pool Balance

Simulate Deposit on a targeted Slippage(%)

# Slippage 2%
python3 Deposit.py -s 2

PoolBalance with 2% Slippage

Simulate Deposit bonus on a targeted PoolBalance(%)

# deposit needed asset, return the pool to balance
python3 Deposit.py -p 80 --bonus True

Deposit Bonus with 80% Pool Balance

Simulate Deposit on a targeted Bonus(%)

# Bonus 2%
python3 Deposit.py -s 2 --bonus True

Deposit with 2% Bonus

Deposit / Swap / Withdraw Sizes

# Pre-set `1%` of poolSize for the operations
# Pass an optional argument -a to specify the size as a percentage of TVL

# default
python3 Swap.py -s 2 -a 1
# specify swap size of 5%
python3 Swap.py -s 2 -a 5

PoolBalance with 2% Slippage

Note:

  1. Modified simulation code from Curve Finance

  2. Use a simple 2-coins model.

  3. Assume no admin fee in the above illustration, modify fee in the script to 4000000 to resemble mainnet setting of 4 bps

Contributor

Core Simulation Logic: GeekRunner

Streamlit: VJiang

curve_finance_slippage_simulator's People

Contributors

chrisckwong821 avatar vhjiang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

curve_finance_slippage_simulator's Issues

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.