主動回報範例(標準版)
以下列舉主動回報範例,包含阻塞式 (non-async, unblock=False) 及 非阻塞式 (async, unblock=True) 功能
( 關於阻塞式與非阻塞式功能,請參考 非阻塞下單 )
此文件僅提供常見使用場景對應範例,不保證包含所有例外情況
單筆下單
單筆新單
阻塞式 (non-async, unblock=False)
-
下單成功
-
主動回報(一筆):
下單成功,status 顯示為 10
==下單主動回報==
Code None
內容 OrderResult {
function_type: 10,
date: "2024/10/17",
seq_no: "00000394159",
branch_no: "20706",
account: "9809268",
order_no: "x0002",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 10,
after_price_type: Limit,
after_price: 43,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: 0,
before_price: 43,
user_def: "Test50",
last_time: "11:24:40.378",
details: None,
error_message: None,
}
======== -
函式回傳值 (return):
Result {
is_success: True,
message: None,
data: OrderResult {
function_type: 0,
date: "2024/10/17",
seq_no: "00000394159",
branch_no: "20706",
account: "9809268",
order_no: "x0002",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 10,
after_price_type: Limit,
after_price: 43,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: 0,
before_price: 43,
user_def: "Test50",
last_time: "11:24:40.378",
details: None,
error_message: None,
}
}
-
-
下單失敗
-
主動回報(一筆):
下單異常,status 顯示為 90
==下單主動回報==
Code [4385715]單價輸入錯誤[4385715]
內容 OrderResult {
function_type: 90,
date: "2024/10/17",
seq_no: "00000394160",
branch_no: "20706",
account: "9809268",
order_no: None,
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 430,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 90,
after_price_type: Limit,
after_price: 430,
unit: 1000,
after_qty: 0,
filled_qty: None,
filled_money: None,
before_qty: 0,
before_price: 430,
user_def: "Test25",
last_time: "11:25:25.670",
details: None,
error_message: "單價輸入錯誤[4385715]",
}
======== -
函式回傳值 (return):
下單失敗,無委託單資料回傳
Result {
is_success: False,
message: 單價輸入錯誤[4385715],
data: None
}
-
非阻塞 (async, unblock=True)
-
下單成功
-
主動回報(三筆):
第一筆為ACK,表示系統將執行請求(status 4),第二筆表示後台準備送單(status 8),此時皆無 order_no(尚未確認下單成功),可用 seq_no 進行後續比對;最後確認下單狀態(成功為 status 10)
==下單主動回報==
Code None
內容 OrderResult {
function_type: 0,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: None,
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: true,
status: 4,
after_price_type: Limit,
after_price: 43,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: 0,
before_price: 43,
user_def: "Test70",
last_time: "11:25:54.188",
details: None,
error_message: None,
}
==========下單主動回報==
Code None
內容 OrderResult {
function_type: 10,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: None,
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 8,
after_price_type: Limit,
after_price: 43,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: 0,
before_price: 43,
user_def: "Test70",
last_time: "11:25:54.189",
details: None,
error_message: None,
}
==========下單主動回報==
Code None
內容 OrderResult {
function_type: 10,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 10,
after_price_type: Limit,
after_price: 43,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: 0,
before_price: 43,
user_def: "Test70",
last_time: "11:25:54.163",
details: None,
error_message: None,
}
======== -
函式回傳值 (return):
因使用非阻塞,函式收到 ACK 即回傳 (status 4)
Result {
is_success: True,
message: None,
data: OrderResult {
function_type: 0,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: None,
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: true,
status: 4,
after_price_type: Limit,
after_price: 43,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: 0,
before_price: 43,
user_def: "Test70",
last_time: "11:25:54.188",
details: None,
error_message: None,
}
}
-
-
下單失敗
-
主動回報(三筆):
第一筆為ACK,表示系統將執行請求(status 4),第二筆表示後台準備送單(status 8),此時皆無 order_no(尚未確認下單成功),可用 seq_no 進行後續比對;最後確認下單狀態(異常為 status 90)
==下單主動回報==
Code None
內容 OrderResult {
function_type: 0,
date: "2024/10/17",
seq_no: "00098000032",
branch_no: "20706",
account: "9809268",
order_no: None,
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 20,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: true,
status: 4,
after_price_type: Limit,
after_price: 20,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: 0,
before_price: 20,
user_def: "Test64",
last_time: "11:26:59.651",
details: None,
error_message: None,
}
==========下單主動回報==
Code None
內容 OrderResult {
function_type: 10,
date: "2024/10/17",
seq_no: "00098000032",
branch_no: "20706",
account: "9809268",
order_no: None,
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 20,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 8,
after_price_type: Limit,
after_price: 20,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: 0,
before_price: 20,
user_def: "Test64",
last_time: "11:26:59.652",
details: None,
error_message: None,
}
==========下單主動回報==
Code [4385715]單價輸入錯誤[4385715]
內容 OrderResult {
function_type: 90,
date: "2024/10/17",
seq_no: "00098000032",
branch_no: "20706",
account: "9809268",
order_no: None,
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 20,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 90,
after_price_type: Limit,
after_price: 20,
unit: 1000,
after_qty: 0,
filled_qty: 0,
filled_money: 0,
before_qty: 0,
before_price: 20,
user_def: "Test64",
last_time: "11:26:59.658",
details: None,
error_message: "單價輸入錯誤[4385715]",
}
======== -
函式回傳值 (return):
因使用非阻塞,函式收到 ACK 即回傳 (status 4)
Result {
is_success: True,
message: None,
data: OrderResult {
function_type: 0,
date: "2024/10/17",
seq_no: "00098000032",
branch_no: "20706",
account: "9809268",
order_no: None,
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 20,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: true,
status: 4,
after_price_type: Limit,
after_price: 20,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: 0,
before_price: 20,
user_def: "Test64",
last_time: "11:26:59.651",
details: None,
error_message: None,
}
}
-
修改委託單價格
改單無論使用阻塞模式或非阻塞模式,若由系統擋單(例如改價同原委託價),無 status 4 回報(表示系統將執行請求);若由後台擋單(例如超過漲跌停價),則有 status 4 回報
阻塞模式與非阻塞模式差異為,若有 status 4 回報時(系統向後送單),非阻塞模式之函式收到該筆回報即回傳,而阻塞模式之函式將等到最終成功或失敗確認才回傳
阻塞
-
改價成功
-
主動回報(兩筆):
改價 function_type 15,回報第一筆為系統將執行請求(status 4);第二筆改價成功 status 10
==改單主動回報==
Code None
內容 OrderResult {
function_type: 15,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 4,
after_price_type: Limit,
after_price: 43,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: None,
before_price: 43,
user_def: "Test70",
last_time: "11:27:47.512",
details: None,
error_message: None,
}
==========改單主動回報==
Code None
內容 OrderResult {
function_type: 15,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 10,
after_price_type: Limit,
after_price: 42,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: None,
before_price: 43,
user_def: "Test70",
last_time: "11:27:47.407",
details: None,
error_message: None,
}
======== -
函式回傳 (return):
Result {
is_success: True,
message: None,
data: OrderResult {
function_type: 15,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 10,
after_price_type: Limit,
after_price: 42,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: 5000,
before_price: 43,
user_def: "Test70",
last_time: "11:27:47.407",
details: None,
error_message: None,
}
}
-
-
改價失敗
-
主動回報(兩筆,後台擋單):
改價 function_type 15,回報第一筆為系統將執行請求(status 4);第二筆改價失敗 status 19
info此案例由後台擋單,因此有第一筆回報 status 4
==改單主動回報==
Code None
內容 OrderResult {
function_type: 15,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 4,
after_price_type: Limit,
after_price: 42,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: None,
before_price: 42,
user_def: "Test70",
last_time: "11:28:46.753",
details: None,
error_message: None,
}
==========改單主動回報==
Code [4385715]單價輸入錯誤[4385715]
內容 OrderResult {
function_type: 15,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 19,
after_price_type: Limit,
after_price: 42,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: None,
before_price: 42,
user_def: "Test70",
last_time: "11:28:46.754",
details: None,
error_message: "單價輸入錯誤[4385715]",
}
======== -
函式回傳 (return):
改價失敗,無委託單資料回傳
Result {
is_success: False,
message: 單價輸入錯誤[4385715],
data: None
}
-
非阻塞
-
改價成功
-
主動回報(兩筆):
改價 function_type 15,回報第一筆為系統將執行請求(status 4);第二筆改價成功 status 10
==改單主動回報==
Code None
內容 OrderResult {
function_type: 15,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 4,
after_price_type: Limit,
after_price: 42,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: None,
before_price: 42,
user_def: "Test70",
last_time: "11:29:43.593",
details: None,
error_message: None,
}
==========改單主動回報==
Code None
內容 OrderResult {
function_type: 15,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 10,
after_price_type: Limit,
after_price: 43,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: None,
before_price: 42,
user_def: "Test70",
last_time: "11:29:43.682",
details: None,
error_message: None,
}
======== -
函式回傳 (return):
因使用非 阻塞,函式收到 ACK 即回傳 (status 4)
Result {
is_success: True,
message: None,
data: OrderResult {
function_type: 15,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 4,
after_price_type: Limit,
after_price: 42,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: None,
before_price: 42,
user_def: "Test70",
last_time: "11:29:43.592",
details: None,
error_message: None,
}
}
-
-
改價失敗
-
主動回報(一筆):
改價 function_type 15,改價失敗 status 19
info此案例由系統擋單,因此無 status 4 回報
==改單主動回報==
Code [154]證券改價限價格格和原價格相同==>[00098000031]
內容 OrderResult {
function_type: 15,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 19,
after_price_type: Limit,
after_price: 43,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: None,
before_price: None,
user_def: "Test70",
last_time: "11:30:20.330",
details: None,
error_message: "證券改價限價格格和原價格相同==>[00098000031]",
}
======== -
函式回傳 (return):
改價失敗,無委託單資料回傳
response: Result {
is_success: False,
message: 證券改價限價格格和原價格相同==>[00098000031],
data: None
}
-
修改委託單數量
改單無論使用阻塞模式或非阻塞模式,若由系統擋單(例如改價同原委託價),無 status 4 回報(表示系統將執行請求);若由後台擋單(例如超過漲跌停價),則有 status 4 回報
阻塞模式與非阻塞模式差異為,若有 status 4 回報時(系統向後送單),非阻塞模式之函式收到該 筆回報即回傳,而阻塞模式之函式將等到最終成功或失敗確認才回傳
阻塞
-
改量成功
-
主動回報(兩筆):
改量 function_type 20,回報第一筆為系統將執行請求(status 4);第二筆改量成功 status 10
==改單主動回報==
Code None
內容 OrderResult {
function_type: 20,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 4,
after_price_type: None,
after_price: 43,
unit: 1000,
after_qty: 5000,
filled_qty: 0,
filled_money: 0,
before_qty: 5000,
before_price: None,
user_def: "Test70",
last_time: "11:31:00.211",
details: None,
error_message: None,
}
==========改單主動回報==
Code None
內容 OrderResult {
function_type: 20,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 10,
after_price_type: None,
after_price: 43,
unit: 1000,
after_qty: 3000,
filled_qty: 0,
filled_money: 0,
before_qty: 5000,
before_price: None,
user_def: "Test70",
last_time: "11:31:00.332",
details: None,
error_message: None,
}
======== -
函式回傳 (return):
Result {
is_success: True,
message: None,
data: OrderResult {
function_type: 20,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 10,
after_price_type: Limit,
after_price: 43,
unit: 1000,
after_qty: 3000,
filled_qty: 0,
filled_money: 0,
before_qty: 5000,
before_price: 43,
user_def: "Test70",
last_time: "11:31:00.332",
details: None,
error_message: None,
}
}
-
-
改量失敗
-
主動回報(一筆):
改量 function_type 20,失敗回報 status 29(系統擋單,因此無 status 4 回報)
==改單主動回報==
Code [164]證券減量使用剩餘數量大於有效單位數量==>[00098000031]
內容 OrderResult {
function_type: 20,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 29,
after_price_type: None,
after_price: 43,
unit: 1000,
after_qty: 3000,
filled_qty: 0,
filled_money: 0,
before_qty: None,
before_price: None,
user_def: "Test70",
last_time: "11:31:51.980",
details: None,
error_message: "證券減量使用剩餘數量大於有效單位數量==>[00098000031]",
}
======== -
函式回傳 (return):
改量失敗,無委託單資料回傳
Result {
is_success: False,
message: 證券減量使用剩餘數量大於有效單位數量==>[00098000031],
data: None
}
-
非阻塞
-
改量成功
-
主動回報(兩筆):
改量 function_type 20,回報第一筆為系統將執行請求(status 4);第二筆改量成功 status 10
==改單主動回報==
Code None
內容 OrderResult {
function_type: 20,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 4,
after_price_type: None,
after_price: 43,
unit: 1000,
after_qty: 3000,
filled_qty: 0,
filled_money: 0,
before_qty: 3000,
before_price: None,
user_def: "Test70",
last_time: "11:32:33.047",
details: None,
error_message: None,
}
==========改單主動回報==
Code None
內容 OrderResult {
function_type: 20,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 10,
after_price_type: None,
after_price: 43,
unit: 1000,
after_qty: 1000,
filled_qty: 0,
filled_money: 0,
before_qty: 3000,
before_price: None,
user_def: "Test70",
last_time: "11:32:33.215",
details: None,
error_message: None,
}
======== -
函式回傳 (return):
因使用非阻塞,函式收到 ACK 即回傳 (status 4)
Result {
is_success: True,
message: None,
data: OrderResult {
function_type: 20,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 4,
after_price_type: None,
after_price: 43,
unit: 1000,
after_qty: 3000,
filled_qty: 0,
filled_money: 0,
before_qty: 3000,
before_price: None,
user_def: "Test70",
last_time: "11:32:33.045",
details: None,
error_message: None,
}
}
-
-
改量失敗
-
主動回報(一筆):
改量 function_type 20,失敗回報 status 29 (系統擋單,因此無 status 4 回報)
==改單主動回報==
Code [164]證券減量使用剩餘數量大於有效單位數量==>[00098000031]
內容 OrderResult {
function_type: 20,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 29,
after_price_type: None,
after_price: 43,
unit: 1000,
after_qty: 1000,
filled_qty: 0,
filled_money: 0,
before_qty: None,
before_price: None,
user_def: "Test70",
last_time: "11:33:18.679",
details: None,
error_message: "證券減量使用剩餘數量大於有效單位數量==>[00098000031]",
}
======== -
函式回傳 (return):
由系統擋單改量失敗,無委託單資料回傳
Result {
is_success: False,
message: 證券減量使用剩餘數量大於有效單位數量==>[00098000031],
data: None
}
-
刪除委託單
若委託單已部分成交, 刪單成功狀態代碼為 40, 其餘為 30
改單無論使用阻塞模式或非阻塞模式,若由系統擋單(例如改價同原委託價),無 status 4 回報(表示系統將執行請求);若由後台擋單(例如超過漲跌停價),則有 status 4 回報
阻塞模式與非阻塞模式差異為,若有 status 4 回報時(系統向後送單),非阻塞模式之函式收到 status 4 回報即回傳,而阻塞模式之函式將等到最終成功或失敗確認才回傳
阻塞
-
刪單成功
-
主動回報(兩筆):
刪單 function_type 30,回報第一筆為系統將執行請求(status 4);第二筆刪單成功 status 30 (若已有部分成交 status 40)
==改單主動回報==
Code None
內容 OrderResult {
function_type: 30,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 4,
after_price_type: None,
after_price: 43,
unit: 1000,
after_qty: 1000,
filled_qty: 0,
filled_money: 0,
before_qty: 1000,
before_price: None,
user_def: "Test70",
last_time: "11:36:14.561",
details: None,
error_message: None,
}
==========改單主動回報==
Code None
內容 OrderResult {
function_type: 30,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 30,
after_price_type: None,
after_price: 43,
unit: 1000,
after_qty: 0,
filled_qty: 0,
filled_money: 0,
before_qty: 1000,
before_price: None,
user_def: "Test70",
last_time: "11:36:14.499",
details: None,
error_message: None,
}
======== -
函式回傳 (return):
Result {
is_success: True,
message: None,
data: OrderResult {
function_type: 30,
date: "2024/10/17",
seq_no: "00098000031",
branch_no: "20706",
account: "9809268",
order_no: "x0003",
asset_type: 0,
market: "TAIEX",
market_type: Common,
stock_no: "1102",
buy_sell: Buy,
price_type: Limit,
price: 43,
quantity: 5000,
time_in_force: ROD,
order_type: Stock,
is_pre_order: false,
status: 30,
after_price_type: Limit,
after_price: 43,
unit: 1000,
after_qty: 0,
filled_qty: 0,
filled_money: 0,
before_qty: 1000,
before_price: 43,
user_def: "Test70",
last_time: "11:36:14.499",
details: None,
error_message: None,
}
}
-
-
刪單失敗
-
主動回報(一筆):
刪單 function_type 30,刪單失敗 status 39(系統擋單,因此無 status 4 回報)
==改單主動回報==
Code [115]證券委託目前狀態部分成交單已不允許取消交易
內容 OrderResult {
function_type: 30,
date: "2024/10/17",
seq_no: "00000394165",
branch_no: "20706",
account: "9809268",
order_no: "x0007",
asset_type: 1,
market: None,
market_type: UnSupported,
stock_no: "1102",
buy_sell: None,
price_type: None,
price: None,
quantity: None,
time_in_force: None,
order_type: None,
is_pre_order: false,
status: 39,
after_price_type: None,
after_price: None,
unit: None,
after_qty: None,
filled_qty: None,
filled_money: None,
before_qty: None,
before_price: None,
user_def: None,
last_time: "11:39:57.468",
details: None,
error_message: "證券委託目前狀態部分成交單已不允許取消交易",
}
======== -
函式回傳 (return):
系統擋單而刪單失敗,無委託單資料回傳
Result {
is_success: False,
message: 證券委託目前狀態部分成交單已不允許取消交易,
data: None
}
-
非阻塞
-
刪單成功
-
主動回報(兩筆):
-