當沖單一條件單
singleConditionDayTrade
停損利注意事項
- 停損利設定僅為觸發送單,不保證必定回補成功,需視市場狀況自行調整
- 請確認停損利委託類別設定需符合當日沖銷交易規則(例如信用交易使用資券互抵)
當沖條件單查詢
- 使用 guid 查詢當沖條件單請使用當沖條件單查詢功能
輸入參數
參數 | 類別 | 說明 |
---|---|---|
account | Account | 帳號 |
stopSign | StopSign | 條件停止條件 : Full 全部成交為止、Partial 部分成交為止、UntilEnd 效期結束為止 |
endTime | string | 父單洗價結束時間 |
condition | Condition | 觸發條件 |
orderObject | ConditionOrder Object | 委託內容 |
ConditionDayTrade Object | ConditionDayTrade | 當沖回補內容 |
TPSLObject | TPSLWrapper | 停損停利條件 |
fixSession | bool | 執行定盤回補 |
Result 回傳
參數 | 類別 | 說明 |
---|---|---|
isSuccess | bool | 是否成功 |
data | Object | 條件單回傳資訊 |
message | string ? (optional) | 當isSuccess = false 回傳錯誤訊息 |
委託資訊 ConditionOrderResult 欄位
Return type : Object
參數 | 類別 | 說明 |
---|---|---|
guid | string | 條件單號 |
請求範例
// 設計條件內容
const condition = {
marketType: TradingType.Reference,
symbol: "2881",
trigger: TriggerContent.MatchedPrice,
triggerValue: "80",
comparison: Operator.LessThan
}
const order = {
buySell: BSAction.Buy,
symbol: "2881",
price: "66",
quantity: 2000,
marketType: ConditionMarketType.Common,
priceType: ConditionPriceType.Limit,
timeInForce: TimeInForce.ROD,
orderType: ConditionOrderType.Stock,
userDef: "from Js"
};
const daytrade_obj = {
dayTradeEndTime : "131000", // 收盤前沖銷時間,可設定區間為 130100 ~ 132000
autoCancel : true,
price : "",
priceType : ConditionPriceType.Market
}
const tp = {
timeInForce: TimeInForce.ROD,
priceType: ConditionPriceType.Limit,
orderType: ConditionOrderType.Stock,
targetPrice: "85",
price: "85",
}
const sl = {
timeInForce: TimeInForce.ROD,
priceType: ConditionPriceType.Limit,
orderType: ConditionOrderType.Stock,
targetPrice: "60",
price: "60",
}
const tpsl = {
stopSign: StopSign.Full,
endDate: "20240517",
tp: tp,
sl: sl,
intraday: true // ** 設定 true 以啟用當日沖銷洗價
}
sdk.stock.singleConditionDayTrade(account, StopSign.Full, "130000", condition, order, daytrade_obj, tpsl, true)
// 不設定停損停利
// sdk.stock.singleConditionDayTrade(account, StopSign.Full, "130000", condition, order, daytrade_obj, null, true)
// 不設定定盤回補
// sdk.stock.singleConditionDayTrade(account, StopSign.Full, "130000", condition, order, daytrade_obj, null, false)
回傳範例
{
isSuccess: true,
data : {
guid : "44150047-8977-40b1-953c-ce2XXXXXX"
}
}