Skip to main content

Trail Profit Condition

trail_profit

Request Parameter

ParameterTypeMeaning
accountAccountAccount
start_datestringCondition Start Date
end_datestringCondition End Date
stop_signStopSignStop Condition : Full Until Fully filled、Partial Once Filled happened 、 UntilEnd Until Expiry
TrailOrderTrail OrderTrail Order Condition
caution

The activate price in TrailOrder can only take up to two decimal places, otherwise it will fail to be activated.

info

The order will be placed when the current price hit the trigger price (the activate price up/down to the setting percentage)

Example. If the activate price is set to 100, and the stop loss/gain condiition is set as 5% down, so the initial trigger price is 95. Assuming that the price never go above 100 (so that the activate price does not move upward), then the stop loss/gain order will be placed when the market price hit 95.

Result Response

ParameterTypeMeaning
isSuccessboolInterface result
dataObjectConditionOrderResult is returned
messagestring ? (optional)isSuccess = false error description is returned

ConditionOrderResult Parameter

Return type : Object

ParameterTypeMeaning
guidstringCondition Serial Number

Request Example

# Condition Content
trail = TrailOrder(
symbol ="2330",
baseprice = "860",
direction = Direction.Up,
percentage = 5, # Up or Down Percent
buy_sell = BSAction.Buy,
quantity = 2000,
price_type = ConditionPriceType.MatchedPrice,
diff = 5, # base price ticker (negative represent down)
time_in_force = TimeInForce.ROD,
order_type = ConditionOrderType.Stock,
)

sdk.stock.trail_profit(target_account, "20240427","20240516", StopSign.Full, trail)

Response Example

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