Skip to content

Commit

Permalink
test: making simulator twocrypto-only
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoCentonze committed Apr 16, 2024
1 parent 05e7a8a commit 7974330
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/utils/simulation_int_many.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def get_fee(x, fee_gamma, mid_fee, out_fee):

def newton_D(A, gamma, x, D0):
D = D0
i = 0

S = sum(x)
x = sorted(x, reverse=True)
Expand Down Expand Up @@ -184,13 +183,15 @@ def solve_D(A, gamma, x):
return newton_D(A, gamma, x, D0)


N_COINS = 2


class Curve:
def __init__(self, A, gamma, D, n, p):
def __init__(self, A, gamma, D, p):
self.A = A
self.gamma = gamma
self.n = n
self.p = p
self.x = [D // n * 10**18 // self.p[i] for i in range(n)]
self.x = [D // N_COINS * 10**18 // self.p[i] for i in range(N_COINS)]

def xp(self):
return [x * p // 10**18 for x, p in zip(self.x, self.p)]
Expand All @@ -208,7 +209,6 @@ def y(self, x, i, j):
return yp * 10**18 // self.p[j]

def get_p(self):

A = self.A
gamma = self.gamma
xp = self.xp()
Expand Down Expand Up @@ -249,7 +249,7 @@ def __init__(
self.p0 = p0[:]
self.price_oracle = self.p0[:]
self.last_price = self.p0[:]
self.curve = Curve(A, gamma, D, n, p=p0[:])
self.curve = Curve(A, gamma, D, p=p0[:])
self.dx = int(D * 1e-8)
self.mid_fee = int(mid_fee * 1e10)
self.out_fee = int(out_fee * 1e10)
Expand Down

0 comments on commit 7974330

Please sign in to comment.