Skip to main content

批次修改委託數量

BatchModifyPrice

先使用 MakeModifyQuantityObj 建立 ModifyQuantityObj物件

參數類別說明
orderResultOrderResult預計修改的委託單
quantityint修改後的委託量 ( 修改後數量包含此委託單已成交部份 )

將回傳的物件放入 ModifyQuantity 的方法中

輸入參數

參數類別說明
accountAccount帳號
ModifyQuantityObjModifyQuantityObj (list of object)批次改量委託單內容

Result 回傳

參數類別說明
isSuccessbool是否成功
dataList回傳修改資訊
messagestring當isSuccess = False 回傳錯誤訊息

修改資訊 OrderResult 欄位

Return type : Object

參數類別說明
functionTypeint功能別 : 0 新單 、 10 新單執行 、 15 改價 、 20 改量 、 30 刪單 、 90 失敗
datestring交易日期
seqNostring委託單流水序號
branchNostring分公司代號
accountstring帳號
orderNostring委託書號
assetTypeint資產類別 : 0 證券
marketstring市場類型 : TAIEX 上市股票 、 TAISDAQ 上櫃股票 、 TAIEMG 興櫃股票
marketTypeMarketType盤別種類 : Common 整股 、 Fixing 定盤 、 IntradayOdd 盤中零股 、 Odd 盤後零股 、 Emg 興櫃 、 EmgOdd 興櫃零股
stockNostring股票代號
buySellBsAction買賣別 : Buy 買 、 Sell
priceTypePriceType原始委託價格別 : Limit 限價 、 LimitUp 漲停 、 LimitDown 跌停 、 Market 市價 、 Reference 參考價
pricedouble價格
quantityint原始委託股數
timeInForceTimeInForce委託條件別 : Rod Rod 、 Fok Fok 、 Ioc Ioc
orderTypeOrderType委託單類型 : Stock 現股 、 Margin 融資 、 Short 融券 、 DayTrade 現股當沖 、 SBL借券
isPreOrderbool是否為預約單
statusint委託單狀態 : 0 預約單 、 4 系統將委託送往後台 、 9 連線逾時 、10 委託成功 、 30未成交刪單成功 、 40部分成交,剩餘取消 、 50 完全成交 、 90 失敗
afterPriceTypePriceType有效委託價格別 : Limit 限價 、 LimitUp 漲停 、 LimitDown 跌停 、 Market 市價 、 Reference 參考價
afterPricedouble有效委託價格
unitint單位數
afterQtyint有效委託股數(包含已成交部分)
filledQtyint成交股數
filledMoneyint成交價金
beforeQtyint改單前有效量
beforePricedouble改單前有效價
user_defstring自訂欄位
lastTimestring最後異動時間
detailslist委託歷程 (查詢order_result_detail or order_history才有值)
errorMessagestring錯誤訊息

請求範例

// 批次改量(利用batch detail回傳的內容改單)
var modified_orders = new List<ModifyQuantity> {
sdk.Stock.MakeModifyQuantityObj(batch_result.data[0], 1000),
sdk.Stock.MakeModifyQuantityObj(batch_result.data[1], 1000)
};

var batch_modify_qty = sdk.Stock.BatchModifyQuantity(account, modified_orders);
Console.WriteLine(batch_modify_qty);


// 批次改量(利用不同的單筆委託)
var modified_orders = new List<ModifyQuantity> {
sdk.Stock.MakeModifyQuantityObj(orderResults.data[0], 1000),
sdk.Stock.MakeModifyQuantityObj(orderResults.data[1], 1000)
};

var batch_modify_qty = sdk.Stock.BatchModifyQuantity(account, modified_orders);
Console.WriteLine(batch_modify_qty);

回傳範例

{
isSuccess = True,
message = ,
data =[ OrderResult{ // 批次改量(利用batch detail回傳的內容改單)
functionType = 20, // 功能別 (int)
date = 2024/03/08, // 交易日期 (string)
seqNo = 00000000042, // 委託單流水序號 (string)
branchNo = 20112, // 分公司代號 (string)
account = 26, // 帳號 (string)
orderNo = x0026, // 委託書號 (string)
assetType = 0, // 資產類別 (int)
market = TAIEX, // 市場類型 (string)
marketType = Common, // 盤別種類 (MarketType)
stockNo = 2881, // 股票代號 (string)
buySell = Buy, // 買賣別 (BsAction)
priceType = Limit, // 原始委託價格別 (PriceType)
price = 66, // 價格 (double)
quantity = 2000, // 原始委託股數 (int)
timeInForce = Rod, // 委託條件別 (TimeInforce)
orderType = Stock, // 委託單類型 (OrderType)
isPreOrder = False, // 是否為預約單 (bool)
status = 10, // 委託單狀態 (int)
afterPriceType = , // 有效委託價格別 (PriceType)
afterPrice = 66, // 有效委託價格 (double)
unit = 1000, // 單位數 (int)
afterQty = 1000, // 有效委託股數 (int)
filledQty = 0, // 成交股數 (int)
filledMoney = 0, // 成交價金 (int)
beforeQty = 2000, // 改單前有效量 (int)
beforePrice = , // 改單前有效價 (double)
userDef = batch 2, // 自訂欄位 (string)
lastTime = 12:21:51.023, // 最後異動時間 (string)
details = , // 委託歷程 (list)
errorMessage = // 錯誤訊息 (string)
},
OrderResult{ // 批次改量(利用batch detail回傳的內容改單)
functionType = 20, // 功能別 (int)
date = 2024/03/08, // 交易日期 (string)
seqNo = 00000000041, // 委託單流水序號 (string)
branchNo = 20112, // 分公司代號 (string)
account = 26, // 帳號 (string)
orderNo = x0025, // 委託書號 (string)
assetType = 0, // 資產類別 (int)
market = TAIEX, // 市場類型 (string)
marketType = Common, // 盤別種類 (MarketType)
stockNo = 2881, // 股票代號 (string)
buySell = Buy, // 買賣別 (BsAction)
priceType = Limit, // 原始委託價格別 (PriceType)
price = 66, // 價格 (double)
quantity = 2000, // 原始委託股數 (int)
timeInForce = Rod, // 委託條件別 (TimeInforce)
orderType = Stock, // 委託單類型 (OrderType)
isPreOrder = False, // 是否為預約單 (bool)
status = 10, // 委託單狀態 (int)
afterPriceType = , // 有效委託價格別 (PriceType)
afterPrice = 66, // 有效委託價格 (double)
unit = 1000, // 單位數 (int)
afterQty = 1000, // 有效委託股數 (int)
filledQty = 0, // 成交股數 (int)
filledMoney = 0, // 成交價金 (int)
beforeQty = 2000, // 改單前有效量 (int)
beforePrice = , // 改單前有效價 (double)
userDef = batch 1, // 自訂欄位 (string)
lastTime = 12:21:51.023, // 最後異動時間 (string)
errorMessage = // 錯誤訊息 (string)
}
]
}

以下擷取data內容

[
OrderResult{ // 批次改量(利用不同的單筆委託)
functionType = 20, // 功能別 (int)
date = 2024/03/08, // 交易日期 (string)
seqNo = 00000000043, // 委託單流水序號 (string)
branchNo = 20112, // 分公司代號 (string)
account = "26", // 帳號 (string)
orderNo = x0027, // 委託書號 (string)
assetType = 0, // 資產類別 (int)
market = TAIEX, // 市場類型 (string)
marketType = Common, // 盤別種類 (MaeketType)
stockNo = 2881, // 股票代號 (string)
buySell = Buy, // 買賣別 (BsAction)
priceType = Limit, // 原始委託價格別 (PriceType)
price = 66, // 價格 (double)
quantity = 2000, // 原始委託股數 (int)
timeInForce = Rod, // 委託條件別 (TimeInForce)
orderType = Stock, // 委託單類型 (OrderType)
isPreOrder = False, // 是否為預約單 (bool)
status = 10, // 委託單狀態 (int)
afterPriceType = , // 有效委託價格別 (PriceType)
afterPrice = 66, // 有效委託價格 (double)
unit = 1000, // 單位數 (int)
afterQty = 1000, // 有效委託股數 (int)
filledQty = 0, // 成交股數 (int)
filledMoney = 0, // 成交價金 (int)
beforeQty = 2000, // 改單前有效量 (int)
beforePrice = , // 改單前有效價 (int)
userDef = Test, // 自訂欄位 (string)
lastTime = 12:21:53.023, // 最後異動時間 (string)
details = , // 委託歷程 (list)
errorMessage = // 錯誤訊息 (string)
},
OrderResult{
functionType = 20, // 功能別 (int)
date = 2024/03/08, // 交易日期 (string)
seqNo = 00000000044, // 委託單流水序號 (string)
branchNo = 20112, // 分公司代號 (string)
account = 26, // 帳號 (string)
orderNo = x0028, // 委託書號 (string)
assetType = 0, // 資產類別 (int)
market = TAIEX, // 市場類型 (string)
marketType = Common, // 盤別種類 (MarketType)
stockNo = 2881, // 股票代號 (string)
buySell = Buy, // 買賣別 (BsAction)
priceType = Limit, // 原始委託價格別 (PriceType)
price = 66, // 價格 (double)
quantity = 2000, // 原始委託股數 (int)
timeInForce = Rod, // 委託條件別 (TimeInForce)
orderType = Stock, // 委託單類型 (OrderType)
isPreOrder = False, // 是否為預約單 (bool)
status = 10, // 委託單狀態 (int)
afterPriceType = , // 有效委託價格別 (PriceType)
afterPrice = 66, // 有效委託價格 (double)
unit = 1000, // 單位數 (int)
afterQty = 1000, // 有效委託股數 (int)
filledQty = 0, // 成交股數 (int)
filledMoney = 0, // 成交價金 (int)
beforeQty = 2000, // 改單前有效量 (int)
beforePrice = , // 改單前有效價 (string)
userDef = Test, // 自訂欄位 (string)
lastTime = 12:21:53.023, // 最後異動時間 (string)
errorMessage = // 錯誤訊息 (string)
}
]