Skip to content
Tradable Quantity and Margin

Estimate Maximum Stock Buy or Sell Quantity

On the stock, ETF, or warrant order page, after the Client enters a price or switches the side or order type, estimates the maximum cash and margin quantities by limit price, order type, and side, to show the maximum buy quantity or short-sell quantity and validate the order quantity. Pick values by order type: for market-type orders use market_* first, for odd-lot orders use odd_* first, and for other orders use limit_* first; if the field is empty, fall back to cash_max_qty / margin_max_qty. Do not call this endpoint when the price is 0. When amending an order, pass the original order ID; omit it when the order being amended is an untriggered conditional order. This endpoint is also used by the day-trade margin order panel (estimated separately for buy and sell). For option orders, use Estimate Option Open Quantity.

When you call this endpoint through WhaleCore requestService(), set requiresTradeToken to true.

WhaleCore's orderService() wraps this endpoint as the typed method getEstimateBuyLimit. If you use WhaleCore, prefer that method.

GEThttps://api.lbkrs.com/v1/orders/estimate_buy_limit

Parameters

counter_idstringqueryRequired

Security ID (counter_id), such as ST/US/AAPL or ST/HK/700

pricestringqueryRequired

Order price in the trading currency. For a market order, pass the latest price

submit_pricestringqueryRequired

Order price. Pass the same value as price

marketstringqueryRequired

Market code of the security, such as US or HK

settlement_currencystringqueryRequired

Settlement currency, such as USD or HKD. Use an item of channel_infos.settlement_currency returned by Get Order Configuration

currencystringqueryRequired

Trading currency. Pass the same value as settlement_currency

order_typestringqueryRequired

Order type code, such as LO, MO, or ELO. Use a key of channel_infos.order_type_config returned by Get Order Configuration

actionintegerqueryRequired

Order side:

  • 1 - Buy
  • 2 - Sell

12

fractional_sharesbooleanquery

Whether to estimate for US fractional shares. Pass it when the account supports US fractional shares

order_idstringquery

Original order ID when amending an order. Omit it for a new order or when the order being amended is an untriggered conditional order

order_id_strstringquery

String form of the original order ID. When amending, pass the same value as order_id

Responses

HTTP 200The request succeeded. The response body contains the result of the “Estimate Maximum Stock Buy or Sell Quantity” operation.
Standard response envelopecodemessagedata
dataobjectdata structure
cash_max_qtystring

Maximum quantity with cash (generic value)

margin_max_qtystring

Maximum quantity including margin financing (generic value)

limit_cash_max_qtystring

Maximum cash quantity for limit-type orders

limit_margin_max_qtystring

Maximum quantity including margin for limit-type orders

market_cash_max_qtystring

Maximum cash quantity for market-type orders

market_margin_max_qtystring

Maximum quantity including margin for market-type orders

odd_cash_max_qtystring

Maximum cash quantity for odd-lot orders

odd_margin_max_qtystring

Maximum quantity including margin for odd-lot orders

Whale Docs