Order Operations
Place Order
Purpose
Submits an order to the configured trading account.
Signature
func (c *TradeClient) PlaceOrder(order model.OrderRequest) (*model.PlaceOrderResult, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.OrderRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
Account | string | No | Replaced with the client account | Trading account ID |
ID | int64 | No | Omitted when zero | Not used by placement; PlaceOrder does not overwrite it |
OrderId | int64 | No | Omitted when zero | Account-level order ID |
Action | string | Yes | Omitted if empty | Allowed values: BUY, SELL |
OrderType | string | Yes | Omitted if empty | Allowed values: MKT, LMT, STP, STP_LMT, TRAIL, AM, AL, TWAP, VWAP, OCA, ICEBERG |
TotalQuantity | int64 | Conditional | Omitted when zero | Required for quantity-based orders; amount-based orders use Amount |
LimitPrice | float64 | Conditional | Omitted when zero | Required for limit-price order types |
AuxPrice | float64 | Conditional | Omitted when zero | Auxiliary price for stop order types |
TrailingPercent | float64 | No | Omitted when zero | Trailing-stop percentage |
TimeInForce | string | No | Omitted if empty | Allowed values: DAY, GTC, OPG |
OutsideRth | bool | No | Omitted when false | Whether to allow execution outside regular trading hours |
OrderLegs | []OrderLegRequest | No | Omitted if empty | Attached profit-taker or stop-loss orders |
AlgoParams | *AlgoParamsRequest | No | Omitted when nil | Algorithm-order parameters |
Symbol | string | Conditional | Omitted if empty | Required for ordinary orders; multi-leg orders identify each leg through ContractLegs |
SecType | string | Yes | Omitted if empty | Allowed values: STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Market | string | No | Omitted if empty | Allowed values: ALL, US, HK, CN, SG |
Currency | string | No | Omitted if empty | Allowed values: ALL, USD, HKD, CNH, SGD |
Expiry | string | No | Omitted if empty | Option or futures expiry |
Strike | string | No | Omitted if empty | Option strike price |
Right | string | No | Omitted if empty | Allowed values: PUT, CALL (option side); br, nr when used as quote adjustment |
Identifier | string | No | Omitted if empty | Contract identifier |
Remark | string | No | Omitted if empty | Order remark |
UserMark | string | No | Omitted if empty | User mark |
SecretKey | string | No | Uses the client configuration when empty | Institutional-account authentication key |
DisplaySize | int64 | No | Omitted when zero | Iceberg display size |
MinDisplaySize | int64 | No | Omitted if empty | Defaults to DisplaySize for iceberg orders |
CheckIntervals | int64 | No | Omitted if empty | Defaults to 30 seconds for iceberg orders |
PriceType | string | No | Omitted if empty | Allowed: LIMIT_PRICE, ASK_PRICE, BID_PRICE, LATEST_PRICE; iceberg default is LIMIT_PRICE |
StartTime | int64 | No | Omitted when zero | Iceberg effective start time in milliseconds |
EndTime | int64 | No | Omitted when zero | Iceberg effective end time in milliseconds |
ExpireTime | int64 | No | Omitted when zero | GTD expiry time in milliseconds |
AfterHoursPrice | float64 | No | Omitted when zero | After-hours order price |
BatchNo | int64 | No | Omitted when zero | Batch number |
SegType | string | No | Omitted if empty | Funding segment type |
Amount | float64 | No | Omitted when zero | Order amount for amount-based orders |
IsQuantityByAmount | *bool | No | Omitted when nil | Deprecated; new code sets Amount directly |
AllocAccounts | []string | No | Omitted if empty | Institutional account allocation list |
AllocShares | []float64 | No | Omitted if empty | Allocation shares corresponding by index to AllocAccounts |
Source | string | No | Omitted if empty | Order source |
Channel | string | No | Omitted if empty | Order channel |
VirtualOrderType | string | No | Omitted if empty | Virtual order type |
VirtualId | string | No | Omitted if empty | Virtual order ID |
ProfitTakerOrderId | int64 | No | Omitted when zero | Profit-taker order ID |
StopLossOrderId | int64 | No | Omitted when zero | Stop-loss order ID |
LocalNo | string | No | Omitted if empty | Local reference number |
OcaOrders | []*OrderRequest | No | Omitted if empty | OCA order group |
ContractLegs | []ContractLegRequest | No | Omitted if empty | Multi-leg option legs |
ComboType | string | No | Omitted if empty | Combo type |
OrderLegRequest field | Type | Description |
|---|---|---|
LegType | string | Attached-order type (PROFIT/LOSS) |
Price | float64 | Attached-order price |
TimeInForce | string | Time in force |
Quantity | int64 | Quantity |
AlgoParamsRequest field | Type | Description |
|---|---|---|
AlgoStrategy | string | Algorithm strategy (TWAP/VWAP) |
StartTime | string | Start time |
EndTime | string | End time |
ParticipationRate | float64 | Participation rate |
ContractLegRequest field | Type | Description |
|---|---|---|
Symbol | string | Instrument symbol |
SecType | string | Security type |
Expiry | string | Expiry date |
Strike | string | Strike price |
Right | string | Option side |
Action | string | Trade direction |
Ratio | *int | Nullable leg ratio |
Returns
(*model.PlaceOrderResult, error). Key fields from model.PlaceOrderResult:
| Field | Type | Description |
|---|---|---|
| ID | int64 | Order ID |
| OrderID | int64 | Order number |
| SubIDs | []int64 | Sub-order ID list |
| Orders | []Order | Order list |
Order field in Orders | Type | Description |
|---|---|---|
| Account | string | Account ID |
| ID | int64 | Global order ID |
| OrderId | int64 | Account-level order number |
| Action | string | Trade direction |
| OrderType | string | Order type |
| TotalQuantity | int64 | Order quantity |
| LimitPrice | float64 | Limit price |
| AuxPrice | float64 | Auxiliary price |
| TrailingPercent | float64 | Trailing-stop percentage |
| Status | string | Order status |
| FilledQuantity | int64 | Filled quantity |
| AvgFillPrice | float64 | Average fill price |
| TimeInForce | string | Time in force |
| OutsideRth | bool | Whether execution outside regular hours is allowed |
| OrderLegs | []OrderLeg | Attached orders |
| AlgoParams | *AlgoParams | Algorithm parameters |
| Symbol | string | Instrument symbol |
| SecType | string | Security type |
| Market | string | Market |
| Currency | string | Currency |
| Expiry | string | Expiry date |
| Strike | string | Strike price |
| Right | string | Option side |
| Identifier | string | Contract identifier |
| Name | string | Contract name |
| Commission | float64 | Commission |
| RealizedPnl | float64 | Realized P&L |
| OpenTime | int64 | Open time in milliseconds |
| UpdateTime | int64 | Update time in milliseconds |
| LatestTime | int64 | Latest time in milliseconds |
| Remark | string | Remark |
| Source | string | Order source |
| UserMark | string | User mark |
| ExternalId | string | External ID |
| TotalQuantityScale | int | Order quantity scale |
| FilledQuantityScale | int | Filled quantity scale |
| FilledCashAmount | float64 | Filled cash amount |
| Gst | float64 | GST |
| Liquidation | bool | Whether this is a liquidation order |
| AttrDesc | string | Attribute description |
| AttrList | []string | Attribute list |
| AlgoStrategy | string | Algorithm strategy |
| Discount | float64 | Discount |
| ReplaceStatus | string | Replacement status |
| CancelStatus | string | Cancellation status |
| CanModify | bool | Whether the order can be modified |
| CanCancel | bool | Whether the order can be cancelled |
| IsOpen | bool | Whether the order is open |
| OrderDiscount | float64 | Order discount |
| TradingSessionType | string | Trading session type |
| LatestPrice | float64 | Latest price |
| DisplaySize | int64 | Iceberg display size |
| MinDisplaySize | int64 | Iceberg minimum display size |
| CheckIntervals | int64 | Iceberg price-check interval in seconds |
| PriceType | string | Iceberg price type |
| StartTime | int64 | Effective start time in milliseconds |
| EndTime | int64 | Effective end time in milliseconds |
OrderLeg field in OrderLegs | Type | Description |
|---|---|---|
| LegType | string | Attached-order type |
| Price | float64 | Price |
| TimeInForce | string | Time in force |
| Quantity | int64 | Quantity |
AlgoParams field | Type | Description |
|---|---|---|
| AlgoStrategy | string | Algorithm strategy |
| StartTime | string | Start time |
| EndTime | string | End time |
| ParticipationRate | float64 | Participation rate |
The returned order ID confirms only that the placement request was submitted. Continue querying the order to determine its final status.
Invocation example
result, err := tc.PlaceOrder(model.OrderRequest{
Account: "U123456",
Symbol: "AAPL",
SecType: "STK",
Action: "BUY",
OrderType: "LMT",
TotalQuantity: 1,
LimitPrice: 310.00,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"id": 123456789,
"order_id": 100001,
"subIds": [123456790],
"orders": [
{
"id": 123456789,
"orderId": 100001,
"account": "U123456",
"symbol": "AAPL",
"secType": "STK",
"action": "BUY",
"orderType": "LMT",
"limitPrice": 310.00,
"totalQuantity": 1,
"filledQuantity": 0,
"status": "Initial"
}
]
}Rate limit
The base rate limit is 120 requests/min.
Preview Order
Purpose
Validates an order and estimates commission and margin without placing it.
Signature
func (c *TradeClient) PreviewOrder(order model.OrderRequest) (*model.PreviewResult, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.OrderRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
Account | string | No | Replaced with the client account | Trading account ID |
ID | int64 | No | Omitted when zero | Not used by preview |
OrderId | int64 | No | Omitted when zero | Account-level order ID |
Action | string | Yes | Omitted if empty | Allowed values: BUY, SELL |
OrderType | string | Yes | Omitted if empty | Allowed values: MKT, LMT, STP, STP_LMT, TRAIL, AM, AL, TWAP, VWAP, OCA, ICEBERG |
TotalQuantity | int64 | Conditional | Omitted when zero | Required for quantity-based previews; amount-based previews use Amount |
LimitPrice | float64 | Conditional | Omitted when zero | Required for limit-price order types |
AuxPrice | float64 | Conditional | Omitted when zero | Auxiliary price for stop order types |
TrailingPercent | float64 | No | Omitted when zero | Trailing-stop percentage |
TimeInForce | string | No | Omitted if empty | Allowed values: DAY, GTC, OPG |
OutsideRth | bool | No | Omitted when false | Whether to allow execution outside regular trading hours |
OrderLegs | []OrderLegRequest | No | Omitted if empty | Attached profit-taker or stop-loss orders |
AlgoParams | *AlgoParamsRequest | No | Omitted when nil | Algorithm-order parameters |
Symbol | string | Conditional | Omitted if empty | Required for ordinary orders; multi-leg orders identify each leg through ContractLegs |
SecType | string | Yes | Omitted if empty | Allowed values: STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Market | string | No | Omitted if empty | Allowed values: ALL, US, HK, CN, SG |
Currency | string | No | Omitted if empty | Allowed values: ALL, USD, HKD, CNH, SGD |
Expiry | string | No | Omitted if empty | Option or futures expiry |
Strike | string | No | Omitted if empty | Option strike price |
Right | string | No | Omitted if empty | Allowed values: PUT, CALL (option side); br, nr when used as quote adjustment |
Identifier | string | No | Omitted if empty | Contract identifier |
Remark | string | No | Omitted if empty | Order remark |
UserMark | string | No | Omitted if empty | User mark |
SecretKey | string | No | Uses the client configuration when empty | Institutional-account authentication key |
DisplaySize | int64 | No | Omitted when zero | Iceberg display size |
MinDisplaySize | int64 | No | Omitted if empty | Defaults to DisplaySize for iceberg orders |
CheckIntervals | int64 | No | Omitted if empty | Defaults to 30 seconds for iceberg orders |
PriceType | string | No | Omitted if empty | Allowed: LIMIT_PRICE, ASK_PRICE, BID_PRICE, LATEST_PRICE; iceberg default is LIMIT_PRICE |
StartTime | int64 | No | Omitted when zero | Iceberg effective start time in milliseconds |
EndTime | int64 | No | Omitted when zero | Iceberg effective end time in milliseconds |
ExpireTime | int64 | No | Omitted when zero | GTD expiry time in milliseconds |
AfterHoursPrice | float64 | No | Omitted when zero | After-hours order price |
BatchNo | int64 | No | Omitted when zero | Batch number |
SegType | string | No | Omitted if empty | Funding segment type |
Amount | float64 | No | Omitted when zero | Order amount for amount-based orders |
IsQuantityByAmount | *bool | No | Omitted when nil | Deprecated; new code sets Amount directly |
AllocAccounts | []string | No | Omitted if empty | Institutional account allocation list |
AllocShares | []float64 | No | Omitted if empty | Allocation shares corresponding by index to AllocAccounts |
Source | string | No | Omitted if empty | Order source |
Channel | string | No | Omitted if empty | Order channel |
VirtualOrderType | string | No | Omitted if empty | Virtual order type |
VirtualId | string | No | Omitted if empty | Virtual order ID |
ProfitTakerOrderId | int64 | No | Omitted when zero | Profit-taker order ID |
StopLossOrderId | int64 | No | Omitted when zero | Stop-loss order ID |
LocalNo | string | No | Omitted if empty | Local reference number |
OcaOrders | []*OrderRequest | No | Omitted if empty | OCA order group |
ContractLegs | []ContractLegRequest | No | Omitted if empty | Multi-leg option legs |
ComboType | string | No | Omitted if empty | Combo type |
OrderLegRequest fields
| Field | Type | Required | Default/omission | Description |
|---|---|---|---|---|
LegType | string | No | Omitted when empty | Attached-order type |
Price | float64 | No | Omitted when zero | Attached-order price |
TimeInForce | string | No | Omitted when empty | Time in force |
Quantity | int64 | No | Omitted when zero | Quantity |
AlgoParamsRequest fields
| Field | Type | Required | Default/omission | Description |
|---|---|---|---|---|
AlgoStrategy | string | No | Omitted when empty | Algorithm strategy |
StartTime | string | No | Omitted when empty | Algorithm-order start time |
EndTime | string | No | Omitted when empty | Algorithm-order end time |
ParticipationRate | float64 | No | Omitted when zero | Participation rate |
ContractLegRequest fields
| Field | Type | Required | Default/omission | Description |
|---|---|---|---|---|
Symbol | string | No | Omitted when empty | Instrument symbol |
SecType | string | No | Omitted when empty | Security type |
Expiry | string | No | Omitted when empty | Expiry date |
Strike | string | No | Omitted when empty | Strike price |
Right | string | No | Omitted when empty | Option side |
Action | string | No | Omitted when empty | Trade direction |
Ratio | *int | No | Omitted when nil | Multi-leg ratio |
Each OcaOrders entry uses the OrderRequest model above; the same fields are not repeated.
Returns
(*model.PreviewResult, error). Key fields from model.PreviewResult:
| Field | Type | Description |
|---|---|---|
| Account | string | Account ID |
| IsPass | bool | Whether risk check passed |
| Commission | float64 | Estimated commission |
| CommissionCurrency | string | Commission currency |
| MarginCurrency | string | Margin currency |
| InitMargin | float64 | Initial margin (after order) |
| InitMarginBefore | float64 | Initial margin (before order) |
| MaintMargin | float64 | Maintenance margin (after order) |
| MaintMarginBefore | float64 | Maintenance margin (before order) |
| EquityWithLoan | float64 | Equity with loan (after order) |
| EquityWithLoanBefore | float64 | Equity with loan (before order) |
| AvailableEE | float64 | Available excess equity after the hypothetical fill, in MarginCurrency |
| ExcessLiquidity | float64 | Excess liquidity after the hypothetical fill, in MarginCurrency |
| OvernightLiquidation | float64 | Overnight excess liquidity after the hypothetical fill, in MarginCurrency |
| Gst | float64 | GST |
| Message | string | Preview-result message |
These fields may be absent for account types or scenarios where they do not apply. The Go model uses non-pointer float64 fields, so a missing value and an explicit zero both appear as 0.
Invocation example
result, err := tc.PreviewOrder(model.OrderRequest{
Account: "U123456",
Symbol: "AAPL",
SecType: "STK",
Action: "BUY",
OrderType: "LMT",
TotalQuantity: 1,
LimitPrice: 310.00,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"account": "U123456",
"isPass": true,
"commission": 0.99,
"commissionCurrency": "USD",
"marginCurrency": "USD",
"initMargin": 31000.00,
"initMarginBefore": 30000.00,
"maintMargin": 28000.00,
"maintMarginBefore": 27000.00,
"equityWithLoan": 100000.00,
"equityWithLoanBefore": 100500.00,
"availableEE": 69000.00,
"excessLiquidity": 72000.00,
"overnightLiquidation": 71000.00,
"gst": 0.00,
"message": ""
}Modify Order
Purpose
Changes an existing order identified by its global ID.
Signature
func (c *TradeClient) ModifyOrder(id int64, order model.OrderRequest) (*model.OrderIDResult, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.OrderRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
Account | string | No | Replaced with the client account | Trading account ID |
ID | int64 | No | Set from the id argument | Do not set it again in order; the struct field is overwritten |
OrderId | int64 | No | Omitted when zero | Account-level order ID |
Action | string | No | Omitted if empty | Allowed values: BUY, SELL |
OrderType | string | No | Omitted if empty | Allowed values: MKT, LMT, STP, STP_LMT, TRAIL, AM, AL, TWAP, VWAP, OCA, ICEBERG |
TotalQuantity | int64 | No | Omitted when zero | Replacement total quantity |
LimitPrice | float64 | No | Omitted when zero | Replacement limit price |
AuxPrice | float64 | No | Omitted when zero | Replacement auxiliary or stop price |
TrailingPercent | float64 | No | Omitted when zero | Replacement trailing-stop percentage |
TimeInForce | string | No | Omitted if empty | Allowed values: DAY, GTC, OPG |
OutsideRth | bool | No | Omitted when false | Whether to allow execution outside regular trading hours |
OrderLegs | []OrderLegRequest | No | Omitted if empty | Attached profit-taker or stop-loss orders |
AlgoParams | *AlgoParamsRequest | No | Omitted when nil | Algorithm-order parameters |
Symbol | string | No | Omitted if empty | Instrument symbol |
SecType | string | No | Omitted if empty | Allowed values: ALL, STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Market | string | No | Omitted if empty | Allowed values: ALL, US, HK, CN, SG |
Currency | string | No | Omitted if empty | Allowed values: ALL, USD, HKD, CNH, SGD |
Expiry | string | No | Omitted if empty | Option or futures expiry |
Strike | string | No | Omitted if empty | Option strike price |
Right | string | No | Omitted if empty | Allowed values: PUT, CALL (option side); br, nr when used as quote adjustment |
Identifier | string | No | Omitted if empty | Contract identifier |
Remark | string | No | Omitted if empty | Order remark |
UserMark | string | No | Omitted if empty | User mark |
SecretKey | string | No | Uses the client configuration when empty | Institutional-account authentication key |
DisplaySize | int64 | No | Omitted when zero | Iceberg display size |
MinDisplaySize | int64 | No | Omitted if empty | Defaults to DisplaySize for iceberg orders |
CheckIntervals | int64 | No | Omitted if empty | Defaults to 30 seconds for iceberg orders |
PriceType | string | No | Omitted if empty | Allowed: LIMIT_PRICE, ASK_PRICE, BID_PRICE, LATEST_PRICE; iceberg default is LIMIT_PRICE |
StartTime | int64 | No | Omitted when zero | Iceberg effective start time in milliseconds |
EndTime | int64 | No | Omitted when zero | Iceberg effective end time in milliseconds |
ExpireTime | int64 | No | Omitted when zero | GTD expiry time in milliseconds |
AfterHoursPrice | float64 | No | Omitted when zero | After-hours order price |
BatchNo | int64 | No | Omitted when zero | Batch number |
SegType | string | No | Omitted if empty | Funding segment type |
Amount | float64 | No | Omitted when zero | Order amount for amount-based orders |
IsQuantityByAmount | *bool | No | Omitted when nil | Deprecated; new code sets Amount directly |
AllocAccounts | []string | No | Omitted if empty | Institutional account allocation list |
AllocShares | []float64 | No | Omitted if empty | Allocation shares corresponding by index to AllocAccounts |
Source | string | No | Omitted if empty | Order source |
Channel | string | No | Omitted if empty | Order channel |
VirtualOrderType | string | No | Omitted if empty | Virtual order type |
VirtualId | string | No | Omitted if empty | Virtual order ID |
ProfitTakerOrderId | int64 | No | Omitted when zero | Profit-taker order ID |
StopLossOrderId | int64 | No | Omitted when zero | Stop-loss order ID |
LocalNo | string | No | Omitted if empty | Local reference number |
OcaOrders | []*OrderRequest | No | Omitted if empty | OCA order group |
ContractLegs | []ContractLegRequest | No | Omitted if empty | Multi-leg option legs |
ComboType | string | No | Omitted if empty | Combo type |
id | int64 | Yes | None; zero values are serialized | Id value |
OrderLegRequest fields
| Field | Type | Required | Default/omission | Description |
|---|---|---|---|---|
LegType | string | No | Omitted when empty | Attached-order type |
Price | float64 | No | Omitted when zero | Attached-order price |
TimeInForce | string | No | Omitted when empty | Time in force |
Quantity | int64 | No | Omitted when zero | Quantity |
AlgoParamsRequest fields
| Field | Type | Required | Default/omission | Description |
|---|---|---|---|---|
AlgoStrategy | string | No | Omitted when empty | Algorithm strategy |
StartTime | string | No | Omitted when empty | Algorithm-order start time |
EndTime | string | No | Omitted when empty | Algorithm-order end time |
ParticipationRate | float64 | No | Omitted when zero | Participation rate |
ContractLegRequest fields
| Field | Type | Required | Default/omission | Description |
|---|---|---|---|---|
Symbol | string | No | Omitted when empty | Instrument symbol |
SecType | string | No | Omitted when empty | Security type |
Expiry | string | No | Omitted when empty | Expiry date |
Strike | string | No | Omitted when empty | Strike price |
Right | string | No | Omitted when empty | Option side |
Action | string | No | Omitted when empty | Trade direction |
Ratio | *int | No | Omitted when nil | Multi-leg ratio |
Each OcaOrders entry uses the OrderRequest model above; the same fields are not repeated.
Returns
(*model.OrderIDResult, error). Key fields from model.OrderIDResult:
| Field | Type | Description |
|---|---|---|
| ID | int64 | Order ID |
The returned order ID confirms only that the modification request was submitted, not that the replacement values are effective. Continue querying until the new values appear or the order reaches a final status.
Invocation example
result, err := tc.ModifyOrder(123456789, model.OrderRequest{
Account: "U123456",
ID: 1,
Action: "BUY",
OrderType: "LMT",
TotalQuantity: 1,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"id": 123456789
}Rate limit
The base rate limit is 120 requests/min.
Cancel Order
Purpose
Cancels an existing order identified by its global ID.
Signature
func (c *TradeClient) CancelOrder(id int64) (*model.OrderIDResult, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
id | int64 | Yes | None | Global order ID |
Returns
(*model.OrderIDResult, error). Key fields from model.OrderIDResult:
| Field | Type | Description |
|---|---|---|
| ID | int64 | Order ID |
The returned order ID confirms only that the cancellation request was submitted. Continue querying until Status is Cancelled or the order reaches another final state, such as a fill that completed first; request acceptance is not cancellation completion.
Invocation example
result, err := tc.CancelOrder(123456789)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"id": 123456789
}Rate limit
The base rate limit is 120 requests/min.
Estimate Tradable Quantity
Purpose
Estimates cash-buy, margin-buy, short-sell, and position-sell quantities. The client fills an empty account field from the client default.
Signature
func (c *TradeClient) EstimateTradableQuantity(req model.EstimateTradableQuantityRequest) (*model.EstimateTradableQuantity, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.EstimateTradableQuantityRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
Account | string | No | Uses the client default when empty | Trading account ID |
SecretKey | string | No | Uses the client configuration when empty | Institutional-account authentication key |
Symbol | string | Yes | Omitted if empty | Instrument symbol |
SecType | string | Yes | Omitted if empty | Security type; allowed values: STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Action | string | Yes | Omitted if empty | Trade direction; allowed values: BUY, SELL |
OrderType | string | No | Omitted if empty | Allowed values: MKT, LMT, STP, STP_LMT, TRAIL, AM, AL, TWAP, VWAP, OCA, ICEBERG |
LimitPrice | float64 | Conditional | Omitted when zero | Price for limit-price order types |
StopPrice | float64 | Conditional | Omitted when zero | Trigger price for stop order types |
Expiry | string | Conditional | Omitted if empty | Option or futures expiry |
Strike | string | Conditional | Omitted if empty | Option strike price |
Right | string | Conditional | Omitted if empty | Option side; allowed values: PUT, CALL |
SegType | string | No | Omitted if empty | Funding segment; allowed values: ALL, SEC, FUT, FUND |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
(*model.EstimateTradableQuantity, error). Key fields from model.EstimateTradableQuantity:
| Field | Type | Description |
|---|---|---|
| TradableQuantity | float64 | Tradable quantity |
| MaxCashBuyQuantity | float64 | Max cash buy quantity |
| MaxMarginBuyQuantity | float64 | Max margin buy quantity |
| MaxShortSellQuantity | float64 | Max short sell quantity |
| MaxPositionSellQuantity | float64 | Max position sell quantity |
| CashBuyingPower | float64 | Cash buying power |
| Currency | string | Currency |
Invocation example
result, err := tc.EstimateTradableQuantity(model.EstimateTradableQuantityRequest{
Account: "U123456",
Symbol: "AAPL",
SecType: "STK",
Action: "BUY",
OrderType: "MKT",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"tradableQuantity": 320,
"maxCashBuyQuantity": 100,
"maxMarginBuyQuantity": 320,
"maxShortSellQuantity": 0,
"maxPositionSellQuantity": 0,
"cashBuyingPower": 31000.00,
"currency": "USD"
}Rate limit
The base rate limit is 60 requests/min.
Updated about 1 month ago
