perp-cli 0.12.17 → 0.14.0

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