Ask us anything. We're here to help.

Matching Engine REST API - Price and Quantity Scaling

When using the API endpoints, certain fields are scaled in to capture fraction-based transactions of cryptocurrencies.

On the Zero Hash Matching Engine, fields that are price related are scaled with the tick_sizewhile fields which related to quantity are scaled with fractional_qty_scale.

Retrieving the scale factors

Tick_size and fractional_qty_scale varies per asset. To find the details for the asset you are interested in, you may query the endpoint: /v1beta1/list_instruments.

Order entry fields that are scaled

Field

Scale Factor

Example

cash_order_qty

fractional_qty_scale

an order entry with cash_order_qty of 1000000000000 means that an order is placed with 10000 worth of USD

min_qty

fractional_qty_scale

a Buy BTC order entry with min_qty or order_qty of 508212 means that the client is willing to buy 0.0050821 units of BTC

order_qty

fractional_qty_scale

price

tick_size

a Sell BTC order entry with price or stop_price of 1967682 means that the order is entered with the BTC price of 19,676.92

stop_price

tick_size

 

The fields above may be used in following endpoints when entering or replacing/modifying orders:

/v1beta1/insert_order

/v1beta1/insert_order_cross

/v1beta1/cancel_replace_order

Other fields that are scaled

Fields that are scaled using tick_size
  • avg_px
  • close_px
  • cost
  • first
  • high
  • high_px
  • last
  • last_px
  • last_trade_px
  • low
  • low_px
  • notional_traded
  • open_px
  • px
  • reference_px
  • settlement_px
 

For these fields that are scaled with tick_size, the API response received is multiplied to the tick_size to get the real value.

e.g. An avg_px of 145000 has been returned as response for an ETH order query, meanwhile ETH has a tick_size of 0.01. To get the real value, multiply the avg_px of 145000 to the tick_size of 0.01 - this then results to 1,450 which approx. the ETH/USD value as of date.

Fields that are scaled using fractional_qty_scale
  • bod_position
  • cleared_volume
  • commissions_basis_points
  • cum_qty
  • last_shares
  • last_trade_qty
  • leaves_qty
  • net_position
  • open_interest
  • qty
  • qty_bought
  • qty_sold
  • realized
  • shares_traded
  • volume
 

For these fields that are scaled with fractional_qty_scale, the API response received is divided to the fractional_qty_scale to get the real value.

e.g. A leaves_qty of 37647 has been returned as response for an XRP order query, meanwhile XRP has a fractional_qty_scale of 1000000. To get the real value, divide the leaves_qty of 37647 to the fractional_qty_scale of 1000000 - this then results to 0.037647 units of XRP.

Related Endpoints

All above fields are scaled on the Zero Hash Matching Engine and may be received as response from various endpoints including but not limited to:

/v1beta1/create_market_data_subscription

/v1beta1/create_position_subscription

/v1beta1/get_trade_stats

/v1beta1/search_executions

/v1beta1/search_orders

/v1beta1/search_trades