移動鎖利條件單
trail_profit
輸入參數
| 參數 | 類別 | 說明 |
|---|---|---|
| account | Account | 帳號 |
| start_date | string | 條件開始監控時間 |
| end_date | string | 條件結束監控時間 |
| stop_sign | StopSign | 條件停止條件 :Full 全部成交為止、Partial部分成交為止、UntilEnd效期結束為止 |
| TrailOrder | TrailOrder | 分單條件 |
caution
TrailOrder 內之 基準價 (price) 只可輸入至多小數點後兩位,若超出將造成系統洗價失敗
info
當前股票價格價觸及觸發價時(以基準價計算之漲跌 % 數) 即下單
例: 若初始基準價設 100, 向下 5% 下單停損/利,初始觸發價為 95,若價格無上漲超過 100(即基準價無調整), 則市場價為 95 時將觸發條件下單
Result 回傳
| 參數 | 類別 | 說明 |
|---|---|---|
| is_success | bool | 是否成功 |
| data | Object | 條件單回傳資訊 |
| message | string ? (optional) | 當isSuccess = false 回傳錯誤訊息 |
委託資訊 ConditionOrderResult 欄位
Return type : Object
| 參數 | 類別 | 說明 |
|---|---|---|
| guid | string | 條件單號 |
請求範例
// 設計條件內容
TrailOrder trail = TrailOrder{
"2330",
"1000",
Direction::UP,
5,
BsAction::BUY,
2000,
ConditionPriceType::MATCHED_PRICE,
5,
TimeInForce::ROD,
ConditionOrderType::STOCK
};
auto trail_order = sdk->stock->trail_profit(target_account, "20250606","20250606", StopSign::FULL, trail);
if (!trail_order.is_success) {
std::cout << "send trail_order result failed reason: "
<< (trail_order.message.has_value() ? trail_order.message.value() : "No message")
<< std::endl;
}
else {
if (trail_order.data.has_value()) {
const auto& send = trail_order.data.value();
std::cout << send << std::endl;
}
else {
std::cout << "send trail_order success but no data returned." << std::endl;
}
}
回傳範例
{
isSuccess = true,
message = ,
data = ConditionOrderResult {
guid = 44150047-8977-40b1-953c-ce2XXXXXX,
}
}