A collection of utility functions when interacting with Ticks.

Methods

  • Get the next initialized tick index within the same tick array.

    Parameters

    • account: TickArrayData
    • currentTickIndex: number
    • tickSpacing: number

    Returns null | number

  • Get the previous initialized tick index within the same tick array.

    Parameters

    • account: TickArrayData
    • currentTickIndex: number
    • tickSpacing: number

    Returns null | number

  • Get the minimum and maximum tick index that can be initialized.

    Parameters

    • tickSpacing: number

      The tickSpacing for the Whirlpool

    Returns [number, number]

    An array of numbers where the first element is the minimum tick index and the second element is the maximum tick index.

  • Get the nearest (rounding down) valid tick index from the tickIndex. A valid tick index is a point on the tick spacing grid line.

    Parameters

    • tickIndex: number
    • tickSpacing: number

    Returns number

  • Parameters

    • tickIndex: number
    • tickSpacing: number

    Returns number

  • Get the offset index to access a tick at a given tick-index in a tick-array

    Parameters

    • tickIndex: number

      The tick index for the tick that this offset would access

    • arrayStartIndex: number

      The starting tick for the array that this tick-index resides in

    • tickSpacing: number

      The tickSpacing for the Whirlpool that this tickArray belongs to

    Returns number

    The offset index that can access the desired tick at the given tick-array

  • Parameters

    • tickIndex: number
    • tickSpacing: number

    Returns number

  • Get the startIndex of the tick array containing tickIndex.

    Parameters

    • tickIndex: number
    • tickSpacing: number
    • offset: number = 0

      can be used to get neighboring tick array startIndex.

    Returns number

  • Returns the tick for the inverse of the price that this tick represents. Eg: Consider tick i where Pb/Pa = 1.0001 ^ i inverse of this, i.e. Pa/Pb = 1 / (1.0001 ^ i) = 1.0001^-i

    Parameters

    • tick: number

      The tick to invert

    Returns number

  • Check if the tick range is the full range of the Whirlpool.

    Parameters

    • tickSpacing: number

      The tickSpacing for the Whirlpool

    • tickLowerIndex: number

      The lower tick index of the range

    • tickUpperIndex: number

      The upper tick index of the range

    Returns boolean

    true if the range is the full range of the Whirlpool, false otherwise.

Generated using TypeDoc