Skip to content

Commit 37f9421

Browse files
committed
app for Ben
1 parent 5cf49a7 commit 37f9421

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import copy
2+
import math
3+
4+
from matplotlib import pyplot as plt
5+
import sys, os
6+
import streamlit as st
7+
from mpmath import mpf
8+
9+
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../"))
10+
sys.path.append(project_root)
11+
12+
from hydradx.model.amm.stableswap_amm import StableSwapPoolState, simulate_swap
13+
from hydradx.model.amm.agents import Agent
14+
from hydradx.apps.gigadot_modeling.utils import get_omnipool_minus_vDOT, set_up_gigaDOT_3pool, set_up_gigaDOT_2pool, \
15+
create_custom_scenario, simulate_route, get_slippage_dict
16+
from hydradx.apps.display_utils import display_liquidity, display_op_and_ss
17+
from hydradx.model.indexer_utils import get_latest_stableswap_data
18+
19+
peg = st.number_input(
20+
label="peg value:",
21+
value=1.578818,
22+
step=0.000001, format="%.6f"
23+
)
24+
pool = StableSwapPoolState(
25+
tokens={'DOT': 1, 'vDOT': 1},
26+
amplification=222,
27+
trade_fee=0,
28+
peg=peg
29+
)
30+
test_cases = [20, 30, 40, 50, 60, 70, 80]
31+
for balance in test_cases:
32+
pool.liquidity['DOT'] = mpf(balance)
33+
pool.liquidity['vDOT'] = mpf(100 - balance) / peg
34+
price = pool.price('vDOT', 'DOT')
35+
st.write(f"price at {balance}% DOT, {100 - balance}% vDOT: {round(price, 6)}")

0 commit comments

Comments
 (0)