stable_swap_math

algofipy.amm.v1.stable_swap_math.get_D(token_amounts: List[int], amplification_factor: int) Tuple[int, int]

Calculate the D quantity in the stableswap invariant given a list of token amounts and an amplication factor.

Parameters:
  • token_amounts (list of ints) – list of token amounts in pool

  • amplication_factor (int) – quantity of sensitivity to price change

Returns:

D quantity

Return type:

(int, int)

algofipy.amm.v1.stable_swap_math.get_y(i: int, j: int, x: int, token_amounts: List[int], D: int, amplification_factor: int) Tuple[int, int]

Calculate the y quantity in the stableswap invariant.