Skip to main content

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

ParameterTypeDescription
accountAccountAccount
start_datestringCondition monitoring start time
end_datestringCondition monitoring end time
stop_signStopSignCondition stop condition :Full Until fully filled、PartialUntil partially filled、UntilEndUntil expiry
MultiConditionCondition ListTrigger condition
ConditionOrder ObjectConditionOrder ObjectOrder Details
TPSLObjectTPSLWrapperTake-Profit/Stop-Loss

Result

ParameterTypeDescription
isSuccessboolWhether successful
dataObjectConditional order response information
messagestring ? (optional)When isSuccess = false Returns an error message

Order Information ConditionOrderResult Fields

Return type : Object

ParameterTypeDescription
guidstringConditional Order ID

Request Example


# Define the condition
condition = Condition(
market_type = TradingType.Reference,
symbol = "2881",
trigger = TriggerContent.MatchedPrice,
trigger_value = "66",
comparison = Operator.LessThan
)

condition2 = Condition(
market_type = TradingType.Reference,
symbol = "2881",
trigger = TriggerContent.TotalQuantity,
trigger_value = "8000",
comparison = Operator.LessThan
)

order = ConditionOrder(
buy_sell = BSAction.Buy,
symbol = "2881",
price = "66",
quantity = 1000,
market_type = ConditionMarketType.Common,
price_type = ConditionPriceType.Limit,
time_in_force = TimeInForce.ROD,
order_type = ConditionOrderType.Stock,
)

# Take-Profit/Stop-LossFor Market, use an empty price""

tp = TPSLOrder(
time_in_force=TimeInForce.ROD,
price_type=ConditionPriceType.Limit,
order_type=ConditionOrderType.Stock,
target_price="85",
price="85",
# trigger=TriggerContent.MatchedPrice # v2.2.0 Added
)


sl = TPSLOrder(
time_in_force=TimeInForce.ROD,
price_type=ConditionPriceType.Limit,
order_type=ConditionOrderType.Stock,
target_price="60",
price="60",
# trigger=TriggerContent.MatchedPrice # v2.2.0 Added
)

tpsl = TPSLWrapper(
stop_sign= StopSign.Full,
tp=tp, # optional field
sl=sl, # optional field
end_date="20240517", # optional field
intraday =False # optional field
)


sdk.stock.multi_condition(account, "20240426", "20240430", StopSign.Full, [condition,condition2], order, tpsl)

Response Example


Result {
is_success: True,
message: None,
data : ConditionOrderResult {
guid : "44150047-8977-40b1-953c-ce270f0000"
}
}