跳到主要內容

预估最大购买数量

该接口用于港美股,窝轮,期权的预估最大购买数量。

SDK Links

Python
longport.openapi.TradeContext.estimate_max_purchase_quantity
Rust
longport::trade::TradeContext#estimate_max_purchase_quantity
Go
TradeContext.EstimateMaxPurchaseQuantity
Node.js
TradeContext#estimateMaxPurchaseQuantity

Request

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

Parameters

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

NameTypeRequiredDescription
symbolstringYES股票代码,使用 ticker.region 格式,例如:AAPL.US
order_typestringYES订单类型
pricestringNO预估下单价格,例如:388.5
sidestringYES买卖方向

可选值:
Buy - 买入
Sell - 卖出 卖出只支持美股卖空查询
currencystringNO结算货币
order_idstringNO订单 ID,获取改单预估最大购买数量时必填

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
200获取预估最大购买数量estimate_available_buy_limit_rsp
400查询失败,请求参数错误。None

Schemas

estimate_available_buy_limit_rsp

预估最大购买数量

NameTypeRequiredDescription
cash_max_qtystringtrue现金可买数量,默认为空字符串
margin_max_qtystringtrue融资可买数量,默认为空字符串