预估最大购买数量
该接口用于港美股,窝轮,期权的预估最大购买数量。
SDK Links
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 | 股票代码,使用 ticker.region 格式,例如:AAPL.US |
| order_type | string | YES | 订单类型 |
| price | string | NO | 预估下单价格,例如:388.5 |
| side | string | YES | 买卖方向 可选值: Buy - 买入Sell - 卖出 卖出只支持美股卖空查询 |
| currency | string | NO | 结算货币 |
| order_id | string | NO | 订单 ID,获取改单预估最大购买数量时必填 |
Request Example
python
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
json
{
"code": 0,
"message": "success",
"data": {
"cash_max_qty": "100",
"margin_max_qty": "100"
}
}Response Status
| Status | Description | Schema |
|---|---|---|
| 200 | 获取预估最大购买数量 | estimate_available_buy_limit_rsp |
| 400 | 查询失败,请求参数错误。 | None |
Schemas
estimate_available_buy_limit_rsp
预估最大购买数量
| Name | Type | Required | Description |
|---|---|---|---|
| cash_max_qty | string | true | 现金可买数量,默认为空字符串 |
| margin_max_qty | string | true | 融资可买数量,默认为空字符串 |