perp-cli 0.12.17 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +247 -27
- package/dist/_stderr-filter.js +0 -1
- package/dist/agent-wallet/lighter-keystore.d.ts +11 -0
- package/dist/agent-wallet/lighter-keystore.js +92 -10
- package/dist/agent-wallet/passphrase.d.ts +1 -1
- package/dist/agent-wallet/passphrase.js +16 -3
- package/dist/agent-wallet/store.d.ts +37 -4
- package/dist/agent-wallet/store.js +132 -0
- package/dist/agent-wallet/venue-keystore.d.ts +14 -0
- package/dist/agent-wallet/venue-keystore.js +121 -0
- package/dist/api/public/hyperliquid.js +4 -4
- package/dist/api/public/lighter.js +5 -5
- package/dist/api/public/pacifica.d.ts +0 -1
- package/dist/api/public/pacifica.js +4 -13
- package/dist/api/public/urls.d.ts +9 -1
- package/dist/api/public/urls.js +35 -13
- package/dist/arb/file-lock.d.ts +11 -0
- package/dist/arb/file-lock.js +74 -0
- package/dist/arb/index.d.ts +2 -2
- package/dist/arb/index.js +2 -2
- package/dist/arb/pending-entry.d.ts +32 -0
- package/dist/arb/pending-entry.js +77 -0
- package/dist/arb/sizing.d.ts +6 -13
- package/dist/arb/sizing.js +12 -51
- package/dist/arb/state.d.ts +45 -12
- package/dist/arb/state.js +214 -42
- package/dist/arb/utils.d.ts +20 -6
- package/dist/arb/utils.js +43 -39
- package/dist/bot/conditions.d.ts +4 -4
- package/dist/bot/conditions.js +11 -6
- package/dist/bot/config.d.ts +17 -1
- package/dist/bot/config.js +48 -12
- package/dist/bot/engine.d.ts +61 -2
- package/dist/bot/engine.js +610 -144
- package/dist/bot/fill-size.d.ts +7 -0
- package/dist/bot/fill-size.js +18 -0
- package/dist/bot/index.d.ts +1 -1
- package/dist/bot/index.js +1 -1
- package/dist/bot/perp-order.d.ts +99 -0
- package/dist/bot/perp-order.js +299 -0
- package/dist/bot/presets.d.ts +7 -0
- package/dist/bot/presets.js +17 -0
- package/dist/bot/quarantine.d.ts +75 -0
- package/dist/bot/quarantine.js +190 -0
- package/dist/bot/quote-rules.d.ts +23 -0
- package/dist/bot/quote-rules.js +69 -0
- package/dist/bot/strategies/avellaneda-mm.d.ts +32 -2
- package/dist/bot/strategies/avellaneda-mm.js +72 -70
- package/dist/bot/strategies/basis-arb.js +2 -0
- package/dist/bot/strategies/dca-strategy.d.ts +2 -0
- package/dist/bot/strategies/dca-strategy.js +5 -0
- package/dist/bot/strategies/funding-arb-strategy.d.ts +43 -3
- package/dist/bot/strategies/funding-arb-strategy.js +571 -380
- package/dist/bot/strategies/funding-arb-utils.d.ts +48 -23
- package/dist/bot/strategies/funding-arb-utils.js +159 -195
- package/dist/bot/strategies/funding-arb-v2.d.ts +32 -0
- package/dist/bot/strategies/funding-arb-v2.js +258 -47
- package/dist/bot/strategies/funding-auto.js +215 -194
- package/dist/bot/strategies/spot-perp-arb-strategy.d.ts +14 -0
- package/dist/bot/strategies/spot-perp-arb-strategy.js +217 -50
- package/dist/bot/strategies/spot-perp-executor.d.ts +73 -19
- package/dist/bot/strategies/spot-perp-executor.js +319 -120
- package/dist/bot/strategies/spot-perp-state.d.ts +43 -0
- package/dist/bot/strategies/spot-perp-state.js +70 -0
- package/dist/bot/strategy-types.d.ts +6 -0
- package/dist/bot/tui/BotDashboard.d.ts +7 -2
- package/dist/bot/tui/BotDashboard.js +6 -3
- package/dist/bridge-engine.d.ts +120 -19
- package/dist/bridge-engine.js +710 -422
- package/dist/bridge-signers.d.ts +54 -0
- package/dist/bridge-signers.js +161 -0
- package/dist/cache.d.ts +4 -1
- package/dist/cache.js +11 -0
- package/dist/cli-flags.d.ts +50 -0
- package/dist/cli-flags.js +104 -0
- package/dist/cli-program.d.ts +35 -0
- package/dist/cli-program.js +303 -0
- package/dist/cli-spec.js +1 -1
- package/dist/client-id-tracker.js +11 -2
- package/dist/commands/account.d.ts +7 -1
- package/dist/commands/account.js +70 -92
- package/dist/commands/agent-import.d.ts +114 -0
- package/dist/commands/agent-import.js +794 -0
- package/dist/commands/agent.d.ts +232 -2
- package/dist/commands/agent.js +1858 -955
- package/dist/commands/alerts.d.ts +1 -0
- package/dist/commands/alerts.js +31 -28
- package/dist/commands/arb/index.d.ts +60 -1
- package/dist/commands/arb/index.js +381 -384
- package/dist/commands/arb-auto.d.ts +132 -4
- package/dist/commands/arb-auto.js +1474 -967
- package/dist/commands/arb.d.ts +3 -1
- package/dist/commands/arb.js +62 -30
- package/dist/commands/bot.js +127 -47
- package/dist/commands/bridge.d.ts +2 -1
- package/dist/commands/bridge.js +339 -192
- package/dist/commands/builder.d.ts +55 -0
- package/dist/commands/builder.js +387 -0
- package/dist/commands/funds-onchain.d.ts +32 -0
- package/dist/commands/funds-onchain.js +248 -0
- package/dist/commands/funds.d.ts +25 -0
- package/dist/commands/funds.js +925 -245
- package/dist/commands/history.js +102 -54
- package/dist/commands/init.d.ts +107 -15
- package/dist/commands/init.js +1116 -249
- package/dist/commands/jobs.d.ts +2 -1
- package/dist/commands/jobs.js +77 -15
- package/dist/commands/manage.js +136 -91
- package/dist/commands/market.d.ts +4 -1
- package/dist/commands/market.js +35 -32
- package/dist/commands/outcome.d.ts +10 -0
- package/dist/commands/outcome.js +396 -0
- package/dist/commands/plan.js +52 -12
- package/dist/commands/portfolio.d.ts +1 -0
- package/dist/commands/portfolio.js +60 -72
- package/dist/commands/rebalance.d.ts +2 -1
- package/dist/commands/rebalance.js +33 -43
- package/dist/commands/risk.js +46 -19
- package/dist/commands/settings.d.ts +1 -0
- package/dist/commands/settings.js +246 -51
- package/dist/commands/trade.d.ts +50 -0
- package/dist/commands/trade.js +1943 -695
- package/dist/commands/wallet.d.ts +30 -1
- package/dist/commands/wallet.js +357 -459
- package/dist/config.d.ts +60 -9
- package/dist/config.js +252 -82
- package/dist/constants.d.ts +29 -4
- package/dist/constants.js +62 -20
- package/dist/dashboard/server.d.ts +2 -0
- package/dist/dashboard/server.js +9 -6
- package/dist/dashboard/ui.js +6 -4
- package/dist/dashboard/ws-feeds.js +20 -8
- package/dist/dex-asset-map.js +5 -3
- package/dist/errors.d.ts +122 -0
- package/dist/errors.js +194 -0
- package/dist/event-stream.js +75 -19
- package/dist/evm-master-tx.d.ts +59 -0
- package/dist/evm-master-tx.js +154 -0
- package/dist/exchanges/adapter-network.d.ts +10 -0
- package/dist/exchanges/adapter-network.js +10 -0
- package/dist/exchanges/arcus/adapter.d.ts +196 -0
- package/dist/exchanges/arcus/adapter.js +1092 -0
- package/dist/exchanges/arcus/agent.d.ts +55 -0
- package/dist/exchanges/arcus/agent.js +188 -0
- package/dist/exchanges/arcus/client.d.ts +63 -0
- package/dist/exchanges/arcus/client.js +285 -0
- package/dist/exchanges/arcus/public.d.ts +65 -0
- package/dist/exchanges/arcus/public.js +138 -0
- package/dist/exchanges/arcus/signing.d.ts +176 -0
- package/dist/exchanges/arcus/signing.js +288 -0
- package/dist/exchanges/arcus/spot-chain.d.ts +60 -0
- package/dist/exchanges/arcus/spot-chain.js +241 -0
- package/dist/exchanges/arcus/spot-router.d.ts +177 -0
- package/dist/exchanges/arcus/spot-router.js +183 -0
- package/dist/exchanges/arcus/spot.d.ts +109 -0
- package/dist/exchanges/arcus/spot.js +645 -0
- package/dist/exchanges/aster-funds.d.ts +127 -0
- package/dist/exchanges/aster-funds.js +252 -0
- package/dist/exchanges/aster-nonce.d.ts +2 -0
- package/dist/exchanges/aster-nonce.js +107 -0
- package/dist/exchanges/aster-spot.d.ts +117 -0
- package/dist/exchanges/aster-spot.js +686 -0
- package/dist/exchanges/aster-typed-data.d.ts +133 -7
- package/dist/exchanges/aster-typed-data.js +121 -7
- package/dist/exchanges/aster.d.ts +240 -6
- package/dist/exchanges/aster.js +1139 -195
- package/dist/exchanges/builder-fee.d.ts +254 -0
- package/dist/exchanges/builder-fee.js +421 -0
- package/dist/exchanges/canonical-symbols.d.ts +32 -0
- package/dist/exchanges/canonical-symbols.js +96 -0
- package/dist/exchanges/capabilities.d.ts +7 -1
- package/dist/exchanges/capabilities.js +7 -0
- package/dist/exchanges/hl-signing.d.ts +165 -0
- package/dist/exchanges/hl-signing.js +158 -0
- package/dist/exchanges/hyperliquid-outcome.d.ts +211 -0
- package/dist/exchanges/hyperliquid-outcome.js +646 -0
- package/dist/exchanges/hyperliquid-spot.d.ts +44 -5
- package/dist/exchanges/hyperliquid-spot.js +308 -117
- package/dist/exchanges/hyperliquid.d.ts +462 -57
- package/dist/exchanges/hyperliquid.js +1575 -449
- package/dist/exchanges/index.d.ts +6 -0
- package/dist/exchanges/index.js +4 -0
- package/dist/exchanges/interface.d.ts +63 -10
- package/dist/exchanges/interface.js +18 -3
- package/dist/exchanges/ioc-outcome.d.ts +44 -0
- package/dist/exchanges/ioc-outcome.js +57 -0
- package/dist/exchanges/legacy-trading-v2.d.ts +39 -0
- package/dist/exchanges/legacy-trading-v2.js +940 -0
- package/dist/exchanges/lighter-public.d.ts +43 -0
- package/dist/exchanges/lighter-public.js +276 -0
- package/dist/exchanges/lighter-rh-deposit.d.ts +62 -0
- package/dist/exchanges/lighter-rh-deposit.js +185 -0
- package/dist/exchanges/lighter-signer.d.ts +123 -0
- package/dist/exchanges/lighter-signer.js +215 -0
- package/dist/exchanges/lighter-spot.d.ts +91 -13
- package/dist/exchanges/lighter-spot.js +595 -233
- package/dist/exchanges/lighter.d.ts +611 -39
- package/dist/exchanges/lighter.js +1890 -649
- package/dist/exchanges/ondo/adapter.d.ts +152 -0
- package/dist/exchanges/ondo/adapter.js +811 -0
- package/dist/exchanges/ondo/agent.d.ts +31 -0
- package/dist/exchanges/ondo/agent.js +101 -0
- package/dist/exchanges/ondo/client.d.ts +60 -0
- package/dist/exchanges/ondo/client.js +297 -0
- package/dist/exchanges/ondo/funds.d.ts +95 -0
- package/dist/exchanges/ondo/funds.js +198 -0
- package/dist/exchanges/ondo/public.d.ts +95 -0
- package/dist/exchanges/ondo/public.js +214 -0
- package/dist/exchanges/ondo/spot.d.ts +127 -0
- package/dist/exchanges/ondo/spot.js +392 -0
- package/dist/exchanges/outcome-interface.d.ts +140 -0
- package/dist/exchanges/outcome-interface.js +16 -0
- package/dist/exchanges/pacifica-spot.d.ts +83 -0
- package/dist/exchanges/pacifica-spot.js +324 -0
- package/dist/exchanges/pacifica-typed-data.d.ts +30 -13
- package/dist/exchanges/pacifica-typed-data.js +57 -9
- package/dist/exchanges/pacifica.d.ts +293 -4
- package/dist/exchanges/pacifica.js +1044 -90
- package/dist/exchanges/precision.d.ts +47 -0
- package/dist/exchanges/precision.js +209 -0
- package/dist/exchanges/qfex/adapter.d.ts +341 -0
- package/dist/exchanges/qfex/adapter.js +1386 -0
- package/dist/exchanges/qfex/agent.d.ts +58 -0
- package/dist/exchanges/qfex/agent.js +188 -0
- package/dist/exchanges/qfex/client.d.ts +54 -0
- package/dist/exchanges/qfex/client.js +138 -0
- package/dist/exchanges/qfex/errors.d.ts +70 -0
- package/dist/exchanges/qfex/errors.js +236 -0
- package/dist/exchanges/qfex/public.d.ts +122 -0
- package/dist/exchanges/qfex/public.js +268 -0
- package/dist/exchanges/qfex/signing.d.ts +160 -0
- package/dist/exchanges/qfex/signing.js +283 -0
- package/dist/exchanges/qfex/ws-transport.d.ts +294 -0
- package/dist/exchanges/qfex/ws-transport.js +798 -0
- package/dist/exchanges/rate-limiter.d.ts +12 -0
- package/dist/exchanges/rate-limiter.js +64 -0
- package/dist/exchanges/registry.d.ts +14 -2
- package/dist/exchanges/registry.js +20 -32
- package/dist/exchanges/slippage.d.ts +37 -0
- package/dist/exchanges/slippage.js +70 -0
- package/dist/exchanges/spot-factory.d.ts +166 -0
- package/dist/exchanges/spot-factory.js +431 -0
- package/dist/exchanges/spot-interface.d.ts +98 -4
- package/dist/exchanges/spot-interface.js +27 -1
- package/dist/exchanges/spot-result.d.ts +79 -0
- package/dist/exchanges/spot-result.js +273 -0
- package/dist/exchanges/trading-v2.d.ts +117 -0
- package/dist/exchanges/trading-v2.js +301 -0
- package/dist/exchanges/venue-types.d.ts +231 -0
- package/dist/exchanges/venue-types.js +87 -0
- package/dist/exchanges/venue.d.ts +211 -0
- package/dist/exchanges/venue.js +132 -0
- package/dist/exchanges/venues/arcus.d.ts +8 -0
- package/dist/exchanges/venues/arcus.js +109 -0
- package/dist/exchanges/venues/aster.d.ts +49 -0
- package/dist/exchanges/venues/aster.js +176 -0
- package/dist/exchanges/venues/create-helpers.d.ts +18 -0
- package/dist/exchanges/venues/create-helpers.js +199 -0
- package/dist/exchanges/venues/hyperliquid.d.ts +23 -0
- package/dist/exchanges/venues/hyperliquid.js +126 -0
- package/dist/exchanges/venues/index.d.ts +16 -0
- package/dist/exchanges/venues/index.js +26 -0
- package/dist/exchanges/venues/lighter-family.d.ts +92 -0
- package/dist/exchanges/venues/lighter-family.js +166 -0
- package/dist/exchanges/venues/lighter-rh.d.ts +7 -0
- package/dist/exchanges/venues/lighter-rh.js +58 -0
- package/dist/exchanges/venues/lighter.d.ts +6 -0
- package/dist/exchanges/venues/lighter.js +55 -0
- package/dist/exchanges/venues/ondo.d.ts +29 -0
- package/dist/exchanges/venues/ondo.js +136 -0
- package/dist/exchanges/venues/pacifica.d.ts +8 -0
- package/dist/exchanges/venues/pacifica.js +95 -0
- package/dist/exchanges/venues/qfex.d.ts +39 -0
- package/dist/exchanges/venues/qfex.js +140 -0
- package/dist/execution-log.js +10 -2
- package/dist/funding/legacy-public.d.ts +31 -0
- package/dist/funding/legacy-public.js +369 -0
- package/dist/funding/normalize.d.ts +28 -16
- package/dist/funding/normalize.js +61 -29
- package/dist/funding/rates.d.ts +46 -11
- package/dist/funding/rates.js +228 -277
- package/dist/guardrail/perp-guardrail.js +0 -0
- package/dist/index.js +156 -684
- package/dist/jobs.d.ts +84 -6
- package/dist/jobs.js +239 -41
- package/dist/landing.d.ts +7 -2
- package/dist/landing.js +19 -3
- package/dist/mcp-server.d.ts +14 -4
- package/dist/mcp-server.js +821 -403
- package/dist/mcp-trade-guard.d.ts +16 -0
- package/dist/mcp-trade-guard.js +59 -0
- package/dist/onchain-balances.d.ts +40 -0
- package/dist/onchain-balances.js +173 -0
- package/dist/pacifica/client.d.ts +41 -10
- package/dist/pacifica/client.js +167 -63
- package/dist/pacifica/constants.d.ts +0 -1
- package/dist/pacifica/constants.js +0 -5
- package/dist/pacifica/deposit.d.ts +30 -3
- package/dist/pacifica/deposit.js +119 -2
- package/dist/pacifica/faucet.d.ts +29 -0
- package/dist/pacifica/faucet.js +100 -0
- package/dist/pacifica/sign-tx.d.ts +15 -0
- package/dist/pacifica/sign-tx.js +41 -0
- package/dist/pacifica/types/account.d.ts +28 -4
- package/dist/pacifica/types/lake.d.ts +20 -5
- package/dist/pacifica/types/lake.js +4 -0
- package/dist/pacifica/types/market.d.ts +5 -0
- package/dist/pacifica/types/order.d.ts +4 -1
- package/dist/pacifica/types/position.d.ts +9 -1
- package/dist/plan-executor.d.ts +10 -5
- package/dist/plan-executor.js +165 -54
- package/dist/position-history.js +13 -0
- package/dist/rebalance.d.ts +26 -2
- package/dist/rebalance.js +86 -7
- package/dist/relay-swap.d.ts +232 -0
- package/dist/relay-swap.js +630 -0
- package/dist/risk.js +5 -1
- package/dist/secret-env.d.ts +15 -0
- package/dist/secret-env.js +36 -0
- package/dist/settings.d.ts +169 -6
- package/dist/settings.js +219 -38
- package/dist/signer/ows-evm.d.ts +13 -0
- package/dist/signer/ows-evm.js +22 -0
- package/dist/smart-order.d.ts +9 -0
- package/dist/smart-order.js +53 -8
- package/dist/strategies/dca.d.ts +6 -2
- package/dist/strategies/dca.js +66 -26
- package/dist/strategies/funding-arb.d.ts +11 -1
- package/dist/strategies/funding-arb.js +202 -89
- package/dist/strategies/grid.d.ts +31 -0
- package/dist/strategies/grid.js +89 -11
- package/dist/strategies/pending-stop.d.ts +8 -0
- package/dist/strategies/pending-stop.js +12 -0
- package/dist/strategies/split-order.d.ts +45 -17
- package/dist/strategies/split-order.js +157 -91
- package/dist/strategies/trailing-stop.d.ts +2 -1
- package/dist/strategies/trailing-stop.js +52 -6
- package/dist/strategies/twap.d.ts +6 -1
- package/dist/strategies/twap.js +39 -11
- package/dist/trade-validator.d.ts +22 -0
- package/dist/trade-validator.js +119 -15
- package/dist/utils/numeric.d.ts +46 -0
- package/dist/utils/numeric.js +79 -0
- package/dist/utils.d.ts +19 -0
- package/dist/utils.js +96 -19
- package/dist/withdraw-gate.d.ts +49 -0
- package/dist/withdraw-gate.js +131 -0
- package/package.json +15 -6
- package/skills/perp-cli/SKILL.md +159 -55
- package/skills/perp-cli/references/agent-operations.md +112 -58
- package/skills/perp-cli/references/commands.md +269 -73
- package/skills/perp-cli/references/strategies.md +34 -31
- package/skills/perp-cli/scripts/arb-monitor.sh +10 -5
- package/skills/perp-cli/scripts/funding-analysis.sh +14 -9
- package/skills/perp-cli/scripts/preflight.sh +21 -14
- package/skills/perp-cli/scripts/spot-perp-scan.sh +12 -7
- package/skills/perp-cli/scripts/validate-arb.sh +31 -15
- package/vendor/lighter-signer/SHA256SUMS +2 -0
- package/vendor/lighter-signer/VERSION +8 -0
- package/vendor/lighter-signer/lighter-signer.wasm +0 -0
- package/vendor/lighter-signer/wasm_exec.js +575 -0
- package/dist/bot/strategies/funding-arb-v2-strategy.d.ts +0 -42
- package/dist/bot/strategies/funding-arb-v2-strategy.js +0 -864
|
@@ -4,7 +4,10 @@ All commands support `--json` for structured output. Always use `--json` when ca
|
|
|
4
4
|
|
|
5
5
|
## Global Flags
|
|
6
6
|
|
|
7
|
-
`--json` (required for agents) | `-e <
|
|
7
|
+
`--json` (required for agents) | `-e <venue>` | `-n mainnet|testnet` | `--dry-run` (only commands whose `--help` says "supports --dry-run"; others refuse with `INVALID_PARAMS`) | `--fields <f1,f2>` | `--ndjson` | `-w, --wallet <name>` | `--ows <name>` (OWS wallet) | `--no-agent` (skip agent-key routing) | `--no-builder` | `--dex <name>` (HIP-3, Hyperliquid)
|
|
8
|
+
|
|
9
|
+
Venues (`-e`, id | aliases): `pacifica|pac`, `hyperliquid|hl`, `lighter|lt`, `lighter-rh|lrh|rh`, `aster|ast`, `ondo|ondo-perps`, `arcus`, `qfex|qf`. Default = `settings.defaultExchange`, else `pacifica` — always pass `-e`.
|
|
10
|
+
`-k <key>` is rejected (keys only via stdin / OWS vault). `--passphrase` is deprecated → `OWS_PASSPHRASE` env or stdin.
|
|
8
11
|
|
|
9
12
|
## Market Data (read-only, safe)
|
|
10
13
|
```bash
|
|
@@ -16,12 +19,14 @@ perp --json -e <EX> market book <SYMBOL> # orderbook (bids/asks)
|
|
|
16
19
|
perp --json -e <EX> market trades <SYMBOL> # recent trades
|
|
17
20
|
perp --json -e <EX> market funding <SYMBOL> # funding rate history
|
|
18
21
|
perp --json -e <EX> market kline <SYM> <INT> # OHLCV candles (1m,5m,15m,1h,4h,1d)
|
|
19
|
-
perp --json market hip3
|
|
22
|
+
perp --json -e hyperliquid market hip3 # list HIP-3 deployed perp dexes (needs -e hyperliquid; other -e → INVALID_PARAMS)
|
|
23
|
+
perp --json -e hyperliquid --dex <DEX> market list # one HIP-3 dex's markets (e.g. --dex xyz)
|
|
24
|
+
perp --json -e hyperliquid --dex <DEX> market book <SYMBOL> # any market/account/trade command takes --dex the same way
|
|
20
25
|
```
|
|
21
26
|
|
|
22
27
|
## Account (read-only, safe)
|
|
23
28
|
```bash
|
|
24
|
-
perp --json -e <
|
|
29
|
+
perp --json portfolio -e <VENUE_ID> # perp balance + spot holdings + 24h funding; venue id or alias (hl, lt, …)
|
|
25
30
|
perp --json -e <EX> account positions # open positions
|
|
26
31
|
perp --json -e <EX> account orders # open/pending orders
|
|
27
32
|
perp --json -e <EX> account history # order history
|
|
@@ -41,7 +46,10 @@ perp --json portfolio --arb # full dashboard with arb top 5
|
|
|
41
46
|
perp --json -e <EX> trade market <SYMBOL> <buy|sell> <SIZE>
|
|
42
47
|
perp --json -e <EX> trade buy <SYMBOL> <SIZE> # shorthand market buy
|
|
43
48
|
perp --json -e <EX> trade sell <SYMBOL> <SIZE> # shorthand market sell
|
|
44
|
-
perp --json -e <EX> trade buy <SYM> <SIZE> --smart # IOC limit at best ask
|
|
49
|
+
perp --json -e <EX> trade buy <SYM> <SIZE> --smart # IOC limit at best ask + 1 tick — pacifica/hyperliquid/lighter/aster only; not with --tp/--sl or a client id
|
|
50
|
+
perp --json -e <EX> trade buy <SYM> <SIZE> --client-id <id> # reused id → ok:true, data.duplicate:true (local ~/.perp/client-ids.jsonl; nothing sent)
|
|
51
|
+
# id formats: pacifica full UUID; hyperliquid 0x+32 hex; lighter(-rh) integer; qfex refuses --client-id (use --auto-id)
|
|
52
|
+
# Opening orders: --force bypasses the local risk limits (user consent only; never quarantine)
|
|
45
53
|
|
|
46
54
|
# Split execution (orderbook-aware, for large orders)
|
|
47
55
|
perp --json -e <EX> trade split <SYMBOL> <buy|sell> <USD>
|
|
@@ -49,17 +57,19 @@ perp --json -e <EX> trade split <SYM> buy 5000 --max-slippage 0.5 --max-slices 5
|
|
|
49
57
|
perp --json -e <EX> trade market <SYM> buy <SIZE> --split # split via flag
|
|
50
58
|
|
|
51
59
|
# Limit / stop / TPSL
|
|
52
|
-
perp --json -e <EX> trade limit <SYMBOL> <buy|sell> <PRICE> <SIZE>
|
|
53
|
-
perp --json -e <EX> trade stop <SYMBOL> <SIDE> <SIZE> <STOP_PRICE>
|
|
54
|
-
perp --json -e <EX> trade tpsl <SYMBOL> <
|
|
60
|
+
perp --json -e <EX> trade limit <SYMBOL> <buy|sell> <PRICE> <SIZE> [--tif GTC|IOC|FOK|ALO] # default GTC on every venue; off-grid price → INVALID_TICK (never rounded)
|
|
61
|
+
perp --json -e <EX> trade stop <SYMBOL> <SIDE> <SIZE> <STOP_PRICE> # reduce-only by default; --no-reduce-only to open (refused on ondo / qfex)
|
|
62
|
+
perp --json -e <EX> trade tpsl <SYMBOL> <long|short> --tp <P> --sl <P> # positionSide = the open position's side
|
|
63
|
+
perp --json -e <EX> trade buy <SYMBOL> <SIZE> --tp <P> --sl <P> # entry protected by TP/SL (verified fill)
|
|
55
64
|
|
|
56
65
|
# Order management
|
|
57
66
|
perp --json -e <EX> trade edit <SYMBOL> <ORDER_ID> <PRICE> <SIZE>
|
|
58
67
|
perp --json -e <EX> trade cancel <SYMBOL_OR_ORDER_ID> [orderId]
|
|
59
68
|
perp --json -e <EX> trade cancel-all
|
|
60
|
-
perp --json -e <EX> trade cancel-stop <SYMBOL> <STOP_ORDER_ID>
|
|
69
|
+
perp --json -e <EX> trade cancel-stop <SYMBOL> <STOP_ORDER_ID> # pacifica / qfex only; other venues: trade cancel
|
|
61
70
|
perp --json -e <EX> trade cancel-twap <SYMBOL> <TWAP_ORDER_ID>
|
|
62
|
-
perp --json -e <EX> trade status <ORDER_ID
|
|
71
|
+
perp --json -e <EX> trade status <ORDER_ID|c:<CLIENT_ID>> [--symbol <SYM>]
|
|
72
|
+
# --symbol required on ondo / arcus / qfex, and for c:<id> on lighter / lighter-rh / aster
|
|
63
73
|
perp --json -e <EX> trade fills [SYMBOL] # recent fills
|
|
64
74
|
|
|
65
75
|
# Pre-flight validation
|
|
@@ -76,19 +86,100 @@ perp --json -e <EX> trade leverage <SYMBOL> <N> [--isolated]
|
|
|
76
86
|
|
|
77
87
|
# Advanced orders
|
|
78
88
|
perp --json -e <EX> trade scale-tp <SYMBOL> --levels '<P1>:<PCT>,<P2>:<PCT>'
|
|
79
|
-
perp --json -e <EX> trade scale-in <SYMBOL> <SIDE> --levels '<P1>:<
|
|
89
|
+
perp --json -e <EX> trade scale-in <SYMBOL> <SIDE> --levels '<P1>:<PCT>,<P2>:<PCT>' (--size-usd <USD> | --size <BASE>) # percents sum to 100
|
|
80
90
|
perp --json -e <EX> trade pnl-track # real-time PnL tracker
|
|
81
|
-
perp --json trade twap <SYMBOL> <SIDE> <SIZE> <DURATION>
|
|
91
|
+
perp --json -e <EX> trade twap <SYMBOL> <SIDE> <SIZE> <DURATION> # Pacifica: seconds (native), HL: minutes (native, min $100); others client-side: --background [--slices <n>]
|
|
82
92
|
|
|
83
|
-
# Spot helpers (
|
|
93
|
+
# Spot helpers (any venue with spot)
|
|
84
94
|
perp --json -e <EX> trade spot-buy <SYMBOL> <SIZE>
|
|
85
95
|
perp --json -e <EX> trade spot-sell <SYMBOL> <SIZE>
|
|
96
|
+
perp --json -e <EX> trade spot-limit <SYMBOL> <SIDE> <PRICE> <SIZE> [--tif <tif>]
|
|
97
|
+
perp --json -e <EX> trade spot-cancel <SYMBOL> <ORDER_ID>
|
|
98
|
+
perp --json -e <EX> trade spot-orders [SYMBOL]
|
|
99
|
+
perp --json -e <EX> trade spot-transfer <to-spot|to-perp> <AMOUNT>
|
|
86
100
|
perp --json -e <EX> trade spot-balance
|
|
87
101
|
|
|
88
|
-
# Multi-leg
|
|
102
|
+
# Multi-leg execution (legs exchange:symbol:side:size; failed legs rolled back; unconfirmed leg → quarantined; no --dry-run)
|
|
89
103
|
perp --json trade multi <legs...>
|
|
90
104
|
```
|
|
91
105
|
|
|
106
|
+
## Outcome Markets (Hyperliquid HIP-4)
|
|
107
|
+
|
|
108
|
+
Fully-collateralized binary/range contracts on Hyperliquid. Each outcome's quote token comes from `outcomeMeta.quoteToken` (`outcome list` shows it; USDC on every listed outcome as of 2026-10-12), held on Hyperliquid spot. No leverage / no liquidation. Minimum order value 10 quote tokens (price × shares ≥ 10). Sizes are whole shares.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# List active outcome markets — parses the description string into
|
|
112
|
+
# class / underlying / expiry / targetPrice / period and lists each side
|
|
113
|
+
# with mid + assetId.
|
|
114
|
+
perp --json outcome list
|
|
115
|
+
|
|
116
|
+
# COMBINED VIEW — all sides' books in parallel + underlying mark price
|
|
117
|
+
# (HL perp mid for `description.underlying`) + gap vs targetPrice + ms
|
|
118
|
+
# until expiry + per-side implied probability. For a binary market the
|
|
119
|
+
# symmetric structure means Yes BID + No ASK ≈ 1.0; this is the
|
|
120
|
+
# preferred entry point for agents that need a single snapshot.
|
|
121
|
+
perp --json outcome view <outcome> [--depth N=10]
|
|
122
|
+
|
|
123
|
+
# Orderbook for ONE side only (use `view` if you want both at once).
|
|
124
|
+
# <side> accepts: 0/1, Yes/No, or #<enc> / +<enc> (the encoded form
|
|
125
|
+
# must match the outcome arg — mismatch throws INVALID_PARAMS).
|
|
126
|
+
perp --json outcome book <outcome> <side> [--depth N=10]
|
|
127
|
+
|
|
128
|
+
# Holdings + open orders.
|
|
129
|
+
perp --json outcome positions
|
|
130
|
+
perp --json outcome orders
|
|
131
|
+
|
|
132
|
+
# Place orders. ALWAYS dry-run first. [usd] = notional in the quote token, or --size <shares>; sell also --all.
|
|
133
|
+
perp --json --dry-run outcome buy <outcome> <side> <usd>
|
|
134
|
+
perp --json --dry-run outcome sell <outcome> <side> --all
|
|
135
|
+
|
|
136
|
+
# Live execution. --limit makes it GTC; without --limit it's IoC at best ask +5% (cap 1) / best bid -5%.
|
|
137
|
+
perp --json outcome buy <outcome> <side> [<usd> | --size <shares>] [--limit <px>] [--tif gtc|ioc|alo]
|
|
138
|
+
perp --json outcome sell <outcome> <side> [<usd> | --size <shares> | --all] [--limit <px>] [--tif gtc|ioc|alo]
|
|
139
|
+
|
|
140
|
+
# Cancel a resting order.
|
|
141
|
+
perp --json outcome cancel <outcome> <side> <oid>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Identifier model
|
|
145
|
+
|
|
146
|
+
Same outcome side can be referenced 5 ways — the CLI normalises:
|
|
147
|
+
|
|
148
|
+
| Form | Example (BTC daily Yes) |
|
|
149
|
+
|---|---|
|
|
150
|
+
| `<outcome>, <side>` integer | `1, 0` |
|
|
151
|
+
| `<outcome>, <side>` name | `1, yes` |
|
|
152
|
+
| `#<enc>` (l2Book / candle / allMids coin) | `#10` |
|
|
153
|
+
| `+<enc>` (spotClearinghouseState balance coin) | `+10` |
|
|
154
|
+
| asset id (HL `/exchange` payload) | `100000010` |
|
|
155
|
+
|
|
156
|
+
Encoding formula: `enc = 10 * outcome + side`; asset id = `100,000,000 + enc`.
|
|
157
|
+
|
|
158
|
+
### Foot-guns enforced (Rule #2)
|
|
159
|
+
|
|
160
|
+
- **Min notional:** `price * size < 10` quote tokens → `INVALID_PARAMS`. Enforced in dry-run too. A trade leaving a remainder worth < 10 warns (it cannot be sold alone — use `sell --all`); selling more than held → `SIZE_TOO_LARGE`.
|
|
161
|
+
- **Encoded-side mismatch:** `outcome buy 2 #10` (where `#10` decodes to outcome=1) → `INVALID_PARAMS`, never silently routes to outcome 2.
|
|
162
|
+
- **Insufficient quote token:** pre-checked before order send → `INSUFFICIENT_BALANCE` (hold the outcome's quote token on Hyperliquid spot).
|
|
163
|
+
- **Venue rejection:** HL returns HTTP 200 with `statuses[0].error` even when an order is rejected; the CLI raises `ORDER_REJECTED` (or `INSUFFICIENT_BALANCE`) so a "placed" message never masks a failure.
|
|
164
|
+
|
|
165
|
+
### Agent workflow recommendation
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
1. perp --json outcome list # discover markets, parse description
|
|
169
|
+
2. perp --json outcome view <outcome> # full snapshot: both books +
|
|
170
|
+
# underlying mark + gap vs target +
|
|
171
|
+
# implied probabilities + time to expiry
|
|
172
|
+
3. perp --json --dry-run outcome buy <outcome> <side> <usd>
|
|
173
|
+
# validate notional, get user approval
|
|
174
|
+
4. perp --json outcome buy <outcome> <side> <usd> [--limit <px>] [--tif ...]
|
|
175
|
+
# execute (only after explicit user OK)
|
|
176
|
+
5. perp --json outcome positions # confirm fill / monitor
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
`outcome view` replaces the old multi-call pattern (separate `book` + `market mid` lookups). One round-trip returns everything an agent needs to decide direction.
|
|
180
|
+
|
|
181
|
+
Settlement at `expiryMs` is venue-side: winning side → 1 quote token per share, losing → 0. Decide before expiry whether to self-close or let the venue settle.
|
|
182
|
+
|
|
92
183
|
## Funds (deposit, withdraw, transfer, bridge, rebalance)
|
|
93
184
|
|
|
94
185
|
All fund movement lives under `perp funds`.
|
|
@@ -100,10 +191,23 @@ perp --json funds deposit hyperliquid <AMOUNT>
|
|
|
100
191
|
perp --json funds deposit lighter ethereum <AMOUNT> # L1 direct (min 1 USDC)
|
|
101
192
|
perp --json funds deposit lighter cctp arbitrum <AMOUNT> # CCTP (min 5 USDC)
|
|
102
193
|
perp --json funds deposit lighter info # all Lighter deposit routes
|
|
103
|
-
perp --json funds withdraw pacifica <AMOUNT>
|
|
104
|
-
perp --json funds withdraw hyperliquid <AMOUNT>
|
|
105
|
-
|
|
106
|
-
|
|
194
|
+
perp --json funds withdraw pacifica <AMOUNT> # to your own Solana wallet
|
|
195
|
+
perp --json funds withdraw hyperliquid <AMOUNT> [--chain arbitrum|ethereum|base] [--to <allowlisted addr>]
|
|
196
|
+
# CCTP (native USDC) to your wallet (default arbitrum; 0.2 USDC forwarding fee on Arbitrum).
|
|
197
|
+
# --to another address only if it is on settings withdraw.hyperliquid (else POLICY_DENIED).
|
|
198
|
+
perp --json funds withdraw lighter <AMOUNT> # -e lighter: USDC → Ethereum; -e lighter-rh: USDG → Robinhood Chain
|
|
199
|
+
perp --json funds deposit lighter-rh <AMOUNT> # USDG on Robinhood Chain (min 1, mainnet only)
|
|
200
|
+
# Ondo Perps: NO API withdrawals — `funds withdraw ondo` → CAPABILITY_UNSUPPORTED; withdraw in the Ondo web app
|
|
201
|
+
perp --json funds withdraw arcus <AMOUNT> # USDG → the account owner (min 1)
|
|
202
|
+
perp --json funds deposit qfex # prints the USDC / Arbitrum One deposit address (sends nothing)
|
|
203
|
+
# QFEX: withdrawals disabled in perp-cli for now — `funds withdraw qfex` → CAPABILITY_UNSUPPORTED; withdraw in the QFEX web app
|
|
204
|
+
perp --json -e qfex funds transfer <AMOUNT> primary --from <account-uuid> # between your QFEX accounts
|
|
205
|
+
perp --json funds deposit aster <AMOUNT> [--chain bsc|arbitrum] [--asset USDT|USDC] # vault approve + deposit (mainnet; default BNB Chain USDT)
|
|
206
|
+
perp --json funds withdraw aster <AMOUNT> [--chain bsc|arbitrum] [--asset USDT|USDC] # → the account's own address (default USDT; mainnet; agent approved with --can-withdraw --ip-whitelist)
|
|
207
|
+
perp --json funds deposit ondo <AMOUNT> [--chain arbitrum|ethereum] [--probe <AMT>] # USDC transfer to the account's funding address (mainnet)
|
|
208
|
+
perp --json funds transfer <AMOUNT> <ADDRESS> # HL internal transfer (instant); destination must be on settings withdraw.hyperliquid
|
|
209
|
+
# settings withdraw.<venue> (allowlist + limits) is set ONLY by the user in an interactive terminal
|
|
210
|
+
# (--json / piped → POLICY_DENIED). Agents never set or change it.
|
|
107
211
|
perp --json funds info # combined routes & limits
|
|
108
212
|
```
|
|
109
213
|
|
|
@@ -112,18 +216,29 @@ perp --json funds info # combined routes &
|
|
|
112
216
|
perp --json funds bridge chains # supported chains
|
|
113
217
|
perp --json funds bridge quote --from <CHAIN> --to <CHAIN> --amount <AMT>
|
|
114
218
|
perp --json funds bridge send --from <CHAIN> --to <CHAIN> --amount <AMT>
|
|
115
|
-
perp --json funds bridge send --from <CHAIN> --to <CHAIN> --amount <AMT> --provider cctp
|
|
116
|
-
|
|
219
|
+
perp --json funds bridge send --from <CHAIN> --to <CHAIN> --amount <AMT> --provider cctp [--fast]
|
|
220
|
+
# exactly --amount leaves the wallet; deBridge nativeFee (ETH/SOL) is shown separately;
|
|
221
|
+
# Solana-origin deBridge → NO_BRIDGE_ROUTE (use --provider cctp)
|
|
222
|
+
# Relay swaps (chains: robinhood, arbitrum, bsc, base, solana as destination; EVM origin; OWS master signs; recipient = your own address)
|
|
223
|
+
perp --json --dry-run funds bridge send --from robinhood --to arbitrum --from-asset USDG --to-asset USDC --amount <AMT> # verified quote only
|
|
224
|
+
perp --json funds bridge send --from robinhood --to solana --from-asset USDG --to-asset SOL --amount <AMT> --min-out <SOL> # stable → native needs --min-out
|
|
225
|
+
perp --json funds bridge send --from arbitrum --to robinhood --from-asset ETH --to-asset ETH --amount <ETH> # native gas to Robinhood Chain
|
|
226
|
+
perp --json funds bridge exchange --from <EX> --to <EX> --amount <AMT> # pacifica|hyperliquid|lighter
|
|
227
|
+
# wallet → wallet: bridges the master's OWN USDC between the venues' chains (pacifica → solana,
|
|
228
|
+
# lighter → arbitrum); no venue withdraw/deposit. hyperliquid: --from spends HyperCore spot USDC,
|
|
229
|
+
# --to credits HyperCore perps. HyperCore → Solana → NO_BRIDGE_ROUTE.
|
|
117
230
|
perp --json funds bridge status <ORDER_ID>
|
|
118
231
|
```
|
|
119
232
|
|
|
120
|
-
### Inter-exchange rebalance (
|
|
233
|
+
### Inter-exchange rebalance (withdraw → bridge; deposit is manual)
|
|
121
234
|
```bash
|
|
122
235
|
perp --json funds rebalance check # balances across exchanges
|
|
123
236
|
perp --json funds rebalance plan # compute optimal moves
|
|
124
|
-
perp --json funds rebalance execute --auto-bridge
|
|
237
|
+
perp --json --dry-run funds rebalance execute --auto-bridge # status "simulated" (moves[].status "dry_run") or "balanced"
|
|
238
|
+
perp --json funds rebalance execute --auto-bridge # withdraw → bridge only (NO deposit)
|
|
125
239
|
perp --json funds rebalance execute --withdraw-only # only withdraw, manual rest
|
|
126
240
|
```
|
|
241
|
+
`ok:true` even if a move failed — check every `moves[].status`: `withdrawn` | `bridged` | `same_chain` | `needs_bridge` | `withdraw_failed` | `bridge_failed`. Then deposit by hand after arrival (`funds deposit <venue> <amt>`).
|
|
127
242
|
|
|
128
243
|
## Arbitrage
|
|
129
244
|
|
|
@@ -143,91 +258,139 @@ perp --json arb scan --compare <SYMBOL> # compare a symbol a
|
|
|
143
258
|
perp --json arb scan --positions # position funding impact
|
|
144
259
|
perp --json arb scan --live --interval 60 # continuous monitoring
|
|
145
260
|
perp --json arb scan --top 10 --hold-days 7 --bridge-cost 0 --size 100 # cost-aware filtering
|
|
261
|
+
perp --json arb scan --rates --include-unverified # also show QFEX (unverified funding; display only, never ranked)
|
|
262
|
+
# netSpread / grossSpread = annualized % (netSpread = gross minus round-trip costs amortized over --hold-days)
|
|
263
|
+
# spot-perp rows: netSpreadPct / grossSpreadPct, spotExchanges[], perpExchange, direction
|
|
146
264
|
|
|
147
|
-
# Execute (perp-perp or spot+perp via spot:<
|
|
265
|
+
# Execute (perp-perp or spot+perp via spot:<venue>; spot venues: hl, lt, lrh, aster, ondo)
|
|
266
|
+
# Sequential: long first, then the short sized to the verified long fill; reconcile always on;
|
|
267
|
+
# an unconfirmed leg quarantines the symbol. Supports --dry-run.
|
|
148
268
|
perp --json arb exec <SYM> <longEx> <shortEx> <USD> # perp-perp dual-leg entry
|
|
149
269
|
perp --json arb exec <SYM> spot:hl hl <USD> # spot+perp via HL spot
|
|
150
270
|
perp --json arb exec <SYM> spot:lt pac <USD> # spot+perp via LT spot
|
|
151
271
|
perp --json arb exec <SYM> <longEx> <shortEx> <USD> \
|
|
152
|
-
--leverage 2 --isolated --smart --
|
|
272
|
+
--leverage 2 --isolated --smart --max-slippage 0.5
|
|
153
273
|
|
|
154
274
|
# Close
|
|
155
275
|
perp --json arb close <SYM> # close perp-perp arb
|
|
156
276
|
perp --json arb close <SYM> --pair <longEx>:<shortEx> # disambiguate by pair
|
|
157
277
|
perp --json arb close <SYM> --spot-exch hl --perp-exch hl # close spot+perp legs
|
|
158
278
|
perp --json arb close <SYM> --smart # IOC limits at best price
|
|
279
|
+
perp --json arb close <SYM> --force # quarantined symbol — only after the user checked positions
|
|
280
|
+
perp --json arb close <SYM> --state-only --yes # drop a stale state entry (no order sent)
|
|
159
281
|
|
|
160
282
|
# Status / history / config / rebalance
|
|
161
|
-
perp --json arb status # open arb positions + PnL + funding
|
|
283
|
+
perp --json arb status # open arb positions + PnL + funding; check unconfirmedPairs, staleStateEntries
|
|
162
284
|
perp --json arb status --period 7 --symbol BTC # filter funding lookback / symbol
|
|
163
285
|
perp --json arb history # alias: arb log
|
|
164
286
|
perp --json arb history --period 30 # past arb trade performance
|
|
165
287
|
perp --json arb config # show arb defaults
|
|
166
|
-
perp --json arb rebalance --check # cross-exchange balance distribution
|
|
167
|
-
perp --json arb rebalance --target 50:50 --amount 1000
|
|
288
|
+
perp --json arb rebalance --check # cross-exchange balance distribution (read-only)
|
|
289
|
+
perp --json arb rebalance --target 50:50 --amount 1000 # plan only; execute with funds rebalance execute
|
|
168
290
|
|
|
169
291
|
# Auto-execute daemon
|
|
170
292
|
perp --json arb auto --min-spread 30 --close-spread 5 --size 100 --max-positions 5
|
|
171
293
|
perp --json arb auto --background # tmux session
|
|
172
294
|
perp --json arb auto --hip3 --min-oi 50000 --min-grade C # HIP-3 mode
|
|
173
|
-
perp --json
|
|
295
|
+
perp --json --dry-run arb auto # simulate (--background inherits it)
|
|
174
296
|
```
|
|
175
297
|
|
|
176
298
|
## Wallet Management
|
|
177
299
|
```bash
|
|
178
300
|
perp --json wallet generate evm # generate EVM wallet
|
|
179
301
|
perp --json wallet generate solana # generate Solana wallet
|
|
180
|
-
perp --json wallet import [
|
|
181
|
-
perp --json wallet set hl
|
|
182
|
-
perp --json wallet set pac
|
|
183
|
-
perp --json wallet set
|
|
184
|
-
perp --json wallet set aster <API_KEY> # set Aster API key
|
|
185
|
-
perp --json wallet set hl <KEY> --default # set + make default exchange
|
|
302
|
+
printf '%s' "$KEY" | OWS_PASSPHRASE=<pp> perp --json wallet import --name <n> [--chain evm|solana|dual] [--mnemonic] # import a key (stdin / hidden prompt; argv key, --evm/--solana <key>, --legacy rejected)
|
|
303
|
+
printf '%s' "$KEY" | OWS_PASSPHRASE=<pp> perp --json wallet set hl # import key (stdin / hidden prompt; argv key rejected) into OWS vault → active wallet
|
|
304
|
+
perp --json wallet set pac --name pac # Solana key, hidden prompt (TTY)
|
|
305
|
+
perp --json wallet set hl --default # also make hyperliquid the default exchange
|
|
186
306
|
perp --json wallet show # public addresses for active wallet
|
|
187
307
|
perp --json wallet list # all named wallets
|
|
188
308
|
perp --json wallet use <name> # set active wallet
|
|
189
309
|
perp --json wallet rename <old> <new>
|
|
190
310
|
perp --json wallet remove <name>
|
|
191
|
-
perp --json wallet balance
|
|
311
|
+
perp --json wallet balance # gas token + USDC/USDT per chain (Arbitrum, Ethereum, Base, BNB, Robinhood USDG, Solana); failed reads → balance null + error
|
|
192
312
|
perp --json wallet solana <address> # check arbitrary Solana address
|
|
193
313
|
perp --json wallet arbitrum <address> # check arbitrary Arbitrum address
|
|
194
314
|
perp --json wallet migrate # migrate legacy ~/.perp/.env config
|
|
195
|
-
perp --json wallet rotate
|
|
315
|
+
perp --json wallet rotate --from <name> --to <name> [--chain evm] # MUTATING: new wallet + transfers assets; no --dry-run — only on explicit user request
|
|
196
316
|
perp --json wallet backup # encrypted backup
|
|
197
317
|
perp --json wallet restore <file> # restore from backup
|
|
198
|
-
perp --json wallet deposit <walletName>
|
|
199
|
-
perp --json wallet setup
|
|
318
|
+
perp --json wallet deposit <walletName> [--for <ex>|-c <chain>] # MoonPay multi-chain deposit (auto-converts to USDC)
|
|
319
|
+
perp --json wallet setup --name <n> --max-tx-usd <usd> --max-daily-usd <usd> [--skip-key]
|
|
320
|
+
# one-click: wallet + policy + agent key.
|
|
321
|
+
# Passphrase prompt unless OWS_PASSPHRASE env is set.
|
|
200
322
|
```
|
|
201
323
|
|
|
202
324
|
### Agent wallet (DEX-side delegation)
|
|
203
325
|
```bash
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
perp --json wallet agent
|
|
326
|
+
# Register an agent (master-signed: user consent; passphrase via OWS_PASSPHRASE / stdin; no --dry-run).
|
|
327
|
+
# Default expires-in is 90d — then AGENT_EXPIRED; pass --expires-in 1y / 180d / etc to extend.
|
|
328
|
+
perp --json wallet agent approve <exchange> \
|
|
329
|
+
[--master <name>] \
|
|
330
|
+
[--agent-name <name>] \
|
|
331
|
+
[--expires-in 30d|90d|180d|1y|<ISO-8601>] \
|
|
332
|
+
[--can-perp|--no-perp] [--can-spot|--no-spot] [--can-withdraw|--no-withdraw] \
|
|
333
|
+
[--rotate] \
|
|
334
|
+
[--ip-whitelist <list>] \
|
|
335
|
+
[--account-index <0-9|255>] # Arcus subaccount
|
|
336
|
+
[--api-key-index <n>] # Lighter slot 4-254 (default: first slot free locally AND on-chain)
|
|
337
|
+
[--force] # Lighter: overwrite an --api-key-index slot that already holds an on-chain key
|
|
338
|
+
|
|
339
|
+
# Import a key the USER created on the exchange WEBSITE (master wallet not needed here).
|
|
340
|
+
# Key on stdin only (one line; ondo: key id + secret; qfex: public key + secret) — an argv key is rejected (INVALID_PARAMS).
|
|
341
|
+
# Verified against the venue before storing (refused → nothing stored); pacifica → "unverified".
|
|
342
|
+
printf '%s' "$AGENT_KEY" | perp --json wallet agent import <exchange> \
|
|
343
|
+
[--master-address <addr>] # aster / pacifica / arcus: required; hyperliquid / lighter: cross-check
|
|
344
|
+
[--account-index <n>] [--api-key-index <n>] # lighter / lighter-rh: required (arcus: optional cross-check)
|
|
345
|
+
[--account-id <uuid>] # qfex: the account the key trades (default primary; required when piped — it confirms the binding)
|
|
346
|
+
[--agent-name <name>] [--expires-in <dur>] [--replace]
|
|
347
|
+
# → data: { source: "imported", masterAddress, agentAddress|publicKey, accountIndex, apiKeyIndex,
|
|
348
|
+
# expiresAt|null, storage, verification: { status: "verified"|"unverified", method } }
|
|
349
|
+
|
|
350
|
+
perp --json wallet agent list [exchange] # rows carry source: "approved" | "imported"
|
|
351
|
+
perp --json wallet agent revoke <exchange> <agentName> [--local-only]
|
|
352
|
+
# imported key: refused unless --local-only (deletes local key + record; still authorized on the
|
|
353
|
+
# exchange — revoke it on the website). --local-only on an approved agent = --force.
|
|
207
354
|
perp --json wallet agent rotate <exchange> [oldAgentName]
|
|
208
|
-
|
|
355
|
+
# imported key: refused — create a new key on the website, then import --agent-name <name> --replace
|
|
356
|
+
# verify: --master (Aster/PAC; passphrase via OWS_PASSPHRASE) / --master-address (HL only) / --account-index (Lighter only).
|
|
357
|
+
# Aster: NOT_IMPLEMENTED (no venue endpoint lists agents) — use wallet agent list aster.
|
|
358
|
+
perp --json wallet agent verify [exchange] [agentName] \
|
|
359
|
+
[--master <name>] [--master-address <addr>] [--account-index <n>]
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Builder fees (`wallet builder`) — OFF by default
|
|
363
|
+
```bash
|
|
364
|
+
# Nothing is attached unless the user configures it explicitly (strict: format, cap, increment):
|
|
365
|
+
perp --json settings set builder.<venue> <address|code>,<feeBps> --yes # hyperliquid/aster: address; pacifica/ondo: code; --yes required non-interactively
|
|
366
|
+
perp --json settings unset builder.<venue>
|
|
367
|
+
perp --json wallet builder status [venue] # support, config, venue approval, attaches?
|
|
368
|
+
perp --json [--dry-run] wallet builder approve <venue> [--master <name>] [--yes] # master-signed; y/N or --yes
|
|
369
|
+
perp --json [--dry-run] wallet builder revoke <venue> [--master <name>] [--yes] # pacifica / aster
|
|
370
|
+
perp --json --no-builder -e <EX> trade market BTC buy 0.1 # never attach on this run
|
|
371
|
+
# Caps: hyperliquid 10 bps (never HIP-3), pacifica 10 bps max (perp-cli cap; never spot), aster 10 bps (mainnet),
|
|
372
|
+
# ondo 10 bps (no approval; also on position stops). lighter / lighter-rh / arcus → CAPABILITY_UNSUPPORTED.
|
|
373
|
+
# Approval missing/unknown → order sent WITHOUT the fee; execution.notes says why. execution.builderFee records it.
|
|
374
|
+
# No master on this computer → NO_SIGNER_AVAILABLE: approve on the venue website.
|
|
209
375
|
```
|
|
210
376
|
|
|
211
377
|
### Exchange settings (`wallet manage`)
|
|
212
378
|
```bash
|
|
213
|
-
perp --json wallet manage margin <SYMBOL> <cross|isolated>
|
|
214
|
-
perp --json wallet manage
|
|
215
|
-
perp --json wallet manage
|
|
216
|
-
perp --json wallet manage sub create <name>
|
|
379
|
+
perp --json -e <EX> wallet manage margin <SYMBOL> <cross|isolated>
|
|
380
|
+
perp --json wallet manage account-mode [unified|standard|portfolio] # Hyperliquid only; no arg = show current
|
|
381
|
+
perp --json wallet manage sub create <name> # not supported (CAPABILITY_UNSUPPORTED): the subaccount wallet must co-sign — use the web app
|
|
217
382
|
perp --json wallet manage sub list
|
|
218
|
-
perp --json wallet manage sub transfer <from> <to> <amount>
|
|
219
|
-
perp --json wallet manage lake create <
|
|
220
|
-
perp --json wallet manage lake deposit <
|
|
221
|
-
perp --json wallet manage lake withdraw <
|
|
222
|
-
perp --json wallet manage builder
|
|
223
|
-
perp --json wallet manage builder revoke <code>
|
|
224
|
-
perp --json wallet manage builder list
|
|
225
|
-
perp --json wallet manage builder overview
|
|
383
|
+
perp --json wallet manage sub transfer <from> <to> <amount> # <from> must be the signing account
|
|
384
|
+
perp --json wallet manage lake create [--manager <address>] [--nickname <name>] [--initial-deposit <amount>]
|
|
385
|
+
perp --json wallet manage lake deposit <lake> <amount> # <lake> = vault address
|
|
386
|
+
perp --json wallet manage lake withdraw <lake> <shares> # shares to redeem, not USDC
|
|
387
|
+
perp --json wallet manage builder overview # Pacifica builder-OWNER tools only (user approvals: wallet builder)
|
|
226
388
|
perp --json wallet manage builder trades <code>
|
|
227
389
|
perp --json wallet manage builder leaderboard <code>
|
|
228
390
|
perp --json wallet manage builder update-fee <code> <feeRate>
|
|
229
391
|
perp --json wallet manage referral claim <code> # Pacifica
|
|
230
|
-
perp --json wallet manage
|
|
392
|
+
perp --json -e hyperliquid wallet manage referral set [code] # HL / Lighter (-e lighter): signs + sends one referral action; supports --dry-run
|
|
393
|
+
perp --json wallet manage apikey create
|
|
231
394
|
perp --json wallet manage apikey list
|
|
232
395
|
perp --json wallet manage apikey revoke <key>
|
|
233
396
|
```
|
|
@@ -246,20 +409,21 @@ perp --json wallet policy delete <id>
|
|
|
246
409
|
## Risk & Analytics
|
|
247
410
|
```bash
|
|
248
411
|
perp --json risk status # portfolio risk overview (level, violations, canTrade)
|
|
249
|
-
perp --json
|
|
412
|
+
perp --json health # adapter health: ping venue REST endpoints (connectivity + latency)
|
|
250
413
|
perp --json risk liquidation-distance # % distance from liquidation for ALL positions
|
|
251
414
|
perp --json risk limits # view current risk limits
|
|
252
|
-
perp --json risk limits --min-liq-distance 30 --max-leverage 5 # set risk limits
|
|
415
|
+
perp --json risk limits --min-liq-distance 30 --max-leverage 5 # set risk limits (also --max-position[-pct], --max-exposure[-pct], --max-positions, --daily-loss[-pct], --max-drawdown[-pct], --max-margin, --reset)
|
|
416
|
+
# The order gate (trade market/buy/sell/limit/split/scale-in/twap/multi, stop --no-reduce-only) enforces
|
|
417
|
+
# max position / total exposure / max positions; reduce-only exempt; --force bypasses (user consent only).
|
|
253
418
|
perp --json risk check --notional 1000 --leverage 3 # pre-trade risk check
|
|
254
419
|
```
|
|
255
420
|
|
|
256
421
|
## History (execution log + analytics)
|
|
257
422
|
```bash
|
|
258
423
|
perp --json history list # execution audit trail
|
|
259
|
-
perp --json history stats # aggregated execution stats
|
|
260
424
|
perp --json history positions # position lifetime tracking
|
|
261
425
|
perp --json history prune # purge old entries
|
|
262
|
-
perp --json history summary # trading performance summary
|
|
426
|
+
perp --json history summary # trading performance summary (replaces former 'stats')
|
|
263
427
|
perp --json history pnl # P&L breakdown by exchange
|
|
264
428
|
perp --json history funding # funding payment aggregation
|
|
265
429
|
perp --json history report # full performance report (summary + pnl + funding)
|
|
@@ -274,27 +438,35 @@ perp --json history perf --period summary # performance summary stats
|
|
|
274
438
|
## Strategies (`perp strategy` — 20 algorithms + nested scripted plans)
|
|
275
439
|
```bash
|
|
276
440
|
perp --json strategy list-strategies # list all 20 strategies
|
|
277
|
-
perp --json strategy run <STRATEGY> [SYMBOL]
|
|
441
|
+
perp --json strategy run <STRATEGY> [SYMBOL] [--exchanges <list>] # multi-venue strategies: --exchanges must include the -e venue
|
|
442
|
+
perp --json --dry-run strategy run <STRATEGY> [SYMBOL] # simulate (actions logged, never sent)
|
|
278
443
|
perp --json strategy run funding-auto # multi-exchange funding arb
|
|
279
444
|
perp --json strategy apex [SYMBOL] # APEX orchestrator
|
|
280
445
|
perp --json strategy reflect # performance analysis
|
|
281
446
|
perp --json strategy preset-list
|
|
282
|
-
perp --json strategy preset <NAME> [SYMBOL]
|
|
447
|
+
perp --json strategy preset <NAME> [SYMBOL] [--size <n>] # grid: total base; DCA: base per order; arb: $ per leg
|
|
283
448
|
perp --json strategy start <CONFIG.yaml> # YAML/JSON config-driven
|
|
284
449
|
perp --json strategy quick-grid <SYMBOL>
|
|
285
|
-
perp --json strategy quick-dca <SYMBOL> <SIDE> <AMOUNT> <
|
|
450
|
+
perp --json strategy quick-dca <SYMBOL> <SIDE> <AMOUNT> <INTERVAL_SEC> [--orders <n>] # 0 = unlimited
|
|
286
451
|
perp --json strategy quick-arb
|
|
287
452
|
perp --json strategy delta-neutral
|
|
288
453
|
perp --json strategy twap <SYMBOL> <SIDE> <SIZE> <DURATION>
|
|
289
|
-
perp --json strategy grid <SYMBOL> --
|
|
454
|
+
perp --json strategy grid <SYMBOL> --upper <PRICE> --lower <PRICE> --grids <N> --size <BASE> [--close-on-stop]
|
|
455
|
+
# at stop: orders cancelled; the grid's inventory stays OPEN (warning) unless --close-on-stop
|
|
290
456
|
perp --json strategy dca <SYMBOL> <SIDE> <AMOUNT> <INTERVAL>
|
|
291
457
|
perp --json strategy trailing-stop <SYMBOL>
|
|
292
|
-
perp --json strategy funding-arb
|
|
458
|
+
perp --json strategy funding-arb [--auto-execute] # monitor only unless --auto-execute
|
|
459
|
+
|
|
460
|
+
# Quarantine (unknown / unhedged outcome): global per symbol, network-scoped; blocks opening orders,
|
|
461
|
+
# arb exec / arb auto and bots (reduce-only passes). Clear only after the USER verified positions.
|
|
462
|
+
perp --json strategy quarantine
|
|
463
|
+
perp --json strategy quarantine-clear <SYMBOL> [--strategy <source>]
|
|
293
464
|
|
|
294
465
|
# Scripted execution plans (one-shot multi-step)
|
|
295
466
|
perp --json strategy plan example
|
|
296
467
|
perp --json strategy plan validate <FILE>
|
|
297
|
-
perp --json strategy plan execute <FILE>
|
|
468
|
+
perp --json --dry-run strategy plan execute <FILE>
|
|
469
|
+
# No --dry-run (refused with INVALID_PARAMS): strategy start / preset / quick-* / grid / dca / twap / funding-arb / apex
|
|
298
470
|
```
|
|
299
471
|
|
|
300
472
|
### Available Strategies (20)
|
|
@@ -307,7 +479,7 @@ perp --json strategy plan execute <FILE> --dry-run
|
|
|
307
479
|
## Background Process Supervisor (tmux)
|
|
308
480
|
```bash
|
|
309
481
|
perp --json background list # list running jobs (default subcommand)
|
|
310
|
-
perp --json background stop <ID>
|
|
482
|
+
perp --json background stop <ID> [--timeout <sec>] # graceful: SIGINT (job cancels its orders, saves state), waits (default 90s), then kills; reports what is left on the venue
|
|
311
483
|
perp --json background logs <ID> # view logs (use -f to follow)
|
|
312
484
|
perp --json background remove <ID> # remove a job entry
|
|
313
485
|
perp --json background clean # purge all stopped/done jobs
|
|
@@ -323,10 +495,10 @@ perp --json backtest grid # backtest grid strategy
|
|
|
323
495
|
```bash
|
|
324
496
|
perp alerts setup # interactive setup wizard
|
|
325
497
|
perp --json alerts test # send test message
|
|
326
|
-
perp --json alerts add <SYMBOL> <PCT>
|
|
327
|
-
perp --json alerts add --all <PCT> # alert for any symbol
|
|
498
|
+
perp --json alerts add <SYMBOL> <PCT> [--exchange <venue>] [--below] # annual funding % threshold (default: above)
|
|
499
|
+
perp --json alerts add --all <PCT> # alert for any symbol
|
|
328
500
|
perp --json alerts list # list active rules
|
|
329
|
-
perp --json alerts remove <
|
|
501
|
+
perp --json alerts remove <SYMBOL|all> # remove a rule
|
|
330
502
|
perp alerts start [--background] # run daemon (tmux for background)
|
|
331
503
|
perp alerts stop # stop background daemon
|
|
332
504
|
```
|
|
@@ -335,19 +507,43 @@ perp alerts stop # stop background daemon
|
|
|
335
507
|
```bash
|
|
336
508
|
perp --json settings show # show current CLI settings
|
|
337
509
|
perp --json settings set <key> <value> # set a CLI default
|
|
338
|
-
|
|
510
|
+
# keys: default-exchange, defaultSlippageBps, slippageBps.<venue>, referralCodes.{hyperliquid,lighter},
|
|
511
|
+
# builder.<venue> "<address|code>,<feeBps>" (off unless set), bridge.debridgeAffiliate.{referralCode,fee}
|
|
512
|
+
perp --json settings unset <key> # slippageBps.<venue> | defaultSlippageBps | builder.<venue> | withdraw.<venue> | bridge.debridgeAffiliate
|
|
513
|
+
# withdraw.<venue> (withdraw / HL transfer allowlist + limits): USER ONLY, interactive terminal; agents never set it (POLICY_DENIED)
|
|
339
514
|
perp --json settings fees show # cached exchange fee table
|
|
340
515
|
perp --json settings fees sync # refresh fee cache
|
|
341
516
|
perp --json settings env show # show ~/.perp/.env values
|
|
342
|
-
perp --json settings env set <name> <value>
|
|
517
|
+
perp --json settings env set <name> <value> # non-secret values only (keys / *_PRIVATE_KEY / secrets → INVALID_PARAMS; use wallet set)
|
|
343
518
|
perp --json settings env remove <name>
|
|
344
519
|
perp --json settings env path # config file path
|
|
345
520
|
```
|
|
346
521
|
|
|
347
522
|
## Init / Setup
|
|
348
523
|
```bash
|
|
349
|
-
|
|
350
|
-
perp setup # alias
|
|
524
|
+
# Interactive default — DO NOT use from agent without flags (will hang on prompts).
|
|
525
|
+
perp setup # alias: perp init
|
|
526
|
+
perp init
|
|
527
|
+
|
|
528
|
+
# Agent-safe non-interactive variant (writes settings; signs nothing by default):
|
|
529
|
+
OWS_PASSPHRASE=<pp> perp --json [-n testnet] setup --non-interactive \
|
|
530
|
+
(--wallet <existing-ows-wallet> | --wallet-name <new-name>) \
|
|
531
|
+
[--venues <list>] [--default-venue <venue>] \
|
|
532
|
+
[--slippage-bps <n>] [--slippage <venue>=<bps> ...]
|
|
533
|
+
# Agent registration (signs with the master wallet — get user consent first):
|
|
534
|
+
# --approve-agents --yes [--aster-can-spot] [--lighter-api-key-index <n>]
|
|
535
|
+
# [--lighter-rh-api-key-index <n>] [--arcus-account-index <0-9|255>]
|
|
536
|
+
# [--ondo-secret-stdin] # Ondo key id + secret as 2 stdin lines; passphrase then via OWS_PASSPHRASE
|
|
537
|
+
# Keys created on the exchange WEBSITES (no master wallet needed when every venue is imported —
|
|
538
|
+
# then omit --wallet / --wallet-name; owsActiveWallet is left unchanged):
|
|
539
|
+
# --import-agents <venues> --yes # subset of --venues; keys on stdin, ONE LINE PER VENUE IN THIS ORDER
|
|
540
|
+
# # (ondo: 2 lines — key id, then secret; qfex: 2 lines — public key, then secret)
|
|
541
|
+
# [--master-address <venue>=<addr> ...] # required for aster, pacifica, arcus
|
|
542
|
+
# [--allow-unverified pacifica] # required for pacifica (no read-only check exists)
|
|
543
|
+
# [--qfex-account-id <uuid>] # required for qfex (confirms the bound account)
|
|
544
|
+
# [--lighter-account-index <n>] [--lighter-api-key-index <n>]
|
|
545
|
+
# [--lighter-rh-account-index <n>] [--lighter-rh-api-key-index <n>] [--arcus-account-index <n>]
|
|
546
|
+
# agents[] entries: { venue, status: "imported", agentName, verification }
|
|
351
547
|
```
|
|
352
548
|
|
|
353
|
-
|
|
549
|
+
For per-exchange key registration without the wizard, use `printf '%s' "$KEY" | OWS_PASSPHRASE=<pp> perp wallet set <ex>` — also agent-safe (key on stdin, never argv).
|