Skip to main content

Estimate Maximum Purchase Quantity

This API is used for estimating the maximum purchase quantity for Hong Kong and US stocks, warrants, and options.

Request

HTTP MethodGET
HTTP URL/v1/trade/estimate/buy_limit

Parameters

Content-Type: application/json; charset=utf-8

NameTypeRequiredDescription
symbolstringYESStock code, using ticker.region format, for example: AAPL.US
order_typestringYESOrder Type
pricestringNOEstimated order price, for example: 388.5
sidestringYESOrder side

Enum Value
Buy - Buy
Sell - Sell (Short selling is only supported for US stocks)
currencystringNOSettlement currency
order_idstringNOOrder ID, required when estimating the maximum purchase quantity for a modified order

Request Example

from longport.openapi import TradeContext, Config, OrderStatus, OrderType, OrderSide

config = Config.from_env()
ctx = TradeContext(config)

resp = ctx.estimate_max_purchase_quantity(
symbol = "700.HK",
order_type = OrderType.LO,
side = OrderSide.Buy,
)
print(resp)

Response

Response Headers

  • Content-Type: application/json

Response Example

{
"code": 0,
"message": "success",
"data": {
"cash_max_qty": "100",
"margin_max_qty": "100"
}
}

Response Status

StatusDescriptionSchema
200Estimate Maximum Purchase Quantity Successestimate_available_buy_limit_rsp
400The query failed with an error in the request parameter.None

Schemas

estimate_available_buy_limit_rsp

Estimated Maximum Purchase Quantity

NameTypeRequiredDescription
cash_max_qtystringtrueCash available quantity, default value is empty string.
margin_max_qtystringtrueMargin available quantity, default value is empty string.