The Hyperliquid API requires that price (p) and size (s) fields do not contain trailing zeros (e.g., 12345.0 must be 12345).
This SDK automatically handles this requirement for you. When using methods like placeOrder, modifyOrder, or batchModifyOrders, the SDK will strip trailing zeros from numeric or string values. You can safely pass values as strings or numbers.
// Both of these will work correctly as the SDK strips trailing zeros
await sdk.exchange.placeOrder({
coin: 'BTC-PERP',
is_buy: true,
sz: '1.0000', // Becomes "1"
limit_px: '50000.00', // Becomes "50000"
reduce_only: false,
order_type: { limit: { tif: 'Gtc' } },
});
await sdk.exchange.placeOrder({
coin: 'BTC-PERP',
is_buy: true,
sz: 1,
limit_px: 50000,
reduce_only: false,
order_type: { limit: { tif: 'Gtc' } },
});