Aller au contenu
Retour
Command line (CLI)8 min de lecture

Place, protect and close trades

The execution path from the shell: propose, execute, attach exits, close — and the guardrails around each step.

Pas encore disponible dans votre langue — version anglaise affichée.

Everything on this page moves real money. Set your limits in the app (Settings → Risk limits) before you start: position size, leverage, daily loss and trade count are enforced server-side and cannot be overridden from the shell.

Two paths: propose, or execute #

Propose files a setup into your Diary. You review it in the app and send it to the ticket yourself. This is the safest way to work with a script or an agent:

bash
jw3 propose --pair BTC/USDT --side long --entry 64000 --stop 62000 \
  --size-usd 50 --venue kucoin --thesis "reclaim after sweep" --timeframe 4h

Execute places the order now:

bash
jw3 execute --exchange kucoin --pair BTC/USDT --side buy --risk-usd 5 \
  --market futures --leverage 3 --stop 62000 --tp 66000 --yes

Without --yes, execute prints the preview — venue, pair, side, size, price, fee estimate, stops — and exits without sending.

Size by amount or by risk #

FlagMeaning
--amountBase quantity, e.g. 0.002 BTC
--risk-usdSize derived from the distance between entry and stop
--sizeContract count on commands that work in contracts

--risk-usd with a stop is usually the better habit: the loss if the stop hits is known before the order is sent.

Attach exits at entry time #

bash
jw3 execute --exchange kucoin --pair SOL/USDT --side buy --risk-usd 4 --stop 138.2 \
  --tp-legs 145:50,149:50 --yes
  • --stop — protective stop, held by the venue.
  • --tp — single take-profit.
  • --tp-legs P1:S1,P2:S2 — multiple take-profits with size percentages.

You can also attach or replace exits later:

bash
jw3 exits --exchange kucoin --pair SOL/USDT --sl 138.2 --tp 149 --yes

Close, reduce, cancel #

bash
jw3 close --exchange kucoin --pair SOL/USDT --side long --yes
jw3 close --exchange kucoin --pair SOL/USDT --side long --size 5 --yes   # partial
jw3 cancel --exchange kucoin --order-id 123456 --pair SOL/USDT --yes
jw3 cancel-all --exchange kucoin --pair SOL/USDT --yes

close sends a reduce-only market order. cancel-all requires an explicit pair and only touches orders on that pair.

Protect a position while you are away #

bash
jw3 trail --pair SOL/USDT --side long --size 5 --activation-pct 0.25 \
  --bounceback-pct 0.08 --polls 600 --yes

trail arms once price moves in your favour by the activation percentage, tracks the peak, and market-closes on the configured bounce back. Without --yes it logs what it would do and keeps watching — a good way to validate the thresholds first.

For a long-running setup, run the supervisor instead of a raw CLI process:

bash
jw3d supervise --trail SOL/USDT:long:5 --heartbeat-sec 15

The supervisor restarts children, writes a heartbeat file and rotates logs. Children run in dry-run unless you pass --allow-live and set yes: true in the manifest.

Safeguards you will meet #

MessageMeaning
unauthorized / missing scopeThe token lacks trade:execute; mint a new one
kill switchExecution is disabled in the app; nothing was sent
autonomyAccount is set to propose-only; execution is refused
cap exceededThe order is larger than a configured limit
fee-aware stop gateThe stop is too close to cover fees; widen it

Every refusal happens before anything reaches the venue. If the server says no, the order was not placed — check the app before retrying.

Idempotency and chasing #

  • --idempotency-key <key> makes a retry safe: the same key will not place a second

order.

  • --chase SECS re-quotes a limit order toward the market for up to SECS;

--chase-max N caps the attempts and --chase-take allows taking the touch.

Both are for limit orders where fill quality matters more than speed.

A conservative workflow #

bash
jw3 risk                                     # confirm limits and kill switch
jw3 positions --exchange kucoin              # know what is already open
jw3 scalp plan --pair SOL/USDT --long --size 15
jw3 execute --exchange kucoin --pair SOL/USDT --side buy --risk-usd 4 --stop 138.2 --yes
jw3 exits --exchange kucoin --pair SOL/USDT --sl 138.2 --tp 145 --yes
jw3 trail --pair SOL/USDT --side long --size 5 --yes

Plan first, preview second, execute last — and keep trade:execute off the token you use for everything else.

Checklist

  • trade:execute token minted only when you need it
  • Risk limits set in the app first
  • Preview read before every --yes

Related documents