Estimate Maximum Purchase Quantity
This API is used for estimating the maximum purchase quantity for Hong Kong and US stocks, warrants, and options.
SDK Links
Python |
Rust |
Go |
Node.js |
Request
HTTP Method | GET |
HTTP URL | /v1/trade/estimate/buy_limit |
Parameters
Content-Type: application/json; charset=utf-8
Name | Type | Required | Description |
---|---|---|---|
symbol | string | YES | Stock code, using ticker.region format, for example: AAPL.US |
order_type | string | YES | Order Type |
price | string | NO | Estimated order price, for example: 388.5 |
side | string | YES | Order side Enum Value Buy - BuySell - Sell (Short selling is only supported for US stocks) |
currency | string | NO | Settlement currency |
order_id | string | NO | Order 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
Status | Description | Schema |
---|---|---|
200 | Estimate Maximum Purchase Quantity Success | estimate_available_buy_limit_rsp |
400 | The query failed with an error in the request parameter. | None |
Schemas
estimate_available_buy_limit_rsp
Estimated Maximum Purchase Quantity
Name | Type | Required | Description |
---|---|---|---|
cash_max_qty | string | true | Cash available quantity, default value is empty string. |
margin_max_qty | string | true | Margin available quantity, default value is empty string. |