← Back to blog

Execution

Orders That Leave the Exchange

On-chain brackets without living in a browser wallet

prepare · sign · relay · exposure checks

July 5, 2026 · 9 min read

CEX integration is REST and ccxt. On-chain perps are a different species: collateral tokens, market addresses, express relays, and signatures you can't undo with a cancel endpoint.

Split brain by design

Signals need clean, fast OHLCV — usually a centralized perpetual feed. Execution goes to GMX on Arbitrum. The strategy JSON says data exchange and execution exchange explicitly. Mixing them without noticing is how you backtest one price and fill another.

Bracket flow (shape, not secrets)

  • Prepare batch via HTTP — entry, take-profit, stop-loss as one intent.
  • Sign typed data with the wallet key from env — never commit it, never log it.
  • Submit through relay — wait for acknowledgement, not vibes.
  • Before submit: check existing exposure and pending orders — duplicate guard with cooldown file.

Sizing from reality

Paper mode sizes from configured capital. GMX sizes from wallet USDC and risk-at-stop math — stop distance drives quantity, leverage falls out of margin requirements, minimum notional enforced. A $16 wallet produces tiny orders. That's correct, not a bug.

We dry-run the path first. When dry-run is off, the event log shows entries with stops and targets — same vocabulary as backtest trades, different transport.