跳到主要內容

預估最大購買數量

該接口用於港美股,窩輪,期權的預估最大購買數量。

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融資可買數量,默認為空字符串