Single conditional order
single_condition
Input parameters
| Parameters | Category | Description |
|---|---|---|
| account | Account | account |
| start_date | string | Conditional start monitoring time |
| end_date | string | Condition end monitoring time |
| stop_sign | StopSign | Conditional stop conditions: FULL until all transactions are completed, PARTIAL until partial transactions are completed, UNTIL_END until the end of the validity period |
| condition | Condition | Trigger condition |
| ConditionOrder Object | ConditionOrder Object | Order details |
Result return
| Parameters | Category | Description |
|---|---|---|
| is_success | bool | Whether it was successful |
| data | Object | Conditional order return information |
| message | string ? (optional) | Return error message when isSuccess = false |
Order information ConditionOrderResult field
Return type : Object
| Parameters | Category | Description |
|---|---|---|
| guid | string | condition order number |
Request example
//Design condition content
Condition condition = Condition{
TradingType::REFERENCE,
"2881",
TriggerContent::MATCHED_PRICE,
"66",
Operator::LESS_THAN,
};
ConditionOrder order = ConditionOrder{
BsAction::BUY,
"2881",
"1000",
1000,
ConditionMarketType::COMMON,
ConditionPriceType::LIMIT,
TimeInForce::ROD,
ConditionOrderType::STOCK,
};
auto send_condition_order = sdk->stock->single_condition(target_account,"20250605","20250605", StopSign::FULL, condition, order, std::nullopt);
if (!send_condition_order.is_success) {
std::cout << "get order result failed reason: "
<< (send_condition_order.message.has_value() ? send_condition_order.message.value() : "No message")
<< std::endl;
}
else {
if (send_condition_order.data.has_value()) {
const auto& send = send_condition_order.data.value();
std::cout << send << std::endl;
}
else {
std::cout << "Order result success but no data returned." << std::endl;
}
}
Return example
{
isSuccess = True,
message = ,
data = ConditionOrderResult {
guid = 44150047-8977-40b1-953c-ce2XXXXXX
}
}