perp-cli 0.14.3 → 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.
Files changed (363) hide show
  1. package/README.ja.md +243 -0
  2. package/README.ko.md +243 -0
  3. package/README.md +138 -405
  4. package/README.zh.md +243 -0
  5. package/dist/agent-wallet/store.d.ts +3 -2
  6. package/dist/agent-wallet/store.js +2 -2
  7. package/dist/api/public/hyperliquid.js +4 -0
  8. package/dist/api/public/lighter.d.ts +5 -0
  9. package/dist/api/public/lighter.js +5 -0
  10. package/dist/api/public/pacifica.js +85 -15
  11. package/dist/api/public/urls.d.ts +2 -0
  12. package/dist/api/public/urls.js +3 -0
  13. package/dist/arb/sizing.js +4 -2
  14. package/dist/arb/state.d.ts +6 -0
  15. package/dist/arb/utils.d.ts +1 -2
  16. package/dist/arb/utils.js +1 -2
  17. package/dist/balance-by-address.d.ts +39 -0
  18. package/dist/balance-by-address.js +44 -0
  19. package/dist/bot/apex/pulse.js +3 -0
  20. package/dist/bot/apex/radar.js +2 -1
  21. package/dist/bot/engine.d.ts +10 -1
  22. package/dist/bot/engine.js +14 -6
  23. package/dist/bot/indicators.d.ts +7 -0
  24. package/dist/bot/indicators.js +16 -0
  25. package/dist/bot/perp-order.d.ts +4 -4
  26. package/dist/bot/perp-order.js +5 -5
  27. package/dist/bot/quarantine.d.ts +1 -1
  28. package/dist/bot/quarantine.js +1 -1
  29. package/dist/bot/quote-rules.js +1 -1
  30. package/dist/bot/strategies/apex-strategy.js +3 -2
  31. package/dist/bot/strategies/engine-mm.js +6 -5
  32. package/dist/bot/strategies/funding-arb-strategy.js +12 -5
  33. package/dist/bot/strategies/funding-arb-utils.d.ts +15 -3
  34. package/dist/bot/strategies/funding-arb-utils.js +53 -20
  35. package/dist/bot/strategies/funding-auto.js +2 -2
  36. package/dist/bot/strategies/liquidation-mm.d.ts +1 -0
  37. package/dist/bot/strategies/liquidation-mm.js +8 -2
  38. package/dist/bot/strategies/momentum-breakout.d.ts +1 -0
  39. package/dist/bot/strategies/momentum-breakout.js +11 -3
  40. package/dist/bot/strategies/spot-perp-arb-strategy.d.ts +1 -1
  41. package/dist/bot/strategies/spot-perp-arb-strategy.js +6 -4
  42. package/dist/bot/strategies/spot-perp-executor.d.ts +1 -1
  43. package/dist/bot/strategies/spot-perp-executor.js +3 -3
  44. package/dist/bot/strategy-types.d.ts +2 -1
  45. package/dist/bot/tui/BotDashboard.d.ts +1 -1
  46. package/dist/bot/tui/BotDashboard.js +1 -1
  47. package/dist/cache.js +12 -6
  48. package/dist/cli-program.d.ts +15 -0
  49. package/dist/cli-program.js +126 -6
  50. package/dist/commands/account.js +168 -24
  51. package/dist/commands/agent-import.d.ts +7 -0
  52. package/dist/commands/agent-import.js +30 -1
  53. package/dist/commands/agent.d.ts +6 -3
  54. package/dist/commands/agent.js +160 -12
  55. package/dist/commands/arb/index.js +23 -81
  56. package/dist/commands/arb-auto.d.ts +24 -0
  57. package/dist/commands/arb-auto.js +175 -97
  58. package/dist/commands/arb.d.ts +20 -0
  59. package/dist/commands/arb.js +107 -163
  60. package/dist/commands/backtest.js +23 -21
  61. package/dist/commands/bot.js +1 -1
  62. package/dist/commands/builder.js +1 -1
  63. package/dist/commands/funds.js +113 -3
  64. package/dist/commands/init.d.ts +1 -1
  65. package/dist/commands/init.js +27 -7
  66. package/dist/commands/manage.js +23 -21
  67. package/dist/commands/market.d.ts +48 -0
  68. package/dist/commands/market.js +395 -100
  69. package/dist/commands/options.d.ts +14 -0
  70. package/dist/commands/options.js +151 -0
  71. package/dist/commands/pacifica-earn.d.ts +5 -0
  72. package/dist/commands/pacifica-earn.js +455 -0
  73. package/dist/commands/pacifica-orders.d.ts +14 -0
  74. package/dist/commands/pacifica-orders.js +142 -0
  75. package/dist/commands/portfolio.d.ts +16 -0
  76. package/dist/commands/portfolio.js +83 -55
  77. package/dist/commands/rebalance.d.ts +1 -0
  78. package/dist/commands/rebalance.js +15 -0
  79. package/dist/commands/risk.d.ts +11 -2
  80. package/dist/commands/risk.js +39 -44
  81. package/dist/commands/trade.d.ts +1 -0
  82. package/dist/commands/trade.js +67 -62
  83. package/dist/commands/wallet.js +1 -1
  84. package/dist/config.d.ts +2 -2
  85. package/dist/config.js +15 -4
  86. package/dist/constants.js +6 -0
  87. package/dist/cross-chain-margin.d.ts +3 -1
  88. package/dist/cross-chain-margin.js +4 -2
  89. package/dist/dashboard/server.js +3 -3
  90. package/dist/dashboard/ui.js +9 -6
  91. package/dist/errors.d.ts +29 -1
  92. package/dist/errors.js +35 -3
  93. package/dist/exchanges/address.d.ts +8 -0
  94. package/dist/exchanges/address.js +47 -0
  95. package/dist/exchanges/arcus/adapter.d.ts +16 -12
  96. package/dist/exchanges/arcus/adapter.js +45 -18
  97. package/dist/exchanges/arcus/agent.d.ts +1 -1
  98. package/dist/exchanges/arcus/agent.js +1 -1
  99. package/dist/exchanges/arcus/client.js +1 -1
  100. package/dist/exchanges/arcus/public.js +3 -2
  101. package/dist/exchanges/arcus/signing.d.ts +2 -3
  102. package/dist/exchanges/arcus/signing.js +1 -1
  103. package/dist/exchanges/arcus/spot-chain.d.ts +1 -1
  104. package/dist/exchanges/arcus/spot-chain.js +1 -1
  105. package/dist/exchanges/arcus/spot-router.d.ts +1 -1
  106. package/dist/exchanges/arcus/spot-router.js +2 -2
  107. package/dist/exchanges/arcus/spot.d.ts +2 -3
  108. package/dist/exchanges/arcus/spot.js +2 -3
  109. package/dist/exchanges/aster-spot.d.ts +3 -3
  110. package/dist/exchanges/aster-spot.js +6 -9
  111. package/dist/exchanges/aster-typed-data.d.ts +1 -1
  112. package/dist/exchanges/aster-typed-data.js +1 -1
  113. package/dist/exchanges/aster.d.ts +30 -10
  114. package/dist/exchanges/aster.js +153 -53
  115. package/dist/exchanges/builder-fee.d.ts +1 -1
  116. package/dist/exchanges/builder-fee.js +13 -2
  117. package/dist/exchanges/canonical-symbols.d.ts +8 -2
  118. package/dist/exchanges/canonical-symbols.js +46 -2
  119. package/dist/exchanges/capabilities.d.ts +2 -0
  120. package/dist/exchanges/capabilities.js +2 -1
  121. package/dist/exchanges/derive/client.d.ts +37 -0
  122. package/dist/exchanges/derive/client.js +135 -0
  123. package/dist/exchanges/derive/options.d.ts +73 -0
  124. package/dist/exchanges/derive/options.js +379 -0
  125. package/dist/exchanges/extended/adapter.d.ts +96 -0
  126. package/dist/exchanges/extended/adapter.js +241 -0
  127. package/dist/exchanges/extended/client.d.ts +38 -0
  128. package/dist/exchanges/extended/client.js +88 -0
  129. package/dist/exchanges/extended/public.d.ts +133 -0
  130. package/dist/exchanges/extended/public.js +436 -0
  131. package/dist/exchanges/grvt/adapter.d.ts +100 -0
  132. package/dist/exchanges/grvt/adapter.js +283 -0
  133. package/dist/exchanges/grvt/client.d.ts +25 -0
  134. package/dist/exchanges/grvt/client.js +86 -0
  135. package/dist/exchanges/grvt/public.d.ts +151 -0
  136. package/dist/exchanges/grvt/public.js +438 -0
  137. package/dist/exchanges/hyperliquid-outcome.d.ts +2 -0
  138. package/dist/exchanges/hyperliquid-outcome.js +29 -1
  139. package/dist/exchanges/hyperliquid-spot.d.ts +9 -1
  140. package/dist/exchanges/hyperliquid-spot.js +24 -16
  141. package/dist/exchanges/hyperliquid.d.ts +199 -22
  142. package/dist/exchanges/hyperliquid.js +550 -202
  143. package/dist/exchanges/index.d.ts +1 -1
  144. package/dist/exchanges/index.js +1 -1
  145. package/dist/exchanges/interface.d.ts +157 -13
  146. package/dist/exchanges/interface.js +47 -0
  147. package/dist/exchanges/ioc-outcome.d.ts +1 -1
  148. package/dist/exchanges/ioc-outcome.js +1 -1
  149. package/dist/exchanges/legacy-trading-v2.d.ts +2 -2
  150. package/dist/exchanges/legacy-trading-v2.js +7 -2
  151. package/dist/exchanges/lighter-public.d.ts +67 -12
  152. package/dist/exchanges/lighter-public.js +250 -82
  153. package/dist/exchanges/lighter-signer.d.ts +1 -1
  154. package/dist/exchanges/lighter-signer.js +1 -1
  155. package/dist/exchanges/lighter-spot.d.ts +10 -5
  156. package/dist/exchanges/lighter-spot.js +105 -97
  157. package/dist/exchanges/lighter.d.ts +80 -21
  158. package/dist/exchanges/lighter.js +312 -105
  159. package/dist/exchanges/ondo/adapter.d.ts +38 -13
  160. package/dist/exchanges/ondo/adapter.js +86 -27
  161. package/dist/exchanges/ondo/agent.d.ts +1 -1
  162. package/dist/exchanges/ondo/agent.js +1 -1
  163. package/dist/exchanges/ondo/client.d.ts +1 -1
  164. package/dist/exchanges/ondo/client.js +2 -2
  165. package/dist/exchanges/ondo/public.d.ts +35 -3
  166. package/dist/exchanges/ondo/public.js +75 -32
  167. package/dist/exchanges/ondo/spot.d.ts +2 -2
  168. package/dist/exchanges/ondo/spot.js +3 -3
  169. package/dist/exchanges/options-interface.d.ts +158 -0
  170. package/dist/exchanges/options-interface.js +17 -0
  171. package/dist/exchanges/options-venues.d.ts +12 -0
  172. package/dist/exchanges/options-venues.js +35 -0
  173. package/dist/exchanges/outcome-interface.d.ts +4 -0
  174. package/dist/exchanges/pacifica-atomic.d.ts +211 -0
  175. package/dist/exchanges/pacifica-atomic.js +440 -0
  176. package/dist/exchanges/pacifica-decimal.d.ts +10 -0
  177. package/dist/exchanges/pacifica-decimal.js +51 -0
  178. package/dist/exchanges/pacifica-presigned.d.ts +53 -0
  179. package/dist/exchanges/pacifica-presigned.js +141 -0
  180. package/dist/exchanges/pacifica-print.d.ts +200 -0
  181. package/dist/exchanges/pacifica-print.js +417 -0
  182. package/dist/exchanges/pacifica-spot.d.ts +8 -2
  183. package/dist/exchanges/pacifica-spot.js +26 -18
  184. package/dist/exchanges/pacifica-typed-data.d.ts +1 -1
  185. package/dist/exchanges/pacifica-typed-data.js +1 -1
  186. package/dist/exchanges/pacifica-vaults.d.ts +130 -0
  187. package/dist/exchanges/pacifica-vaults.js +277 -0
  188. package/dist/exchanges/pacifica.d.ts +108 -10
  189. package/dist/exchanges/pacifica.js +428 -171
  190. package/dist/exchanges/precision.d.ts +3 -1
  191. package/dist/exchanges/precision.js +9 -2
  192. package/dist/exchanges/public-balances.d.ts +25 -0
  193. package/dist/exchanges/public-balances.js +158 -0
  194. package/dist/exchanges/public-positions.d.ts +43 -0
  195. package/dist/exchanges/public-positions.js +154 -0
  196. package/dist/exchanges/qfex/adapter.d.ts +69 -13
  197. package/dist/exchanges/qfex/adapter.js +102 -17
  198. package/dist/exchanges/qfex/agent.d.ts +1 -1
  199. package/dist/exchanges/qfex/agent.js +1 -1
  200. package/dist/exchanges/qfex/client.d.ts +1 -1
  201. package/dist/exchanges/qfex/client.js +1 -1
  202. package/dist/exchanges/qfex/errors.d.ts +1 -1
  203. package/dist/exchanges/qfex/errors.js +2 -2
  204. package/dist/exchanges/qfex/public.d.ts +65 -12
  205. package/dist/exchanges/qfex/public.js +131 -25
  206. package/dist/exchanges/qfex/signing.d.ts +2 -2
  207. package/dist/exchanges/qfex/signing.js +4 -5
  208. package/dist/exchanges/qfex/ws-transport.d.ts +3 -3
  209. package/dist/exchanges/qfex/ws-transport.js +3 -3
  210. package/dist/exchanges/rate-limiter.d.ts +1 -1
  211. package/dist/exchanges/rate-limiter.js +5 -2
  212. package/dist/exchanges/registry.d.ts +1 -1
  213. package/dist/exchanges/registry.js +1 -1
  214. package/dist/exchanges/risex/adapter.d.ts +160 -0
  215. package/dist/exchanges/risex/adapter.js +842 -0
  216. package/dist/exchanges/risex/agent.d.ts +154 -0
  217. package/dist/exchanges/risex/agent.js +384 -0
  218. package/dist/exchanges/risex/client.d.ts +47 -0
  219. package/dist/exchanges/risex/client.js +174 -0
  220. package/dist/exchanges/risex/nonce.d.ts +43 -0
  221. package/dist/exchanges/risex/nonce.js +212 -0
  222. package/dist/exchanges/risex/public.d.ts +64 -0
  223. package/dist/exchanges/risex/public.js +150 -0
  224. package/dist/exchanges/risex/session.d.ts +71 -0
  225. package/dist/exchanges/risex/session.js +171 -0
  226. package/dist/exchanges/risex/typed-data.d.ts +173 -0
  227. package/dist/exchanges/risex/typed-data.js +240 -0
  228. package/dist/exchanges/risex/units.d.ts +29 -0
  229. package/dist/exchanges/risex/units.js +104 -0
  230. package/dist/exchanges/slippage.d.ts +1 -1
  231. package/dist/exchanges/slippage.js +1 -1
  232. package/dist/exchanges/spot-factory.d.ts +3 -3
  233. package/dist/exchanges/spot-factory.js +8 -8
  234. package/dist/exchanges/spot-interface.d.ts +5 -5
  235. package/dist/exchanges/spot-interface.js +2 -2
  236. package/dist/exchanges/spot-result.d.ts +3 -3
  237. package/dist/exchanges/spot-result.js +3 -3
  238. package/dist/exchanges/trading-v2.d.ts +3 -3
  239. package/dist/exchanges/trading-v2.js +9 -6
  240. package/dist/exchanges/txflow/adapter.d.ts +61 -0
  241. package/dist/exchanges/txflow/adapter.js +150 -0
  242. package/dist/exchanges/txflow/client.d.ts +47 -0
  243. package/dist/exchanges/txflow/client.js +155 -0
  244. package/dist/exchanges/txflow/public.d.ts +87 -0
  245. package/dist/exchanges/txflow/public.js +355 -0
  246. package/dist/exchanges/unknown-symbol.d.ts +34 -0
  247. package/dist/exchanges/unknown-symbol.js +56 -0
  248. package/dist/exchanges/variational/adapter.d.ts +67 -0
  249. package/dist/exchanges/variational/adapter.js +137 -0
  250. package/dist/exchanges/variational/client.d.ts +21 -0
  251. package/dist/exchanges/variational/client.js +66 -0
  252. package/dist/exchanges/variational/public.d.ts +126 -0
  253. package/dist/exchanges/variational/public.js +430 -0
  254. package/dist/exchanges/venue-types.d.ts +52 -10
  255. package/dist/exchanges/venue-types.js +82 -11
  256. package/dist/exchanges/venue.d.ts +150 -11
  257. package/dist/exchanges/venue.js +126 -4
  258. package/dist/exchanges/venues/arcus.d.ts +1 -2
  259. package/dist/exchanges/venues/arcus.js +5 -4
  260. package/dist/exchanges/venues/aster.d.ts +2 -2
  261. package/dist/exchanges/venues/aster.js +6 -4
  262. package/dist/exchanges/venues/create-helpers.d.ts +1 -1
  263. package/dist/exchanges/venues/create-helpers.js +3 -3
  264. package/dist/exchanges/venues/extended.d.ts +21 -0
  265. package/dist/exchanges/venues/extended.js +96 -0
  266. package/dist/exchanges/venues/grvt.d.ts +30 -0
  267. package/dist/exchanges/venues/grvt.js +98 -0
  268. package/dist/exchanges/venues/hyperliquid.d.ts +2 -2
  269. package/dist/exchanges/venues/hyperliquid.js +19 -8
  270. package/dist/exchanges/venues/index.d.ts +7 -2
  271. package/dist/exchanges/venues/index.js +8 -2
  272. package/dist/exchanges/venues/lighter-family.d.ts +7 -9
  273. package/dist/exchanges/venues/lighter-family.js +9 -11
  274. package/dist/exchanges/venues/lighter-rh.d.ts +2 -2
  275. package/dist/exchanges/venues/lighter-rh.js +20 -8
  276. package/dist/exchanges/venues/lighter.d.ts +1 -1
  277. package/dist/exchanges/venues/lighter.js +18 -6
  278. package/dist/exchanges/venues/ondo.d.ts +1 -1
  279. package/dist/exchanges/venues/ondo.js +5 -3
  280. package/dist/exchanges/venues/pacifica.d.ts +2 -2
  281. package/dist/exchanges/venues/pacifica.js +15 -4
  282. package/dist/exchanges/venues/qfex.d.ts +1 -1
  283. package/dist/exchanges/venues/qfex.js +4 -2
  284. package/dist/exchanges/venues/risex-release.d.ts +14 -0
  285. package/dist/exchanges/venues/risex-release.js +14 -0
  286. package/dist/exchanges/venues/risex.d.ts +31 -0
  287. package/dist/exchanges/venues/risex.js +131 -0
  288. package/dist/exchanges/venues/txflow.d.ts +18 -0
  289. package/dist/exchanges/venues/txflow.js +77 -0
  290. package/dist/exchanges/venues/variational.d.ts +21 -0
  291. package/dist/exchanges/venues/variational.js +85 -0
  292. package/dist/execution-log.d.ts +1 -1
  293. package/dist/funding/legacy-public.d.ts +6 -4
  294. package/dist/funding/legacy-public.js +42 -41
  295. package/dist/funding/normalize.d.ts +1 -1
  296. package/dist/funding/normalize.js +1 -1
  297. package/dist/funding/rates.d.ts +95 -6
  298. package/dist/funding/rates.js +99 -19
  299. package/dist/index.js +7 -6
  300. package/dist/jobs.d.ts +1 -0
  301. package/dist/jobs.js +25 -1
  302. package/dist/landing.d.ts +2 -0
  303. package/dist/landing.js +1 -1
  304. package/dist/liquidity.d.ts +3 -1
  305. package/dist/liquidity.js +8 -4
  306. package/dist/mcp-pacifica-earn.d.ts +9 -0
  307. package/dist/mcp-pacifica-earn.js +64 -0
  308. package/dist/mcp-server.js +211 -68
  309. package/dist/pacifica/client.d.ts +69 -5
  310. package/dist/pacifica/client.js +181 -8
  311. package/dist/pacifica/rate-limit.d.ts +144 -0
  312. package/dist/pacifica/rate-limit.js +267 -0
  313. package/dist/pacifica/types/order.d.ts +2 -1
  314. package/dist/plan-executor.js +7 -2
  315. package/dist/positions-by-address.d.ts +34 -0
  316. package/dist/positions-by-address.js +46 -0
  317. package/dist/rebalance.js +1 -1
  318. package/dist/risk.d.ts +2 -1
  319. package/dist/risk.js +2 -4
  320. package/dist/settings.d.ts +32 -3
  321. package/dist/signer/ows-evm.d.ts +1 -1
  322. package/dist/signer/ows-evm.js +1 -1
  323. package/dist/smart-order.d.ts +1 -1
  324. package/dist/smart-order.js +1 -1
  325. package/dist/strategies/funding-arb.d.ts +1 -1
  326. package/dist/strategies/funding-arb.js +36 -63
  327. package/dist/trade-validator.js +2 -2
  328. package/dist/utils.d.ts +22 -3
  329. package/dist/utils.js +11 -3
  330. package/dist/venue-health.d.ts +40 -0
  331. package/dist/venue-health.js +75 -0
  332. package/dist/withdraw-gate.d.ts +1 -1
  333. package/dist/withdraw-gate.js +1 -1
  334. package/dist/ws/arcus-market.d.ts +9 -0
  335. package/dist/ws/arcus-market.js +9 -0
  336. package/dist/ws/aster-market.d.ts +33 -0
  337. package/dist/ws/aster-market.js +30 -0
  338. package/dist/ws/index.d.ts +980 -0
  339. package/dist/ws/index.js +4460 -0
  340. package/dist/ws/lighter-market.d.ts +14 -0
  341. package/dist/ws/lighter-market.js +13 -0
  342. package/dist/ws/node.d.ts +996 -0
  343. package/dist/ws/node.js +4554 -0
  344. package/dist/ws/pacifica-instrument.d.ts +8 -0
  345. package/dist/ws/pacifica-instrument.js +8 -0
  346. package/dist/ws/unclassified.d.ts +16 -0
  347. package/dist/ws/unclassified.js +43 -0
  348. package/dist/ws-cli/credentials.d.ts +62 -0
  349. package/dist/ws-cli/credentials.js +126 -0
  350. package/package.json +71 -10
  351. package/skills/perp-cli/SKILL.md +153 -36
  352. package/skills/perp-cli/package.json +15 -2
  353. package/skills/perp-cli/references/agent-operations.md +22 -12
  354. package/skills/perp-cli/references/commands.md +143 -17
  355. package/skills/perp-cli/references/strategies.md +38 -3
  356. package/skills/perp-cli/references/ws-library.md +523 -0
  357. package/skills/perp-cli/scripts/arb-monitor.sh +13 -10
  358. package/skills/perp-cli/scripts/funding-analysis.sh +57 -29
  359. package/skills/perp-cli/scripts/preflight.sh +27 -19
  360. package/skills/perp-cli/scripts/spot-perp-scan.sh +58 -38
  361. package/skills/perp-cli/scripts/validate-arb.sh +56 -39
  362. package/dist/cli-spec.d.ts +0 -46
  363. package/dist/cli-spec.js +0 -81
@@ -4,17 +4,19 @@ 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 <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)
7
+ `--json` (required for agents) | `-e <venue>` | `-n mainnet|testnet` | `--dry-run` (honored by: every `trade` write, `arb exec|close|auto|rebalance`, `funds deposit|withdraw|transfer|faucet|bridge send|bridge exchange|rebalance execute|address-book add`, `outcome buy|sell`, `print deposit|cancel`, `vault deposit|withdraw`, `wallet builder approve|revoke`, `wallet manage referral set`, `strategy run`, `strategy plan execute` — `--help` does not always say so; every other command, read-only ones included, refuses it with `INVALID_PARAMS` = unsupported, nothing ran) | `--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
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`.
9
+ Venues (`-e`, id | aliases): `pacifica|pac`, `hyperliquid|hl`, `lighter|lt`, `lighter-rh|lrh|rh`, `aster|ast`, `ondo|ondo-perps`, `arcus`, `qfex|qf`, `risex|rise` (READ-ONLY in this release — market data + account reads; trading is planned for a later release, every trade / agent / bot write refuses with CAPABILITY_UNSUPPORTED), `txflow|txf` (market data only, UNOFFICIAL API — every write refuses with CAPABILITY_UNSUPPORTED), `variational|var|omni` (market data only, official API, RFQ venue: `market book` = indicative RFQ quotes, `market funding` = current terms — every write refuses with CAPABILITY_UNSUPPORTED), `grvt|grv` (market data only in this version, official API — every write refuses with CAPABILITY_UNSUPPORTED), `extended|ext|x10` (Extended on Starknet, official API, market data only in this version — every write refuses with CAPABILITY_UNSUPPORTED). Default = `settings.defaultExchange`, else `pacifica` — always pass `-e`.
10
10
  `-k <key>` is rejected (keys only via stdin / OWS vault). `--passphrase` is deprecated → `OWS_PASSPHRASE` env or stdin.
11
11
 
12
12
  ## Market Data (read-only, safe)
13
13
  ```bash
14
14
  perp --json -e <EX> market list # all markets with prices, funding, volume
15
- perp --json market prices # cross-exchange price comparison
16
- perp --json -e <EX> market mid <SYMBOL> # mid price (fast)
17
- perp --json -e <EX> market info <SYMBOL> # mark/index price, funding, volume, OI, max leverage
15
+ perp --json market prices # cross-exchange price comparison (every market; takes no symbol)
16
+ perp --json -e <EX> market mid <SYMBOL> # mid price (fast) — the canonical single-symbol price read
17
+ perp --json -e <EX> market info <SYMBOL> # mark/index price, funding, volume, OI, max leverage, stepSize (no tickSize / min notional — see SKILL.md Step 4)
18
+ # No spot market reads: `market *` are perp markets (HYPE/USDC, @107, HYPE-SPOT → SYMBOL_NOT_FOUND). Spot balances / orders:
19
+ # `trade spot-balance`, `trade spot-orders` (keyed). `arb scan --basis` = cross-venue PERP basis, not spot-perp.
18
20
  perp --json -e <EX> market book <SYMBOL> # orderbook (bids/asks)
19
21
  perp --json -e <EX> market trades <SYMBOL> # recent trades
20
22
  perp --json -e <EX> market funding <SYMBOL> # funding rate history
@@ -24,10 +26,22 @@ perp --json -e hyperliquid --dex <DEX> market list # one HIP-3 dex's m
24
26
  perp --json -e hyperliquid --dex <DEX> market book <SYMBOL> # any market/account/trade command takes --dex the same way
25
27
  ```
26
28
 
29
+ Hyperliquid read-path notes:
30
+ - **Venue caps that cannot be paged are refused** (`INVALID_PARAMS` naming the cap; never fewer rows than asked, silently). `trades`: the venue serves only the last 10 trades — the default `--limit` is min(20, 10) = 10, an explicit `--limit` above 10 is refused. `book`: at most 20 levels per side — `-d` above 20 is refused (`-d` cuts JSON too). `kline`: only the most recent 5000 candles per interval exist — a `--start` before now − 5000 × interval is refused before any request, naming the earliest allowed start. `backtest grid --days N` clamps its start to that window and reports `dataFrom` / `truncated`.
31
+ - **kline intervals:** `1m,3m,5m,15m,30m,1h,2h,4h,8h,12h,1d,3d,1w,1M` (anything else → `INVALID_PARAMS`, not retryable). `1M` candles are **30-day buckets**, not calendar months; `1w` candles open **Thursday 00:00 UTC**. Each candle carries `closed` (false on the in-progress last candle).
32
+ - **funding:** `--limit N` = the last N hourly settlements (paged over the venue's 500-row cap; max 5000).
33
+ - **Delisted markets** (meta `isDelisted`, e.g. `MATIC`, every asset of `--dex km`) → `SYMBOL_NOT_FOUND` with `details.reason: "delisted"` on `info` / `trades` / `funding` / `book` / `kline`; orders / positions / history still resolve them. `market hip3` lists live assets only (`assets`), plus `delistedAssets` and `delisted: true` for a dex with no live asset; `deployer` comes from `perpDexs`.
34
+ - **Symbol naming:** `market list` / `info` rows use the plain coin `BTC` (HIP-3: `xyz:XYZ100`; the wire coin is in `venueSymbol`), as `market trades` rows and the WS codec. `-PERP` arguments still resolve. Keyed `account positions` rows still show `BTC-PERP`; strip `-PERP` to compare.
35
+ - **marginTiers:** a market on a single-tier table (`marginTableId` < 50) reports `[{ lowerBound: 0, maxLeverage: <id> }]` (docs "Margin tiers"), not null.
36
+
27
37
  ## Account (read-only, safe)
28
38
  ```bash
29
39
  perp --json portfolio -e <VENUE_ID> # perp balance + spot holdings + 24h funding; venue id or alias (hl, lt, …)
30
40
  perp --json -e <EX> account positions # open positions
41
+ perp --json -e <EX> account positions --address <ADDR> # ANY account's open positions, keyless (public data; nothing signed)
42
+ perp --json account positions --address <0xADDR> # every supporting venue: { venues, errors?, notes? }
43
+ perp --json -e <EX> account balance --address <ADDR> # ANY account's balances + spot, keyless (same venues; Lighter: per account, --account-index)
44
+ perp --json account balance --address <0xADDR> # every supporting venue: { venues, errors?, notes? }
31
45
  perp --json -e <EX> account orders # open/pending orders
32
46
  perp --json -e <EX> account history # order history
33
47
  perp --json -e <EX> account trades # trade fill history
@@ -38,6 +52,14 @@ perp --json -e <EX> account pnl # realized + unrealized + funding
38
52
  perp --json -e <EX> account twap-orders # active TWAP orders
39
53
  perp --json portfolio # cross-exchange unified view
40
54
  # funding24h is null (with fundingError) when a venue's funding history is unreadable; totals.fundingIncomplete = true then
55
+ # --address (public-address positions): hyperliquid / lighter / lighter-rh / risex take a 0x address, pacifica a base58
56
+ # Solana address (a wrong format → INVALID_PARAMS before any request); other venues → CAPABILITY_UNSUPPORTED
57
+ # (feature publicPositions). Rows = the account positions rows with plain symbols, plus:
58
+ # hyperliquid: native + EVERY HIP-3 dex (one read each), `dex: null | "<dex>"`; a dex that fails is in
59
+ # meta.errors["hip3:<dex>"] + meta.warnings — its rows are missing, the others are kept (exit 0).
60
+ # lighter / lighter-rh: every account (sub-account) of the address, `accountIndex` on each row; zero-size rows
61
+ # dropped; --account-index <n> narrows (not an account of the address → INVALID_PARAMS). No account → [] + meta.notes.
62
+ # --symbol <SYM> filters (GOLD matches xyz:GOLD). meta: { address, source: "public" }. MCP: get_positions_by_address.
41
63
  perp --json portfolio --arb # full dashboard with arb top 5
42
64
  ```
43
65
 
@@ -61,10 +83,13 @@ perp --json -e <EX> trade market <SYM> buy <SIZE> --split # split via flag
61
83
  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)
62
84
  perp --json -e <EX> trade stop <SYMBOL> <SIDE> <SIZE> <STOP_PRICE> # reduce-only by default; --no-reduce-only to open (refused on ondo / qfex)
63
85
  perp --json -e <EX> trade tpsl <SYMBOL> <long|short> --tp <P> --sl <P> # positionSide = the open position's side
64
- perp --json -e <EX> trade buy <SYMBOL> <SIZE> --tp <P> --sl <P> # entry protected by TP/SL (verified fill)
86
+ perp --json -e <EX> trade buy <SYMBOL> <SIZE> --tp <P> --sl <P> # entry protected by TP/SL (verified fill); absolute prices, not %; not with --smart
87
+ # trade limit --tp/--sl: ondo / arcus any entry, other venues --tif IOC only
65
88
 
66
89
  # Order management
67
- perp --json -e <EX> trade edit <SYMBOL> <ORDER_ID> <PRICE> <SIZE>
90
+ perp --json -e <EX> trade edit <SYMBOL> <ORDER_ID> <PRICE> <SIZE> # SIZE = new open size; may return a NEW orderId — use it
91
+ # pacifica: TIF from the order's client id — ALO native edit, GTC / TOB cancel+replace (new id either way);
92
+ # ondo: cancel+replace; qfex: venue assigns a new id (client id kept); --tif only on ondo / pacifica
68
93
  perp --json -e <EX> trade cancel <SYMBOL_OR_ORDER_ID> [orderId]
69
94
  perp --json -e <EX> trade cancel-all
70
95
  perp --json -e <EX> trade cancel-stop <SYMBOL> <STOP_ORDER_ID> # pacifica / qfex only; other venues: trade cancel
@@ -82,6 +107,7 @@ perp --json -e <EX> trade check <SYM> <SIDE> <SIZE> --leverage 3
82
107
  perp --json -e <EX> trade close <SYMBOL> # close single position
83
108
  perp --json -e <EX> trade close-all # close all positions
84
109
  perp --json -e <EX> trade flatten # cancel all orders + close all positions
110
+ # close / close-all do NOT cancel resting TP/SL / stop / limit orders (QFEX: WARNING lists them) — check account orders
85
111
  perp --json -e <EX> trade reduce <SYMBOL> <PCT> # reduce by percentage
86
112
  perp --json -e <EX> trade leverage <SYMBOL> <N> [--isolated]
87
113
 
@@ -91,6 +117,16 @@ perp --json -e <EX> trade scale-in <SYMBOL> <SIDE> --levels '<P1>:<PCT>,<P2>:<PC
91
117
  perp --json -e <EX> trade pnl-track # real-time PnL tracker
92
118
  perp --json -e <EX> trade twap <SYMBOL> <SIDE> <SIZE> <DURATION> # Pacifica: seconds (native), HL: minutes (native, min $100); others client-side: --background [--slices <n>]
93
119
 
120
+ # Pacifica Atomic basket (pacifica only; other venues → CAPABILITY_UNSUPPORTED). Legs SYMBOL[:WEIGHT] (≤ 5 per side, each market once);
121
+ # --usd is split by weight at each mark, floored to the lot, each leg ≥ the market's USD minimum. ONE POST /orders/batch of market
122
+ # orders — NOT all-or-nothing: each leg fills or fails on its own (ORDER_PARTIAL / ORDER_REJECTED / ORDER_PENDING per basket).
123
+ # --reduce-only: --long legs must close shorts, --short legs must close longs (checked before sending). Supports --dry-run (plan + unsigned body).
124
+ perp --json -e pacifica trade atomic --long BTC:50 --short ETH:50 --usd 1000 [--reduce-only] [--slippage-bps <n>] [--force]
125
+ # A leg needs notional ≥ the market minimum × (1 + slippage bound). Legs without an order_id in the ack are traced by their client_order_id.
126
+ # A batch failure other than HTTP 400 / 429 (timeout, 5xx, unreadable answer) → ORDER_PENDING and EVERY leg is quarantined.
127
+ # Pacifica Chase / OCO / Trailing Stop / Swarm / Trigger Swarm / Conditional Market|Limit: no documented API / SDK path (as of 2026-10-19) —
128
+ # nearest here: trade twap (≈ Swarm, split market execution), trade tpsl (≈ OCO bracket exit).
129
+
94
130
  # Spot helpers (any venue with spot)
95
131
  perp --json -e <EX> trade spot-buy <SYMBOL> <SIZE>
96
132
  perp --json -e <EX> trade spot-sell <SYMBOL> <SIZE>
@@ -181,6 +217,61 @@ Encoding formula: `enc = 10 * outcome + side`; asset id = `100,000,000 + enc`.
181
217
 
182
218
  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.
183
219
 
220
+ ## Options market data (read-only, `-e derive`)
221
+
222
+ Derive (derive.xyz, formerly Lyra) options through its official public v3 API — keyless, no orders, no account. Options venues are separate from the perp venues (not in `perp health`, arb or `market`). JSON objects carry `schema: 1`; decimals are strings; unknown is `null` (empty book side → `bid`/`ask` `null`; IV the venue could not compute → `null`; 24h high/low `null` without trades).
223
+
224
+ ```bash
225
+ perp --json -e derive options underlyings # underlyings with options (spot price)
226
+ perp --json -e derive options expiries ETH # active expiries: expiry (YYYY-MM-DD UTC), expiryMs, strikes, instruments
227
+ perp --json -e derive options chain ETH # nearest expiry (expirySelection: "nearest"), every strike
228
+ perp --json -e derive options chain ETH --expiry 2026-12-25 --strikes 10 # 10 strikes closest to ATM (forward, else index)
229
+ perp --json -e derive options quote ETH-20261225-3500-P # one option
230
+ ```
231
+
232
+ - Chain row: `{strike, call, put}`; each side is an option quote: `bid`/`ask` `{price, size}`, `mark`, `index`, `forward`, `discountFactor`, `iv {mark, bid, ask}`, `greeks {delta, gamma, theta, vega, rho}` (venue units, verbatim), `openInterest` (contracts), `stats24h {contracts, notional, premium, trades, high, low}`, `timestampMs`. Chain level: `index`, `forward` (both of the newest ticker of the expiry, not an average), `atm {strike, reference, price}`, `strikesListed`, `missingTickers`.
233
+ - Errors: unknown underlying / expiry / instrument → `SYMBOL_NOT_FOUND` (remediation names the listing command / active expiries); a perp name in `quote` → `INVALID_PARAMS`; an active option with no live ticker (activation / expiry race) → `EXCHANGE_ERROR` (retry); other Derive rejections → `EXCHANGE_ERROR`; no `-e` or a perp venue → `CAPABILITY_UNSUPPORTED`; Derive's rate limit → `RATE_LIMITED` (retryable).
234
+ - Cost: `expiries` 1 request, `chain` 2 (instruments + ONE tickers call for the expiry), `quote` 2. Derive's public budget is 5 requests/s per IP.
235
+ - `-n testnet` reads `testnet.api.derive.xyz`. MCP: `get_option_expiries`, `get_option_chain`, `get_option_quote` (`venue: "derive"`).
236
+
237
+ ## Pacifica Print (`perp print`) and vaults (`perp vault`)
238
+
239
+ Pacifica-only products: these commands always use Pacifica (`-e <other venue>` → `INVALID_PARAMS`). Reads are unauthenticated GETs and never sign; `--account <address>` reads any account without a key. Every write supports `--dry-run`, which prints the exact message to sign and the body (`signature: null`), never signs and sends nothing. `--account` on a write only plans (with `--dry-run`); a live write with `--account` is refused.
240
+
241
+ **Signer rule (perp-cli, stricter than the venue):** `vault deposit` is **master-only** (like `funds withdraw pacifica`) — an agent key must never be able to move the balance into a vault someone else manages; with only an agent key on the machine it is `NO_SIGNER_AVAILABLE`. `vault withdraw` (pays only into the own account), `print deposit` and `print cancel` are signed by the active signer (the agent key when approved, else the master). `wallet manage lake deposit|withdraw` were replaced by these commands (they now refuse with a pointer); `wallet manage lake create --initial-deposit` is refused with an agent key.
242
+
243
+ **Idempotency:** every deposit / withdraw sends a fresh `idempotency_key`. After `ORDER_PENDING` never resubmit with a new key; the only safe retry is the same command with `--idempotency-key <the reported key>` (the venue answers a duplicate with HTTP 409; how long it remembers a key is unverified). `error.details.before` holds the pre-write state (Print order count / vault shares) to compare with `print positions` / `vault positions`.
244
+
245
+ ### Print — strike orders that earn a premium every cycle
246
+ A Print order locks a USDC deposit (min 10) as margin at a target price: **long** = target BELOW mark, **short** = target ABOVE mark, 0.5% … 10% / 20% / 40% from mark for a 24-hour / 7-day / 30-day cycle. Leverage 1 … product max (`print games`). The premium is credited to the order at the START of each cycle. **While resting** (before a fill) it is evaluated only at the END of each cycle: it fills AT the target (size = deposit × leverage ÷ target), rolls to a new target at the same % distance, or is liquidated; max loss = deposit + premiums. **After a fill** it is an ordinary perp position in the main account — continuous mark-price liquidation, it nets with an existing position in the same market and may be cross-margined; read it with `perp -e pacifica account positions`. Product / pool deposit caps are totals across all users (the venue refuses when full). `--cycles 1…1000` caps the cycles (default: roll until cancelled). A cancel takes effect only at the end of the running cycle — funds stay locked until then (up to 30 days on BTC_1M).
247
+ ```bash
248
+ perp --json -e pacifica print games # products: cycle, max lev, caps, allowed target range
249
+ perp --json -e pacifica print quote BTC_24H long 100 --strike 79000 --leverage 10 [--cycles 7]
250
+ # read-only preview: notional, size on fill, docsLiquidationPrice, maxLoss, lock; estimatedPremium is null
251
+ # (the venue's premium preview is a signed request — never called on a read path)
252
+ perp --json -e pacifica print positions [--account <addr>] # current orders: printing | cancelling | filled | liquidated | cancelled | completed | ended
253
+ perp --json -e pacifica print history [--account <addr>] [--limit N] [--cursor C]
254
+ perp --json -e pacifica print events <printAddress> [--limit N] [--cursor C] # created / premium / end_requested / position_opened / liquidated
255
+ perp --json -e pacifica --dry-run print deposit BTC_24H long 100 --strike 79000 --leverage 10 --cycles 7
256
+ perp --json -e pacifica print deposit BTC_24H long 100 --strike 79000 --leverage 10 --cycles 7 # POST /game/deposit (deposit_to_game)
257
+ perp --json -e pacifica --dry-run print cancel <printAddress> # UNOFFICIAL: POST /game/end (end_game) is not in the API docs (apiStatus: "unofficial")
258
+ perp --json -e pacifica print cancel <printAddress> --unverified-endpoint # live run needs the flag; only a `printing` order
259
+ ```
260
+ - `docsLiquidationPrice` is the docs formula (margin fully lost) — an outer bound, not the trigger: a liquidation was observed earlier in one live case (2026-10-16, ZEC_24H short at mark 1216.84 vs formula ≈ 1269); the venue's trigger is unpublished. For a 1× long the formula gives ≤ 0: `null` = unknown, not "no liquidation". Show the user `maxLoss`.
261
+
262
+ ### Vaults (API: lakes)
263
+ A vault is a Pacifica account traded by its manager; LPs get shares at NAV (lp_balance ÷ lp_shares). Min deposit 10 USDC; `deposit_cap` caps the LP balance; the manager takes `manager_profit_share` above the high-water mark. A withdrawal redeems shares into YOUR OWN trading balance (the API has no destination) only after `deposit_min_duration_ms` since your LAST deposit (each deposit restarts the lock for your whole balance), inside the withdrawal window when one is set (open while now_s mod window < duration), and from the vault's free balance (a fully deployed vault may pay partially). APY is not published (`apy: null`).
264
+ ```bash
265
+ perp --json -e pacifica vault list [--account <addr>] # TVL, NAV/share, fee, lock-up, window, config
266
+ perp --json -e pacifica vault info <address|nickname> # + live equity, positions, deposit whitelist (UNOFFICIAL endpoint, advisory), window open now?
267
+ # a nickname must match exactly ONE vault (case-insensitive) — duplicates exist live ("Pacifica Vault" / "Pacifica vault");
268
+ # ambiguity → INVALID_PARAMS listing every candidate's address / manager / TVL. Writes: prefer the ADDRESS.
269
+ perp --json -e pacifica vault positions [--account <addr>] # your LP (or manager) shares and value
270
+ perp --json -e pacifica --dry-run vault deposit <vault> <amount> # POST /lake/deposit (deposit_to_lake) — MASTER-ONLY; refused when the LP NAV is zero / undefined
271
+ perp --json -e pacifica --dry-run vault withdraw <vault> <shares>|--all # POST /lake/withdraw (withdraw_from_lake)
272
+ ```
273
+ MCP (read-only): `pacifica_print_products`, `pacifica_print_quote`, `pacifica_print_positions`, `pacifica_vaults`. Print / vault writes are CLI-only.
274
+
184
275
  ## Funds (deposit, withdraw, transfer, bridge, rebalance)
185
276
 
186
277
  All fund movement lives under `perp funds`.
@@ -201,6 +292,8 @@ perp --json funds deposit lighter-rh <AMOUNT> # USDG on Robinhood
201
292
  # Ondo Perps: NO API withdrawals — `funds withdraw ondo` → CAPABILITY_UNSUPPORTED; withdraw in the Ondo web app
202
293
  perp --json funds withdraw arcus <AMOUNT> # USDG → the account owner (min 1)
203
294
  perp --json funds deposit qfex # prints the USDC / Arbitrum One deposit address (sends nothing)
295
+ # RISEx: deposits / withdrawals are app-only — `funds deposit|withdraw risex` → CAPABILITY_UNSUPPORTED (app.rise.trade)
296
+ # RISEx is read-only in this release (trading later): `funds faucet risex` → CAPABILITY_UNSUPPORTED too
204
297
  # QFEX: withdrawals disabled in perp-cli for now — `funds withdraw qfex` → CAPABILITY_UNSUPPORTED; withdraw in the QFEX web app
205
298
  perp --json -e qfex funds transfer <AMOUNT> primary --from <account-uuid> # between your QFEX accounts
206
299
  perp --json funds deposit aster <AMOUNT> [--chain bsc|arbitrum] [--asset USDT|USDC] # vault approve + deposit (mainnet; default BNB Chain USDT)
@@ -251,24 +344,54 @@ perp --json arb scan # default --mode all
251
344
  perp --json arb scan --mode perp-perp --min 10 # perp-only with min annual %
252
345
  perp --json arb scan --mode spot-perp --min 10 # spot+perp only
253
346
  perp --json arb scan --rates # funding rates across exchanges
347
+ # Which rate is compared: each venue's market-row `fundingRate` (the CURRENT rate it publishes), labelled
348
+ # per row by `rateKind` — Pacifica / Lighter / Lighter RH / Arcus / RISEx / Ondo "lastSettled", Hyperliquid /
349
+ # Aster / TxFlow / Extended "accruing", GRVT / Variational "predicted", null = QFEX (not established). It is NOT the WS comparator's kind:"next" (predicted
350
+ # next-period rate, where a venue publishes one: Pacifica `predictedFundingRate`).
254
351
  perp --json arb scan --basis [SYMBOL] # cross-exchange basis
255
352
  perp --json arb scan --gaps # cross-exchange price gaps
256
353
  perp --json arb scan --hip3 # HIP-3 cross-dex spreads
257
- perp --json arb scan --history [SYMBOL] # historical funding
354
+ perp --json arb scan --history [SYMBOL] [--hours 24] # LOCAL snapshots only (~/.perp/funding-rates/, written by
355
+ # `arb scan --rates` / `portfolio --arb`; hyperliquid / pacifica / lighter unless -e) — `rates: {}` until scans
356
+ # have run; `historicalAvg` (avg1h/8h/24h/7d) in --rates / --compare rows comes from the same store (null when empty).
357
+ # Real settled history: perp --json -e <EX> market funding <SYM> -l <N> (newest first; rate = fraction per
358
+ # intervalHours → hourly = rate / intervalHours, annual % = hourly × 8760 × 100; average the rows yourself)
258
359
  perp --json arb scan --compare <SYMBOL> # compare a symbol across exchanges
259
360
  perp --json arb scan --positions # position funding impact; actual24h null + fundingHistoryErrors when a venue's history is unreadable
260
361
  perp --json arb scan --live --interval 60 # continuous monitoring
261
362
  perp --json arb scan --top 10 --hold-days 7 --bridge-cost 0 --size 100 # cost-aware filtering
262
- perp --json arb scan --rates --include-unverified # also show QFEX (unverified funding; display only, never ranked)
363
+ perp --json -e extended market list # Extended (read-only): rows carry assetClass, venueSymbol (TSLA_24_5-USD), tickSize, minSize, tradable, fundingRateKind "accruing"
364
+ perp --json -e extended market funding BTC -l 24 # applied hourly prints: rateKind "lastSettled", intervalHours 1, annualizedPct
365
+ perp --json arb scan --rates --include-unverified # also show QFEX, TxFlow, Variational, GRVT and Extended (unverified funding; TxFlow rows apiStatus "unofficial"; display only, never ranked)
366
+ perp --json -e qfex market funding AAPL -l 72 # hourly windows; outside the market's funding hours: rate null + marketClosed true (not a 0 rate)
367
+ # QFEX marketClosed limits: (1) a market holiday INSIDE a configured session (e.g. SAMSUNG-KRW on
368
+ # Hangul Day, a weekday) is not in market_hours, so its 0 prints as a real-looking rate "0" with
369
+ # marketClosed false; (2) US equities DO fund in the weekday overnight gap (post_market → pre_market),
370
+ # so only an exact 0 with no part of the hour in any funding session counts as closed — a real 0
371
+ # in a gap would also read as closed. Averages / APRs skip marketClosed rows only.
263
372
  # netSpread / grossSpread = annualized % (netSpread = gross minus round-trip costs amortized over --hold-days)
264
- # spot-perp rows: netSpreadPct / grossSpreadPct, spotExchanges[], perpExchange, direction
373
+ # estFeesPct = round trip on BOTH legs = 2 × (taker fee leg A + taker fee leg B) + 2 × 0.05 % slippage, taker fees from
374
+ # `perp settings fees show` (settings.fees, else the shipped table — the spot leg uses its venue's perp taker rate);
375
+ # e.g. hl+hl: 2 × (0.035 + 0.035) + 0.1 = 0.24 %. `settings fees show` is the per-fill rate, estFeesPct the round trip.
376
+ # perp-perp rows: mode, longExch, shortExch, markPrice, grossSpread(Pct), netSpread(Pct), estFeesPct, priceGapPct
377
+ # spot-perp rows: mode, spotExchanges[], perpExchange, direction, perpFundingRate, netSpreadPct / grossSpreadPct AND
378
+ # netSpread / grossSpread (same values), estFeesPct, estHourlyIncomeUsd (per $1000), breakEvenDays, markPrice.
379
+ # Executable only when direction == "long-spot-short-perp" (arb exec spot: always buys spot + shorts the perp and
380
+ # does not check the funding sign) — never act on "sell-spot-long-perp".
381
+ # --rates / --compare rows: symbol, rates[] (exchange, fundingRate, hourlyRate, annualizedPct, rateKind, fundingVerified,
382
+ # historicalAvg), maxSpreadAnnual / longExchange / shortExchange / estHourlyIncomeUsd (null with < 2 verified rates),
383
+ # executable (act only when true), readOnlyLegs, unverifiedLegs, mixedKinds; --rates top level: symbols[], minSpread,
384
+ # belowMinSpread, exchangeStatus, exchangeErrors. --compare <unknown> → ok:true, data { symbol, available: false }.
385
+ # Testnet funding / spreads are meaningless (thousands of %/yr) — analyse yield on mainnet only.
265
386
 
266
387
  # Execute (perp-perp or spot+perp via spot:<venue>; spot venues: hl, lt, lrh, aster, ondo)
267
388
  # Sequential: long first, then the short sized to the verified long fill; reconcile always on;
268
389
  # an unconfirmed leg quarantines the symbol. Supports --dry-run.
269
390
  perp --json arb exec <SYM> <longEx> <shortEx> <USD> # perp-perp dual-leg entry
270
- perp --json arb exec <SYM> spot:hl hl <USD> # spot+perp via HL spot
391
+ perp --json arb exec <SYM> spot:hl hl <USD> # spot+perp via HL spot (long-spot-short-perp rows only)
271
392
  perp --json arb exec <SYM> spot:lt pac <USD> # spot+perp via LT spot
393
+ # spot: validates balances (spot quote + transferable perp; perp margin), both books (empty book → refused),
394
+ # spot/perp mid gap ≤ 5 %, depth and venue minimums before anything moves
272
395
  perp --json arb exec <SYM> <longEx> <shortEx> <USD> \
273
396
  --leverage 2 --isolated --smart --max-slippage 0.5
274
397
 
@@ -282,6 +405,8 @@ perp --json arb close <SYM> --state-only --yes # drop a stale state
282
405
 
283
406
  # Status / history / config / rebalance
284
407
  perp --json arb status # open arb positions + PnL + funding; check unconfirmedPairs, staleStateEntries
408
+ # reads every configured venue; one failing venue fails the whole command (EXCHANGE_ERROR, no venue filter) →
409
+ # check per venue with `-e <EX> account positions`
285
410
  # spot-perp entries: fundingSource actual | partial | estimate | recorded (+ fundingError) — only "actual" is complete settled funding
286
411
  perp --json arb status --period 7 --symbol BTC # filter funding lookback / symbol
287
412
  perp --json arb history # alias: arb log
@@ -299,8 +424,7 @@ perp --json --dry-run arb auto # simulate (--backgr
299
424
 
300
425
  ## Wallet Management
301
426
  ```bash
302
- perp --json wallet generate evm # generate EVM wallet
303
- perp --json wallet generate solana # generate Solana wallet
427
+ perp --json wallet generate [name] [--words 12|24] # new multi-chain OWS vault wallet (EVM + Solana); passphrase via OWS_PASSPHRASE / stdin
304
428
  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)
305
429
  printf '%s' "$KEY" | OWS_PASSPHRASE=<pp> perp --json wallet set hl # import key (stdin / hidden prompt; argv key rejected) into OWS vault → active wallet
306
430
  perp --json wallet set pac --name pac # Solana key, hidden prompt (TTY)
@@ -337,6 +461,9 @@ perp --json wallet agent approve <exchange> \
337
461
  [--account-index <0-9|255>] # Arcus subaccount
338
462
  [--api-key-index <n>] # Lighter slot 4-254 (default: first slot free locally AND on-chain)
339
463
  [--force] # Lighter: overwrite an --api-key-index slot that already holds an on-chain key
464
+ # risex: READ-ONLY in this release (trading is planned for a later release) — `wallet agent approve|import|revoke|rotate
465
+ # risex` → CAPABILITY_UNSUPPORTED (also with --dry-run); `wallet agent verify risex` (read-only) still works.
466
+ # txflow / variational / extended: every agent command → CAPABILITY_UNSUPPORTED (market data only).
340
467
 
341
468
  # Import a key the USER created on the exchange WEBSITE (master wallet not needed here).
342
469
  # Key on stdin only (one line; ondo: key id + secret; qfex: public key + secret) — an argv key is rejected (INVALID_PARAMS).
@@ -383,9 +510,8 @@ perp --json wallet manage account-mode [unified|standard|portfolio] # Hyperliq
383
510
  perp --json wallet manage sub create <name> # not supported (CAPABILITY_UNSUPPORTED): the subaccount wallet must co-sign — use the web app
384
511
  perp --json wallet manage sub list
385
512
  perp --json wallet manage sub transfer <from> <to> <amount> # <from> must be the signing account
386
- perp --json wallet manage lake create [--manager <address>] [--nickname <name>] [--initial-deposit <amount>]
387
- perp --json wallet manage lake deposit <lake> <amount> # <lake> = vault address
388
- perp --json wallet manage lake withdraw <lake> <shares> # shares to redeem, not USDC
513
+ perp --json wallet manage lake create [--manager <address>] [--nickname <name>] [--initial-deposit <amount>] # --initial-deposit: master-signed only
514
+ perp --json wallet manage lake deposit|withdraw … # MOVED → perp -e pacifica vault deposit|withdraw (refused here)
389
515
  perp --json wallet manage builder overview # Pacifica builder-OWNER tools only (user approvals: wallet builder)
390
516
  perp --json wallet manage builder trades <code>
391
517
  perp --json wallet manage builder leaderboard <code>
@@ -411,7 +537,7 @@ perp --json wallet policy delete <id>
411
537
  ## Risk & Analytics
412
538
  ```bash
413
539
  perp --json risk status # portfolio risk overview (level, violations, canTrade)
414
- perp --json health # adapter health: ping venue REST endpoints (connectivity + latency)
540
+ perp --json health # keyless venue ping: data.healthy (official venues up), allHealthy (+ unofficial), exchanges[], unofficial[], skipped[]
415
541
  perp --json risk liquidation-distance # % distance from liquidation for ALL positions
416
542
  perp --json risk limits # view current risk limits
417
543
  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)
@@ -59,7 +59,10 @@ During transition, you are **unhedged**. Price can move against you. Factor this
59
59
  ```bash
60
60
  perp --json arb scan --min 5 # find spreads > 5% annual (shows longExch/shortExch/netSpread)
61
61
  perp --json arb scan --rates # raw funding rates across all exchanges
62
- perp --json arb scan --history <SYMBOL> # historical funding for a symbol
62
+ perp --json -e <EX> market funding <SYMBOL> -l 168 # settled funding history per venue (newest first; average it yourself)
63
+ # `arb scan --history <SYMBOL>` = only snapshots THIS machine recorded during earlier `arb scan --rates` runs
64
+ # (often `rates: {}`; `historicalAvg` in --rates / --compare rows is null for the same reason) — not venue history.
65
+ # Testnet rates are meaningless (thousands of %/yr): analyse on mainnet only.
63
66
  # NOTE: legacy 'arb rates'/'arb prices'/'arb dex' are removed — all routes go through 'arb scan'
64
67
  ```
65
68
 
@@ -75,6 +78,8 @@ netSpread: 12.87 → annualized % after round-trip trading costs amorti
75
78
  (and --bridge-cost if given)
76
79
  ```
77
80
 
81
+ (perp-perp rows. `--rates` / `--compare` rows name the legs `longExchange` / `shortExchange` and are actionable only when `executable === true`; spot-perp rows have `spotExchanges` / `perpExchange` / `direction` — see "Spot-Perp Carry".)
82
+
78
83
  **Rules:**
79
84
  1. **ALWAYS follow longExch/shortExch directions exactly.** DO NOT reverse them.
80
85
  2. **NEVER enter if netSpread ≤ 0.** Negative netSpread = loss after fees over the assumed hold. A shorter real hold makes costs weigh more — re-scan with your `--hold-days`.
@@ -181,7 +186,7 @@ Desired size: 1.0
181
186
  ```bash
182
187
  perp --json -e <EX> market info <SYM> # check maxLeverage, volume, openInterest
183
188
  ```
184
- Round `ORDER_SIZE` to the coarser step size of the two exchanges. If the matched size falls below either exchange's minimum, the arb is NOT executable at this size — reduce target or skip.
189
+ Round `ORDER_SIZE` to the coarser step size of the two exchanges. If the matched size is below $15 notional on either leg (the skill's default smallest order — the $10 venue minimums plus a buffer for price moves, step rounding and fees; see SKILL.md Step 4), the arb is NOT executable at this size — raise the target or skip.
185
190
 
186
191
  #### Step 2: Execute Legs Sequentially with Same Size
187
192
 
@@ -267,6 +272,34 @@ If positions already have mismatched sizes, close to the smaller size first, the
267
272
  - Better opportunity found (after accounting for switch cost!)
268
273
  - Risk limits breached
269
274
 
275
+ ## Spot-Perp Carry (long spot + short perp)
276
+
277
+ **What:** buy the asset spot and short the same asset's perp while perp funding is POSITIVE (longs pay shorts) — the short leg collects funding, the spot leg pays none, price exposure nets out.
278
+
279
+ **Find:**
280
+ ```bash
281
+ perp --json arb scan --mode spot-perp --min 0 --hold-days 14 --size 500 # mainnet; keep only direction == "long-spot-short-perp"
282
+ perp --json -e <perpExchange> market funding <SYM> -l 168 # is the rate persistent? (settled, newest first)
283
+ ```
284
+ Row fields: `spotExchanges[]` (venues that can hold the spot leg; `arb exec` spot venues: hl, lt, lrh, aster, ondo), `perpExchange`, `direction`, `grossSpread` / `netSpread` (annual %), `estFeesPct` (round trip on BOTH legs: 2 × (taker A + taker B) + 0.1 % slippage — taker fees from `perp settings fees show`), `breakEvenDays` (days of funding needed to pay `estFeesPct`), `estHourlyIncomeUsd` (per $1000). `--hold-days` amortizes the fees into `netSpread`; `--size` / `--bridge-cost` add a bridge cost when the legs sit on different venues. A `sell-spot-long-perp` row is NOT a carry trade for perp-cli: `arb exec spot:` always buys spot and shorts the perp (it does not check the funding sign), so on such a row it pays funding.
285
+
286
+ **Economics:**
287
+ - Net ≈ funding received on the short − `estFeesPct` (entry + exit, both legs) − bridge cost if the legs are on different venues.
288
+ - Capital = the FULL spot notional in the spot venue's quote token (`trade spot-balance`; separate-margin venues transfer the shortfall perp→spot) + perp margin (notional / leverage, with a buffer) on the perp venue. Hyperliquid unified accounts fund both legs from one balance.
289
+ - Practical ceiling: on many venues funding sits at the base interest rate, 0.00125 %/h ≈ 10.95 % APR (observed 2026-10-26 on HYPE: Pacifica / Ondo / Arcus 10.95 %, Hyperliquid 24 h average ≈ 7.6 %). Treat ~11 % gross as the normal ceiling for liquid assets; much higher prints are usually short-lived spikes — check the settled history before entering.
290
+ - There is no spot price / book read in perp-cli, so the spot-perp basis cannot be pre-computed here; `arb exec` itself compares the spot and perp books (refuses an empty book or a > 5 % mid gap) and checks depth and venue minimums before anything moves.
291
+
292
+ **Risks:** funding flips negative (the short then PAYS — exit when the settled rate stays negative); short-leg liquidation on a rally (spot gains on another venue do not margin the perp) → 1–2x leverage, isolated margin, watch `risk liquidation-distance`; basis moves at entry / exit; venue / transfer risk on the spot leg.
293
+
294
+ **Execute / exit (dry-run first, user confirmation for each live step):**
295
+ ```bash
296
+ perp --json --dry-run arb exec <SYM> spot:hl hl <USD> --leverage 2 --isolated # only for a long-spot-short-perp row
297
+ perp --json arb exec <SYM> spot:hl hl <USD> --leverage 2 --isolated
298
+ perp --json arb status # spotPerpPairs; fails as a whole if one venue read fails
299
+ perp --json --dry-run arb close <SYM> --spot-exch hl --perp-exch hl
300
+ perp --json arb close <SYM> --spot-exch hl --perp-exch hl
301
+ ```
302
+
270
303
  ## Risk Management — THE MOST IMPORTANT SECTION
271
304
 
272
305
  **Risk management is more important than profit.** A single liquidation can wipe out months of funding rate income. Every decision you make should be filtered through risk first, profit second.
@@ -399,7 +432,9 @@ Compare each position's unrealized P&L. In a perfect arb, they should roughly of
399
432
 
400
433
  Think in terms of total capital across all exchanges:
401
434
  ```bash
402
- perp --json portfolio # totalEquity, marginUtilization, concentration
435
+ perp --json portfolio # totals.{equity,marginUsed,marginPct,funding24h,fundingIncomplete}, risk.{level,marginPct}, exchanges[].perp.available
436
+ # MCP `portfolio`: totalEquity / totalAvailable / totalMarginUsed / riskMetrics.marginUtilization are null when no balance
437
+ # was read — check accountState ("ok" | "unread" | "noAccount") and totalsCover (venues included) first
403
438
  ```
404
439
 
405
440
  Rules of thumb: