Class Economics

java.lang.Object
convex.core.util.Economics

public class Economics extends Object
Utility function for Convex Cryptoeconomics
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 A
      b - 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:
      a - Quantity of Asset A in Pool
      b - Quantity of Asset B in Pool
      delta - Quantity of Unit A to buy (negative = sell)
      Returns:
      Price of A in terms of B