Package convex.core.util
Class Economics
java.lang.Object
convex.core.util.Economics
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double
stakeDecay
(long time, long peerTime) static long
swapPrice
(long delta, long a, long b) Computes the smallest price for d units of Asset A in terms of units of Asset B such that a constant liquidity pool c = a * b is increasedstatic double
swapRate
(long a, long b) Computes the marginal exchange rate between assets A and B with pool quantities, such that a constant liquidity pool c = a * b is maintained.
-
Constructor Details
-
Economics
public Economics()
-
-
Method Details
-
swapRate
public static double swapRate(long a, long b) Computes the marginal exchange rate between assets A and B with pool quantities, such that a constant liquidity pool c = a * b is maintained.- Parameters:
a
- Quantity of Asset Ab
- Quantity of Asset B- Returns:
- Price of A in terms of B
-
swapPrice
public static long swapPrice(long delta, long a, long b) Computes the smallest price for d units of Asset A in terms of units of Asset B such that a constant liquidity pool c = a * b is increased- Parameters:
delta
- Quantity of Unit A to buy (negative = sell)a
- Quantity of Asset A in Poolb
- Quantity of Asset B in Pool- Returns:
- Price of A in terms of B
-
stakeDecay
public static double stakeDecay(long time, long peerTime)
-