Function roundTicks

Rounds a price to the appropriate precision based on the tick size.

roundTicks(123.456789, 0.01) // returns "123.46"
roundTicks("100.12345", 0.001) // returns "100.123"
  • Parameters

    • price: string | number

      The price to round, can be a string or number

    • tickSize: number

      The tick size that determines the precision (e.g., 0.01 for 2 decimal places)

    Returns string

    The price rounded to the precision specified by the tick size