Trail Profit Condition
Fubon Neo API supports trail profit orders.
Trailing Profit Mechanism: After the initial condition is triggered, the order will not be activated if the set pullback range is not reached. As the stock price continues to rise, the new price will be used as the benchmark. If the pullback range reaches the set value at this point, the order will be submitted.
程式範例
- Python
- Node.js
- C#
# 設計條件內容
trail = FutOptTrailOrder(
symbol = "TXFL4",
price = "22000",
direction = Direction.Up ,
tick_num = 5, # 漲跌 tick 數
buy_sell = BSAction.Sell,
lot = 2,
price_type = FutOptConditionPriceType.MatchedPrice,
diff = 1, # 向上 or 向下追買 tick數 (向下為負值)
time_in_force = TimeInForce.ROD,
order_type = FutOptConditionOrderType.Close
)
sdk.futopt.trail_profit(target_account, "20240427","20240516", StopSign.Full, trail)
// 設計條件內容
const trail = {
symbol: "TXO20000E4",
price: "1050",
direction: Direction.Down,
tickNum: 5,
buysell: BSAction.Sell,
lot: 2,
priceType: FutOptConditionPriceType.MatchedPrice,
diff: 1,
timeInForce: TimeInForce.ROD,
orderType: FutOptConditionOrderType.Close
};
sdk.futopt.trailProfit(target_account, "20240427","20240516", StopSign.Full, trail)
// 設計條件內容
var trail = new FutOptTrailOrder(
"TXO20000E4",
"1050",
Direction.Up ,
5, // 漲跌 tick 數
BsAction.Buy,
2,
FutOptConditionPriceType.MatchedPrice,
1, // 向上 or 向下追買 tick數 (向下為負值)
TimeInForce.Rod,
FutOptConditionOrderType.Close
);
sdk.FutOpt.TrailProfit(target_account, "20240427","20240516", StopSign.Full, trail);