Multi-Condition Order
multi_conditions_day_trade
Notes on stop loss and profit
- The stop loss and profit setting is only for triggering orders. There is no guarantee that the cover will be successful. It needs to be adjusted according to the market conditions.
- Please confirm that the Stop Loss Profit Order Category setting must comply with the day's offsetting transaction rules (for example, credit transactions use mutual offset of securities)
Conditional order query
- To use guid to query the current trading condition order, please use the current trading condition order query function
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 |
| ConditionDayTrade Object | ConditionDayTrade Object | Trading order content |
| TPSLObject | TpslWrapper | Stop loss and stop profit conditions |
| FixSession | bool | day-to-day cover |
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,
};
Condition condition2 = Condition{
TradingType::REFERENCE,
"2881",
TriggerContent::TOTAL_QUANTITY,
"1000",
Operator::GREATER_THAN,
};
std::vector<Condition> conditions;
conditions.push_back(condition);
conditions.push_back(condition2);
ConditionOrder order = ConditionOrder{
BsAction::BUY,
"2330",
"1000",
1000,
ConditionMarketType::COMMON,
ConditionPriceType::LIMIT,
TimeInForce::ROD,
ConditionOrderType::STOCK,
};
ConditionDayTrade day_order = ConditionDayTrade{
"131500", // Offsetting time before closing, the settable range is 130100 ~ 132000
true,
"",
ConditionPriceType::MARKET
};
TpslOrder tp = TpslOrder{
TimeInForce::ROD,
ConditionPriceType::LIMIT,
ConditionOrderType::STOCK,
"85",
"85",
};
TpslOrder sl = TpslOrder{
TimeInForce::ROD,
ConditionPriceType::LIMIT,
ConditionOrderType::STOCK,
"60",
"60",
};
TPSLWrapper tpsl = TPSLWrapper{
StopSign::FULL,
tp,
sl,
"20250816",
true // **Set true to enable intraday washout
};
auto daytrade_condition_order = sdk->stock->multi_condition_day_trade(target_account, StopSign::FULL, "130000", conditions , order, day_order, tpsl, true);
if (!daytrade_condition_order.is_success) {
std::cout << "get order result failed reason: "
<< (daytrade_condition_order.message.has_value() ? daytrade_condition_order.message.value() : "No message")
<< std::endl;
}
else {
if (daytrade_condition_order.data.has_value()) {
const auto& send = daytrade_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
}
}