Skip to content

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

License

Notifications You must be signed in to change notification settings

chrisckwong821/Curve_Finance_Slippage_Simulator

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages