單一條件單包含停損停利
singleCondition
停損利注意事項
- 停損利設定僅為觸發送單,不保證必定成交,需視市場狀況自行調整
- 請確認停損利委託類別設定需符合適合之交易規則
輸入參數
參數 | 類別 | 說明 |
---|---|---|
account | Account | 帳號 |
start_date | string | 條件開始監控時間 |
end_date | string | 條件結束監控時間 |
stop_sign | StopSign | 條件停止條件 : Full 全部成交為止、Partial 部分成交為止、UntilEnd 效期結束為止 |
condition | Condition | 觸發條件 |
OrderObject | OrderObject | 委託內容 |
TPSLObject | FutOptTPSLWrapper | 停損停利條件 |
Result 回傳
參數 | 類別 | 說明 |
---|---|---|
isSuccess | bool | 是否成功 |
data | Object | 條件單回傳資訊 |
message | string ? (optional) | 當isSuccess = false 回傳錯誤訊息 |
委託資訊 ConditionOrderResult 欄位
Return type : Object
參數 | 類別 | 說明 |
---|---|---|
guid | string | 條件單號 |
請求範例
// 設計條件內容
const condition = {
marketType: TradingType.Reference,
symbol: "TXO20000E4",
trigger: TriggerContent.MatchedPrice,
triggerValue: "100",
comparison: Operator.LessThan
}
const order = {
buySell: BSAction.Buy,
symbol: "TXO20000E4",
price: "100",
lot: 1,
marketType: FutOptConditionMarketType.Option,
priceType: FutOptConditionPriceType.Limit,
timeInForce: TimeInForce.ROD,
orderType: FutOptConditionOrderType.New
};
const tp = {
timeInForce: TimeInForce.ROD,
priceType: FutOptConditionPriceType.Limit,
orderType: FutOptConditionOrderType.Close,
targetPrice: "120",
price: "120"
}
const sl = {
timeInForce: TimeInForce.ROD,
priceType: FutOptConditionPriceType.Limit,
orderType: FutOptConditionOrderType.Close,
targetPrice: "60",
price: "60"
}
const tpsl = {
stopSign: StopSign.Full,
tp: tp, // optional field
sl: sl, // optional field
endDate: "20240517" // optional field
}
sdk.futopt.singleCondition(account, "20240426", "20240430", StopSign.Full, condition, order, tpsl)
回傳範例
{
isSuccess: true,
data : {
guid : "44150047-8977-40b1-953c-ce2XXXXXX"
}
}