Skip to content

Estimated Tradable Quantity

This endpoint calculates the maximum quantity of a specific product that can be bought or sold based on the user’s available funds or holdings, using a specified ratio. This is useful for strategy allocation, risk control, or UI hints for user trade input.


HTTP Request

bash
POST /trade/v1/orders/quantity

Request Parameters

NameTypeRequiredDescription
marketENUMYesMarket code (refer to supported market enum values)
symbolSTRINGYesProduct symbol/code
order_sideENUMYesOrder direction: buy or sell (refer to order_side enum definition)
priceDECIMALNoTrade price (required when order_side is buy)
ratioDECIMALYesRatio of funds or position to allocate (less than 1, e.g., 0.5)

Example cURL Request

bash
curl --location --request POST '{$base_url}/trade/v1/orders/quantity' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'X-API-Signature: YOUR_GENERATED_SIGNATURE' \
--header 'X-API-Timestamp: 1746774142003' \
--header 'Content-Type: application/json' \
--data-raw '{
    "market": "hkex",
    "symbol": "00700",
    "order_side": "buy",
    "price": 438.30,
    "ratio": 0.5
}'

Successful Response Format

FieldTypeDescription
qtyDECIMALMaximum quantity that can trade

Successful Response Example

json
{
	"code": 0,
	"data": {
		"qty": 20000
	}
}

Error Response Example

json
{
	"code": 500,
	"message": "Internal Service Error",
	"details": ""
}

For more details on possible error codes and their meanings, please refer to the Error Code Reference.