post
https://api.cert.zerohash.com/orders/v1/insert_order
Recent Requests
Log in to see full request history
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Loading…
Price and Quantity Scaling
The zerohash CLOB uses scaled integers for price and quantity values. Think of this like converting Dollars to Cents so you never have to deal with a decimal point.
How it works
You take your human-readable price or quantity and multiply it by the "Scale" factor found in List Instruments response.
- Price:
int(round(human_readable_price *price_scale)) - Quantity:
int(round(human_readable_price *fractional_qty_scale))
Example of sending a Buy Limit orders;
# Inputs
human_price = 78000.00
human_qty = 0.5
# Scales from BTC instrument object
p_scale = 100
q_scale = 100000000
# Logic: Multiply and round to remove decimal artifacts
scaled_price = str(int(round(human_price * p_scale)))
scaled_qty = str(int(round(human_qty * q_scale)))
payload = {
"side": "SIDE_BUY",
"time_in_force": "TIME_IN_FORCE_DAY",
"type": "ORDER_TYPE_LIMIT",
"order_qty": scaled_qty, # "50000000"
"price": scaled_price, # "7800000"
"clord_id": "ORDER-BTC-001",
"symbol": "BTC/USD"
}# Inputs
human_price = 0.012262
human_qty = 1000.0
# Scales from GALA instrument object
p_scale = 100000
q_scale = 100000000
# Logic: Multiply and round
scaled_price = str(int(round(human_price * p_scale)))
scaled_qty = str(int(round(human_qty * q_scale)))
payload = {
"side": "SIDE_BUY",
"time_in_force": "TIME_IN_FORCE_DAY",
"type": "ORDER_TYPE_LIMIT",
"order_qty": scaled_qty, # "100000000000"
"price": scaled_price, # "1226"
"clord_id": "ORDER-GALA-001",
"symbol": "GALA/USD"
}