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