From f9a103b3affabbf1336c3a7a1a3a032043db09c7 Mon Sep 17 00:00:00 2001 From: brianna Date: Wed, 8 Jul 2026 16:16:56 +0800 Subject: [PATCH] feat(trade): --take-profit / --stop-loss perp flags Forward TP/SL trigger prices to the planner. With a size (--size/--amount-usdc) they attach to the opening order; alone they attach to an existing position. Each accepts an optional --*-limit companion to rest a limit on trigger instead of a market close. Maps to the backend's takeProfitPrice / stopLossPrice (+ *LimitPrice); the proxy forwards them verbatim. Co-Authored-By: Claude Fable 5 --- src/commands/trade.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/commands/trade.ts b/src/commands/trade.ts index 1f55ece..8b408c5 100644 --- a/src/commands/trade.ts +++ b/src/commands/trade.ts @@ -247,6 +247,8 @@ export function registerTradeCommands(program: Command): void { " acp trade withdraw-from-hl --amount 25 # withdraw to Arbitrum\n" + " acp trade --side long --token BTC --size 0.01 --leverage 5\n" + " acp trade --side long --token BTC --size 0.01 --leverage 5 --dry-run # preview only\n" + + " acp trade --side long --token BTC --amount-usdc 100 --take-profit 130000 --stop-loss 80000 # open with TP/SL\n" + + " acp trade --side long --token BTC --stop-loss 80000 # set a stop on an existing long\n" + " acp trade --amount-in 25 --chain-out hyperliquid # deposit (alias)\n" + " acp trade --token AAPL --amount-usdc 50 # buy tokenized AAPL with USDC on Ethereum\n" + " acp trade --token AAPL --token-in eth --chain-in 8453 --amount-in 0.02 # buy AAPL, funded by ETH on Base\n" + @@ -281,6 +283,16 @@ export function registerTradeCommands(program: Command): void { .option("--leverage ", "Set leverage for this token before a perp order") .option("--isolated", "Use isolated margin when setting leverage", false) .option("--reduce-only", "Only reduce an existing perp position", false) + .option( + "--take-profit ", + "Perp take-profit trigger price. With --size/--amount-usdc it attaches to the entry; alone it attaches to an existing position. Market close unless --take-profit-limit is set." + ) + .option("--take-profit-limit ", "Rest the take-profit as a limit at this price instead of a market close") + .option( + "--stop-loss ", + "Perp stop-loss trigger price. With --size/--amount-usdc it attaches to the entry; alone it attaches to an existing position. Market close unless --stop-loss-limit is set." + ) + .option("--stop-loss-limit ", "Rest the stop-loss as a limit at this price instead of a market close") .option("--dry-run", "Preview the trade (route, size, margin, fees) without signing or submitting anything", false) .action(async (opts, cmd) => { const json = isJson(cmd); @@ -393,6 +405,12 @@ async function runTrade(opts: Record, json: boolean): Promise