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
package/README.md CHANGED
@@ -1,229 +1,155 @@
1
+ **English** | [한국어](README.ko.md) | [中文](README.zh.md) | [日本語](README.ja.md)
2
+
1
3
  # perp-cli
2
4
 
3
5
  [![npm version](https://img.shields.io/npm/v/perp-cli.svg)](https://www.npmjs.com/package/perp-cli)
4
6
  [![npm downloads](https://img.shields.io/npm/dw/perp-cli.svg)](https://www.npmjs.com/package/perp-cli)
5
7
  [![license](https://img.shields.io/npm/l/perp-cli.svg)](https://github.com/hypurrquant/perp-cli/blob/main/LICENSE)
6
8
 
7
- Multi-DEX perpetual futures CLI — **Pacifica** (Solana), **Hyperliquid** (HyperEVM), **Lighter** (Ethereum), **Aster** (BNB Chain), **Lighter RH** (Robinhood chain), **Ondo Perps** (off-chain), **Arcus** (Robinhood chain), **QFEX** (off-chain, TradFi perps).
9
+ One CLI for perpetual futures across many DEXs — trade, compare funding, move funds and run bots from the terminal, or hand it to an AI agent (JSON output, MCP server, agent skill).
10
+
11
+ - **Trade on 8 venues:** Hyperliquid (incl. HIP-3 dexes), Pacifica, Lighter, Lighter RH, Aster, Ondo Perps, Arcus, QFEX (bridge and perp-perp arb cover the original four: Pacifica, Hyperliquid, Lighter, Aster)
12
+ - **Market data only:** RISEx, GRVT, Extended, Variational, TxFlow (unofficial API) — plus Derive options data
13
+
14
+ ## Install
8
15
 
9
16
  ```bash
10
- npm install -g perp-cli # global install
11
- perp --json portfolio
17
+ npm install -g perp-cli
18
+ perp --version
12
19
 
13
- # Or without global install (restricted environments)
20
+ # Or without a global install
14
21
  npx -y perp-cli --json portfolio
15
22
  ```
16
23
 
17
- ## Features
24
+ The package ships three executables: `perp` (the CLI), `perp-mcp` (the [MCP server](docs/mcp.md), stdio) and `perp-guardrail` (the [signing guardrail](docs/guardrail.md)).
18
25
 
19
- - **8 Venues** — trade on Pacifica, Hyperliquid, Lighter, Aster, Lighter RH, Ondo Perps, Arcus, QFEX (bridge / perp-perp arb cover the original four)
20
- - **Funding Rate Arb** — perp-perp + spot-perp scan & one-command dual-leg execution
21
- - **Portfolio** — single call returns balances, positions, risk level across all exchanges
22
- - **Funds** — deposit, withdraw, transfer, multi-provider bridge (cctp/relay/debridge), inter-exchange rebalance — all in one group
23
- - **Bots** — TWAP, grid, DCA, trailing-stop with background job management
24
- - **Agent-First Design** — `--json`, `--fields`, `--ndjson`, `--dry-run`, runtime schema introspection
25
- - **Safety** — pre-trade validation, response sanitization, client-id deduplication
26
+ ## Quick start
26
27
 
27
- ## Setup
28
+ **1. Look around — no keys needed.**
28
29
 
29
30
  ```bash
30
- # Import an exchange key into the encrypted OWS vault and make it the active wallet.
31
- # The key is read from a hidden prompt or stdin — never argv (shell history), never ~/.perp/.env.
32
- perp wallet set hl # Hyperliquid (EVM) — hidden prompt
33
- pbpaste | OWS_PASSPHRASE="$PP" perp wallet set pac --name pac # Pacifica (Solana) — piped
34
- # The active wallet serves every venue; one EVM key covers HL / Lighter / Aster.
35
- # Lighter trading also needs: perp wallet agent approve lighter
36
-
37
- # Or the interactive setup wizard (all 7 venues): picks / creates / imports an OWS
38
- # vault wallet, network, venues, registers agent wallets (y/N confirmation before
39
- # any signature — never moves funds), explains + sets the slippage bound, and the
40
- # default venue. It never writes keys to ~/.perp/.env.
41
- perp setup
42
-
43
- # Scriptable (CI / agents) — writes settings only, signs nothing:
44
- perp --json setup --non-interactive --wallet <ows-wallet> --venues hyperliquid,aster \
45
- --network testnet --default-venue hyperliquid --slippage-bps 50 --slippage aster=80
46
- # Add agent registration explicitly (Ondo key id + secret via stdin only):
47
- OWS_PASSPHRASE=<pp> perp --json setup --non-interactive --wallet <ows-wallet> \
48
- --venues hyperliquid,arcus --approve-agents --yes --arcus-account-index 0
49
-
50
- # Verify
51
- perp wallet show
31
+ perp -e hl market list # markets, prices, funding
32
+ perp -e hl market book BTC # order book
33
+ perp arb scan --rates # funding rates across venues
52
34
  ```
53
35
 
54
- Same EVM key works for both Hyperliquid and Lighter.
55
-
56
- > **Lighter API Key Index:** Indexes 0–3 are reserved by Lighter's frontend (web/mobile). perp-cli defaults to index `4`. Override with `LIGHTER_API_KEY_INDEX` env var, or use `perp wallet agent approve lighter --api-key-index <n>` for managed agent slots. Valid range: 4–254.
57
-
58
- ### Lighter RH, Ondo Perps, Arcus
59
-
60
- These venues have no `wallet set` private-key path — register an agent / API key instead:
36
+ **2. Add a wallet.** The setup wizard creates or imports an encrypted [OWS](https://github.com/open-wallet-standard) vault wallet, picks venues and registers agent keys (it asks before every signature and never moves funds):
61
37
 
62
38
  ```bash
63
- perp wallet agent approve lighter-rh # Lighter RH L2 slot key (USDG collateral, Robinhood chain)
64
- printf '%s\n%s\n' "$KEY_ID" "$SECRET" | perp wallet agent approve ondo # Ondo HMAC key id + secret, stdin only
65
- perp wallet agent approve arcus --master <ows-wallet> # Arcus Ed25519 API key (OWS wallet agent-arcus-<master>)
66
- perp wallet agent verify [lighter-rh|ondo|arcus] # no venue = verify every configured venue
39
+ perp setup
40
+ perp wallet show
67
41
  ```
68
42
 
69
- ### No master wallet on this computer — import a key created on the exchange website
43
+ Keys are read from a hidden prompt or stdin — never from argv or `~/.perp/.env`. One EVM key covers Hyperliquid, Lighter and Aster. For other paths (one-line key import, scriptable setup, keys created on the exchange website) see [docs/setup.md](docs/setup.md).
70
44
 
71
- Create the agent / API key on the venue's website, then import it. The master wallet never has to be
72
- on this machine; it is identified only by its public address. The key is read from a hidden prompt or
73
- stdin (never argv) and **checked against the venue before anything is stored** — a refused check stores
74
- nothing; a venue that cannot be checked without the master is reported as `unverified`, never as verified.
45
+ **3. Check your account and trade.** Add `-n testnet` to any command to use testnet.
75
46
 
76
47
  ```bash
77
- perp -n testnet wallet agent import hyperliquid # API wallet key; master read from HL (userRole)
78
- pbpaste | perp wallet agent import aster --master-address 0xYOU # signer key; signed /fapi/v3/balance check (works on Aster testnet too)
79
- perp wallet agent import pacifica --master-address <SOL account> # agent key; UNVERIFIED (Pacifica lists bindings only master-signed)
80
- perp wallet agent import lighter --account-index 123 --api-key-index 5 # slot key; auth token accepted for that slot
81
- perp wallet agent import arcus --master-address 0xOWNER # Ed25519 key; public key listed ACTIVE for the owner
82
- printf '%s\n%s\n' "$KEY_ID" "$SECRET" | perp wallet agent import ondo
83
- printf '%s\n%s\n' "$PUBLIC_KEY" "$SECRET" | perp wallet agent import qfex --account-id <uuid> # QFEX: import only (keys are created on the website, 2FA)
84
- perp wallet agent list # SOURCE column: approved | imported
85
-
86
- # Setup without any master wallet: one stdin line per --import-agents venue, in order (ondo: 2 lines)
87
- printf '%s\n%s\n' "$HL_AGENT_KEY" "$LT_KEY" | perp --json setup --non-interactive \
88
- --venues hyperliquid,lighter --import-agents hyperliquid,lighter --yes \
89
- --lighter-account-index 123 --lighter-api-key-index 5
48
+ perp --json portfolio # balances + positions + risk on every venue
49
+ perp --json --dry-run -e hl trade market BTC buy 0.001 # validate only, nothing is sent
50
+ perp --json -e hl trade market BTC buy 0.001 # market order (bounded by the slippage setting)
51
+ perp --json -e hl trade close BTC
90
52
  ```
91
53
 
92
- Trading works with the imported key. **Deposits, withdrawals, transfers, bridge, referral set and agent
93
- approvals need the master**: without it they fail with `NO_SIGNER_AVAILABLE` ("do it on the exchange
94
- website, or add the master with `perp wallet import`"). The CLI cannot revoke or rotate an imported key —
95
- revoke it on the website; `perp wallet agent revoke <venue> <name> --local-only` removes the local copy,
96
- and `wallet agent import <venue> --agent-name <name> --replace` swaps in a new website-created key.
97
- `perp setup` offers the same choice per venue: approve with this computer's master wallet, or import a
98
- website-created key (Step 1 can skip the master wallet).
54
+ ## AI Agent Skill
99
55
 
100
- Secrets are stored once (see `docs/SSOT_RULES.md` Rule #3): Lighter RH → `~/.perp/lighter-rh-agents/`, Ondo → `~/.perp/ondo-agents/<keyId>.json`, Arcus → OWS wallet `agent-arcus-<master>`; imported EVM / Solana / Ed25519 keys → OWS wallet `agent-{hl,aster,pac,arcus}-import-<name>` (empty passphrase, like approved agent wallets), imported Lighter keys → the network-tagged Lighter keystore. A missing wallet/key now fails with `KEY_NOT_FOUND` / `NO_SIGNER_AVAILABLE` instead of silently falling back to read-only.
56
+ Drop-in skill for Claude Code, Cursor, Codex, Gemini CLI, and other agent CLIs. Bundles a non-interactive command guide, ops playbook, strategy framework, and reusable shell scripts (preflight, arb monitor, validation) so your agent stops at the right confirmation points and never wedges on interactive wizards.
101
57
 
102
- ## Venues
58
+ ### Install
103
59
 
104
- | Venue | `-e` id (aliases) | Trading | Notes |
105
- |-------|-------------------|---------|-------|
106
- | Pacifica | `pacifica` (`pac`) | yes | Solana |
107
- | Hyperliquid | `hyperliquid` (`hl`) | yes | HyperEVM; HIP-3 dexes via `--dex` |
108
- | Lighter | `lighter` (`lt`) | yes | Ethereum L2 |
109
- | Aster | `aster` (`ast`) | yes | BNB Chain; funding interval is per symbol |
110
- | Lighter RH | `lighter-rh` (`lrh`, `rh`) | yes | Lighter engine on the Robinhood chain, USDG collateral |
111
- | Ondo Perps | `ondo` (`ondo-perps`) | yes | Off-chain engine; limit TIF GTC (default) / IOC / ALO; restricted: US, PA |
112
- | QFEX | `qfex` (`qf`) | yes (see **QFEX** below) | Custodial, off-chain engine; equities / indices / commodities, cross margin, USDC; limit TIF GTC (default) / IOC / FOK / ALO; testnet = QFEX UAT; restricted: US, GB, ES and others |
113
- | Arcus | `arcus` | yes | Robinhood chain, USDG collateral; limit TIF GTC (default, sent as GTT) / IOC / FOK / ALO; restricted: US, CA, GB; **access whitelist** — unlisted addresses are rejected (request access at arcus.xyz) |
114
-
115
- - **Time in force:** `trade limit` defaults to `GTC` on every venue (common names `GTC | IOC | FOK | ALO`; a TIF the venue does not offer → `CAPABILITY_UNSUPPORTED`). Lighter post-only (`ALO`) is disabled until verified on the venue.
116
- - **TP/SL on an entry:** `trade market|buy|sell|limit ... --tp <px> --sl <px>` means the same on every venue — *protect this entry's verified fill*. The direction is checked before anything is sent (long: tp > reference > sl; short: the reverse; reference = mark for market entries, the limit price for limit entries). Ondo attaches the legs to the order; Arcus sends an entry+TP/SL batch; Hyperliquid / Lighter / Aster verify the entry fill, then place reduce-only TP/SL trigger orders sized to it (only market or `--tif IOC` entries — a resting entry → `CAPABILITY_UNSUPPORTED`); Pacifica verifies the fill, then sets position TP/SL (refused if the symbol already has a position or TP/SL — never overwritten). Entry outcome unknown → `ORDER_PENDING` and **no** TP/SL (the position may be unprotected); entry filled but a leg failed → `ORDER_PARTIAL` (not retryable) with the entry result and which legs were placed — do not re-enter, finish with `trade tpsl`.
117
- - **TP/SL on a position:** `trade tpsl <SYM> <long|short> --tp <px> --sl <px> [--tp-limit <px>] [--size <n>]` — the argument is the **position's** side (buy/sell no longer accepted), checked against the live position; legs are reduce-only and sized to the live position (or `--size`).
118
- - **Stop orders are reduce-only by default** on every venue (`trade stop`); pass `--no-reduce-only` to let a stop open or flip a position (refused on Ondo and QFEX, whose stops are always reduce-only). Lighter / Arcus market triggers execute as a limit at trigger ± the slippage bound (`--slippage-bps` or settings) and may stay unfilled in a fast move; other venues use native market triggers (`--slippage-bps` → `CAPABILITY_UNSUPPORTED`).
119
- - **Order edit:** `trade edit` keeps the order's TIF. Pacifica: post-only (ALO) orders are edited natively; GTC / TOB orders placed by perp-cli (TIF recorded in the client order id) are cancelled and replaced with the remaining open size; orders whose TIF is unknown → `CAPABILITY_UNSUPPORTED` (pass `--tif`).
120
- - **Slippage bound:** every market-type order (entry, close, spot) is bounded by one value: `--slippage-bps <n>` → `settings.slippageBps.<venue>` → `settings.defaultSlippageBps` (shipped default 50, shown in `perp settings show`; change with `perp settings set defaultSlippageBps <n>`). Values outside 1..venue max (Arcus 1000) are rejected before sending.
121
- - **Restricted regions:** creating a signing adapter for a venue with restricted regions (Ondo, Arcus, QFEX) prints a one-time stderr notice; it never blocks — check the venue terms yourself.
122
- - **Aggregate views** (`portfolio`, `account positions/orders`, `risk`, `history`, `wallet agent verify`, MCP `portfolio`) cover every account venue with configured credentials.
123
-
124
- ### What works — mainnet verification (2026-10-13)
125
-
126
- Every mark below comes from a real-money mainnet run, not from code reading — at the venue minimum, with the per-venue cap raised to about $25–30 for multi-slice / multi-level checks and about $110 for the Hyperliquid TWAP. Details, evidence and the open issues: [`docs/MAINNET-VERIFICATION-STATUS.md`](docs/MAINNET-VERIFICATION-STATUS.md).
127
-
128
- ✅ verified live · ⛔ not supported (refused before anything is sent) · ❌ implemented but not run on mainnet yet · — not offered by the venue
129
-
130
- | Feature | HL | HIP-3 `xyz` | Pacifica | Lighter | Lighter RH | Aster | Ondo | Arcus | QFEX |
131
- |---|---|---|---|---|---|---|---|---|---|
132
- | Market / limit (GTC, ALO, IOC), cancel, edit, close, reduce, flatten, status | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
133
- | Entry `--tp/--sl`, `trade tpsl`, `trade stop` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
134
- | Stop-limit | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⛔ | ✅ | ⛔ |
135
- | Resting reduce-only limit | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⛔ | ✅ | ⛔ (IOC only) |
136
- | Client order id (place / status / cancel) | ✅ | ✅ | ✅³ (UUID) | ✅ (numeric) | ✅ (numeric) | ✅ | ✅ | ✅ | generated ids only |
137
- | Isolated margin (set, read back with a position, revert) | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ (venue rejected with `-4050`, condition unknown) | ⛔ | ✅ | ⛔ |
138
- | `trade scale-in` / `scale-tp` | ✅ | ✅ (position ≥ $20.5) | ✅ | ✅ | ✅ | ✅ | scale-in ✅ / scale-tp ⛔ — use partial `trade tpsl --size` ✅ | ✅ | scale-in ✅ / scale-tp ⛔ |
139
- | `trade split` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
140
- | `trade multi` (legs on several venues) | ✅ | ✅ (global `--dex xyz`) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
141
- | Native TWAP (`trade twap`) | ✅ | ❌ (HL minimum $100) | ✅ master-signed / ⛔ agent-signed | —² | —² | —² | —² | —² | —² |
142
- | Client-side TWAP (`trade twap` on other venues, `strategy twap`, `--background`) | — | — | — | ✅ | ✅ | ✅ | ✅ | ✅ | ⛔ (automation gate) |
143
- | `account margin` with a position | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
144
- | Spot (`trade spot-*`) | ✅ | — | ✅ | ✅ | ✅ | ❌ (needs USDT) | ✅ | ❌ (needs an Arcus-issued key) | — |
145
- | Deposit via perp-cli | ✅ | (HL) | ✅ | ✅ | ✅ | ✅ | ✅ | — (web app) | — (address only) |
146
- | Withdraw | ❌ | (HL) | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
147
-
148
- ² perp-cli has no native TWAP for this venue: `trade twap` runs the client-side TWAP (slices) instead. Whether the venue's API offers one is not checked.
149
- ³ Verified in the session; no saved log file.
150
-
151
- Automation, verified live (bounded runs at minimum size, stopped and flattened afterwards):
152
-
153
- | Area | Verified |
154
- |---|---|
155
- | Arbitrage | `arb exec` / `status` / `close` on Aster–Arcus, Lighter–Arcus; `arb auto` (Lighter–HL); spot-perp `arb exec <sym> spot:hl pacifica` and `arb close`; `strategy funding-arb`, `quick-arb`, `funding-auto` (Pacifica–HL); `strategy delta-neutral` (HL spot + Pacifica perp) |
156
- | Bots | `strategy grid` / `dca` / `trailing-stop` / `quick-grid` / `quick-dca` / `preset` (Aster); all 12 engine strategies via `strategy start <config>` (Aster); `strategy apex` (Aster) |
157
- | Execution helpers | `strategy twap` (Aster), `trade twap --background` (Arcus), `strategy plan execute` (9 of 10 action types — `cancel_order` not run), `perp background stop` (graceful: orders cancelled, positions listed) |
158
- | Hyperliquid HIP-4 outcomes | GTC place / cancel, IOC buy, `outcome sell --all` / `--size` |
60
+ ```bash
61
+ # Claude Code — slash command
62
+ /install-skill hypurrquant/perp-cli
159
63
 
160
- Not run on mainnet yet: withdrawals and `funds transfer` / `rebalance execute` / `bridge exchange` (run last), subaccounts, builder fees, `strategy claude-agent` (needs an Anthropic key), alerts / dashboard.
64
+ # Cursor / Codex / generic agent CLIs — via npx
65
+ npx skills add hypurrquant/perp-cli
161
66
 
162
- ### QFEX
67
+ # Manual install (any agent that reads a Skills directory)
68
+ git clone https://github.com/hypurrquant/perp-cli.git
69
+ cp -R perp-cli/skills/perp-cli ~/.claude/skills/ # or your CLI's skills dir
70
+ ```
163
71
 
164
- QFEX is custodial: there is no wallet signature. The only credential is an **API key created on the QFEX website** (Developer Settings, 2FA), imported with `perp wallet agent import qfex` (public key + secret via hidden prompt / stdin; stored encrypted in `~/.perp/qfex-agents/`). The import resolves the **one account UUID** the key trades (primary, or `--account-id <uuid>`), shows it and stores nothing until you confirm it (piped: pass `--account-id` equal to it). Create the trading key **without** the "Deposit and withdraw" permission.
72
+ The skill ships inside the npm package (`perp-cli/skills/perp-cli`), so a global install also makes it available locally:
165
73
 
166
74
  ```bash
167
- perp -n testnet wallet agent import qfex # QFEX UAT (api.qfex.io); y/N on the resolved account
168
- perp -e qfex market list # public: /refdata + market-data snapshot
169
- perp -e qfex trade limit AAPL buy 320 0.01 # GTC: "accepted" after the ACK; "open" once listed (trade status)
170
- perp -e qfex trade market AAPL buy 0.01 # IOC LIMIT at mark ± slippage (never the venue's unbounded MARKET)
171
- perp -e qfex trade status c:<id> --symbol AAPL # by the generated client order id
172
- perp funds deposit qfex # prints the USDC / Arbitrum One deposit address; you send the funds
75
+ npm install -g perp-cli@latest
76
+ ls "$(npm root -g)/perp-cli/skills/perp-cli"
173
77
  ```
174
78
 
175
- Verified on QFEX production (2026-10-13): `trade close` / `close-all` / `flatten` / `reduce` (sent as reduce-only **IOC**), `trade stop`, `trade tpsl` (both legs), market entry with `--sl`, `trade edit` (native modify — a new order id, the client id is kept, so `c:<id>` keeps working), cancel / status by `c:<id>`.
79
+ ### What's in the skill
176
80
 
177
- What perp-cli **still refuses on QFEX** (uniform `CAPABILITY_UNSUPPORTED`, before anything is sent):
81
+ | File | Purpose |
82
+ |------|---------|
83
+ | `SKILL.md` | Top-level agent guide — rules, workflows, examples |
84
+ | `references/commands.md` | Full non-interactive command reference (every group) |
85
+ | `references/agent-operations.md` | Setup flows, idempotency, error handling, common mistakes |
86
+ | `references/strategies.md` | Funding-arb decision framework + risk management |
87
+ | `scripts/preflight.sh` | Install + wallet + connectivity + risk readiness check |
88
+ | `scripts/arb-monitor.sh` | Live monitor for open arb positions |
89
+ | `scripts/spot-perp-scan.sh` | Scan spot+perp opportunities with balance context |
90
+ | `scripts/funding-analysis.sh` | Cross-exchange funding overview / per-symbol drilldown |
91
+ | `scripts/validate-arb.sh` | Pre-execution validation (price / balance / risk / dry-run) |
178
92
 
179
- | Refused | Why | Do instead |
180
- |---|---|---|
181
- | Resting reduce-only orders (`trade limit --reduce-only` with GTC / ALO, `trade scale-tp`) | Live: a resting reduce-only order **stays open after the position goes flat**; how the venue treats it if it later matches is unverified | Reduce-only IOC (`trade close` / `reduce`), or `trade stop` / `trade tpsl` |
182
- | Stop-limit (`--tp-limit`, `trade stop` with a limit price) | The venue's stop orders convert to market orders when triggered | Stop-market |
183
- | Stops that open or flip a position (`trade stop --no-reduce-only`) | QFEX stop orders only reduce a position | Reduce-only stops |
184
- | `trade edit` of a reduce-only order | A reduce-only order is sized against the live position when placed; a modify would skip that check | `trade cancel`, then place again |
185
- | `--client-id` | Client ids are not unique on the venue; perp-cli only trusts ids it generates | Omit it (the generated id is reported) |
186
- | Markets not quoted in USD (`SKHYNIX-KRW`, …) | Sizing, risk limits and notionals assume USD | QFEX web app |
187
- | Unattended automation on QFEX: bots, plans, TWAP, DCA, grid, funding arb, trailing stop, background jobs; QFEX in `arb scan` rankings | Automation is gated until verified (`QFEX_AUTOMATION_VERIFIED`); the funding rate's unit is unverified and equity funding accrues only part of the week (Q4) | Trade QFEX by hand; view funding only: `perp arb scan --rates --include-unverified` |
93
+ See [`skills/perp-cli/SKILL.md`](skills/perp-cli/SKILL.md) for the full agent guide.
188
94
 
189
- Known caveat: cancelling a stop / TP right after its position was closed can answer "unexpected error" while the venue removes the stop itself. QFEX keeps no record of stop orders, so perp-cli cannot prove the cancel and reports `ORDER_PARTIAL` (pending) — check `perp -e qfex account orders`; if it lists nothing, the stop is gone.
95
+ ## Features
190
96
 
191
- Order outcomes are never guessed: an IOC / market order is final only on a venue terminal frame (nothing filled → `ORDER_REJECTED`, `reason: iocNoFill`); anything unclear after the order was sent is `ORDER_PENDING` with the `c:<id>` to check — never resubmit. perp-cli never enables QFEX cancel-on-disconnect, but **another connection of the same user that enabled it (e.g. the official QFEX CLI) cancels all of the account's orders when that connection drops**.
97
+ - **Funding rate arb** — perp-perp and spot-perp scans, one-command dual-leg entry and exit
98
+ - **Portfolio** — one call returns balances, positions and risk across every venue
99
+ - **Funds** — deposit, withdraw, transfer, multi-provider bridge (CCTP / Relay / deBridge), inter-exchange rebalance
100
+ - **Bots** — TWAP, grid, DCA, trailing stop and more, with background job management
101
+ - **Agent-first** — `--json`, `--fields`, `--ndjson`, `--dry-run`, runtime schema introspection
102
+ - **Safety** — pre-trade validation, a slippage bound on every market order, client-id deduplication, response sanitization
192
103
 
193
- **Withdrawals** are authorized by the API key alone, so they are off until you set a local gate in an interactive terminal (no `--yes`, refused under `--json` / pipes / MCP): `perp settings set withdraw.qfex <address[+address…]>,<maxPerTx>,<maxPerDay>`, then `perp funds withdraw qfex <amount> --to <allowlisted address>` (`--dry-run` shows the plan and the gate verdict). The gate guards against mistakes and misdirected automation — it is **not** a defence against key theft; that defence is a trading key without the withdraw permission. QFEX itself documents that withdrawals need 2FA on the web app, so the API may refuse. Subaccounts: `perp -e qfex funds transfer <amount> primary --from <account uuid>`.
104
+ ## Venues
194
105
 
195
- ### Spot trading
106
+ | Venue | `-e` | Trading | Chain / collateral |
107
+ |---|---|---|---|
108
+ | Hyperliquid | `hyperliquid` (`hl`) | ✅ | HyperEVM, USDC; HIP-3 dexes via `--dex` |
109
+ | Pacifica | `pacifica` (`pac`) | ✅ | Solana, USDC |
110
+ | Lighter | `lighter` (`lt`) | ✅ | Ethereum L2, USDC |
111
+ | Lighter RH | `lighter-rh` (`lrh`) | ✅ | Robinhood chain, USDG |
112
+ | Aster | `aster` (`ast`) | ✅ | BNB Chain, USDT / USDC |
113
+ | Ondo Perps | `ondo` | ✅ | off-chain, USDC |
114
+ | Arcus | `arcus` | ✅ (access whitelist) | Robinhood chain, USDG |
115
+ | QFEX | `qfex` (`qf`) | ✅ (manual trading only) | custodial; equities, indices, commodities |
116
+ | RISEx | `risex` | read-only | RISE chain, USDC |
117
+ | GRVT | `grvt` | market data only | USDT |
118
+ | Extended | `extended` (`ext`) | market data only | Starknet; crypto + equities / FX |
119
+ | Variational | `variational` (`var`) | market data only | RFQ venue |
120
+ | TxFlow | `txflow` (`txf`) | market data only | **unofficial** API |
121
+ | Derive | `derive` | options data only | — |
122
+
123
+ - **[Support matrix and per-venue notes](docs/venues.md)** — funding, WebSocket, deposit / withdraw, lookups by address, restricted regions
124
+ - **[Mainnet verification](docs/verification.md)** — which features have been run with real money
125
+ - **[Trading details](docs/trading.md)** — time in force, TP/SL, stops, slippage, spot trading, builder fees
126
+
127
+ ## Common commands
196
128
 
197
- Spot support is declared per venue (`VenueDefinition.spot`) and every spot command, portfolio view and bot goes through one factory. Symbols are `BASE/QUOTE`; a bare base (`ETH`) uses the venue's first quote asset.
129
+ ```bash
130
+ # Market data
131
+ perp --json -e <EX> market list | book <SYM> | funding <SYM> | kline <SYM> 1h
198
132
 
199
- | Venue | Account model | Quote | Limit / book / cancel | Spot↔perp transfer |
200
- |-------|---------------|-------|-----------------------|--------------------|
201
- | Hyperliquid | runtime (unified accounts share USDC with perp; standard accounts are separate) | USDC | yes | yes (no-op on unified accounts) |
202
- | Lighter / Lighter RH | separate | USDC / USDG | yes | yes |
203
- | Aster | separate (`sapi` spot account) | USDT, USD1 (bare base → USDT) | yes | yes |
204
- | Pacifica | **unified** — spot shares the perp account | USDC | yes | no (not needed) |
205
- | Ondo Perps | separate (spot wallet ↔ margin) | USDC | yes | yes |
206
- | Arcus | **wallet** — on-chain swaps from your master EVM wallet (router, Permit2) | USDG | no (market swaps only) | no |
133
+ # Trading
134
+ perp --json -e <EX> trade buy <SYM> <SIZE> --tp <PX> --sl <PX> # entry protected by TP/SL
135
+ perp --json -e <EX> trade limit <SYM> buy <PX> <SIZE>
136
+ perp --json -e <EX> trade close <SYM> # or: flatten (every position)
207
137
 
208
- ```bash
209
- perp --json -e <EX> trade spot-buy <SYM> <SIZE> [--slippage-bps <n>] [--yes]
210
- perp --json -e <EX> trade spot-sell <SYM> <SIZE> [--slippage-bps <n>] [--yes]
211
- perp --json -e <EX> trade spot-limit <SYM> <buy|sell> <PRICE> <SIZE> [--tif GTC|IOC|ALO]
212
- perp --json -e <EX> trade spot-cancel <SYM> <ORDER_ID>
213
- perp --json -e <EX> trade spot-orders [SYM]
214
- perp --json -e <EX> trade spot-transfer <to-spot|to-perp> <AMOUNT> # moves the venue's first quote asset
215
- perp --json -e <EX> trade spot-balance
138
+ # Account
139
+ perp --json portfolio
140
+ perp --json -e <EX> account positions
141
+ perp --json account balance --address <ADDR> # any account, keyless
142
+
143
+ # Funding arb
144
+ perp --json arb scan --min 5
145
+ perp --json arb exec <SYM> <longEx> <shortEx> <USD>
146
+
147
+ # Funds
148
+ perp --json funds deposit hyperliquid 100
149
+ perp --json funds bridge send --from solana --to arbitrum --amount 100
216
150
  ```
217
151
 
218
- - **Unsupported operations fail loudly** with `CAPABILITY_UNSUPPORTED` (e.g. `spot-limit` / `spot-cancel` / `spot-orders` / `spot-transfer` on Arcus).
219
- - **`spot-transfer` on a shared-balance account** (Pacifica, Hyperliquid unified) succeeds as a no-op with `execution.method: "sharedAccount"` (nothing needs to move); a real move reports `execution.method: "transfer"`.
220
- - **Slippage:** same rule as perps — `--slippage-bps <n>` → `settings.slippageBps.<venue>` → `settings.defaultSlippageBps` (shipped 50).
221
- - **Pacifica:** spot buys spend the shared USDC perp margin and reduce perp available margin (a warning is printed before the first buy). Pacifica `getMarkets()` (perp) no longer lists the `SOL-USDC` spot market.
222
- - **Aster:** an agent signer needs spot permission — `perp wallet agent rotate aster --can-spot` (or `perp wallet agent approve aster --can-spot`); otherwise spot orders fail with `POLICY_DENIED`.
223
- - **Arcus:** swaps go through `router.spot.arcus.xyz` and settle on the Robinhood chain from the master EVM wallet (`--ows` / active OWS wallet; none → `NO_SIGNER_AVAILABLE`). Spot needs only the master wallet — no Arcus perp agent key; perp orders / account reads without one fail with `AGENT_NOT_REGISTERED` (`perp wallet agent approve arcus`). Listing Arcus spot markets is slow (~80 s, one router `/price` per token) — use `spot-buy` / `spot-sell` directly. Tokens without EIP-2612 permit need a one-time on-chain `approve(Permit2)` that costs Robinhood Chain ETH gas — pass `--yes` to allow it. Results show `status`, `finality`, `receivedToken` and a remediation; a `pending` result means the swap was submitted — **do not resubmit**.
224
- - **Results:** spot orders print the normalized result (status, finality, filled size, average price, received token, remediation). `spot-buy` / `spot-sell` add an `execution` record on every venue (method, slippage bps + source, protection price and reference where the venue path computes one). `spot-cancel` returns one `SpotOrderResult` shape on every venue (a Lighter cancel is `pending` until `spot-orders` confirms it); `spot-orders` lists the same columns on every venue (Hyperliquid included).
225
- - **Portfolio / landing:** spot value is added on top of perp equity except balances marked `shared` (Pacifica USDC, Hyperliquid unified USDC). Tokens without a spot price are excluded from totals with a stderr warning (never valued at 0).
226
- - **Bots and arb** (`funding-arb`, `spot-perp-arb`, `arb exec spot:<venue>`, `arb close`, `arb scan --mode spot-perp`) only use spot venues with a separate (or runtime) spot balance **and** a spot↔perp transfer: hyperliquid, lighter, lighter-rh, aster, ondo. Pacifica (shared margin) and Arcus (on-chain swaps) are refused with `CAPABILITY_UNSUPPORTED`; trade them manually with `trade spot-*`.
152
+ Full list with every group: **[docs/commands.md](docs/commands.md)**. Global flags: `--json`, `--fields <f>`, `--ndjson`, `--dry-run`, `-n testnet`, `-e <venue>`, `--dex <name>` (HIP-3), `-w, --wallet <name>`.
227
153
 
228
154
  ## Command Groups
229
155
 
@@ -233,13 +159,16 @@ perp --json -e <EX> trade spot-balance
233
159
  | `account` | Balance, positions, orders, margin |
234
160
  | `trade` | Market/limit/stop orders, close, scale, split execution |
235
161
  | `outcome` | Hyperliquid Outcome (HIP-4) — binary/range contracts, quoted per outcome (outcomeMeta `quoteToken`, USDC today), no leverage |
162
+ | `options` | Options market data, read-only (Derive: `-e derive options underlyings / expiries / chain / quote`) |
163
+ | `print` | Pacifica Print — strike orders earning a premium per cycle: games, quote, positions, history, events, deposit / cancel (`--dry-run`) |
164
+ | `vault` | Pacifica vaults (API: lakes) — list, info, positions, deposit (master wallet only) / withdraw (`--dry-run`) |
236
165
  | `arb` | Funding rate arb — scan, exec, close, monitor (perp-perp & spot-perp) |
237
166
  | `strategy` | 19 bot algorithms (grid, dca, twap, APEX, REFLECT, presets) + nested scripted plans |
238
167
  | `funds` | Deposit, withdraw, transfer, cross-chain bridge (multi-provider), inter-exchange rebalance |
239
168
  | `risk` | Risk limits, liquidation distance, guardrails |
240
169
  | `wallet` | Multi-wallet management, agent wallets (`wallet agent ...`), builder fees (`wallet builder ...`, off by default), margin mode / subaccount / API keys (`wallet manage ...`), on-chain balances |
241
170
  | `history` | Execution log, PnL, performance breakdown |
242
- | `portfolio` | Cross-exchange unified overview (replaces former `account balance` / `status` / `dashboard`) |
171
+ | `portfolio` | Cross-exchange unified overview (replaces former `account balance` / `status` / `dashboard`; `account balance --address` reads any account's balances, keyless) |
243
172
  | `health` | Adapter health check: ping every venue's REST endpoint (connectivity + latency) |
244
173
  | `settings` | CLI settings (referrals, defaults, fees, builder fees, deBridge affiliate) |
245
174
  | `backtest` | Strategy backtesting |
@@ -247,165 +176,38 @@ perp --json -e <EX> trade spot-balance
247
176
  | `alerts` | Funding rate alerts (Telegram / Discord) with background daemon |
248
177
  | `setup` | Setup wizard: OWS wallet, venues, agent wallets, slippage, default venue (alias: `init`; `--non-interactive` for scripts) |
249
178
 
250
- ### Builder fees (off by default)
251
-
252
- perp-cli attaches **no** builder fee unless you configure one and the venue approval is confirmed:
253
-
254
- ```bash
255
- perp settings set builder.hyperliquid 0xBuilder…,1 # <address|code>,<feeBps> — strict: format, venue cap; asks y/N (or --yes)
256
- perp wallet builder status # per venue: supported? configured? approved? attached?
257
- perp --dry-run wallet builder approve hyperliquid # plan only
258
- perp wallet builder approve hyperliquid # master-signed, asks y/N (or --yes)
259
- perp --no-builder trade market BTC buy 0.1 # skip it for one command
260
- perp settings unset builder.hyperliquid # off again
261
- ```
262
-
263
- Supported: hyperliquid (≤ 10 bps, not on HIP-3 dexes), pacifica (≤ 10 bps max, not on spot), aster (≤ 10 bps, mainnet), ondo (≤ 10 bps, no approval step), qfex (`perp settings set builder.qfex <uuid>` — a **fee share**: your fills are attributed to the builder code and you pay the normal fee, nothing extra; the code rides on the trading connection; mainnet only). Lighter / Lighter RH / Arcus: unsupported. If the approval is missing or cannot be read, the order is sent **without** the fee and the result's `execution.notes` says why; `execution.builderFee` shows what was attached.
179
+ ## Agent-First CLI Design
264
180
 
265
- ## Core Commands
181
+ Built following [agent-first CLI principles](https://justin.poehnelt.com/posts/rewrite-your-cli-for-ai-agents/):
266
182
 
267
183
  ```bash
268
- # Portfolio (balances + positions + risk across all exchanges)
184
+ # Every command returns structured JSON envelope
269
185
  perp --json portfolio
186
+ # → { "ok": true, "data": {...}, "meta": { "timestamp": "..." } }
270
187
 
271
- # Market data
272
- perp --json -e <EX> market list
273
- perp --json -e <EX> market book <SYM>
274
- perp --json -e <EX> market mid <SYM> # fast mid-price lookup
275
- perp --json -e <EX> market funding <SYM>
276
- perp --json -e <EX> market kline <SYM> 1h # candlestick data
277
- perp --json -e hl market hip3 # list HIP-3 deployed dexes
278
-
279
- # Trading
280
- perp --json -e <EX> trade buy <SYM> <SIZE> # shortcut for market buy
281
- perp --json -e <EX> trade sell <SYM> <SIZE> # shortcut for market sell
282
- perp --json -e <EX> trade market <SYM> buy <SIZE> --smart # IOC limit (less slippage)
283
- perp --json -e <EX> trade split <SYM> buy 5000 # orderbook-aware split (large orders)
284
- perp --json -e <EX> trade close <SYM>
285
- perp --json -e <EX> trade flatten # close ALL positions on exchange
286
- perp --json -e <EX> trade reduce <SYM> 50 # reduce position by 50%
287
- perp --json -e <EX> trade cancel <SYM> # cancel by symbol (or orderId)
288
- perp --json -e <EX> trade buy <SYM> <SIZE> --tp <PX> --sl <PX> # entry protected by TP/SL
289
- perp --json -e <EX> trade tpsl <SYM> long --tp <PX> --sl <PX> # TP/SL on an open position (long|short)
290
- perp --json -e <EX> trade stop <SYM> sell <SIZE> <PX> # reduce-only stop (default)
291
- perp --json -e <EX> trade leverage <SYM> <N>
292
-
293
- # Account
294
- perp --json portfolio -e <EX> # balance + spot + positions (account balance was renamed in v0.12)
295
- perp --json -e <EX> account positions
296
- perp --json -e <EX> account pnl # realized + unrealized + funding
297
- perp --json -e <EX> account funding # personal funding payment history
298
- perp --json -e <EX> account settings # per-market leverage & margin mode
299
-
300
- # Outcome markets (Hyperliquid HIP-4 — fully-collateralized binary contracts, quote token per outcome (USDC today), min 10 quote tokens)
301
- perp --json outcome list # active markets + Yes/No mid prices
302
- perp --json outcome view <outcome> # symmetric Yes/No book + underlying gap + expiry
303
- perp --json outcome book <outcome> <side> # one-side orderbook (e.g. '1 yes' or '1 0')
304
- perp --json outcome positions # open outcome holdings
305
- perp --json outcome orders # open outcome orders
306
- perp --json outcome buy <outcome> <side> <usd> --dry-run # validate before submit
307
- perp --json outcome buy <outcome> <side> <usd> # market buy, notional in the outcome's quote token
308
- perp --json outcome sell <outcome> <side> <usd> --limit <px> --tif gtc
309
- perp --json outcome cancel <outcome> <side> <oid>
310
-
311
- # Funding rate arbitrage
312
- perp --json arb scan --min 5 # perp-perp opportunities
313
- perp --json arb scan --mode spot-perp # spot+perp opportunities
314
- perp --json arb scan --rates # funding rates across all exchanges
315
- perp --json arb scan --basis # cross-exchange basis opportunities
316
- perp --json arb scan --gaps # cross-exchange price gaps
317
- perp --json arb scan --hip3 # HIP-3 cross-dex funding spreads
318
- perp --json arb scan --live # continuous live monitoring
319
- perp --json arb exec <SYM> <longEx> <shortEx> <$> # perp-perp dual-leg entry
320
- perp --json arb exec <SYM> spot:<exch> <perpEx> <$> # spot+perp entry
321
- perp --json arb config # show arb defaults
322
- perp --json arb history # past arb trade performance (alias: log)
323
-
324
- # Funds (deposit, withdraw, transfer, bridge, rebalance)
325
- perp --json funds deposit hyperliquid 100
326
- perp --json funds withdraw pacifica 50
327
- perp --json funds deposit lighter-rh 10 # USDG on Robinhood Chain (approve + deposit, mainnet)
328
- perp --json -e lighter-rh funds withdraw lighter 10 # USDG → Robinhood Chain
329
- perp --json --dry-run funds withdraw ondo 10 --to <ADDRESS> # plan only, nothing sent
330
- perp --json funds deposit aster 8 # USDT → Aster vault on BNB Chain (--chain arbitrum / --asset USDC; mainnet)
331
- perp --json funds withdraw aster 8 --chain bsc # USDT → your own address (agent needs --can-withdraw --ip-whitelist)
332
- perp --json funds deposit ondo 12 --probe 2 # USDC transfer to your Ondo funding address (Arbitrum; --chain ethereum)
333
- perp --json funds address-book add ondo <MASTER_ADDR> # SIWE challenge → Ondo withdrawal address book
334
- perp --json funds withdraw arcus 10 # to the Arcus account owner
335
- perp --json funds transfer 100 <ADDRESS> # HL internal transfer (instant)
336
- perp --json funds bridge quote --from solana --to arbitrum --amount 100
337
- perp --json funds bridge send --from solana --to arbitrum --amount 100 # auto-cheapest provider
338
- perp --json --dry-run funds bridge send --from robinhood --to solana --from-asset USDG --to-asset SOL --amount 15 # Relay quote only
339
- perp --json funds bridge send --from robinhood --to bsc --from-asset USDG --to-asset USDT --amount 15 # Relay swap, OWS master signs
340
- perp --json funds bridge exchange --from pacifica --to hyperliquid --amount 100
341
- perp --json funds rebalance check # balances across exchanges
342
- perp --json funds rebalance plan # compute optimal moves
343
- perp --json funds rebalance execute --auto-bridge # withdraw → bridge → deposit
344
- perp --json funds info # all routes & limits
345
-
346
- # Risk
347
- perp --json risk limits --max-leverage 5
348
- perp --json risk liquidation-distance
349
-
350
- # Strategies (19 bot algorithms + nested scripted plans)
351
- perp strategy list-strategies # list all available strategies
352
- perp strategy run <strategy> [symbol] # run any strategy
353
- perp strategy apex [symbol] # APEX autonomous orchestrator
354
- perp strategy reflect # trading performance analysis
355
- perp strategy preset-list # list strategy presets
356
- perp --json strategy twap <SYM> buy <SIZE> 30m
357
- perp --json strategy grid <SYM> --range 5 --grids 10 --size 100
358
- perp strategy plan example # scripted multi-step plan format
359
- perp --json strategy plan validate <FILE> # validate scripted plan
360
- perp --json strategy plan execute <FILE> --dry-run # dry-run scripted plan
361
-
362
- # Background process supervisor (tmux)
363
- perp background list # list running jobs
364
- perp background stop <ID> # stop a job
365
- perp background logs <ID> -f # follow logs
366
- # Jobs inherit -n, --dry-run, -e, --ows, -w, --no-agent, --dex and never receive keys via argv/env:
367
- # they read the OWS vault / agent keystores / ~/.perp/.env themselves. -k, --passphrase, --ows-key or a
368
- # shell-exported key / OWS_PASSPHRASE is refused — register an agent (perp wallet agent approve <venue>).
369
-
370
- ```
371
-
372
- ## Telegram Alerts
373
-
374
- Funding rate alerts via Telegram with background daemon support.
375
-
376
- ```bash
377
- # Interactive setup (BotFather token + chat ID auto-detection)
378
- perp alerts setup
188
+ # Filter output to specific fields (saves tokens)
189
+ perp --json --fields totalEquity,risk portfolio
379
190
 
380
- # Add alert rules
381
- perp alerts add ETH 30 # alert when ETH funding > 30% annualized
382
- perp alerts add --all 50 # alert for any symbol > 50%
191
+ # Stream large lists as NDJSON (one JSON per line)
192
+ perp --json --ndjson -e hl market list
383
193
 
384
- # Test & manage
385
- perp alerts test # send test message
386
- perp alerts list # show active rules
194
+ # Pre-validate before executing
195
+ perp --json -e hl trade check BTC buy 0.01
196
+ perp --json --dry-run -e hl trade market BTC buy 0.01
387
197
 
388
- # Run daemon
389
- perp alerts start # foreground
390
- perp alerts start --background # tmux background daemon
391
- perp alerts stop # stop background daemon
198
+ # Idempotent orders with client ID (Hyperliquid: a 128-bit cloid, 0x + 32 hex; --auto-id generates one)
199
+ perp --json -e hl trade market BTC buy 0.01 --client-id 0x1234567890abcdef1234567890abcdef
200
+ perp --json -e hl trade status c:0x1234567890abcdef1234567890abcdef
392
201
  ```
393
202
 
394
- Setup flow: BotFather token → bot validation → send `/start` to bot → auto-detect chat ID → test message.
395
-
396
- Exchange flag: `-e hyperliquid` / `-e pacifica` / `-e lighter` / `-e aster` (aliases: `hl`, `pac`, `lt`).
397
-
398
- Global flags: `--json`, `--fields <f>`, `--ndjson`, `--dry-run`, `--dex <name>` (HIP-3), `-w, --wallet <name>`.
203
+ All responses are auto-sanitized (control chars stripped, prompt injection patterns blocked).
204
+ Errors include `retryable` flag — only retry when `true`.
399
205
 
400
206
  ## MCP Server
401
207
 
402
208
  [![Glama MCP server](https://glama.ai/mcp/servers/hypurrquant/perp-cli/badges/score.svg)](https://glama.ai/mcp/servers/hypurrquant/perp-cli)
403
209
 
404
- perp-cli includes a full-featured MCP server (18 tools, 3 resources, 2 prompts) for Claude Desktop, Cursor, and other MCP clients.
405
-
406
- **No API keys required for market data** — explore prices, orderbooks, funding rates, and arb opportunities without any setup. Add keys only when you want to trade.
407
-
408
- **Network:** set `PERP_NETWORK=testnet` in the server env to serve testnet (validated; unset = mainnet); every result reports `meta.network`. `trade_execute` / `trade_close` place real orders through the same local risk gate as `perp trade` (no override over MCP), refuse non-reduce-only orders on quarantined symbols, and are written to the execution log.
210
+ `perp-mcp` serves 31 tools to Claude Desktop, Cursor and other MCP clients. Market data needs no keys; for account and trading tools run `perp setup` first (the server reads the same wallet). Never put private keys in the MCP config.
409
211
 
410
212
  ```json
411
213
  {
@@ -418,90 +220,21 @@ perp-cli includes a full-featured MCP server (18 tools, 3 resources, 2 prompts)
418
220
  }
419
221
  ```
420
222
 
421
- For trading and account data, run `perp setup` first: the MCP server reads the same OWS vault wallet and agent keystores as the CLI. Never put private keys in the MCP config. Select the network with `PERP_NETWORK` (`mainnet` | `testnet`; unset = mainnet, invalid values stop the server):
422
- ```json
423
- {
424
- "env": {
425
- "PERP_NETWORK": "testnet"
426
- }
427
- }
428
- ```
429
-
430
- **Read-only tools (no keys):** `get_markets`, `get_orderbook`, `get_funding_rates`, `get_prices`, `arb_scan`, `health_check`
431
-
432
- **Account & trading tools (keys required):** `get_balance`, `get_positions`, `portfolio`, `trade_preview`, `trade_execute`, `trade_close`, `get_funding_analysis`, `get_pnl_analysis`, `get_arb_compare`
433
-
434
- **Resources:** `market://prices`, `market://funding-rates`, `perp://schema`
223
+ Testnet, the full tool list, resources and prompts: **[docs/mcp.md](docs/mcp.md)**.
435
224
 
436
- **Prompts:** `trading-guide`, `arb-strategy`
225
+ ## Documentation
437
226
 
438
- ## AI Agent Skill
439
-
440
- Drop-in skill for Claude Code, Cursor, Codex, Gemini CLI, and other agent CLIs. Bundles a non-interactive command guide, ops playbook, strategy framework, and reusable shell scripts (preflight, arb monitor, validation) so your agent stops at the right confirmation points and never wedges on interactive wizards.
441
-
442
- ### Install
443
-
444
- ```bash
445
- # Claude Code — slash command
446
- /install-skill hypurrquant/perp-cli
447
-
448
- # Cursor / Codex / generic agent CLIs — via npx
449
- npx skills add hypurrquant/perp-cli
450
-
451
- # Manual install (any agent that reads a Skills directory)
452
- git clone https://github.com/hypurrquant/perp-cli.git
453
- cp -R perp-cli/skills/perp-cli ~/.claude/skills/ # or your CLI's skills dir
454
- ```
455
-
456
- The skill ships inside the npm package (`perp-cli/skills/perp-cli`), so a global install also makes it available locally:
457
-
458
- ```bash
459
- npm install -g perp-cli@latest
460
- ls "$(npm root -g)/perp-cli/skills/perp-cli"
461
- ```
462
-
463
- ### What's in the skill
464
-
465
- | File | Purpose |
466
- |------|---------|
467
- | `SKILL.md` | Top-level agent guide — rules, workflows, examples |
468
- | `references/commands.md` | Full non-interactive command reference (every group) |
469
- | `references/agent-operations.md` | Setup flows, idempotency, error handling, common mistakes |
470
- | `references/strategies.md` | Funding-arb decision framework + risk management |
471
- | `scripts/preflight.sh` | Install + wallet + connectivity + risk readiness check |
472
- | `scripts/arb-monitor.sh` | Live monitor for open arb positions |
473
- | `scripts/spot-perp-scan.sh` | Scan spot+perp opportunities with balance context |
474
- | `scripts/funding-analysis.sh` | Cross-exchange funding overview / per-symbol drilldown |
475
- | `scripts/validate-arb.sh` | Pre-execution validation (price / balance / risk / dry-run) |
476
-
477
- See [`skills/perp-cli/SKILL.md`](skills/perp-cli/SKILL.md) for the full agent guide.
478
-
479
- ## Agent-First CLI Design
480
-
481
- Built following [agent-first CLI principles](https://justin.poehnelt.com/posts/rewrite-your-cli-for-ai-agents/):
482
-
483
- ```bash
484
- # Every command returns structured JSON envelope
485
- perp --json portfolio
486
- # → { "ok": true, "data": {...}, "meta": { "timestamp": "..." } }
487
-
488
- # Filter output to specific fields (saves tokens)
489
- perp --json --fields totalEquity,risk portfolio
490
-
491
- # Stream large lists as NDJSON (one JSON per line)
492
- perp --json --ndjson -e hl market list
493
-
494
- # Pre-validate before executing
495
- perp --json -e hl trade check BTC buy 0.01
496
- perp --json --dry-run -e hl trade market BTC buy 0.01
497
-
498
- # Idempotent orders with client ID (Hyperliquid: a 128-bit cloid, 0x + 32 hex; --auto-id generates one)
499
- perp --json -e hl trade market BTC buy 0.01 --client-id 0x1234567890abcdef1234567890abcdef
500
- perp --json -e hl trade status c:0x1234567890abcdef1234567890abcdef
501
- ```
502
-
503
- All responses are auto-sanitized (control chars stripped, prompt injection patterns blocked).
504
- Errors include `retryable` flag — only retry when `true`.
227
+ | Doc | What's in it |
228
+ |---|---|
229
+ | [Setup](docs/setup.md) | Wallets, agent keys, keys created on the exchange website, where secrets are stored |
230
+ | [Venues](docs/venues.md) | Support matrix, venue ids, QFEX / RISEx / GRVT / Extended / Variational / TxFlow / Derive details |
231
+ | [Trading](docs/trading.md) | Time in force, TP/SL, stops, order edit, slippage, spot trading, builder fees |
232
+ | [Commands](docs/commands.md) | Every command group with examples, Telegram alerts |
233
+ | [Mainnet verification](docs/verification.md) | What has been run with real money, per venue |
234
+ | [MCP server](docs/mcp.md) | Configuration, testnet, tools, resources, prompts |
235
+ | [Signing guardrail](docs/guardrail.md) | `perp-guardrail`, the OWS policy executable for agent keys |
236
+ | [Testing](docs/TESTING.md) | Test suites and the venue checklist |
237
+ | [CHANGELOG](CHANGELOG.md) | Release notes |
505
238
 
506
239
  ## License
507
240