Multiple Conditional Orders with Take-Profit/Stop-Loss
multiCondition
Take-Profit/Stop-LossNotes
- Take-Profit/Stop-LossSetistrigger order submission,does not guarantee a fill,adjust as market conditions require
- Confirm thatTake-Profit/Stop-LossOrder typeSetmust comply with applicable trading rules(Examplesuch as margin buying and short selling)
info
After the parent order is fully filled,,Take-Profit/Stop-Lossthe portion is activated
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 | Condition stop condition : Full Until fully filled、PartialUntil partially filled、UntilEndUntil expiry |
| MultiCondition | Condition List | Trigger condition |
| ConditionOrder Object | ConditionOrder Object | Order Details |
| TPSLObject | TPSLWrapper | Take-Profit/Stop-Loss |
Result
| Parameter | Type | Description |
|---|---|---|
| isSuccess | bool | Whether successful |
| data | Object | Conditional order response information |
| message | string ? (optional) | When isSuccess = false Returns an error message |
Order Information ConditionOrderResult Fields
Return type : Object
| Parameter | Type | Description |
|---|---|---|
| guid | string | Conditional Order ID |
Request Example
// Define the condition
const condition = {
marketType: TradingType.Reference,
symbol: "2881",
trigger: TriggerContent.MatchedPrice,
triggerValue: "80",
comparison: Operator.LessThan
}
const condition2 = {
marketType: TradingType.Reference,
symbol: "2881",
trigger: TriggerContent.TotalQuantity,
triggerValue: "8000",
comparison: Operator.GreaterThan
}
const order = {
buySell: BSAction.Buy,
symbol: "2881",
price: "66",
quantity: 2000,
marketType: ConditionMarketType.Common,
priceType: ConditionPriceType.Limit,
timeInForce: TimeInForce.ROD,
orderType: ConditionOrderType.Stock
};
// Take-Profit/Stop-LossFor Market, use an empty price""
const tp = {
timeInForce: TimeInForce.ROD,
priceType: ConditionPriceType.Limit,
orderType: ConditionOrderType.Stock,
targetPrice: "85",
price: "85",
// trigger: TriggerContent.MatchPrice // v2.2.0 Added
}
const sl = {
timeInForce: TimeInForce.ROD,
priceType: ConditionPriceType.Limit,
orderType: ConditionOrderType.Stock,
targetPrice: "60",
price: "60",
// trigger: TriggerContent.MatchPrice // v2.2.0 Added
}
const tpsl = {
stopSign: StopSign.Full,
tp: tp, // optional field
sl: sl, // optional field
endDate: "20240517", // optional field
intraday: false // optional field
}
sdk.stock.multiCondition(account, "20240426", "20240430", StopSign.Full, [condition,condition2], order, tpsl)
Response Example
{
isSuccess: true,
data : {
guid : "44150047-8977-40b1-953c-ce2XXXXXX"
}
}