Skip to content
EliteChart

roundToTick

Documentation


Documentation / @elitechart/core / roundToTick

code
function roundToTick(price, tick): Price;

Defined in: data/primitives.ts:142

Round a price to the nearest multiple of a tick size.

Half-away-from-zero rounding; exact for tick sizes that are representable in binary floating point at the given magnitude.

Parameters

price

Price

tick

TickSize

Returns

Price

Example

code
roundToTick(asPrice(23.456), asTickSize(0.01)); // -> Price 23.46