Query Max Tradable Quantity
GET/api/v1.0/accounts/{acc_id}/acctradinginfoQuery the maximum quantity that can be bought or sold under a specific trading account, and you can also query the maximum changeable quantity of a specific order.
When to use
- Before place: pass the same
codeandorder_typeyou will use on place; for non-market orders, also passprice. Usemax_cash_buy/max_cash_and_margin_buy/max_position_sell(and related fields) to cap order size. - Before modify: pass the original
order_idto get the max replaceable quantity. Wait briefly after a successful place (see theorder_idparameter note below). - Japan accounts:
sub_acc_idis required and must match place order. - Close by position: with
position_id,max_position_sell/max_buy_backare computed for that position; without it, they aggregate by symbol. - This API only estimates size — it does not place an order. Actual fills still depend on place and later order state.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
acc_id | string | Yes | Trading business account ID. |
Request Parameters
| Parameter | Type | Position | Required | Description |
|---|---|---|---|---|
code | string | Query | Yes | Symbol code. Format: market.symbol, e.g. US.AAPL |
price | string | Query | No | Price of a non-market order. For futures accounts, accurate to 9 decimal places. For forex accounts, accurate to 5 decimal places. For securities accounts, accurate to 4 decimal places. Excess will be rounded. |
order_type | string | Query | Yes | Order type. See Naming Dictionary |
session | trading_session | Query | No | Trading session (US stocks only). |
order_id | string | Query | No | Order ID. Leave empty to query max size for a new order; when set, returns the max replaceable quantity for that order. After a successful place, wait briefly before querying (0.5 seconds or more is commonly recommended). |
position_id | string | Query | No | Optional. Controls close-quantity granularity. When provided, returns the max closeable quantity for the specified position (max_position_sell / max_buy_back computed at position level); must be a valid position ID. When omitted, returns the quantity aggregated by symbol. |
sub_acc_id | string | Query | Conditional | Sub-account id. Pass this value as sub_acc_id when placing an order. Required for JP accounts. |
Response Parameters
| Field | Type | Description |
|---|---|---|
max_cash_buy | string | Buy on cash |
max_cash_and_margin_buy | string | Buy on margin |
max_position_sell | string | Sell on position |
max_sell_short | string | Short sell |
max_buy_back | string | Short positions |
long_required_im | string | Initial margin change when buying one contract of an asset |
short_required_im | string | Initial margin change when selling one contract of an asset |
Response Example
json
{
"s": "ok",
"d": {
"max_cash_buy": "3700",
"max_cash_and_margin_buy": "3900",
"max_position_sell": "2100",
"max_sell_short": "4300",
"max_buy_back": "0",
"long_required_im": "0",
"short_required_im": "0"
}
}Error Response:
json
{
"s": "error",
"errcode": 485210001,
"errmsg": "invalid order_type"
}