Trailing Profit Conditional Order
trailProfit
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 |
| trailOrder | TrailOrder | Trailing Profit |
caution
TrailOrder withinof Base price (price) accepts at most two decimal places,additional decimal places cause price refreshing to fail
info
When the current stock price reaches the trigger price(based on the percentage change from the base price) Place order
Example: If the initial base price is 100, downward 5% Place order/,the initial trigger price is 95,if the price does not rise above 100(so the base price is not adjusted), then when the market price is 95 Trigger conditionPlace order
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 |
| reply_code | string | Response status code |
| advisory | string | Response status content |
Request Example
// Define the condition
const trail = {
symbol: "2330",
price: "860",
direction: Direction.Down,
percentage: 5,
buySell: BSAction.Sell,
quantity: 2000,
priceType: ConditionPriceType.MatchedPrice,
diff: 5,
timeInForce: TimeInForce.ROD,
orderType: ConditionOrderType.Stock
};
sdk.stock.trailProfit(target_account, "20240427","20240516", StopSign.Full, trail)
Response Example
{
isSuccess: true,
data : {
guid : "44150047-8977-40b1-953c-ce2XXXXXX"
}
}