Skip to content

Tick.toPrice

Converts a tick to a price string.

Stablecoin DEX Pricing

Imports

Named
import { Tick } from 'ox/tempo'

Examples

import { Tick } from 'ox/tempo'
 
// Tick 0 = price of 1.0
const price1 = Tick.toPrice(0) // "1"
 
// Tick 100 = price of 1.001 (0.1% higher)
const price2 = Tick.toPrice(100) // "1.001"
 
// Tick -100 = price of 0.999 (0.1% lower)
const price3 = Tick.toPrice(-100) // "0.999"

Definition

function toPrice(
  tick: toPrice.Tick,
): toPrice.ReturnType

Source: src/tempo/Tick.ts

Parameters

tick

  • Type: toPrice.Tick

The tick value (range: -2000 to +2000).

Return Type

The price as a string with exact decimal representation.

toPrice.ReturnType