Skip to content

Tick

Tick-based pricing utilities for DEX price conversions.

Prices on Tempo's stablecoin DEX are discretized into integer ticks with a tick size of 0.1 bps (where price = PRICE_SCALE + tick and PRICE_SCALE = 100_000). Orders must be placed at ticks divisible by TICK_SPACING = 10 (1 bp grid), within bounds of ±2000 ticks (±2%).

Stablecoin DEX Pricing

Examples

import { Tick } from 'ox/tempo'
 
const price = Tick.toPrice(100) // "1.001" (0.1% above 1.0)
const tick = Tick.fromPrice('0.999') // -100

Functions

NameDescription
Tick.fromPriceConverts a price string to a tick.
Tick.toPriceConverts a tick to a price string.

Errors

NameDescription
Tick.InvalidPriceFormatErrorError thrown when a price string has an invalid format.
Tick.PriceOutOfBoundsErrorError thrown when a price string results in an out-of-bounds tick.
Tick.TickOutOfBoundsErrorError thrown when a tick value is out of the allowed bounds.

Types

NameDescription
Tick.TickTick type.