perp-cli 0.15.0 → 0.16.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.ja.md +243 -0
- package/README.ko.md +243 -0
- package/README.md +129 -535
- package/README.zh.md +243 -0
- package/dist/api/public/lighter.d.ts +5 -0
- package/dist/api/public/lighter.js +5 -0
- package/dist/api/public/pacifica.js +2 -2
- package/dist/arb/sizing.js +4 -2
- package/dist/arb/state.d.ts +6 -0
- package/dist/balance-by-address.d.ts +39 -0
- package/dist/balance-by-address.js +44 -0
- package/dist/bot/quote-rules.js +1 -1
- package/dist/bot/strategies/funding-arb-strategy.js +10 -3
- package/dist/bot/strategies/funding-arb-utils.d.ts +14 -2
- package/dist/bot/strategies/funding-arb-utils.js +48 -15
- package/dist/bot/strategies/spot-perp-arb-strategy.d.ts +1 -1
- package/dist/bot/strategies/spot-perp-arb-strategy.js +4 -2
- package/dist/bot/strategies/spot-perp-executor.js +2 -2
- package/dist/cli-program.js +1 -1
- package/dist/commands/account.js +168 -24
- package/dist/commands/arb/index.js +19 -77
- package/dist/commands/arb-auto.d.ts +24 -0
- package/dist/commands/arb-auto.js +155 -81
- package/dist/commands/arb.d.ts +8 -0
- package/dist/commands/arb.js +49 -23
- package/dist/commands/backtest.js +23 -21
- package/dist/commands/market.d.ts +48 -0
- package/dist/commands/market.js +241 -78
- package/dist/commands/options.d.ts +5 -0
- package/dist/commands/options.js +20 -3
- package/dist/commands/pacifica-earn.js +8 -21
- package/dist/commands/portfolio.d.ts +16 -0
- package/dist/commands/portfolio.js +51 -8
- package/dist/commands/trade.js +4 -4
- package/dist/cross-chain-margin.d.ts +3 -1
- package/dist/cross-chain-margin.js +4 -2
- package/dist/dashboard/server.js +2 -2
- package/dist/dashboard/ui.js +9 -6
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +10 -0
- package/dist/exchanges/address.d.ts +8 -0
- package/dist/exchanges/address.js +47 -0
- package/dist/exchanges/arcus/adapter.d.ts +10 -6
- package/dist/exchanges/arcus/adapter.js +33 -6
- package/dist/exchanges/arcus/public.js +3 -2
- package/dist/exchanges/aster.d.ts +27 -7
- package/dist/exchanges/aster.js +124 -42
- package/dist/exchanges/canonical-symbols.d.ts +7 -0
- package/dist/exchanges/canonical-symbols.js +20 -0
- package/dist/exchanges/capabilities.d.ts +2 -0
- package/dist/exchanges/capabilities.js +2 -1
- package/dist/exchanges/derive/options.d.ts +5 -0
- package/dist/exchanges/derive/options.js +20 -1
- package/dist/exchanges/extended/adapter.d.ts +16 -2
- package/dist/exchanges/extended/adapter.js +96 -34
- package/dist/exchanges/extended/public.d.ts +3 -0
- package/dist/exchanges/extended/public.js +9 -2
- package/dist/exchanges/grvt/adapter.d.ts +16 -2
- package/dist/exchanges/grvt/adapter.js +98 -21
- package/dist/exchanges/hyperliquid-outcome.d.ts +2 -0
- package/dist/exchanges/hyperliquid-outcome.js +29 -1
- package/dist/exchanges/hyperliquid-spot.d.ts +8 -0
- package/dist/exchanges/hyperliquid-spot.js +20 -12
- package/dist/exchanges/hyperliquid.d.ts +180 -13
- package/dist/exchanges/hyperliquid.js +487 -185
- package/dist/exchanges/interface.d.ts +64 -8
- package/dist/exchanges/interface.js +31 -0
- package/dist/exchanges/lighter-public.d.ts +66 -11
- package/dist/exchanges/lighter-public.js +249 -81
- package/dist/exchanges/lighter-spot.d.ts +7 -1
- package/dist/exchanges/lighter-spot.js +99 -90
- package/dist/exchanges/lighter.d.ts +70 -11
- package/dist/exchanges/lighter.js +285 -92
- package/dist/exchanges/ondo/adapter.d.ts +34 -8
- package/dist/exchanges/ondo/adapter.js +73 -16
- package/dist/exchanges/ondo/public.d.ts +27 -2
- package/dist/exchanges/ondo/public.js +63 -31
- package/dist/exchanges/outcome-interface.d.ts +4 -0
- package/dist/exchanges/pacifica-spot.d.ts +6 -0
- package/dist/exchanges/pacifica-spot.js +23 -15
- package/dist/exchanges/pacifica-vaults.d.ts +9 -0
- package/dist/exchanges/pacifica-vaults.js +14 -1
- package/dist/exchanges/pacifica.d.ts +77 -6
- package/dist/exchanges/pacifica.js +321 -130
- package/dist/exchanges/public-balances.d.ts +25 -0
- package/dist/exchanges/public-balances.js +158 -0
- package/dist/exchanges/public-positions.d.ts +43 -0
- package/dist/exchanges/public-positions.js +154 -0
- package/dist/exchanges/qfex/adapter.d.ts +52 -9
- package/dist/exchanges/qfex/adapter.js +74 -9
- package/dist/exchanges/qfex/public.d.ts +62 -9
- package/dist/exchanges/qfex/public.js +128 -22
- package/dist/exchanges/qfex/ws-transport.d.ts +1 -1
- package/dist/exchanges/risex/adapter.d.ts +19 -7
- package/dist/exchanges/risex/adapter.js +58 -12
- package/dist/exchanges/spot-factory.js +1 -1
- package/dist/exchanges/txflow/adapter.d.ts +14 -7
- package/dist/exchanges/txflow/adapter.js +51 -19
- package/dist/exchanges/txflow/client.js +3 -1
- package/dist/exchanges/txflow/public.d.ts +12 -1
- package/dist/exchanges/txflow/public.js +82 -11
- package/dist/exchanges/unknown-symbol.d.ts +6 -1
- package/dist/exchanges/unknown-symbol.js +7 -2
- package/dist/exchanges/variational/adapter.d.ts +2 -6
- package/dist/exchanges/venue-types.d.ts +46 -3
- package/dist/exchanges/venue-types.js +80 -9
- package/dist/exchanges/venue.d.ts +99 -3
- package/dist/exchanges/venue.js +72 -0
- package/dist/exchanges/venues/hyperliquid.js +9 -0
- package/dist/exchanges/venues/lighter-rh.js +13 -3
- package/dist/exchanges/venues/lighter.js +13 -3
- package/dist/exchanges/venues/pacifica.js +9 -0
- package/dist/exchanges/venues/risex.js +15 -0
- package/dist/funding/legacy-public.d.ts +5 -3
- package/dist/funding/legacy-public.js +33 -37
- package/dist/funding/rates.d.ts +54 -5
- package/dist/funding/rates.js +49 -13
- package/dist/liquidity.d.ts +3 -1
- package/dist/liquidity.js +8 -4
- package/dist/mcp-pacifica-earn.js +11 -5
- package/dist/mcp-server.js +104 -15
- package/dist/pacifica/client.d.ts +2 -1
- package/dist/pacifica/client.js +11 -0
- package/dist/positions-by-address.d.ts +34 -0
- package/dist/positions-by-address.js +46 -0
- package/dist/strategies/funding-arb.js +35 -62
- package/dist/utils.d.ts +11 -1
- package/dist/venue-health.js +1 -1
- package/dist/ws/arcus-market.d.ts +9 -0
- package/dist/ws/arcus-market.js +9 -0
- package/dist/ws/aster-market.d.ts +33 -0
- package/dist/ws/aster-market.js +30 -0
- package/dist/ws/index.d.ts +30 -9
- package/dist/ws/index.js +180 -15
- package/dist/ws/lighter-market.d.ts +14 -0
- package/dist/ws/lighter-market.js +13 -0
- package/dist/ws/node.d.ts +30 -9
- package/dist/ws/node.js +204 -16
- package/dist/ws/unclassified.d.ts +16 -0
- package/dist/ws/unclassified.js +43 -0
- package/package.json +15 -2
- package/skills/perp-cli/SKILL.md +97 -33
- package/skills/perp-cli/package.json +15 -2
- package/skills/perp-cli/references/agent-operations.md +15 -12
- package/skills/perp-cli/references/commands.md +67 -12
- package/skills/perp-cli/references/strategies.md +38 -3
- package/skills/perp-cli/references/ws-library.md +55 -24
- package/skills/perp-cli/scripts/arb-monitor.sh +13 -10
- package/skills/perp-cli/scripts/funding-analysis.sh +57 -29
- package/skills/perp-cli/scripts/preflight.sh +27 -19
- package/skills/perp-cli/scripts/spot-perp-scan.sh +58 -38
- package/skills/perp-cli/scripts/validate-arb.sh +56 -39
- package/dist/cli-spec.d.ts +0 -46
- package/dist/cli-spec.js +0 -81
package/README.md
CHANGED
|
@@ -1,363 +1,155 @@
|
|
|
1
|
+
**English** | [한국어](README.ko.md) | [中文](README.zh.md) | [日本語](README.ja.md)
|
|
2
|
+
|
|
1
3
|
# perp-cli
|
|
2
4
|
|
|
3
5
|
[](https://www.npmjs.com/package/perp-cli)
|
|
4
6
|
[](https://www.npmjs.com/package/perp-cli)
|
|
5
7
|
[](https://github.com/hypurrquant/perp-cli/blob/main/LICENSE)
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
One CLI for perpetual futures across many DEXs — trade, compare funding, move funds and run bots from the terminal, or hand it to an AI agent (JSON output, MCP server, agent skill).
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
perp --json portfolio
|
|
11
|
+
- **Trade on 8 venues:** Hyperliquid (incl. HIP-3 dexes), Pacifica, Lighter, Lighter RH, Aster, Ondo Perps, Arcus, QFEX (bridge and perp-perp arb cover the original four: Pacifica, Hyperliquid, Lighter, Aster)
|
|
12
|
+
- **Market data only:** RISEx, GRVT, Extended, Variational, TxFlow (unofficial API) — plus Derive options data
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
npx -y perp-cli --json portfolio
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Features
|
|
18
|
-
|
|
19
|
-
- **13 perp venues** — trade on 8: Pacifica, Hyperliquid, Lighter, Aster, Lighter RH, Ondo Perps, Arcus, QFEX (bridge / perp-perp arb cover the original four); market data on RISEx (read-only in 0.15.0, trading in a later release) TxFlow (unofficial API, read-only), Variational (official API, read-only — no public trading API yet) GRVT (official API, read-only in this version — trading in a later release) and Extended (official API, read-only in this version — trading in a later release); plus **Derive** options data (read-only). See the [support matrix](#support-matrix)
|
|
20
|
-
- **Funding Rate Arb** — perp-perp + spot-perp scan & one-command dual-leg execution
|
|
21
|
-
- **Portfolio** — single call returns balances, positions, risk level across all exchanges
|
|
22
|
-
- **Funds** — deposit, withdraw, transfer, multi-provider bridge (cctp/relay/debridge), inter-exchange rebalance — all in one group
|
|
23
|
-
- **Bots** — TWAP, grid, DCA, trailing-stop with background job management
|
|
24
|
-
- **Agent-First Design** — `--json`, `--fields`, `--ndjson`, `--dry-run`, runtime schema introspection
|
|
25
|
-
- **Safety** — pre-trade validation, response sanitization, client-id deduplication
|
|
26
|
-
|
|
27
|
-
## Support matrix
|
|
28
|
-
|
|
29
|
-
What each venue supports in this release, derived from the code (venue definitions in `src/exchanges/venues/*.ts`, `perp-cli/ws` codecs in `src/ws/codecs/`, the `funds deposit|withdraw` commands, the options registry). ✅ = implemented and available; — = not available. This says what perp-cli **offers**, not what was run with real money — for that see [What works — mainnet verification](#what-works--mainnet-verification-2026-10-13).
|
|
30
|
-
|
|
31
|
-
| Venue | Market data (CLI) | Funding | WS stream (`perp-cli/ws`) | Trading | Deposit via perp-cli | Withdraw via perp-cli | Extras | API |
|
|
32
|
-
|---|---|---|---|---|---|---|---|---|
|
|
33
|
-
| Hyperliquid (incl. HIP-3 via `--dex`) | ✅ | ✅ hourly | ✅ public + user (HIP-3 dexes opt-in) | ✅ | ✅ (USDC from Arbitrum) | ✅ (CCTP) | spot, outcomes (HIP-4), native TWAP | official |
|
|
34
|
-
| Pacifica | ✅ | ✅ hourly | ✅ public + user | ✅ | ✅ | ✅ | spot (unified margin), native TWAP (master-signed only); Print (`perp print`), Vaults (`perp vault`; deposit master-only) and Atomic basket (`trade atomic`) — each not yet verified live; legacy `wallet manage lake`: `create` still works, `deposit` / `withdraw` refuse and point to `perp vault` | official |
|
|
35
|
-
| Lighter | ✅ | ✅ hourly | ✅ public + user | ✅ | ✅ (L1 or CCTP) | ✅ | spot, client-side TWAP | official |
|
|
36
|
-
| Lighter RH | ✅ | ✅ hourly | ✅ public + user (mainnet; testnet WS → HTTP 403) | ✅ | ✅ (USDG, mainnet) | ✅ (`-e lighter-rh funds withdraw lighter`) | spot, client-side TWAP | official |
|
|
37
|
-
| Aster | ✅ | ✅ per symbol | ✅ public only (user channels: known gap) | ✅ | ✅ (USDT / USDC, mainnet) | ✅ (agent with `--can-withdraw --ip-whitelist`) | spot, client-side TWAP | official |
|
|
38
|
-
| Ondo Perps | ✅ | ✅ hourly | — | ✅ | ✅ (USDC, mainnet) | — (the API allows none; web app)⁴ | spot, client-side TWAP | official |
|
|
39
|
-
| Arcus | ✅ | ✅ hourly | ✅ public + user | ✅ | — (web app) | ✅ (to the account owner) | spot (on-chain swaps), client-side TWAP | official |
|
|
40
|
-
| QFEX | ✅ | unverified (display only, `--include-unverified`) | — | ✅ (no resting reduce-only, no automation — see [QFEX](#qfex)) | address only | — (disabled for now; web app)⁵ | — | official |
|
|
41
|
-
| RISEx | ✅ | ✅ hourly | — | — (**read-only in 0.15.0**; trading in a later release) | — (app only) | — (app only) | account reads by address | official |
|
|
42
|
-
| TxFlow | ✅ | unverified (display only, `--include-unverified`) | — | — (market data only) | — | — | — | **unofficial** |
|
|
43
|
-
| Variational | ✅ (`market book` = RFQ quotes, not an order book) | unverified (display only, `--include-unverified`); interval per market (1h / 4h / 8h) | — | — (market data only) | — | — | equities / ETFs / commodities; pre-IPO (not matched) | official |
|
|
44
|
-
| GRVT | ✅ | unverified (display only, `--include-unverified`); interval per market (4h / 8h) | — (per-instrument streams only) | — (market data only in this version; trading in a later release) | — | — | equities / ETFs, commodities; pre-IPO not matched | official |
|
|
45
|
-
| Extended | ✅ (crypto plus equities / ETFs / commodities / indices / FX) | unverified (display only, `--include-unverified`), hourly; `_24_5` equities print 0 off-hours | — (one socket per stream; not supported yet) | — (read-only in 0.15.0) | — | — | asset-class column; pre-IPO and ambiguous tickers not matched | official |
|
|
46
|
-
| Derive | options only (`perp -e derive options …`) | — | — | — (**read-only**; trading in a later release) | — | — | options: underlyings, expiries, chain (IV, greeks), quote | official |
|
|
47
|
-
|
|
48
|
-
- **Funding** ✅ = the rate's unit is verified against settled payments (`fundingVerified`), so the venue takes part in `arb scan` and funding strategies; unverified venues are shown only with `--include-unverified`, never ranked or traded.
|
|
49
|
-
- **WS stream** = `perp-cli/ws` / `@hypurrquant/perp-ws` channels: public = all-market / per-market state and `bbo`; user = account, positions, orders, fills. `book` / `trades` channels are not available yet on any venue.
|
|
50
|
-
- **Client-side TWAP** = `trade twap` / `strategy twap` slicing on venues without a native TWAP (refused on QFEX by its automation gate).
|
|
51
|
-
|
|
52
|
-
## Setup
|
|
14
|
+
## Install
|
|
53
15
|
|
|
54
16
|
```bash
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
perp wallet set hl # Hyperliquid (EVM) — hidden prompt
|
|
58
|
-
pbpaste | OWS_PASSPHRASE="$PP" perp wallet set pac --name pac # Pacifica (Solana) — piped
|
|
59
|
-
# The active wallet serves every venue; one EVM key covers HL / Lighter / Aster.
|
|
60
|
-
# Lighter trading also needs: perp wallet agent approve lighter
|
|
61
|
-
|
|
62
|
-
# Or the interactive setup wizard (every trading venue): picks / creates / imports an OWS
|
|
63
|
-
# vault wallet, network, venues, registers agent wallets (y/N confirmation before
|
|
64
|
-
# any signature — never moves funds), explains + sets the slippage bound, and the
|
|
65
|
-
# default venue. It never writes keys to ~/.perp/.env.
|
|
66
|
-
perp setup
|
|
67
|
-
|
|
68
|
-
# Scriptable (CI / agents) — writes settings only, signs nothing:
|
|
69
|
-
perp --json setup --non-interactive --wallet <ows-wallet> --venues hyperliquid,aster \
|
|
70
|
-
--network testnet --default-venue hyperliquid --slippage-bps 50 --slippage aster=80
|
|
71
|
-
# Add agent registration explicitly (Ondo key id + secret via stdin only):
|
|
72
|
-
OWS_PASSPHRASE=<pp> perp --json setup --non-interactive --wallet <ows-wallet> \
|
|
73
|
-
--venues hyperliquid,arcus --approve-agents --yes --arcus-account-index 0
|
|
17
|
+
npm install -g perp-cli
|
|
18
|
+
perp --version
|
|
74
19
|
|
|
75
|
-
#
|
|
76
|
-
perp
|
|
20
|
+
# Or without a global install
|
|
21
|
+
npx -y perp-cli --json portfolio
|
|
77
22
|
```
|
|
78
23
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
> **Lighter API Key Index:** Indexes 0–3 are reserved by Lighter's frontend (web/mobile). perp-cli defaults to index `4`. Override with `LIGHTER_API_KEY_INDEX` env var, or use `perp wallet agent approve lighter --api-key-index <n>` for managed agent slots. Valid range: 4–254.
|
|
24
|
+
The package ships three executables: `perp` (the CLI), `perp-mcp` (the [MCP server](docs/mcp.md), stdio) and `perp-guardrail` (the [signing guardrail](docs/guardrail.md)).
|
|
82
25
|
|
|
83
|
-
|
|
26
|
+
## Quick start
|
|
84
27
|
|
|
85
|
-
|
|
28
|
+
**1. Look around — no keys needed.**
|
|
86
29
|
|
|
87
30
|
```bash
|
|
88
|
-
perp
|
|
89
|
-
|
|
90
|
-
perp
|
|
91
|
-
perp wallet agent verify [lighter-rh|ondo|arcus] # no venue = verify every configured venue
|
|
31
|
+
perp -e hl market list # markets, prices, funding
|
|
32
|
+
perp -e hl market book BTC # order book
|
|
33
|
+
perp arb scan --rates # funding rates across venues
|
|
92
34
|
```
|
|
93
35
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
Create the agent / API key on the venue's website, then import it. The master wallet never has to be
|
|
97
|
-
on this machine; it is identified only by its public address. The key is read from a hidden prompt or
|
|
98
|
-
stdin (never argv) and **checked against the venue before anything is stored** — a refused check stores
|
|
99
|
-
nothing; a venue that cannot be checked without the master is reported as `unverified`, never as verified.
|
|
36
|
+
**2. Add a wallet.** The setup wizard creates or imports an encrypted [OWS](https://github.com/open-wallet-standard) vault wallet, picks venues and registers agent keys (it asks before every signature and never moves funds):
|
|
100
37
|
|
|
101
38
|
```bash
|
|
102
|
-
perp
|
|
103
|
-
|
|
104
|
-
perp wallet agent import pacifica --master-address <SOL account> # agent key; UNVERIFIED (Pacifica lists bindings only master-signed)
|
|
105
|
-
perp wallet agent import lighter --account-index 123 --api-key-index 5 # slot key; auth token accepted for that slot
|
|
106
|
-
perp wallet agent import arcus --master-address 0xOWNER # Ed25519 key; public key listed ACTIVE for the owner
|
|
107
|
-
printf '%s\n%s\n' "$KEY_ID" "$SECRET" | perp wallet agent import ondo
|
|
108
|
-
printf '%s\n%s\n' "$PUBLIC_KEY" "$SECRET" | perp wallet agent import qfex --account-id <uuid> # QFEX: import only (keys are created on the website, 2FA)
|
|
109
|
-
perp wallet agent list # SOURCE column: approved | imported
|
|
110
|
-
|
|
111
|
-
# Setup without any master wallet: one stdin line per --import-agents venue, in order (ondo: 2 lines)
|
|
112
|
-
printf '%s\n%s\n' "$HL_AGENT_KEY" "$LT_KEY" | perp --json setup --non-interactive \
|
|
113
|
-
--venues hyperliquid,lighter --import-agents hyperliquid,lighter --yes \
|
|
114
|
-
--lighter-account-index 123 --lighter-api-key-index 5
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Trading works with the imported key. **Deposits, withdrawals, transfers, bridge, referral set and agent
|
|
118
|
-
approvals need the master**: without it they fail with `NO_SIGNER_AVAILABLE` ("do it on the exchange
|
|
119
|
-
website, or add the master with `perp wallet import`"). The CLI cannot revoke or rotate an imported key —
|
|
120
|
-
revoke it on the website; `perp wallet agent revoke <venue> <name> --local-only` removes the local copy,
|
|
121
|
-
and `wallet agent import <venue> --agent-name <name> --replace` swaps in a new website-created key.
|
|
122
|
-
`perp setup` offers the same choice per venue: approve with this computer's master wallet, or import a
|
|
123
|
-
website-created key (Step 1 can skip the master wallet).
|
|
124
|
-
|
|
125
|
-
Secrets are stored once (see `docs/SSOT_RULES.md` Rule #3): Lighter RH → `~/.perp/lighter-rh-agents/`, Ondo → `~/.perp/ondo-agents/<keyId>.json`, Arcus → OWS wallet `agent-arcus-<master>`; imported EVM / Solana / Ed25519 keys → OWS wallet `agent-{hl,aster,pac,arcus}-import-<name>` (empty passphrase, like approved agent wallets), imported Lighter keys → the network-tagged Lighter keystore. A missing wallet/key now fails with `KEY_NOT_FOUND` / `NO_SIGNER_AVAILABLE` instead of silently falling back to read-only.
|
|
126
|
-
|
|
127
|
-
## Venues
|
|
128
|
-
|
|
129
|
-
| Venue | `-e` id (aliases) | Trading | Notes |
|
|
130
|
-
|-------|-------------------|---------|-------|
|
|
131
|
-
| Pacifica | `pacifica` (`pac`) | yes | Solana |
|
|
132
|
-
| Hyperliquid | `hyperliquid` (`hl`) | yes | HyperEVM; HIP-3 dexes via `--dex` |
|
|
133
|
-
| Lighter | `lighter` (`lt`) | yes | Ethereum L2 |
|
|
134
|
-
| Aster | `aster` (`ast`) | yes | BNB Chain; funding interval is per symbol |
|
|
135
|
-
| Lighter RH | `lighter-rh` (`lrh`, `rh`) | yes | Lighter engine on the Robinhood chain, USDG collateral |
|
|
136
|
-
| Ondo Perps | `ondo` (`ondo-perps`) | yes | Off-chain engine; limit TIF GTC (default) / IOC / ALO; restricted: US, PA |
|
|
137
|
-
| QFEX | `qfex` (`qf`) | yes (see **QFEX** below) | Custodial, off-chain engine; equities / indices / commodities, cross margin, USDC; limit TIF GTC (default) / IOC / FOK / ALO; testnet = QFEX UAT; restricted: US, GB, ES and others |
|
|
138
|
-
| Arcus | `arcus` | yes | Robinhood chain, USDG collateral; limit TIF GTC (default, sent as GTT) / IOC / FOK / ALO; restricted: US, CA, GB; **access whitelist** — unlisted addresses are rejected (request access at arcus.xyz) |
|
|
139
|
-
| RISEx | `risex` (`rise`) | **no — read-only in 0.15.0** (trading in a later release; see **RISEx** below) | Fully on-chain order book on RISE chain, USDC; official API. Market data, funding and account reads by address; every trade / agent / bot path → `CAPABILITY_UNSUPPORTED`; deposits / withdrawals in the RISEx app only |
|
|
140
|
-
| Variational | `variational` (`var`, `omni`) | **no — market data only** (see **Variational** below) | Variational Omni, an RFQ venue (one market maker, no order book); official read-only API, no public trading API yet. Funding is unverified (shown only with `--include-unverified`); restricted: US, CA and others |
|
|
141
|
-
| GRVT | `grvt` (`grv`) | **no — market data only in this version** (trading in a later release; see **GRVT** below) | Hybrid perps exchange, USDT collateral; official Market Data API. Funding is unverified (shown only with `--include-unverified`); testnet = `-n testnet`; trading needs KYC; restricted: US, CA, SG, HK and others |
|
|
142
|
-
| Extended | `extended` (`ext`, `x10`) | **no — market data only in this version** (trading in a later release; see **Extended** below) | Perps order book on Starknet (formerly X10), USD collateral; official public API. Crypto plus RWA (equities, ETFs, indices, commodities, FX). Funding is unverified (shown only with `--include-unverified`); testnet = Sepolia (`-n testnet`); restricted: US, GB, CA, HK and others |
|
|
143
|
-
| TxFlow | `txflow` (`txf`) | **no — market data only** | **UNOFFICIAL API**: TxFlow has no official API yet; perp-cli reads the undocumented API its web app uses. It may change or break without notice. Funding is unverified (shown only with `--include-unverified`) |
|
|
144
|
-
|
|
145
|
-
- **Time in force:** `trade limit` defaults to `GTC` on every venue (common names `GTC | IOC | FOK | ALO`; a TIF the venue does not offer → `CAPABILITY_UNSUPPORTED`). Lighter post-only (`ALO`) is disabled until verified on the venue.
|
|
146
|
-
- **TP/SL on an entry:** `trade market|buy|sell|limit ... --tp <px> --sl <px>` means the same on every venue — *protect this entry's verified fill*. The direction is checked before anything is sent (long: tp > reference > sl; short: the reverse; reference = mark for market entries, the limit price for limit entries). Ondo attaches the legs to the order; Arcus sends an entry+TP/SL batch; Hyperliquid / Lighter / Aster verify the entry fill, then place reduce-only TP/SL trigger orders sized to it (only market or `--tif IOC` entries — a resting entry → `CAPABILITY_UNSUPPORTED`); Pacifica verifies the fill, then sets position TP/SL (refused if the symbol already has a position or TP/SL — never overwritten). Entry outcome unknown → `ORDER_PENDING` and **no** TP/SL (the position may be unprotected); entry filled but a leg failed → `ORDER_PARTIAL` (not retryable) with the entry result and which legs were placed — do not re-enter, finish with `trade tpsl`.
|
|
147
|
-
- **TP/SL on a position:** `trade tpsl <SYM> <long|short> --tp <px> --sl <px> [--tp-limit <px>] [--size <n>]` — the argument is the **position's** side (buy/sell no longer accepted), checked against the live position; legs are reduce-only and sized to the live position (or `--size`).
|
|
148
|
-
- **Stop orders are reduce-only by default** on every venue (`trade stop`); pass `--no-reduce-only` to let a stop open or flip a position (refused on Ondo and QFEX, whose stops are always reduce-only). Lighter / Arcus market triggers execute as a limit at trigger ± the slippage bound (`--slippage-bps` or settings) and may stay unfilled in a fast move; other venues use native market triggers (`--slippage-bps` → `CAPABILITY_UNSUPPORTED`).
|
|
149
|
-
- **Order edit:** `trade edit` keeps the order's TIF. Pacifica: post-only (ALO) orders are edited natively; GTC / TOB orders placed by perp-cli (TIF recorded in the client order id) are cancelled and replaced with the remaining open size; orders whose TIF is unknown → `CAPABILITY_UNSUPPORTED` (pass `--tif`).
|
|
150
|
-
- **Slippage bound:** every market-type order (entry, close, spot) is bounded by one value: `--slippage-bps <n>` → `settings.slippageBps.<venue>` → `settings.defaultSlippageBps` (shipped default 50, shown in `perp settings show`; change with `perp settings set defaultSlippageBps <n>`). Values outside 1..venue max (Arcus 1000) are rejected before sending.
|
|
151
|
-
- **Restricted regions:** creating a signing adapter for a venue with restricted regions (Ondo, Arcus, QFEX) prints a one-time stderr notice; it never blocks — check the venue terms yourself.
|
|
152
|
-
- **Aggregate views** (`portfolio`, `account positions/orders`, `risk`, `history`, `wallet agent verify`, MCP `portfolio`) cover every account venue with configured credentials.
|
|
153
|
-
|
|
154
|
-
### What works — mainnet verification (2026-10-13)
|
|
155
|
-
|
|
156
|
-
Every mark below comes from a real-money mainnet run, not from code reading — at the venue minimum, with the per-venue cap raised to about $25–30 for multi-slice / multi-level checks and about $110 for the Hyperliquid TWAP.
|
|
157
|
-
|
|
158
|
-
✅ verified live · ⛔ not supported (refused before anything is sent) · ❌ implemented but not run on mainnet yet · — not offered by the venue
|
|
159
|
-
|
|
160
|
-
| Feature | HL | HIP-3 `xyz` | Pacifica | Lighter | Lighter RH | Aster | Ondo | Arcus | QFEX |
|
|
161
|
-
|---|---|---|---|---|---|---|---|---|---|
|
|
162
|
-
| Market / limit (GTC, ALO, IOC), cancel, edit, close, reduce, flatten, status | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
163
|
-
| Entry `--tp/--sl`, `trade tpsl`, `trade stop` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
164
|
-
| Stop-limit | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⛔ | ✅ | ⛔ |
|
|
165
|
-
| Resting reduce-only limit | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⛔ | ✅ | ⛔ (IOC only) |
|
|
166
|
-
| Client order id (place / status / cancel) | ✅ | ✅ | ✅³ (UUID) | ✅ (numeric) | ✅ (numeric) | ✅ | ✅ | ✅ | generated ids only |
|
|
167
|
-
| Isolated margin (set, read back with a position, revert) | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ (venue rejected with `-4050`, condition unknown) | ⛔ | ✅ | ⛔ |
|
|
168
|
-
| `trade scale-in` / `scale-tp` | ✅ | ✅ (position ≥ $20.5) | ✅ | ✅ | ✅ | ✅ | scale-in ✅ / scale-tp ⛔ — use partial `trade tpsl --size` ✅ | ✅ | scale-in ✅ / scale-tp ⛔ |
|
|
169
|
-
| `trade split` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
170
|
-
| `trade multi` (legs on several venues) | ✅ | ✅ (global `--dex xyz`) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
171
|
-
| Native TWAP (`trade twap`) | ✅ | ❌ (HL minimum $100) | ✅ master-signed / ⛔ agent-signed | —² | —² | —² | —² | —² | —² |
|
|
172
|
-
| Client-side TWAP (`trade twap` on other venues, `strategy twap`, `--background`) | — | — | — | ✅ | ✅ | ✅ | ✅ | ✅ | ⛔ (automation gate) |
|
|
173
|
-
| `account margin` with a position | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
174
|
-
| Spot (`trade spot-*`) | ✅ | — | ✅ | ✅ | ✅ | ❌ (needs USDT) | ✅ | ❌ (needs an Arcus-issued key) | — |
|
|
175
|
-
| Deposit via perp-cli | ✅ | (HL) | ✅ | ✅ | ✅ | ✅ | ✅ | — (web app) | — (address only) |
|
|
176
|
-
| Withdraw (to your own address)⁶ | ✅ | (HL) | ✅ | ✅ | ✅ | ✅ (`--asset USDC`) | ⛔⁴ | ✅ | ⛔⁵ |
|
|
177
|
-
|
|
178
|
-
RISEx, TxFlow, Variational, GRVT and Extended are not in this table: none trades in this release. RISEx trading (shipped but disabled in 0.15.0) was exercised on **testnet** only (2026-10-14); no mainnet RISEx order has been run.
|
|
179
|
-
|
|
180
|
-
² perp-cli has no native TWAP for this venue: `trade twap` runs the client-side TWAP (slices) instead. Whether the venue's API offers one is not checked.
|
|
181
|
-
³ Verified in the session; no saved log file.
|
|
182
|
-
⁴ Not available: the Ondo Perps API does not allow withdrawals (`funds withdraw ondo` → `CAPABILITY_UNSUPPORTED`). Withdraw in the Ondo web app.
|
|
183
|
-
⁵ Disabled in perp-cli for now (`funds withdraw qfex` → `CAPABILITY_UNSUPPORTED`). Withdraw in the QFEX web app.
|
|
184
|
-
⁶ Mainnet, 2026-10-13: one withdrawal per venue to the account's own address, received amount checked on the destination chain — `funds withdraw hyperliquid 12.22` (Arbitrum USDC), `funds withdraw pacifica 12.98` (Solana USDC), `-e lighter funds withdraw lighter 15.95` (Ethereum USDC), `-e lighter-rh funds withdraw lighter 12.96` and `funds withdraw arcus 9.94` (Robinhood Chain USDG), `funds withdraw aster 8.74 --chain arbitrum --asset USDC` (Arbitrum USDC).
|
|
185
|
-
|
|
186
|
-
Automation, verified live (bounded runs at minimum size, stopped and flattened afterwards):
|
|
187
|
-
|
|
188
|
-
| Area | Verified |
|
|
189
|
-
|---|---|
|
|
190
|
-
| Arbitrage | `arb exec` / `status` / `close` on Aster–Arcus, Lighter–Arcus; `arb auto` (Lighter–HL); spot-perp `arb exec <sym> spot:hl pacifica` and `arb close`; `strategy funding-arb`, `quick-arb`, `funding-auto` (Pacifica–HL); `strategy delta-neutral` (HL spot + Pacifica perp) |
|
|
191
|
-
| Bots | `strategy grid` / `dca` / `trailing-stop` / `quick-grid` / `quick-dca` / `preset` (Aster); all 12 engine strategies via `strategy start <config>` (Aster); `strategy apex` (Aster) |
|
|
192
|
-
| Execution helpers | `strategy twap` (Aster), `trade twap --background` (Arcus), `strategy plan execute` (9 of 10 action types — `cancel_order` not run), `perp background stop` (graceful: orders cancelled, positions listed) |
|
|
193
|
-
| Hyperliquid HIP-4 outcomes | GTC place / cancel, IOC buy, `outcome sell --all` / `--size` |
|
|
194
|
-
|
|
195
|
-
Funds and bridge, verified live (mainnet, 2026-10-13 — `funds bridge send` runs, `funds rebalance plan` + `execute --withdraw-only` after a $11 HL deposit, alerts rule commands without a channel):
|
|
196
|
-
|
|
197
|
-
| Area | Verified | Not verified |
|
|
198
|
-
|---|---|---|
|
|
199
|
-
| `funds bridge send` | deBridge Arbitrum → Solana USDC (OWS-signed); Relay swaps Arbitrum ETH → Robinhood ETH, Robinhood USDG → Solana SOL / USDC, Robinhood USDG → Arbitrum USDC | CCTP routes; any **Solana-source** bridge (the OWS Solana signing path is covered by mocked tests only) |
|
|
200
|
-
| `funds bridge exchange` | — | everything; the HyperCore → Solana CCTP route (`--from hyperliquid --to pacifica`) is suspected broken (Solana recipient encoding) |
|
|
201
|
-
| `funds rebalance` | `plan`; `execute --withdraw-only` (HL → Arbitrum) | `execute --auto-bridge` (no gas pre-check yet) |
|
|
202
|
-
| `funds transfer` | — | HL `usdSend`, QFEX account transfer (need a receiving account) |
|
|
203
|
-
| alerts | rule `add` / `list` / `remove`; `test` / `start` refuse without a channel | Telegram / Discord delivery (needs a bot token) |
|
|
204
|
-
|
|
205
|
-
Not run on mainnet yet: subaccounts, builder fees, `strategy claude-agent` (needs an Anthropic key), dashboard.
|
|
206
|
-
|
|
207
|
-
### QFEX
|
|
208
|
-
|
|
209
|
-
QFEX is custodial: there is no wallet signature. The only credential is an **API key created on the QFEX website** (Developer Settings, 2FA), imported with `perp wallet agent import qfex` (public key + secret via hidden prompt / stdin; stored encrypted in `~/.perp/qfex-agents/`). The import resolves the **one account UUID** the key trades (primary, or `--account-id <uuid>`), shows it and stores nothing until you confirm it (piped: pass `--account-id` equal to it). Create the trading key **without** the "Deposit and withdraw" permission.
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
perp -n testnet wallet agent import qfex # QFEX UAT (api.qfex.io); y/N on the resolved account
|
|
213
|
-
perp -e qfex market list # public: /refdata + market-data snapshot
|
|
214
|
-
perp -e qfex trade limit AAPL buy 320 0.01 # GTC: "accepted" after the ACK; "open" once listed (trade status)
|
|
215
|
-
perp -e qfex trade market AAPL buy 0.01 # IOC LIMIT at mark ± slippage (never the venue's unbounded MARKET)
|
|
216
|
-
perp -e qfex trade status c:<id> --symbol AAPL # by the generated client order id
|
|
217
|
-
perp funds deposit qfex # prints the USDC / Arbitrum One deposit address; you send the funds
|
|
39
|
+
perp setup
|
|
40
|
+
perp wallet show
|
|
218
41
|
```
|
|
219
42
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
What perp-cli **still refuses on QFEX** (uniform `CAPABILITY_UNSUPPORTED`, before anything is sent):
|
|
43
|
+
Keys are read from a hidden prompt or stdin — never from argv or `~/.perp/.env`. One EVM key covers Hyperliquid, Lighter and Aster. For other paths (one-line key import, scriptable setup, keys created on the exchange website) see [docs/setup.md](docs/setup.md).
|
|
223
44
|
|
|
224
|
-
|
|
225
|
-
|---|---|---|
|
|
226
|
-
| Resting reduce-only orders (`trade limit --reduce-only` with GTC / ALO, `trade scale-tp`) | Live: a resting reduce-only order **stays open after the position goes flat**; how the venue treats it if it later matches is unverified | Reduce-only IOC (`trade close` / `reduce`), or `trade stop` / `trade tpsl` |
|
|
227
|
-
| Stop-limit (`--tp-limit`, `trade stop` with a limit price) | The venue's stop orders convert to market orders when triggered | Stop-market |
|
|
228
|
-
| Stops that open or flip a position (`trade stop --no-reduce-only`) | QFEX stop orders only reduce a position | Reduce-only stops |
|
|
229
|
-
| `trade edit` of a reduce-only order | A reduce-only order is sized against the live position when placed; a modify would skip that check | `trade cancel`, then place again |
|
|
230
|
-
| `--client-id` | Client ids are not unique on the venue; perp-cli only trusts ids it generates | Omit it (the generated id is reported) |
|
|
231
|
-
| Markets not quoted in USD (`SKHYNIX-KRW`, …) | Sizing, risk limits and notionals assume USD | QFEX web app |
|
|
232
|
-
| Unattended automation on QFEX: bots, plans, TWAP, DCA, grid, funding arb, trailing stop, background jobs; QFEX in `arb scan` rankings | Automation is gated until verified (`QFEX_AUTOMATION_VERIFIED`); the funding rate's unit is unverified and equity funding accrues only part of the week (Q4) | Trade QFEX by hand; view funding only: `perp arb scan --rates --include-unverified` |
|
|
233
|
-
|
|
234
|
-
Known caveat: cancelling a stop / TP right after its position was closed can answer "unexpected error" while the venue removes the stop itself. QFEX keeps no record of stop orders, so perp-cli cannot prove the cancel and reports `ORDER_PARTIAL` (pending) — check `perp -e qfex account orders`; if it lists nothing, the stop is gone.
|
|
235
|
-
|
|
236
|
-
Order outcomes are never guessed: an IOC / market order is final only on a venue terminal frame (nothing filled → `ORDER_REJECTED`, `reason: iocNoFill`); anything unclear after the order was sent is `ORDER_PENDING` with the `c:<id>` to check — never resubmit. perp-cli never enables QFEX cancel-on-disconnect, but **another connection of the same user that enabled it (e.g. the official QFEX CLI) cancels all of the account's orders when that connection drops**.
|
|
237
|
-
|
|
238
|
-
**Withdrawals** are disabled in perp-cli for now (`funds withdraw qfex` → `CAPABILITY_UNSUPPORTED`, also under `--dry-run`); withdraw in the QFEX web app. Subaccounts: `perp -e qfex funds transfer <amount> primary --from <account uuid>`.
|
|
239
|
-
|
|
240
|
-
### RISEx (read-only in 0.15.0 — trading in a later release)
|
|
241
|
-
|
|
242
|
-
RISEx is a fully on-chain perps order book on RISE chain (USDC collateral), reached through its **official** API. New venues ship in phases: in this release perp-cli reads RISEx data only; trading comes in a later release.
|
|
45
|
+
**3. Check your account and trade.** Add `-n testnet` to any command to use testnet.
|
|
243
46
|
|
|
244
47
|
```bash
|
|
245
|
-
perp
|
|
246
|
-
perp -e
|
|
247
|
-
perp
|
|
248
|
-
perp
|
|
249
|
-
perp -e risex account positions --ows <master> # account reads are public by address — nothing is signed
|
|
48
|
+
perp --json portfolio # balances + positions + risk on every venue
|
|
49
|
+
perp --json --dry-run -e hl trade market BTC buy 0.001 # validate only, nothing is sent
|
|
50
|
+
perp --json -e hl trade market BTC buy 0.001 # market order (bounded by the slippage setting)
|
|
51
|
+
perp --json -e hl trade close BTC
|
|
250
52
|
```
|
|
251
53
|
|
|
252
|
-
|
|
253
|
-
- **Funds:** deposits and withdrawals are done in the RISEx app (app.rise.trade). `funds deposit|withdraw risex`, `funds transfer -e risex` and `funds rebalance execute` with risex refuse with `CAPABILITY_UNSUPPORTED` (also under `--dry-run`).
|
|
254
|
-
- The trading code (session signer restricted on-chain to trading only, EIP-712 permits) ships with its tests but is switched off by one flag (`RISEX_TRADING_ENABLED` in `src/exchanges/venues/risex-release.ts`).
|
|
54
|
+
## AI Agent Skill
|
|
255
55
|
|
|
256
|
-
|
|
56
|
+
Drop-in skill for Claude Code, Cursor, Codex, Gemini CLI, and other agent CLIs. Bundles a non-interactive command guide, ops playbook, strategy framework, and reusable shell scripts (preflight, arb monitor, validation) so your agent stops at the right confirmation points and never wedges on interactive wizards.
|
|
257
57
|
|
|
258
|
-
|
|
58
|
+
### Install
|
|
259
59
|
|
|
260
60
|
```bash
|
|
261
|
-
|
|
262
|
-
perp
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
Every trade / account / portfolio / funds (deposit, withdraw, transfer, rebalance) / agent / builder / strategy / arb exec command and every MCP account or trading tool refuses TxFlow with `CAPABILITY_UNSUPPORTED` before any request. There is no funding history and no testnet; a market whose funding interval cannot be proven to be 1 hour shows funding as unknown.
|
|
266
|
-
|
|
267
|
-
### Variational (market data only — official API)
|
|
61
|
+
# Claude Code — slash command
|
|
62
|
+
/install-skill hypurrquant/perp-cli
|
|
268
63
|
|
|
269
|
-
|
|
64
|
+
# Cursor / Codex / generic agent CLIs — via npx
|
|
65
|
+
npx skills add hypurrquant/perp-cli
|
|
270
66
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
perp -e variational market funding BTC # current terms: per interval (1h / 4h / 8h per market), hourly, APR
|
|
275
|
-
perp arb scan --rates --include-unverified # Variational funding rows, display only
|
|
276
|
-
perp health # probed as an official venue
|
|
67
|
+
# Manual install (any agent that reads a Skills directory)
|
|
68
|
+
git clone https://github.com/hypurrquant/perp-cli.git
|
|
69
|
+
cp -R perp-cli/skills/perp-cli ~/.claude/skills/ # or your CLI's skills dir
|
|
277
70
|
```
|
|
278
71
|
|
|
279
|
-
|
|
280
|
-
- **Symbols:** TradFi perps (equities, ETFs, commodities) are classified explicitly; `US500-PERP` is the SPDR S&P 500 ETF (compared as `SPY`); pre-IPO markets, swaps, `SPX` (SPX6900) and `QNT` (Quant) are never matched across venues. No index price, tick, lot, leverage or base-unit open interest is published (shown as `-` / null).
|
|
281
|
-
- **Refused** (`CAPABILITY_UNSUPPORTED`, before any request — also under `--dry-run`): every trade / account / portfolio / funds / agent / builder / strategy / arb exec command and every MCP account or trading tool. No testnet, no WebSocket.
|
|
282
|
-
|
|
283
|
-
### GRVT (market data only — official API)
|
|
284
|
-
|
|
285
|
-
GRVT is a hybrid perps exchange (off-chain matching, USDT collateral). perp-cli reads its **official**, keyless Market Data API (`POST https://market-data.grvt.io/full/v1/…`; testnet `-n testnet`). In this version GRVT is read-only; trading is planned for a later release.
|
|
72
|
+
The skill ships inside the npm package (`perp-cli/skills/perp-cli`), so a global install also makes it available locally:
|
|
286
73
|
|
|
287
74
|
```bash
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
perp -e grvt market funding BTC # settled funding history (per 4h / 8h interval)
|
|
291
|
-
perp -e grvt market trades | kline BTC … # public tape / candles
|
|
292
|
-
perp arb scan --rates --include-unverified # GRVT funding rows, display only
|
|
293
|
-
perp health # probed as an official venue
|
|
75
|
+
npm install -g perp-cli@latest
|
|
76
|
+
ls "$(npm root -g)/perp-cli/skills/perp-cli"
|
|
294
77
|
```
|
|
295
78
|
|
|
296
|
-
|
|
297
|
-
- **Symbols:** crypto by ticker; equities / ETFs by ticker from a reviewed list; XAU / XAG / CL / BZ → GOLD / SILVER / WTI / Brent; pre-IPO markets (OPENAI, ANTHROPIC, SPACEX) and ambiguous tickers are never matched across venues. No lot step is published (`stepSize` null); max leverage comes from GRVT's margin rules (`market list|prices|info`, cached up to 6 h — `leverageAsOf`).
|
|
298
|
-
- **Requests:** GRVT has no bulk ticker, so a full market read is one ticker per market (~185 requests, ~5 s), reused for 15 s; documented limits (1500 / min for tickers, 500 / min otherwise) are enforced by the venue limiter.
|
|
299
|
-
- **Refused** (`CAPABILITY_UNSUPPORTED`, "GRVT is read-only (market data) in this version; trading is planned for a later release", before any request — also under `--dry-run`): every trade / account / portfolio / funds / agent / builder / strategy / arb exec command, `setup --venues grvt`, and every MCP account or trading tool. No `perp-cli/ws` codec (GRVT streams are per instrument, capped below its market count).
|
|
79
|
+
### What's in the skill
|
|
300
80
|
|
|
301
|
-
|
|
81
|
+
| File | Purpose |
|
|
82
|
+
|------|---------|
|
|
83
|
+
| `SKILL.md` | Top-level agent guide — rules, workflows, examples |
|
|
84
|
+
| `references/commands.md` | Full non-interactive command reference (every group) |
|
|
85
|
+
| `references/agent-operations.md` | Setup flows, idempotency, error handling, common mistakes |
|
|
86
|
+
| `references/strategies.md` | Funding-arb decision framework + risk management |
|
|
87
|
+
| `scripts/preflight.sh` | Install + wallet + connectivity + risk readiness check |
|
|
88
|
+
| `scripts/arb-monitor.sh` | Live monitor for open arb positions |
|
|
89
|
+
| `scripts/spot-perp-scan.sh` | Scan spot+perp opportunities with balance context |
|
|
90
|
+
| `scripts/funding-analysis.sh` | Cross-exchange funding overview / per-symbol drilldown |
|
|
91
|
+
| `scripts/validate-arb.sh` | Pre-execution validation (price / balance / risk / dry-run) |
|
|
302
92
|
|
|
303
|
-
|
|
93
|
+
See [`skills/perp-cli/SKILL.md`](skills/perp-cli/SKILL.md) for the full agent guide.
|
|
304
94
|
|
|
305
|
-
|
|
306
|
-
perp -e extended market list | prices | info <SYM> # base tickers (BTC, TSLA, SPX500M); wire names (TSLA_24_5-USD) also accepted
|
|
307
|
-
perp -e extended market book TSLA # order book (RFQ markets: the indicative book)
|
|
308
|
-
perp -e extended market funding ETH # applied hourly funding prints
|
|
309
|
-
perp -e extended market trades | kline BTC … # public tape / candles
|
|
310
|
-
perp arb scan --rates --include-unverified # Extended funding rows, display only
|
|
311
|
-
perp health # probed as an official venue
|
|
312
|
-
```
|
|
95
|
+
## Features
|
|
313
96
|
|
|
314
|
-
- **Funding
|
|
315
|
-
- **
|
|
316
|
-
- **
|
|
97
|
+
- **Funding rate arb** — perp-perp and spot-perp scans, one-command dual-leg entry and exit
|
|
98
|
+
- **Portfolio** — one call returns balances, positions and risk across every venue
|
|
99
|
+
- **Funds** — deposit, withdraw, transfer, multi-provider bridge (CCTP / Relay / deBridge), inter-exchange rebalance
|
|
100
|
+
- **Bots** — TWAP, grid, DCA, trailing stop and more, with background job management
|
|
101
|
+
- **Agent-first** — `--json`, `--fields`, `--ndjson`, `--dry-run`, runtime schema introspection
|
|
102
|
+
- **Safety** — pre-trade validation, a slippage bound on every market order, client-id deduplication, response sanitization
|
|
317
103
|
|
|
318
|
-
|
|
104
|
+
## Venues
|
|
319
105
|
|
|
320
|
-
|
|
106
|
+
| Venue | `-e` | Trading | Chain / collateral |
|
|
107
|
+
|---|---|---|---|
|
|
108
|
+
| Hyperliquid | `hyperliquid` (`hl`) | ✅ | HyperEVM, USDC; HIP-3 dexes via `--dex` |
|
|
109
|
+
| Pacifica | `pacifica` (`pac`) | ✅ | Solana, USDC |
|
|
110
|
+
| Lighter | `lighter` (`lt`) | ✅ | Ethereum L2, USDC |
|
|
111
|
+
| Lighter RH | `lighter-rh` (`lrh`) | ✅ | Robinhood chain, USDG |
|
|
112
|
+
| Aster | `aster` (`ast`) | ✅ | BNB Chain, USDT / USDC |
|
|
113
|
+
| Ondo Perps | `ondo` | ✅ | off-chain, USDC |
|
|
114
|
+
| Arcus | `arcus` | ✅ (access whitelist) | Robinhood chain, USDG |
|
|
115
|
+
| QFEX | `qfex` (`qf`) | ✅ (manual trading only) | custodial; equities, indices, commodities |
|
|
116
|
+
| RISEx | `risex` | read-only | RISE chain, USDC |
|
|
117
|
+
| GRVT | `grvt` | market data only | USDT |
|
|
118
|
+
| Extended | `extended` (`ext`) | market data only | Starknet; crypto + equities / FX |
|
|
119
|
+
| Variational | `variational` (`var`) | market data only | RFQ venue |
|
|
120
|
+
| TxFlow | `txflow` (`txf`) | market data only | **unofficial** API |
|
|
121
|
+
| Derive | `derive` | options data only | — |
|
|
122
|
+
|
|
123
|
+
- **[Support matrix and per-venue notes](docs/venues.md)** — funding, WebSocket, deposit / withdraw, lookups by address, restricted regions
|
|
124
|
+
- **[Mainnet verification](docs/verification.md)** — which features have been run with real money
|
|
125
|
+
- **[Trading details](docs/trading.md)** — time in force, TP/SL, stops, slippage, spot trading, builder fees
|
|
126
|
+
|
|
127
|
+
## Common commands
|
|
321
128
|
|
|
322
129
|
```bash
|
|
323
|
-
|
|
324
|
-
perp --json -e
|
|
325
|
-
perp --json -e derive options chain ETH --expiry 2026-12-25 --strikes 10 # bid/ask, mark, IV, greeks, OI per strike
|
|
326
|
-
perp --json -e derive options quote ETH-20261225-3500-P
|
|
327
|
-
```
|
|
130
|
+
# Market data
|
|
131
|
+
perp --json -e <EX> market list | book <SYM> | funding <SYM> | kline <SYM> 1h
|
|
328
132
|
|
|
329
|
-
|
|
133
|
+
# Trading
|
|
134
|
+
perp --json -e <EX> trade buy <SYM> <SIZE> --tp <PX> --sl <PX> # entry protected by TP/SL
|
|
135
|
+
perp --json -e <EX> trade limit <SYM> buy <PX> <SIZE>
|
|
136
|
+
perp --json -e <EX> trade close <SYM> # or: flatten (every position)
|
|
330
137
|
|
|
331
|
-
|
|
138
|
+
# Account
|
|
139
|
+
perp --json portfolio
|
|
140
|
+
perp --json -e <EX> account positions
|
|
141
|
+
perp --json account balance --address <ADDR> # any account, keyless
|
|
332
142
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
| Lighter / Lighter RH | separate | USDC / USDG | yes | yes |
|
|
337
|
-
| Aster | separate (`sapi` spot account) | USDT, USD1 (bare base → USDT) | yes | yes |
|
|
338
|
-
| Pacifica | **unified** — spot shares the perp account | USDC | yes | no (not needed) |
|
|
339
|
-
| Ondo Perps | separate (spot wallet ↔ margin) | USDC | yes | yes |
|
|
340
|
-
| Arcus | **wallet** — on-chain swaps from your master EVM wallet (router, Permit2) | USDG | no (market swaps only) | no |
|
|
143
|
+
# Funding arb
|
|
144
|
+
perp --json arb scan --min 5
|
|
145
|
+
perp --json arb exec <SYM> <longEx> <shortEx> <USD>
|
|
341
146
|
|
|
342
|
-
|
|
343
|
-
perp --json
|
|
344
|
-
perp --json
|
|
345
|
-
perp --json -e <EX> trade spot-limit <SYM> <buy|sell> <PRICE> <SIZE> [--tif GTC|IOC|ALO]
|
|
346
|
-
perp --json -e <EX> trade spot-cancel <SYM> <ORDER_ID>
|
|
347
|
-
perp --json -e <EX> trade spot-orders [SYM]
|
|
348
|
-
perp --json -e <EX> trade spot-transfer <to-spot|to-perp> <AMOUNT> # moves the venue's first quote asset
|
|
349
|
-
perp --json -e <EX> trade spot-balance
|
|
147
|
+
# Funds
|
|
148
|
+
perp --json funds deposit hyperliquid 100
|
|
149
|
+
perp --json funds bridge send --from solana --to arbitrum --amount 100
|
|
350
150
|
```
|
|
351
151
|
|
|
352
|
-
|
|
353
|
-
- **`spot-transfer` on a shared-balance account** (Pacifica, Hyperliquid unified) succeeds as a no-op with `execution.method: "sharedAccount"` (nothing needs to move); a real move reports `execution.method: "transfer"`.
|
|
354
|
-
- **Slippage:** same rule as perps — `--slippage-bps <n>` → `settings.slippageBps.<venue>` → `settings.defaultSlippageBps` (shipped 50).
|
|
355
|
-
- **Pacifica:** spot buys spend the shared USDC perp margin and reduce perp available margin (a warning is printed before the first buy). Pacifica `getMarkets()` (perp) no longer lists the `SOL-USDC` spot market.
|
|
356
|
-
- **Aster:** an agent signer needs spot permission — `perp wallet agent rotate aster --can-spot` (or `perp wallet agent approve aster --can-spot`); otherwise spot orders fail with `POLICY_DENIED`.
|
|
357
|
-
- **Arcus:** swaps go through `router.spot.arcus.xyz` and settle on the Robinhood chain from the master EVM wallet (`--ows` / active OWS wallet; none → `NO_SIGNER_AVAILABLE`). Spot needs only the master wallet — no Arcus perp agent key; perp orders / account reads without one fail with `AGENT_NOT_REGISTERED` (`perp wallet agent approve arcus`). Listing Arcus spot markets is slow (~80 s, one router `/price` per token) — use `spot-buy` / `spot-sell` directly. Tokens without EIP-2612 permit need a one-time on-chain `approve(Permit2)` that costs Robinhood Chain ETH gas — pass `--yes` to allow it. Results show `status`, `finality`, `receivedToken` and a remediation; a `pending` result means the swap was submitted — **do not resubmit**.
|
|
358
|
-
- **Results:** spot orders print the normalized result (status, finality, filled size, average price, received token, remediation). `spot-buy` / `spot-sell` add an `execution` record on every venue (method, slippage bps + source, protection price and reference where the venue path computes one). `spot-cancel` returns one `SpotOrderResult` shape on every venue (a Lighter cancel is `pending` until `spot-orders` confirms it); `spot-orders` lists the same columns on every venue (Hyperliquid included).
|
|
359
|
-
- **Portfolio / landing:** spot value is added on top of perp equity except balances marked `shared` (Pacifica USDC, Hyperliquid unified USDC). Tokens without a spot price are excluded from totals with a stderr warning (never valued at 0).
|
|
360
|
-
- **Bots and arb** (`funding-arb`, `spot-perp-arb`, `arb exec spot:<venue>`, `arb close`, `arb scan --mode spot-perp`) only use spot venues with a separate (or runtime) spot balance **and** a spot↔perp transfer: hyperliquid, lighter, lighter-rh, aster, ondo. Pacifica (shared margin) and Arcus (on-chain swaps) are refused with `CAPABILITY_UNSUPPORTED`; trade them manually with `trade spot-*`.
|
|
152
|
+
Full list with every group: **[docs/commands.md](docs/commands.md)**. Global flags: `--json`, `--fields <f>`, `--ndjson`, `--dry-run`, `-n testnet`, `-e <venue>`, `--dex <name>` (HIP-3), `-w, --wallet <name>`.
|
|
361
153
|
|
|
362
154
|
## Command Groups
|
|
363
155
|
|
|
@@ -376,7 +168,7 @@ perp --json -e <EX> trade spot-balance
|
|
|
376
168
|
| `risk` | Risk limits, liquidation distance, guardrails |
|
|
377
169
|
| `wallet` | Multi-wallet management, agent wallets (`wallet agent ...`), builder fees (`wallet builder ...`, off by default), margin mode / subaccount / API keys (`wallet manage ...`), on-chain balances |
|
|
378
170
|
| `history` | Execution log, PnL, performance breakdown |
|
|
379
|
-
| `portfolio` | Cross-exchange unified overview (replaces former `account balance` / `status` / `dashboard`) |
|
|
171
|
+
| `portfolio` | Cross-exchange unified overview (replaces former `account balance` / `status` / `dashboard`; `account balance --address` reads any account's balances, keyless) |
|
|
380
172
|
| `health` | Adapter health check: ping every venue's REST endpoint (connectivity + latency) |
|
|
381
173
|
| `settings` | CLI settings (referrals, defaults, fees, builder fees, deBridge affiliate) |
|
|
382
174
|
| `backtest` | Strategy backtesting |
|
|
@@ -384,163 +176,38 @@ perp --json -e <EX> trade spot-balance
|
|
|
384
176
|
| `alerts` | Funding rate alerts (Telegram / Discord) with background daemon |
|
|
385
177
|
| `setup` | Setup wizard: OWS wallet, venues, agent wallets, slippage, default venue (alias: `init`; `--non-interactive` for scripts) |
|
|
386
178
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
perp-cli attaches **no** builder fee unless you configure one and the venue approval is confirmed:
|
|
390
|
-
|
|
391
|
-
```bash
|
|
392
|
-
perp settings set builder.hyperliquid 0xBuilder…,1 # <address|code>,<feeBps> — strict: format, venue cap; asks y/N (or --yes)
|
|
393
|
-
perp wallet builder status # per venue: supported? configured? approved? attached?
|
|
394
|
-
perp --dry-run wallet builder approve hyperliquid # plan only
|
|
395
|
-
perp wallet builder approve hyperliquid # master-signed, asks y/N (or --yes)
|
|
396
|
-
perp --no-builder trade market BTC buy 0.1 # skip it for one command
|
|
397
|
-
perp settings unset builder.hyperliquid # off again
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
Supported: hyperliquid (≤ 10 bps, not on HIP-3 dexes), pacifica (≤ 10 bps max, not on spot), aster (≤ 10 bps, mainnet), ondo (≤ 10 bps, no approval step), qfex (`perp settings set builder.qfex <uuid>` — a **fee share**: your fills are attributed to the builder code and you pay the normal fee, nothing extra; the code rides on the trading connection; mainnet only). Lighter / Lighter RH / Arcus: unsupported. If the approval is missing or cannot be read, the order is sent **without** the fee and the result's `execution.notes` says why; `execution.builderFee` shows what was attached.
|
|
179
|
+
## Agent-First CLI Design
|
|
401
180
|
|
|
402
|
-
|
|
181
|
+
Built following [agent-first CLI principles](https://justin.poehnelt.com/posts/rewrite-your-cli-for-ai-agents/):
|
|
403
182
|
|
|
404
183
|
```bash
|
|
405
|
-
#
|
|
184
|
+
# Every command returns structured JSON envelope
|
|
406
185
|
perp --json portfolio
|
|
186
|
+
# → { "ok": true, "data": {...}, "meta": { "timestamp": "..." } }
|
|
407
187
|
|
|
408
|
-
#
|
|
409
|
-
perp --json
|
|
410
|
-
perp --json -e <EX> market book <SYM>
|
|
411
|
-
perp --json -e <EX> market mid <SYM> # fast mid-price lookup
|
|
412
|
-
perp --json -e <EX> market funding <SYM>
|
|
413
|
-
perp --json -e <EX> market kline <SYM> 1h # candlestick data
|
|
414
|
-
perp --json -e hl market hip3 # list HIP-3 deployed dexes
|
|
415
|
-
|
|
416
|
-
# Trading
|
|
417
|
-
perp --json -e <EX> trade buy <SYM> <SIZE> # shortcut for market buy
|
|
418
|
-
perp --json -e <EX> trade sell <SYM> <SIZE> # shortcut for market sell
|
|
419
|
-
perp --json -e <EX> trade market <SYM> buy <SIZE> --smart # IOC limit (less slippage)
|
|
420
|
-
perp --json -e <EX> trade split <SYM> buy 5000 # orderbook-aware split (large orders)
|
|
421
|
-
perp --json -e <EX> trade close <SYM>
|
|
422
|
-
perp --json -e <EX> trade flatten # close ALL positions on exchange
|
|
423
|
-
perp --json -e <EX> trade reduce <SYM> 50 # reduce position by 50%
|
|
424
|
-
perp --json -e <EX> trade cancel <SYM> # cancel by symbol (or orderId)
|
|
425
|
-
perp --json -e <EX> trade buy <SYM> <SIZE> --tp <PX> --sl <PX> # entry protected by TP/SL
|
|
426
|
-
perp --json -e <EX> trade tpsl <SYM> long --tp <PX> --sl <PX> # TP/SL on an open position (long|short)
|
|
427
|
-
perp --json -e <EX> trade stop <SYM> sell <SIZE> <PX> # reduce-only stop (default)
|
|
428
|
-
perp --json -e <EX> trade leverage <SYM> <N>
|
|
429
|
-
|
|
430
|
-
# Account
|
|
431
|
-
perp --json portfolio -e <EX> # balance + spot + positions (account balance was renamed in v0.12)
|
|
432
|
-
perp --json -e <EX> account positions
|
|
433
|
-
perp --json -e <EX> account pnl # realized + unrealized + funding
|
|
434
|
-
perp --json -e <EX> account funding # personal funding payment history
|
|
435
|
-
perp --json -e <EX> account settings # per-market leverage & margin mode
|
|
436
|
-
|
|
437
|
-
# Outcome markets (Hyperliquid HIP-4 — fully-collateralized binary contracts, quote token per outcome (USDC today), min 10 quote tokens)
|
|
438
|
-
perp --json outcome list # active markets + Yes/No mid prices
|
|
439
|
-
perp --json outcome view <outcome> # symmetric Yes/No book + underlying gap + expiry
|
|
440
|
-
perp --json outcome book <outcome> <side> # one-side orderbook (e.g. '1 yes' or '1 0')
|
|
441
|
-
perp --json outcome positions # open outcome holdings
|
|
442
|
-
perp --json outcome orders # open outcome orders
|
|
443
|
-
perp --json outcome buy <outcome> <side> <usd> --dry-run # validate before submit
|
|
444
|
-
perp --json outcome buy <outcome> <side> <usd> # market buy, notional in the outcome's quote token
|
|
445
|
-
perp --json outcome sell <outcome> <side> <usd> --limit <px> --tif gtc
|
|
446
|
-
perp --json outcome cancel <outcome> <side> <oid>
|
|
447
|
-
|
|
448
|
-
# Funding rate arbitrage
|
|
449
|
-
perp --json arb scan --min 5 # perp-perp opportunities
|
|
450
|
-
perp --json arb scan --mode spot-perp # spot+perp opportunities
|
|
451
|
-
perp --json arb scan --rates # funding rates across all exchanges
|
|
452
|
-
perp --json arb scan --basis # cross-exchange basis opportunities
|
|
453
|
-
perp --json arb scan --gaps # cross-exchange price gaps
|
|
454
|
-
perp --json arb scan --hip3 # HIP-3 cross-dex funding spreads
|
|
455
|
-
perp --json arb scan --live # continuous live monitoring
|
|
456
|
-
perp --json arb exec <SYM> <longEx> <shortEx> <$> # perp-perp dual-leg entry
|
|
457
|
-
perp --json arb exec <SYM> spot:<exch> <perpEx> <$> # spot+perp entry
|
|
458
|
-
perp --json arb config # show arb defaults
|
|
459
|
-
perp --json arb history # past arb trade performance (alias: log)
|
|
460
|
-
|
|
461
|
-
# Funds (deposit, withdraw, transfer, bridge, rebalance)
|
|
462
|
-
perp --json funds deposit hyperliquid 100
|
|
463
|
-
perp --json funds withdraw pacifica 50
|
|
464
|
-
perp --json funds deposit lighter-rh 10 # USDG on Robinhood Chain (approve + deposit, mainnet)
|
|
465
|
-
perp --json -e lighter-rh funds withdraw lighter 10 # USDG → Robinhood Chain
|
|
466
|
-
perp --json funds deposit aster 8 # USDT → Aster vault on BNB Chain (--chain arbitrum / --asset USDC; mainnet)
|
|
467
|
-
perp --json funds withdraw aster 8 --chain bsc # USDT → your own address (agent needs --can-withdraw --ip-whitelist)
|
|
468
|
-
perp --json funds deposit ondo 12 --probe 2 # USDC transfer to your Ondo funding address (Arbitrum; --chain ethereum)
|
|
469
|
-
perp --json funds withdraw arcus 10 # to the Arcus account owner
|
|
470
|
-
perp --json funds transfer 100 <ADDRESS> # HL internal transfer (instant)
|
|
471
|
-
perp --json funds bridge quote --from solana --to arbitrum --amount 100
|
|
472
|
-
perp --json funds bridge send --from solana --to arbitrum --amount 100 # auto-cheapest provider
|
|
473
|
-
perp --json --dry-run funds bridge send --from robinhood --to solana --from-asset USDG --to-asset SOL --amount 15 # Relay quote only
|
|
474
|
-
perp --json funds bridge send --from robinhood --to bsc --from-asset USDG --to-asset USDT --amount 15 # Relay swap, OWS master signs
|
|
475
|
-
perp --json funds bridge exchange --from pacifica --to hyperliquid --amount 100
|
|
476
|
-
perp --json funds rebalance check # balances across exchanges
|
|
477
|
-
perp --json funds rebalance plan # compute optimal moves
|
|
478
|
-
perp --json funds rebalance execute --auto-bridge # withdraw → bridge → deposit
|
|
479
|
-
perp --json funds info # all routes & limits
|
|
480
|
-
|
|
481
|
-
# Risk
|
|
482
|
-
perp --json risk limits --max-leverage 5
|
|
483
|
-
perp --json risk liquidation-distance
|
|
484
|
-
|
|
485
|
-
# Strategies (19 bot algorithms + nested scripted plans)
|
|
486
|
-
perp strategy list-strategies # list all available strategies
|
|
487
|
-
perp strategy run <strategy> [symbol] # run any strategy
|
|
488
|
-
perp strategy apex [symbol] # APEX autonomous orchestrator
|
|
489
|
-
perp strategy reflect # trading performance analysis
|
|
490
|
-
perp strategy preset-list # list strategy presets
|
|
491
|
-
perp --json strategy twap <SYM> buy <SIZE> 30m
|
|
492
|
-
perp --json strategy grid <SYM> --range 5 --grids 10 --size 100
|
|
493
|
-
perp strategy plan example # scripted multi-step plan format
|
|
494
|
-
perp --json strategy plan validate <FILE> # validate scripted plan
|
|
495
|
-
perp --json strategy plan execute <FILE> --dry-run # dry-run scripted plan
|
|
496
|
-
|
|
497
|
-
# Background process supervisor (tmux)
|
|
498
|
-
perp background list # list running jobs
|
|
499
|
-
perp background stop <ID> # stop a job
|
|
500
|
-
perp background logs <ID> -f # follow logs
|
|
501
|
-
# Jobs inherit -n, --dry-run, -e, --ows, -w, --no-agent, --dex and never receive keys via argv/env:
|
|
502
|
-
# they read the OWS vault / agent keystores / ~/.perp/.env themselves. -k, --passphrase, --ows-key or a
|
|
503
|
-
# shell-exported key / OWS_PASSPHRASE is refused — register an agent (perp wallet agent approve <venue>).
|
|
504
|
-
|
|
505
|
-
```
|
|
506
|
-
|
|
507
|
-
## Telegram Alerts
|
|
508
|
-
|
|
509
|
-
Funding rate alerts via Telegram with background daemon support.
|
|
510
|
-
|
|
511
|
-
```bash
|
|
512
|
-
# Interactive setup (BotFather token + chat ID auto-detection)
|
|
513
|
-
perp alerts setup
|
|
188
|
+
# Filter output to specific fields (saves tokens)
|
|
189
|
+
perp --json --fields totalEquity,risk portfolio
|
|
514
190
|
|
|
515
|
-
#
|
|
516
|
-
perp
|
|
517
|
-
perp alerts add --all 50 # alert for any symbol > 50%
|
|
191
|
+
# Stream large lists as NDJSON (one JSON per line)
|
|
192
|
+
perp --json --ndjson -e hl market list
|
|
518
193
|
|
|
519
|
-
#
|
|
520
|
-
perp
|
|
521
|
-
perp
|
|
194
|
+
# Pre-validate before executing
|
|
195
|
+
perp --json -e hl trade check BTC buy 0.01
|
|
196
|
+
perp --json --dry-run -e hl trade market BTC buy 0.01
|
|
522
197
|
|
|
523
|
-
#
|
|
524
|
-
perp
|
|
525
|
-
perp
|
|
526
|
-
perp alerts stop # stop background daemon
|
|
198
|
+
# Idempotent orders with client ID (Hyperliquid: a 128-bit cloid, 0x + 32 hex; --auto-id generates one)
|
|
199
|
+
perp --json -e hl trade market BTC buy 0.01 --client-id 0x1234567890abcdef1234567890abcdef
|
|
200
|
+
perp --json -e hl trade status c:0x1234567890abcdef1234567890abcdef
|
|
527
201
|
```
|
|
528
202
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
Exchange flag: `-e hyperliquid` / `-e pacifica` / `-e lighter` / `-e aster` (aliases: `hl`, `pac`, `lt`).
|
|
532
|
-
|
|
533
|
-
Global flags: `--json`, `--fields <f>`, `--ndjson`, `--dry-run`, `--dex <name>` (HIP-3), `-w, --wallet <name>`.
|
|
203
|
+
All responses are auto-sanitized (control chars stripped, prompt injection patterns blocked).
|
|
204
|
+
Errors include `retryable` flag — only retry when `true`.
|
|
534
205
|
|
|
535
206
|
## MCP Server
|
|
536
207
|
|
|
537
208
|
[](https://glama.ai/mcp/servers/hypurrquant/perp-cli)
|
|
538
209
|
|
|
539
|
-
perp-
|
|
540
|
-
|
|
541
|
-
**No API keys required for market data** — explore prices, orderbooks, funding rates, and arb opportunities without any setup. Add keys only when you want to trade.
|
|
542
|
-
|
|
543
|
-
**Network:** set `PERP_NETWORK=testnet` in the server env to serve testnet (validated; unset = mainnet); every result reports `meta.network`. `trade_execute` / `trade_close` place real orders through the same local risk gate as `perp trade` (no override over MCP), refuse non-reduce-only orders on quarantined symbols, and are written to the execution log.
|
|
210
|
+
`perp-mcp` serves 31 tools to Claude Desktop, Cursor and other MCP clients. Market data needs no keys; for account and trading tools run `perp setup` first (the server reads the same wallet). Never put private keys in the MCP config.
|
|
544
211
|
|
|
545
212
|
```json
|
|
546
213
|
{
|
|
@@ -553,94 +220,21 @@ perp-cli includes a full-featured MCP server (29 tools, 3 resources, 2 prompts)
|
|
|
553
220
|
}
|
|
554
221
|
```
|
|
555
222
|
|
|
556
|
-
|
|
557
|
-
```json
|
|
558
|
-
{
|
|
559
|
-
"env": {
|
|
560
|
-
"PERP_NETWORK": "testnet"
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
**Read-only tools (no keys):** `get_markets`, `get_orderbook`, `get_funding_rates`, `get_prices`, `get_outcome_markets`, `get_outcome_view`, `get_outcome_book`, `get_option_expiries`, `get_option_chain`, `get_option_quote` (Derive options), `pacifica_print_products`, `pacifica_print_quote`, `pacifica_print_positions`, `pacifica_vaults` (Pacifica Print / vaults; writes are CLI-only), `arb_scan`, `health_check`
|
|
566
|
-
|
|
567
|
-
**Advisor tools (no keys):** `suggest_command`, `explain_command`
|
|
568
|
-
|
|
569
|
-
**Account & trading tools (keys required):** `get_balance`, `get_positions`, `get_open_orders`, `get_outcome_positions`, `portfolio`, `trade_preview`, `trade_execute`, `trade_close`, `get_funding_analysis`, `get_pnl_analysis`, `get_arb_compare`
|
|
570
|
-
|
|
571
|
-
- `get_markets` / `get_orderbook` add `meta.apiStatus` (`"unofficial"` + `apiNote` for TxFlow); `get_prices` lists `meta.unofficialApiVenues`; `health_check` rows carry `apiStatus`. Account / trading tools refuse TxFlow with `CAPABILITY_UNSUPPORTED`; `trade_preview` / `trade_execute` / `trade_close` refuse RISEx (read-only in 0.15.0) before any credential is read.
|
|
572
|
-
|
|
573
|
-
**Resources:** `market://prices`, `market://funding-rates`, `perp://schema`
|
|
574
|
-
|
|
575
|
-
**Prompts:** `trading-guide`, `arb-strategy`
|
|
576
|
-
|
|
577
|
-
## AI Agent Skill
|
|
578
|
-
|
|
579
|
-
Drop-in skill for Claude Code, Cursor, Codex, Gemini CLI, and other agent CLIs. Bundles a non-interactive command guide, ops playbook, strategy framework, and reusable shell scripts (preflight, arb monitor, validation) so your agent stops at the right confirmation points and never wedges on interactive wizards.
|
|
580
|
-
|
|
581
|
-
### Install
|
|
582
|
-
|
|
583
|
-
```bash
|
|
584
|
-
# Claude Code — slash command
|
|
585
|
-
/install-skill hypurrquant/perp-cli
|
|
586
|
-
|
|
587
|
-
# Cursor / Codex / generic agent CLIs — via npx
|
|
588
|
-
npx skills add hypurrquant/perp-cli
|
|
589
|
-
|
|
590
|
-
# Manual install (any agent that reads a Skills directory)
|
|
591
|
-
git clone https://github.com/hypurrquant/perp-cli.git
|
|
592
|
-
cp -R perp-cli/skills/perp-cli ~/.claude/skills/ # or your CLI's skills dir
|
|
593
|
-
```
|
|
594
|
-
|
|
595
|
-
The skill ships inside the npm package (`perp-cli/skills/perp-cli`), so a global install also makes it available locally:
|
|
223
|
+
Testnet, the full tool list, resources and prompts: **[docs/mcp.md](docs/mcp.md)**.
|
|
596
224
|
|
|
597
|
-
|
|
598
|
-
npm install -g perp-cli@latest
|
|
599
|
-
ls "$(npm root -g)/perp-cli/skills/perp-cli"
|
|
600
|
-
```
|
|
225
|
+
## Documentation
|
|
601
226
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
|
605
|
-
|
|
606
|
-
|
|
|
607
|
-
|
|
|
608
|
-
|
|
|
609
|
-
|
|
|
610
|
-
|
|
|
611
|
-
|
|
|
612
|
-
|
|
|
613
|
-
| `scripts/funding-analysis.sh` | Cross-exchange funding overview / per-symbol drilldown |
|
|
614
|
-
| `scripts/validate-arb.sh` | Pre-execution validation (price / balance / risk / dry-run) |
|
|
615
|
-
|
|
616
|
-
See [`skills/perp-cli/SKILL.md`](skills/perp-cli/SKILL.md) for the full agent guide.
|
|
617
|
-
|
|
618
|
-
## Agent-First CLI Design
|
|
619
|
-
|
|
620
|
-
Built following [agent-first CLI principles](https://justin.poehnelt.com/posts/rewrite-your-cli-for-ai-agents/):
|
|
621
|
-
|
|
622
|
-
```bash
|
|
623
|
-
# Every command returns structured JSON envelope
|
|
624
|
-
perp --json portfolio
|
|
625
|
-
# → { "ok": true, "data": {...}, "meta": { "timestamp": "..." } }
|
|
626
|
-
|
|
627
|
-
# Filter output to specific fields (saves tokens)
|
|
628
|
-
perp --json --fields totalEquity,risk portfolio
|
|
629
|
-
|
|
630
|
-
# Stream large lists as NDJSON (one JSON per line)
|
|
631
|
-
perp --json --ndjson -e hl market list
|
|
632
|
-
|
|
633
|
-
# Pre-validate before executing
|
|
634
|
-
perp --json -e hl trade check BTC buy 0.01
|
|
635
|
-
perp --json --dry-run -e hl trade market BTC buy 0.01
|
|
636
|
-
|
|
637
|
-
# Idempotent orders with client ID (Hyperliquid: a 128-bit cloid, 0x + 32 hex; --auto-id generates one)
|
|
638
|
-
perp --json -e hl trade market BTC buy 0.01 --client-id 0x1234567890abcdef1234567890abcdef
|
|
639
|
-
perp --json -e hl trade status c:0x1234567890abcdef1234567890abcdef
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
All responses are auto-sanitized (control chars stripped, prompt injection patterns blocked).
|
|
643
|
-
Errors include `retryable` flag — only retry when `true`.
|
|
227
|
+
| Doc | What's in it |
|
|
228
|
+
|---|---|
|
|
229
|
+
| [Setup](docs/setup.md) | Wallets, agent keys, keys created on the exchange website, where secrets are stored |
|
|
230
|
+
| [Venues](docs/venues.md) | Support matrix, venue ids, QFEX / RISEx / GRVT / Extended / Variational / TxFlow / Derive details |
|
|
231
|
+
| [Trading](docs/trading.md) | Time in force, TP/SL, stops, order edit, slippage, spot trading, builder fees |
|
|
232
|
+
| [Commands](docs/commands.md) | Every command group with examples, Telegram alerts |
|
|
233
|
+
| [Mainnet verification](docs/verification.md) | What has been run with real money, per venue |
|
|
234
|
+
| [MCP server](docs/mcp.md) | Configuration, testnet, tools, resources, prompts |
|
|
235
|
+
| [Signing guardrail](docs/guardrail.md) | `perp-guardrail`, the OWS policy executable for agent keys |
|
|
236
|
+
| [Testing](docs/TESTING.md) | Test suites and the venue checklist |
|
|
237
|
+
| [CHANGELOG](CHANGELOG.md) | Release notes |
|
|
644
238
|
|
|
645
239
|
## License
|
|
646
240
|
|