fintech-algorithms

Tick-Size Validation

Install and import

bash
npm install fintech-algorithms
ts
import { tickSizeValidation } from "fintech-algorithms/matching-engines-and-venue-logic/order-controls/tick-size-validation";

Signature

tickSizeValidation(price_atoms, tick_size_atoms, price_scale, effective_policy_id)

Rejects a price that is not a whole multiple of the instrument's tick. Prices and quantities are integer **atoms** — the venue's minimum increment — not floating-point currency. Matching arithmetic that rounds is matching arithmetic that disagrees with the exchange. Validating in floating point is how sub-tick prices reach a book that cannot represent them.

Parameters

NameTypeNotes
price_atomsnumberOrder price in integer atoms.
min: 0 · integer: true
tick_size_atomsnumberTick size in atoms.
min: 1 · integer: true
price_scalenumberDecimal scale relating atoms to display currency.
min: 0 · integer: true
effective_policy_idstringWhich tick policy applies; tick size varies by price band on many venues.

Returns

{ valid, reason, price_atoms, tick_size_atoms, policy_id }

The verdict with the policy applied, so a rejection can be explained to the participant.

Errors

  • When tick size is not a positive integer — throws

Complexity: time O(1), space O(1).

Worked example

executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

Input

price_atoms
1000500
tick_size_atoms
100
price_scale
10000
effective_policy_id
"SYN-US-EQ-2026-A"

Call

tickSizeValidation(price_atoms, tick_size_atoms, price_scale, effective_policy_id)

Returns

object with 12 fields: effective_policy_id, price_atoms, tick_size_atoms, price_scale, valid, remainder_atoms, lower_valid_price_atoms, upper_valid_price_atoms, …

{
  "effective_policy_id": "SYN-US-EQ-2026-A",
  "price_atoms": 1000500,
  "tick_size_atoms": 100,
  "price_scale": 10000,
  "valid": true,
  "remainder_atoms": 0,
  "lower_valid_price_atoms": 1000500,
  "upper_valid_price_atoms": 1000500,
  "distance_to_lower_atoms": 0,
  "distance_to_upper_atoms": 0,
  "reason": "on-grid",
  "state": "accepted"
}

Other exports

This module also exports priceBandValidation, selfTradePrevention, cancelOnDisconnect, fatFingerLimit, circuitBreakerTrigger, calculate. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams

Tick-Size Validation — system map

How it works

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References