股票交易
股票訂單 API 支援在美股、港股和 A 股市場下單、改單和撤單,涵蓋股票和 ETF。統一的訂單介面會根據您指定的 market 參數自動處理不同市場的規則。
期權交易請參閱獨立的期權頁面。各市場支援的訂單類型和功能完整列表,請參閱 Trading API 概覽中的功能矩陣。
訂單生命週期
每個訂單遵循以下生命週期:
- 預覽 — 下單前預估費用和成本
- 下單 — 提交訂單
- 改單 — 修改未成交訂單的價格或數量
- 撤單 — 取消待處理的訂單
- 查詢 — 隨時查看訂單狀態、歷史或詳情
關鍵參數
| 參數 | 必填 | 說明 |
|---|---|---|
account_id | 是 | 交易帳戶標識 |
client_order_id | 是 | 唯一的客戶端訂單 ID(最長 32 字元,每個帳戶內必須唯一) |
combo_type | 是 | NORMAL 表示標準單一訂單 |
symbol | 是 | 交易標的代碼(如 AAPL、00700、600519) |
instrument_type | 是 | EQUITY 表示股票訂單 |
market | 是 | US、HK 或 CN |
order_type | 是 | 訂單類型 — 因市場而異(見下方) |
side | 是 | BUY、SELL 或 SHORT |
quantity | 是 | 股數 |
entrust_type | 是 | QTY(按數量)或 AMOUNT(按金額,僅美股碎股) |
time_in_force | 是 | DAY、GTC 或 GTD(僅美股) |
limit_price | 條件必填 | LIMIT、STOP_LOSS_LIMIT、ENHANCED_LIMIT、AT_AUCTION_LIMIT 時必填 |
stop_price | 條件必填 | STOP_LOSS、STOP_LOSS_LIMIT 時必填 |
support_trading_session | 僅美股 | CORE、ALL、NIGHT 或 ALL_DAY |
no_party_ids | 僅港股 | BCAN 參與者標識,用於監管合規 |
各市場支援的訂單類型
| 市場 | 訂單類型 |
|---|---|
| 美股 | LIMIT、MARKET、STOP_LOSS、STOP_LOSS_LIMIT、MARKET_ON_OPEN、MARKET_ON_CLOSE |
| 港股 | ENHANCED_LIMIT、AT_AUCTION、AT_AUCTION_LIMIT |
| A 股(滬深港通) | LIMIT |
請求範例 — 美股
- 限價單
- 市價單
- 止損單
- 止損限價單
- 開市競價
- 收市競價
- 碎股
- 盤前盤後
以 $180 的限價買入 10 股 AAPL,當日有效,僅限常規交易時段。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "AAPL",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "LIMIT",
"limit_price": "180.00",
"quantity": "10",
"side": "BUY",
"time_in_force": "DAY",
"support_trading_session": "CORE",
"entrust_type": "QTY"
}
]
}
以市價買入 5 股 TSLA,當日有效。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "TSLA",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "MARKET",
"quantity": "5",
"side": "BUY",
"time_in_force": "DAY",
"support_trading_session": "CORE",
"entrust_type": "QTY"
}
]
}
當 NVDA 價格跌至 $100 時賣出 20 股(觸發市價單)。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "NVDA",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "STOP_LOSS",
"stop_price": "100.00",
"quantity": "20",
"side": "SELL",
"time_in_force": "GTC",
"support_trading_session": "CORE",
"entrust_type": "QTY"
}
]
}
當 AMZN 價格跌至 $180(止損價)時觸發,以 $178 的限價賣出 10 股。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "AMZN",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "STOP_LOSS_LIMIT",
"stop_price": "180.00",
"limit_price": "178.00",
"quantity": "10",
"side": "SELL",
"time_in_force": "GTC",
"support_trading_session": "CORE",
"entrust_type": "QTY"
}
]
}
以開盤價買入 50 股 MSFT。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "MSFT",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "MARKET_ON_OPEN",
"quantity": "50",
"side": "BUY",
"time_in_force": "DAY",
"support_trading_session": "CORE",
"entrust_type": "QTY"
}
]
}
以收盤價賣出 30 股 GOOG。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "GOOG",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "MARKET_ON_CLOSE",
"quantity": "30",
"side": "SELL",
"time_in_force": "DAY",
"support_trading_session": "CORE",
"entrust_type": "QTY"
}
]
}
以金額方式買入 $500 的 AAPL(碎股訂單)。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "AAPL",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "MARKET",
"total_cash_amount": "500.00",
"side": "BUY",
"time_in_force": "DAY",
"support_trading_session": "CORE",
"entrust_type": "AMOUNT"
}
]
}
以 $178 的限價買入 10 股 AAPL,包含盤前和盤後交易時段。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "AAPL",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "LIMIT",
"limit_price": "178.00",
"quantity": "10",
"side": "BUY",
"time_in_force": "DAY",
"support_trading_session": "ALL",
"entrust_type": "QTY"
}
]
}
請求範例 — 港股
港股每手股數
港股以「手」為單位交易。每手股數因股票而異(例如:騰訊 00700 = 100 股、匯豐 00005 = 400 股、友邦 01299 = 200 股)。下單數量必須為每手股數的整數倍。可透過標的資料 API 查詢每手股數。
- 增強限價盤
- 競價盤
- 競價限價盤
以增強限價盤買入 100 股騰訊(00700)。港股訂單需要提供 BCAN 參與者標識。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "00700",
"instrument_type": "EQUITY",
"market": "HK",
"order_type": "ENHANCED_LIMIT",
"limit_price": "380.00",
"quantity": "100",
"side": "BUY",
"time_in_force": "DAY",
"entrust_type": "QTY",
"no_party_ids": [
{
"party_id": "ABC123.2568",
"party_id_source": "D",
"party_role": "3"
}
]
}
]
}
以競價盤買入 200 股匯豐(00005)。競價盤不需要指定限價。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "00005",
"instrument_type": "EQUITY",
"market": "HK",
"order_type": "AT_AUCTION",
"quantity": "200",
"side": "BUY",
"time_in_force": "DAY",
"entrust_type": "QTY",
"no_party_ids": [
{
"party_id": "ABC123.2568",
"party_id_source": "D",
"party_role": "3"
}
]
}
]
}
以競價限價盤買入 500 股友邦(01299),限價 HK$60.00。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "01299",
"instrument_type": "EQUITY",
"market": "HK",
"order_type": "AT_AUCTION_LIMIT",
"limit_price": "60.00",
"quantity": "500",
"side": "BUY",
"time_in_force": "DAY",
"entrust_type": "QTY",
"no_party_ids": [
{
"party_id": "ABC123.2568",
"party_id_source": "D",
"party_role": "3"
}
]
}
]
}
請求範例 — A 股(滬深港通)
A 股通過滬深港通交易,僅支援 LIMIT 限價單。
{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<unique_id>",
"combo_type": "NORMAL",
"symbol": "600519",
"instrument_type": "EQUITY",
"market": "CN",
"order_type": "LIMIT",
"limit_price": "1800.00",
"quantity": "100",
"side": "BUY",
"time_in_force": "DAY",
"entrust_type": "QTY"
}
]
}
資訊
A 股交易功能預設為關閉狀態。如需開通,請聯繫 Webull 客服。
A 股漲跌幅限制
A 股價格受每日漲跌幅限制(一般為 ±10%,創業板 / 科創板為 ±20%)。limit_price 超出允許範圍的訂單將被拒絕。下單前請確認當前允許的價格範圍。
下一步
- 期權 — 期權交易
- Trading API 概覽 — 各市場完整功能矩陣
- 帳戶 — 查詢餘額和持倉
- Trading API 常見問題 — 常見問題和故障排除