perp-cli 0.12.15 → 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 +278 -31
- 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 +74 -84
- 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 +157 -682
- package/dist/jobs.d.ts +84 -6
- package/dist/jobs.js +239 -41
- package/dist/landing.d.ts +14 -0
- package/dist/landing.js +36 -0
- 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 +338 -134
- package/skills/perp-cli/references/agent-operations.md +181 -92
- package/skills/perp-cli/references/commands.md +475 -132
- package/skills/perp-cli/references/strategies.md +44 -38
- package/skills/perp-cli/scripts/arb-monitor.sh +22 -17
- package/skills/perp-cli/scripts/funding-analysis.sh +20 -10
- 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 +33 -16
- 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,19 +4,46 @@ Complete reference for non-interactive CLI operations. Every command here is saf
|
|
|
4
4
|
|
|
5
5
|
## Interactive vs Non-Interactive Commands
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Avoid bare interactive forms (they prompt and will hang an agent):
|
|
8
8
|
```
|
|
9
|
-
perp setup
|
|
9
|
+
perp setup # interactive wizard — asks questions via stdin
|
|
10
|
+
perp init # alias for setup
|
|
11
|
+
perp wallet setup # one-click setup — passphrase prompt
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Agent-safe non-interactive variants:
|
|
15
|
+
```bash
|
|
16
|
+
# Setup wizard with explicit args (no prompts):
|
|
17
|
+
OWS_PASSPHRASE=<pp> perp --json [-n testnet] setup --non-interactive \
|
|
18
|
+
(--wallet <existing-ows-wallet> | --wallet-name <new-name>) \
|
|
19
|
+
[--venues <pacifica,hyperliquid,lighter,aster,lighter-rh,ondo,arcus,qfex>] \
|
|
20
|
+
[--default-venue <venue>] \
|
|
21
|
+
[--slippage-bps <n>] [--slippage <venue>=<bps> ...]
|
|
22
|
+
# Writes settings only. Agent registration signs with the master wallet — only with
|
|
23
|
+
# explicit user consent: add --approve-agents --yes (passphrase via OWS_PASSPHRASE;
|
|
24
|
+
# Ondo key id + secret as 2 stdin lines with --ondo-secret-stdin). A failed venue
|
|
25
|
+
# returns APPROVE_FAILED with per-venue results in error.details.result.agents.
|
|
26
|
+
# No master wallet on this machine: the user creates keys on the exchange websites and
|
|
27
|
+
# pipes them in — --import-agents <venues> --yes (one stdin line per venue in order; ondo
|
|
28
|
+
# 2 lines: key id, secret; qfex 2 lines: public key, secret) [--master-address <venue>=<addr>]
|
|
29
|
+
# (required for aster / pacifica / arcus) [--allow-unverified pacifica] (required for pacifica)
|
|
30
|
+
# [--qfex-account-id <uuid>] (required for qfex) [--lighter-account-index <n> --lighter-api-key-index <n>];
|
|
31
|
+
# omit --wallet. Imported keys trade only: deposit / withdraw / transfer / bridge / referral
|
|
32
|
+
# set / agent approve then fail with NO_SIGNER_AVAILABLE → the user does them on the website.
|
|
33
|
+
|
|
34
|
+
# wallet setup (one-click) only prompts for passphrase — set OWS_PASSPHRASE env to skip:
|
|
35
|
+
OWS_PASSPHRASE=<pp> perp --json wallet setup --name <name> --max-tx-usd <usd> --max-daily-usd <usd>
|
|
10
36
|
```
|
|
11
37
|
|
|
12
38
|
### ALWAYS use these (non-interactive, agent-safe):
|
|
13
39
|
```bash
|
|
14
|
-
perp --json wallet set <exchange>
|
|
40
|
+
printf '%s' "$KEY" | OWS_PASSPHRASE=<pp> perp --json wallet set <exchange> # import key (stdin) into OWS vault → active wallet
|
|
15
41
|
perp --json wallet generate evm # generate EVM wallet
|
|
16
42
|
perp --json wallet generate solana # generate Solana wallet
|
|
17
43
|
perp --json wallet show # check configured wallets
|
|
44
|
+
perp --json wallet list # list named wallets
|
|
18
45
|
perp --json wallet balance # on-chain USDC balances
|
|
19
|
-
perp --json -e <EX>
|
|
46
|
+
perp --json portfolio -e <EX> # per-exchange balance + positions (account balance was renamed in v0.12)
|
|
20
47
|
perp --json -e <EX> account positions # open positions
|
|
21
48
|
perp --json -e <EX> market list # available markets
|
|
22
49
|
perp --json -e <EX> trade market ... # execute trade
|
|
@@ -24,7 +51,7 @@ perp --json -e <EX> trade buy ... # alias for market buy
|
|
|
24
51
|
perp --json -e <EX> trade sell ... # alias for market sell
|
|
25
52
|
perp --json risk status # risk assessment
|
|
26
53
|
perp --json risk liquidation-distance # % from liquidation for all positions
|
|
27
|
-
perp --json risk limits
|
|
54
|
+
perp --json risk limits [--max-position <usd> ...] # view (no flags) / set risk limits
|
|
28
55
|
perp --json risk check --notional <$> --leverage <L> # pre-trade risk check
|
|
29
56
|
```
|
|
30
57
|
|
|
@@ -35,17 +62,18 @@ perp --json risk check --notional <$> --leverage <L> # pre-trade risk check
|
|
|
35
62
|
### Single Exchange Setup
|
|
36
63
|
```bash
|
|
37
64
|
# 1. Install
|
|
38
|
-
npm install -g perp-cli
|
|
65
|
+
npm install -g perp-cli@latest
|
|
66
|
+
# or use npx -y perp-cli@latest as the prefix
|
|
39
67
|
|
|
40
|
-
# 2. Register wallet (user provides key)
|
|
41
|
-
perp --json wallet set hl
|
|
68
|
+
# 2. Register wallet (user provides key — on stdin, never argv)
|
|
69
|
+
printf '%s' "$USER_PRIVATE_KEY" | OWS_PASSPHRASE=<pp> perp --json wallet set hl
|
|
42
70
|
|
|
43
71
|
# 3. Verify
|
|
44
72
|
perp --json wallet show
|
|
45
73
|
# → check "ok": true and address appears
|
|
46
74
|
|
|
47
75
|
# 4. Check balance
|
|
48
|
-
perp --json -e
|
|
76
|
+
perp --json portfolio -e hyperliquid
|
|
49
77
|
# → if balance is 0, tell user to deposit USDC
|
|
50
78
|
|
|
51
79
|
# 5. Ready to trade
|
|
@@ -54,76 +82,79 @@ perp --json -e hl market list
|
|
|
54
82
|
|
|
55
83
|
### Multi-Exchange Setup (for Funding Rate Arb)
|
|
56
84
|
To run arb, you need wallets on AT LEAST 2 exchanges. Each exchange needs:
|
|
57
|
-
- A
|
|
85
|
+
- A wallet key in the OWS vault (EVM for HL / Lighter / Aster, Solana for Pacifica)
|
|
58
86
|
- USDC balance deposited on-exchange
|
|
59
87
|
|
|
60
88
|
```bash
|
|
61
|
-
# 1. Register
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
#
|
|
89
|
+
# 1. Register wallets (any 2+ of: hl, pac, lt, aster). The active OWS wallet serves every
|
|
90
|
+
# venue, so EVM + Solana venues need one multi-chain wallet (perp wallet generate <name>)
|
|
91
|
+
# or two vault wallets selected per command with --ows <name>:
|
|
92
|
+
printf '%s' "$EVM_KEY" | OWS_PASSPHRASE=<pp> perp --json wallet set hl --name evm
|
|
93
|
+
printf '%s' "$SOLANA_KEY" | OWS_PASSPHRASE=<pp> perp --json wallet set pac --name sol # now active; HL: --ows evm
|
|
94
|
+
perp --json wallet agent approve lighter # Lighter trading key
|
|
95
|
+
|
|
96
|
+
# 2. Verify
|
|
66
97
|
perp --json wallet show
|
|
67
|
-
# → should show both exchanges with addresses
|
|
68
98
|
|
|
69
|
-
# 3. Check balances
|
|
70
|
-
perp --json -e
|
|
71
|
-
perp --json -e
|
|
99
|
+
# 3. Check balances (each exchange holds its own balance)
|
|
100
|
+
perp --json portfolio -e hyperliquid
|
|
101
|
+
perp --json portfolio -e pacifica
|
|
102
|
+
perp --json portfolio -e lighter
|
|
103
|
+
perp --json portfolio -e aster
|
|
72
104
|
|
|
73
|
-
# 4. If one side needs funding, bridge USDC
|
|
74
|
-
perp --json bridge quote --from solana --to arbitrum --amount 500
|
|
105
|
+
# 4. If one side needs funding, bridge USDC via funds bridge
|
|
106
|
+
perp --json funds bridge quote --from solana --to arbitrum --amount 500
|
|
75
107
|
# → show quote to user, get confirmation
|
|
76
|
-
perp --json bridge send --from solana --to arbitrum --amount 500
|
|
77
|
-
perp --json bridge status <orderId> # wait for completion
|
|
108
|
+
perp --json funds bridge send --from solana --to arbitrum --amount 500
|
|
109
|
+
perp --json funds bridge status <orderId> # wait for completion
|
|
78
110
|
|
|
79
111
|
# 5. Verify both sides have balance, then start arb
|
|
80
112
|
perp --json arb scan --min 5
|
|
81
113
|
```
|
|
82
114
|
|
|
83
115
|
### Lighter API Key Setup
|
|
84
|
-
Lighter uses a separate API key for trading.
|
|
116
|
+
Lighter uses a separate API key for trading. Two paths:
|
|
85
117
|
|
|
86
|
-
1. **
|
|
87
|
-
2. **Managed agent (recommended for long-running agents)**: `perp wallet agent approve lighter --master <wallet> --api-key-index <slot>` registers a per-agent slot
|
|
118
|
+
1. **No implicit registration**: setting a key (`wallet set lt`, env) never registers a Lighter API key — adapter creation signs nothing. Register explicitly with `perp wallet agent approve lighter`.
|
|
119
|
+
2. **Managed agent (recommended for long-running agents)**: `perp wallet agent approve lighter --master <wallet> --api-key-index <slot>` registers a per-agent slot with explicit expiry tracking + 3-tier signer routing.
|
|
88
120
|
|
|
89
|
-
|
|
121
|
+
Register / retry:
|
|
90
122
|
```bash
|
|
91
123
|
perp --json wallet agent approve lighter --master <wallet>
|
|
92
124
|
```
|
|
93
125
|
|
|
94
126
|
### Using the Same EVM Key for Multiple Exchanges
|
|
95
|
-
One EVM private key works for
|
|
127
|
+
One EVM private key works for Hyperliquid, Lighter and Aster — `wallet set` imports it once as the active OWS wallet:
|
|
96
128
|
```bash
|
|
97
|
-
perp --json wallet set hl
|
|
98
|
-
perp --json wallet set lt 0xKEY # same key, different exchange binding
|
|
129
|
+
printf '%s' "$KEY" | OWS_PASSPHRASE=<pp> perp --json wallet set hl
|
|
99
130
|
```
|
|
100
131
|
|
|
101
132
|
## Wallet Key Types
|
|
102
133
|
|
|
103
|
-
|
|
|
104
|
-
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
| Lighter | EVM
|
|
108
|
-
|
|
|
134
|
+
| Venue (`-e` id \| aliases) | Settles on | Credentials |
|
|
135
|
+
|----------|-------|-----------|
|
|
136
|
+
| `pacifica` \| `pac` | Solana | Solana key (`wallet set pac`), or agent (`wallet agent approve/import pacifica`) |
|
|
137
|
+
| `hyperliquid` \| `hl` | HyperCore (deposit from Arbitrum) | EVM key, or API wallet agent |
|
|
138
|
+
| `lighter` \| `lt` | Ethereum (Lighter L2) | EVM master + API key (`wallet agent approve lighter` / `import`) |
|
|
139
|
+
| `lighter-rh` \| `lrh` \| `rh` | Robinhood Chain (USDG) | API key (`wallet agent approve lighter-rh` / `import`) |
|
|
140
|
+
| `aster` \| `ast` | BNB Chain / Arbitrum | EVM key, or API wallet agent |
|
|
141
|
+
| `ondo` \| `ondo-perps` | off-chain (USDC deposits from Arbitrum / Ethereum) | API key id + secret (stdin) |
|
|
142
|
+
| `arcus` | Robinhood Chain (USDG) | Ed25519 API key (`wallet agent approve arcus --master <w>` / `import`) |
|
|
143
|
+
| `qfex` \| `qf` | custodial (USDC on Arbitrum One) | website key, imported by the user only (`wallet agent import qfex`) |
|
|
109
144
|
|
|
110
|
-
|
|
111
|
-
- `pac` or `pacifica`
|
|
112
|
-
- `hl` or `hyperliquid`
|
|
113
|
-
- `lt` or `lighter`
|
|
114
|
-
- `aster`
|
|
145
|
+
Default `-e` = `settings.defaultExchange`, else `pacifica` — always pass `-e`.
|
|
115
146
|
|
|
116
147
|
## Deposit & Withdraw Flows
|
|
117
148
|
|
|
118
149
|
### Check On-Chain vs Exchange Balance
|
|
119
150
|
```bash
|
|
120
151
|
perp --json wallet balance # on-chain USDC in your wallet
|
|
121
|
-
perp --json -e
|
|
152
|
+
perp --json portfolio -e hyperliquid # USDC deposited on exchange
|
|
122
153
|
```
|
|
123
154
|
|
|
124
155
|
**On-chain balance ≠ exchange balance.** USDC in your wallet must be deposited to the exchange before trading.
|
|
125
156
|
|
|
126
|
-
### Deposit to Exchange
|
|
157
|
+
### Deposit to Exchange (`funds deposit`)
|
|
127
158
|
```bash
|
|
128
159
|
# Hyperliquid (from Arbitrum wallet)
|
|
129
160
|
perp --json funds deposit hyperliquid 100
|
|
@@ -132,36 +163,56 @@ perp --json funds deposit hyperliquid 100
|
|
|
132
163
|
perp --json funds deposit pacifica 100
|
|
133
164
|
|
|
134
165
|
# Lighter (multiple routes)
|
|
135
|
-
perp --json funds deposit lighter info
|
|
136
|
-
perp --json funds deposit lighter
|
|
166
|
+
perp --json funds deposit lighter info # show all available routes
|
|
167
|
+
perp --json funds deposit lighter ethereum 100 # L1 direct (min 1 USDC)
|
|
168
|
+
perp --json funds deposit lighter cctp arbitrum 100 # via CCTP from Arbitrum (min 5 USDC)
|
|
137
169
|
```
|
|
138
170
|
|
|
139
|
-
### Withdraw from Exchange
|
|
171
|
+
### Withdraw from Exchange (`funds withdraw`)
|
|
140
172
|
```bash
|
|
141
|
-
perp --json funds withdraw hyperliquid 100
|
|
142
|
-
perp --json funds withdraw
|
|
143
|
-
perp --json funds withdraw
|
|
173
|
+
perp --json --dry-run funds withdraw hyperliquid 100 # plan first (every withdraw supports --dry-run)
|
|
174
|
+
perp --json funds withdraw hyperliquid 100 [--chain arbitrum|ethereum|base] # CCTP to your own wallet
|
|
175
|
+
perp --json funds withdraw pacifica 100 # to your own Solana wallet
|
|
176
|
+
perp --json -e lighter funds withdraw lighter 100 # USDC → Ethereum (-e lighter-rh: USDG → Robinhood Chain)
|
|
144
177
|
```
|
|
145
178
|
|
|
146
|
-
###
|
|
147
|
-
When you need to move USDC between exchanges on different chains:
|
|
179
|
+
### Internal Transfer (Hyperliquid)
|
|
148
180
|
```bash
|
|
149
|
-
|
|
181
|
+
perp --json funds transfer 100 <ADDRESS> # instant HL→HL transfer
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
`funds transfer` and `funds withdraw hyperliquid --to <other address>` require the destination on the `settings withdraw.hyperliquid` allowlist (else `POLICY_DENIED`). That setting can be created / changed ONLY by the user in an interactive terminal (`--json` / piped → `POLICY_DENIED`, no `--yes`). Never try to set it; ask the user.
|
|
185
|
+
|
|
186
|
+
### Bridge Between Chains (`funds bridge`)
|
|
187
|
+
When you need to move USDC between chains (different networks):
|
|
188
|
+
```bash
|
|
189
|
+
# 1. Withdraw from source exchange to wallet
|
|
150
190
|
perp --json funds withdraw pacifica 500
|
|
151
191
|
|
|
152
|
-
# 2. Quote the bridge
|
|
153
|
-
perp --json bridge quote --from solana --to arbitrum --amount 500
|
|
192
|
+
# 2. Quote the bridge (auto-cheapest of cctp / relay / debridge)
|
|
193
|
+
perp --json funds bridge quote --from solana --to arbitrum --amount 500
|
|
154
194
|
|
|
155
|
-
# 3. Send (after user confirmation)
|
|
156
|
-
perp --json bridge send --from solana --to arbitrum --amount 500
|
|
195
|
+
# 3. Send (after user confirmation; pin --provider to override auto)
|
|
196
|
+
perp --json funds bridge send --from solana --to arbitrum --amount 500
|
|
197
|
+
perp --json funds bridge send --from solana --to arbitrum --amount 500 --provider cctp
|
|
157
198
|
|
|
158
199
|
# 4. Wait for completion
|
|
159
|
-
perp --json bridge status <orderId>
|
|
200
|
+
perp --json funds bridge status <orderId>
|
|
160
201
|
|
|
161
202
|
# 5. Deposit to destination exchange
|
|
162
203
|
perp --json funds deposit hyperliquid 500
|
|
163
204
|
```
|
|
164
205
|
|
|
206
|
+
### Inter-Exchange Rebalance (withdraw → bridge; deposit is manual)
|
|
207
|
+
```bash
|
|
208
|
+
perp --json funds rebalance check # current distribution
|
|
209
|
+
perp --json funds rebalance plan # compute optimal moves
|
|
210
|
+
perp --json --dry-run funds rebalance execute --auto-bridge # status "simulated" or "balanced"
|
|
211
|
+
perp --json funds rebalance execute --auto-bridge # withdraw → bridge only — NO deposit
|
|
212
|
+
perp --json funds rebalance execute --withdraw-only # only withdraw, manual rest
|
|
213
|
+
```
|
|
214
|
+
The envelope is `ok:true` even when a move failed: check every `moves[].status` (`withdrawn`, `bridged`, `same_chain`, `needs_bridge`, `withdraw_failed`, `bridge_failed`). Deposit by hand (`funds deposit <venue> <amt>`) after `funds bridge status` confirms arrival.
|
|
215
|
+
|
|
165
216
|
## Order Types & Execution
|
|
166
217
|
|
|
167
218
|
### Market Orders (immediate execution)
|
|
@@ -170,8 +221,17 @@ perp --json -e hl trade market BTC buy 0.01 # market buy
|
|
|
170
221
|
perp --json -e hl trade market BTC sell 0.01 # market sell
|
|
171
222
|
perp --json -e hl trade buy BTC 0.01 # shorthand
|
|
172
223
|
perp --json -e hl trade sell BTC 0.01 # shorthand
|
|
224
|
+
perp --json -e hl trade buy BTC 0.01 --smart # IOC limit at best ask (less slippage)
|
|
173
225
|
```
|
|
174
226
|
|
|
227
|
+
> **Risk gate:** `trade market / buy / sell / limit / split / market --split / scale-in /
|
|
228
|
+
> twap / multi / stop --no-reduce-only` enforce the local risk limits in `~/.perp/risk.json`
|
|
229
|
+
> (`maxPositionUsd` / `maxTotalExposureUsd` / `maxPositions`, set with `perp risk limits
|
|
230
|
+
> --max-position <usd> --max-exposure <usd> --max-positions <n>` or the `-pct` variants).
|
|
231
|
+
> A breach fails with `RISK_VIOLATION`, also in dry-run. `--force` overrides the limits —
|
|
232
|
+
> only with explicit user consent; it NEVER bypasses a quarantine (also `RISK_VIOLATION`).
|
|
233
|
+
> Reduce-only orders are exempt. Defaults are loose (`maxPositionUsd` 100000).
|
|
234
|
+
|
|
175
235
|
### Split Orders (orderbook-aware, for large orders)
|
|
176
236
|
```bash
|
|
177
237
|
perp --json -e hl trade split BTC buy 5000 # split $5000 into depth-based slices
|
|
@@ -181,35 +241,39 @@ perp --json -e hl trade market BTC buy 0.5 --split # split via market command
|
|
|
181
241
|
Returns `{ slices[], filledUsd, avgPrice, totalSlippagePct, status }`.
|
|
182
242
|
Status: `complete` (all filled), `partial` (some filled), `failed` (none filled).
|
|
183
243
|
|
|
184
|
-
### Limit
|
|
244
|
+
### Limit / Stop / TPSL
|
|
185
245
|
```bash
|
|
186
|
-
perp --json -e hl trade
|
|
187
|
-
perp --json -e hl trade
|
|
246
|
+
perp --json -e hl trade limit BTC buy 60000 0.01 # buy 0.01 BTC at $60k
|
|
247
|
+
perp --json -e hl trade stop BTC sell 0.01 58000 # stop sell at $58k (reduce-only by default)
|
|
248
|
+
perp --json -e hl trade tpsl BTC long --tp 65000 --sl 58000 # long|short = the OPEN position's side
|
|
188
249
|
```
|
|
189
250
|
|
|
190
|
-
### Close
|
|
251
|
+
### Close / Reduce
|
|
191
252
|
```bash
|
|
192
253
|
perp --json -e hl trade close BTC # close entire position
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
perp --json -e hl trade sl BTC 58000 # stop loss at $58k
|
|
198
|
-
perp --json -e hl trade tp BTC 65000 # take profit at $65k
|
|
254
|
+
perp --json -e hl trade close-all # close all positions on this exchange
|
|
255
|
+
perp --json -e hl trade flatten # cancel all orders + close all positions
|
|
256
|
+
perp --json -e hl trade reduce BTC 50 # reduce position by 50%
|
|
199
257
|
```
|
|
200
258
|
|
|
201
259
|
### Cancel Orders
|
|
202
260
|
```bash
|
|
203
261
|
perp --json -e hl account orders # list open orders
|
|
262
|
+
perp --json -e hl trade cancel BTC # cancel by symbol
|
|
204
263
|
perp --json -e hl trade cancel <orderId> # cancel specific order
|
|
264
|
+
perp --json -e hl trade cancel-all # cancel all orders
|
|
265
|
+
perp --json -e pac trade cancel-stop BTC <stopId> # cancel stop order (pacifica / qfex; other venues: trade cancel)
|
|
266
|
+
perp --json -e hl trade cancel-twap BTC <twapId> # cancel TWAP order
|
|
205
267
|
```
|
|
206
268
|
|
|
207
269
|
### Pre-Flight Validation
|
|
208
270
|
ALWAYS run before executing a trade:
|
|
209
271
|
```bash
|
|
210
|
-
perp --json -e hl trade check BTC buy 0.01
|
|
272
|
+
perp --json -e hl trade check BTC buy 0.01 --leverage 3
|
|
211
273
|
```
|
|
212
|
-
|
|
274
|
+
Returns estimated fees, slippage, and whether the trade is within risk limits.
|
|
275
|
+
|
|
276
|
+
> **Important:** `trade check` does NOT read the exchange-set leverage. Always pass `--leverage` explicitly so the cost estimate matches what the exchange will apply.
|
|
213
277
|
|
|
214
278
|
## Parsing JSON Output
|
|
215
279
|
|
|
@@ -218,7 +282,7 @@ Every command returns this envelope:
|
|
|
218
282
|
{
|
|
219
283
|
"ok": true,
|
|
220
284
|
"data": { ... },
|
|
221
|
-
"meta": { "timestamp": "2026-
|
|
285
|
+
"meta": { "timestamp": "2026-05-02T..." }
|
|
222
286
|
}
|
|
223
287
|
```
|
|
224
288
|
|
|
@@ -234,27 +298,41 @@ Error case:
|
|
|
234
298
|
}
|
|
235
299
|
```
|
|
236
300
|
|
|
237
|
-
**Always check `ok` field first
|
|
301
|
+
**Always check `ok` field first** (`ok:false` also exits 1). If `ok` is `false`, read `error.code` and follow `error.remediation`. If `error.retryable` is `true` AND the command is read-only, wait 5 seconds and retry once. Never retry a write — writes surface an unknown outcome as `ORDER_PENDING` (non-retryable).
|
|
302
|
+
|
|
303
|
+
In scripts, capture exactly one JSON document and read `.ok` — do NOT append a fallback (`$(perp … || echo '{"ok":false}')` yields two documents on failure):
|
|
304
|
+
```bash
|
|
305
|
+
out=$(perp --json -e hl account positions 2>/dev/null; true)
|
|
306
|
+
jq -e '.ok == true' >/dev/null <<<"$out" || echo "failed: $(jq -r '.error.code // "no output"' <<<"$out")"
|
|
307
|
+
```
|
|
238
308
|
|
|
239
309
|
## Idempotency & Safety
|
|
240
310
|
|
|
241
311
|
### Safe to retry (idempotent):
|
|
242
|
-
- `wallet show`, `wallet balance` — read-only
|
|
243
|
-
- `
|
|
244
|
-
- `market list`, `market mid`, `market book` — read-only
|
|
245
|
-
- `arb scan`
|
|
246
|
-
- `portfolio`, `risk
|
|
247
|
-
- `bridge quote` — read-only
|
|
248
|
-
- `
|
|
312
|
+
- `wallet show`, `wallet list`, `wallet balance` — read-only
|
|
313
|
+
- `portfolio`, `portfolio -e <ex>`, `account positions`, `account orders`, `account margin` — read-only (note: `account balance` was renamed to `portfolio` in v0.12)
|
|
314
|
+
- `market list`, `market mid`, `market book`, `market info`, `market funding` — read-only
|
|
315
|
+
- `arb scan` (any mode), `arb status`, `arb history`, `arb config` — read-only
|
|
316
|
+
- `portfolio`, `risk status`, `risk liquidation-distance` — read-only
|
|
317
|
+
- `funds bridge quote`, `funds bridge status`, `funds rebalance check`, `funds rebalance plan` — read-only
|
|
318
|
+
- `funds info`, `funds deposit lighter info` — read-only
|
|
249
319
|
|
|
250
320
|
### NOT safe to retry blindly:
|
|
251
|
-
- `trade market`, `trade buy`, `trade sell` — will open duplicate positions
|
|
252
|
-
- `trade close` —
|
|
253
|
-
- `bridge send` — will send duplicate transfers
|
|
254
|
-
- `funds deposit
|
|
321
|
+
- `trade market`, `trade buy`, `trade sell`, `trade limit`, `trade tpsl` — will open duplicate positions
|
|
322
|
+
- `trade close`, `trade close-all`, `trade flatten` — usually safe (no-op when nothing to close), but verify
|
|
323
|
+
- `funds bridge send` — will send duplicate transfers
|
|
324
|
+
- `funds deposit *`, `funds withdraw *`, `funds transfer` — will move funds twice
|
|
325
|
+
- `arb exec`, `arb close`, `arb auto` — open/close real positions
|
|
326
|
+
- `funds rebalance execute` — sends withdrawals / bridges
|
|
255
327
|
|
|
256
328
|
**For non-idempotent commands:** always verify the result before retrying. Check positions or balances to confirm whether the first attempt succeeded.
|
|
257
329
|
|
|
330
|
+
### Unknown outcome (`ORDER_PENDING`) — every write
|
|
331
|
+
Orders, cancels, edits, leverage, withdraw / deposit / bridge / transfer: `ORDER_PENDING` means the request was sent and its outcome is unknown. Do NOT resubmit. Check, in order: `perp --json -e <ex> trade status c:<id> --symbol <SYM>` (id from `remediation`), `account orders` / `account positions` / `portfolio`, the tx hash / request id in `error.details` (`funds bridge status <id>`). Unknown arb / bot / close / multi outcomes also quarantine the symbol (`perp --json strategy quarantine`); only the user clears it after verifying (`strategy quarantine-clear <SYM>`).
|
|
332
|
+
|
|
333
|
+
### Idempotency Key
|
|
334
|
+
`--client-id <id>` / `--auto-id` on `trade market/buy/sell/limit`. An id already recorded locally (`~/.perp/client-ids.jsonl`, not marked failed) returns `ok:true` with `data.duplicate: true` and sends nothing — this is local tracking, not a venue-side check and not an error. Formats: Pacifica a full UUID; Hyperliquid `0x` + 32 hex; Lighter / Lighter RH an integer; QFEX refuses `--client-id` (`CAPABILITY_UNSUPPORTED`; `--auto-id` works). `--client-id`/`--auto-id` with `--smart` → `CAPABILITY_UNSUPPORTED`.
|
|
335
|
+
|
|
258
336
|
## Symbol Naming Across Exchanges
|
|
259
337
|
|
|
260
338
|
Symbols are auto-resolved by the CLI. **Always use bare symbols** (e.g., `BTC`, `SOL`, `ICP`) — the CLI handles exchange-specific naming automatically:
|
|
@@ -267,25 +345,36 @@ Symbols are auto-resolved by the CLI. **Always use bare symbols** (e.g., `BTC`,
|
|
|
267
345
|
|
|
268
346
|
- `arb scan` returns bare symbols — pass them directly to trade/leverage commands on any exchange.
|
|
269
347
|
- Do NOT manually add `-PERP` suffix — the CLI resolves this automatically.
|
|
348
|
+
- For HL spot+perp: BTC→`UBTC`, ETH→`UETH`, SOL→`USOL` are auto-resolved.
|
|
270
349
|
|
|
271
350
|
## Exchange-Specific Constraints
|
|
272
351
|
|
|
273
|
-
|
|
|
274
|
-
|
|
275
|
-
| Pacifica |
|
|
276
|
-
| Hyperliquid | **$10**
|
|
277
|
-
| Lighter |
|
|
278
|
-
| Aster |
|
|
352
|
+
| Venue | Notes |
|
|
353
|
+
|-------|-------|
|
|
354
|
+
| Pacifica | client ids = full UUID; `cancel-stop` / native TWAP (seconds) |
|
|
355
|
+
| Hyperliquid | **$10** min order; prices ≤ 5 significant figures (off-grid → `INVALID_TICK`); native TWAP in minutes, min $100 |
|
|
356
|
+
| Lighter / Lighter RH | min varies by symbol (`market info`); `trade status c:<id>` needs `--symbol` |
|
|
357
|
+
| Aster | funding interval per symbol; `trade status c:<id>` needs `--symbol` |
|
|
358
|
+
| Ondo / Arcus | `trade status` needs `--symbol`; restricted-region notice on stderr |
|
|
359
|
+
| QFEX | `--client-id` refused; no resting reduce-only limits, opening stops or automation; funding unverified (display only) |
|
|
360
|
+
|
|
361
|
+
`--smart` only on pacifica / hyperliquid / lighter / aster. Stops are reduce-only by default; `--no-reduce-only` is refused on ondo / qfex. Limit and trigger prices off the venue grid are refused with `INVALID_TICK`, never rounded.
|
|
279
362
|
|
|
280
363
|
**`trade check` is advisory only** — it returns `valid: true/false` but does NOT block execution. The exchange itself enforces minimums and will reject with an error if the order is too small.
|
|
281
364
|
|
|
282
365
|
## Common Agent Mistakes
|
|
283
366
|
|
|
284
|
-
1. **Using `perp setup
|
|
367
|
+
1. **Using `perp setup` / `perp init` / `perp wallet setup`** — interactive, will hang forever. Use `wallet set` (key on stdin) or `setup --non-interactive` instead.
|
|
285
368
|
2. **Forgetting `--json`** — output becomes unparseable human text.
|
|
286
|
-
3. **Trading with zero balance** — check `
|
|
369
|
+
3. **Trading with zero balance** — check `perp --json portfolio -e <ex>` first, tell user to deposit.
|
|
287
370
|
4. **Retrying a trade without checking** — leads to double positions. Always check `account positions` after a trade, even if it seemed to fail.
|
|
288
|
-
5. **Bridging without quoting** — always run `bridge quote` first to show the user fees and estimated time.
|
|
289
|
-
6. **Assuming deposit is instant** — after `bridge send`, wait for `bridge status` to confirm completion before depositing to the destination exchange.
|
|
371
|
+
5. **Bridging without quoting** — always run `funds bridge quote` first to show the user fees and estimated time.
|
|
372
|
+
6. **Assuming deposit is instant** — after `funds bridge send`, wait for `funds bridge status` to confirm completion before depositing to the destination exchange.
|
|
290
373
|
7. **Manually adding `-PERP` suffix** — the CLI auto-resolves symbols. Just use bare names like `ICP`, `SOL`, `BTC`.
|
|
291
374
|
8. **Order below exchange minimum** — Hyperliquid requires $10+ notional. Compute `size × price` before submitting.
|
|
375
|
+
9. **Using legacy command names** — `arb rates`/`prices`/`dex`/`spot-exec`/`spot-close` are removed; use `arb scan --rates`/`--gaps`/`--hip3` and `arb exec spot:<exch>` / `arb close <SYM> --spot-exch <ex>` instead.
|
|
376
|
+
10. **Calling `trade check` without `--leverage`** — the CLI does not read exchange-set leverage, so cost estimates will be wrong.
|
|
377
|
+
11. **Resubmitting after `ORDER_PENDING`** — the first request may have executed. Check status / positions / tx first.
|
|
378
|
+
12. **Working around `CAPABILITY_UNSUPPORTED`** (another order type, venue or emulation) — report it to the user instead.
|
|
379
|
+
13. **`--dry-run` on a command without dry-run support** → `INVALID_PARAMS` (e.g. `trade twap`, `trade multi`, `strategy grid`, `wallet agent approve`). Simulate bots with `perp --json --dry-run strategy run <s>` or `perp --json --dry-run arb auto`.
|
|
380
|
+
14. **Omitting `-e`** — the default venue is `settings.defaultExchange`, else `pacifica`.
|