Trail Profit Order
trail_profit
Input Parameters
| Parameter | Type | Description |
|---|---|---|
| account | Account | Account |
| start_date | string | Condition Monitoring Start Time |
| end_date | string | Condition Monitoring End Time |
| stop_sign | StopSign | Stop Sign : Full Until Full Execution, Partial Until Partial Execution, UntilEnd Until Expiry |
| TrailOrder | TrailOrder | Split Condition |
caution
The base price (price) in TrailOrder can only be input up to two decimal places. Exceeding this will cause system wash price failure.
info
When the current stock price touches the trigger price (calculated by percentage rise/fall from base price), the order is placed.
Example: If initial base price is 100, trailing stop/profit 5% down. Initial trigger price is 95. If price does not rise above 100 (i.e. base price not adjusted), then when market price hits 95, the condition order is triggered.
Result Return
| Parameter | Type | Description |
|---|---|---|
| is_success | bool | Is Success |
| data | Object | Condition Order Return Info |
| message | string ? (optional) | Error message when isSuccess = false |
Order Info ConditionOrderResult Fields
Return type : Object
| Parameter | Type | Description |
|---|---|---|
| guid | string | Condition Order GUID |
Request Example
// Design Condition Content
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;
}
}
Return Example
{
isSuccess = true,
message = ,
data = ConditionOrderResult {
guid = 44150047-8977-40b1-953c-ce2XXXXXX,
}
}