Options
All
  • Public
  • Public/Protected
  • All
Menu

A collection of utility functions when interacting with Ticks.

Hierarchy

  • TickUtil

Index

Methods

  • checkTickInBounds(tick: number): boolean
  • findNextInitializedTickIndex(account: TickArrayData, currentTickIndex: number, tickSpacing: number): null | number
  • findPreviousInitializedTickIndex(account: TickArrayData, currentTickIndex: number, tickSpacing: number): null | number
  • getInitializableTickIndex(tickIndex: number, tickSpacing: number): number
  • 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

  • getNextInitializableTickIndex(tickIndex: number, tickSpacing: number): number
  • getOffsetIndex(tickIndex: number, arrayStartIndex: number, tickSpacing: number): 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

  • getPrevInitializableTickIndex(tickIndex: number, tickSpacing: number): number
  • getStartTickIndex(tickIndex: number, tickSpacing: number, offset?: number): 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

  • invertTick(tick: number): 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

  • isTickInitializable(tick: number, tickSpacing: number): boolean

Generated using TypeDoc