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
@@ -1,4 +1,4 @@
1
- export type { ExchangeMarketInfo, ExchangePosition, ExchangeOrder, ExchangeBalance, ExchangeTrade, ExchangeFundingPayment, ExchangeKline, ExchangeAdapter, } from "./interface.js";
1
+ export type { ExchangeMarketInfo, ExchangePosition, ExchangeOrder, ExchangeBalance, ExchangeTrade, ExchangePublicTrade, ExchangeFundingPayment, ExchangeKline, ExchangeAdapter, } from "./interface.js";
2
2
  export type { SpotMarketInfo, SpotBalance, SpotAdapter } from "./spot-interface.js";
3
3
  export { SPOT_PERP_TOKEN_MAP, PERP_TO_SPOT_MAP, MAX_PRICE_DEVIATION_PCT } from "./spot-interface.js";
4
4
  export * from "./capabilities.js";
@@ -9,7 +9,7 @@ export { LighterAdapter } from "./lighter.js";
9
9
  export { AsterAdapter } from "./aster.js";
10
10
  export { HyperliquidSpotAdapter } from "./hyperliquid-spot.js";
11
11
  export { LighterSpotAdapter } from "./lighter-spot.js";
12
- // Venue abstraction (docs/DESIGN-venue-abstraction.md §10)
12
+ // Venue abstraction
13
13
  export { getVenue, listVenues, listVenuesWithRole, resolveVenueId, tryResolveVenueId, parseVenueRef, networkConfig, requireCapabilities, fundingBasisOf, settlementIntervalOf, isLegacyVenue, isVenueId, READ_ONLY_CREDENTIALS, } from "./venue.js";
14
14
  export { ensureVenuesRegistered, ALL_VENUES } from "./venues/index.js";
15
15
  export { isTradingV2, validateOrderRequest, validateLegacyTif } from "./trading-v2.js";
@@ -9,9 +9,15 @@ export interface ExchangeMarketInfo {
9
9
  /** null = venue does not publish an index/oracle price for this market */
10
10
  indexPrice: string | null;
11
11
  fundingRate: string | null;
12
- /** null = venue does not publish 24h volume */
12
+ /** 24h volume in USD notional; null = venue does not publish 24h volume */
13
13
  volume24h: string | null;
14
- /** null = venue does not publish open interest (never "0" as a stand-in) */
14
+ /**
15
+ * Open interest in BASE-asset units (contracts of the underlying, e.g. BTC) — every venue
16
+ * publishes it that way, so it is never a USD figure. null = venue does not publish it
17
+ * (never "0" as a stand-in). One side where known (Lighter / Lighter RH: one side — inferred,
18
+ * not documented by the venue). The perp-ws `openInterest` is a different field with its own `unit` (Lighter:
19
+ * USD) — never compare the two without converting.
20
+ */
15
21
  openInterest: string | null;
16
22
  /** null = the venue does not publish it (Aster: the public exchangeInfo carries no leverage) */
17
23
  maxLeverage: number | null;
@@ -32,7 +38,31 @@ export interface ExchangeMarketInfo {
32
38
  lowerBound: number;
33
39
  maxLeverage: number;
34
40
  }> | null;
41
+ /**
42
+ * Listed but not tradable right now (VenueMarket.tradable: off-hours, reduce-only, halted, paused)
43
+ * → false. Delisted / disabled / inactive markets are not listed at all (each venue's eligibility
44
+ * rule). Absent = the venue publishes no tradability flag (its adapter lists live markets only).
45
+ */
46
+ tradable?: boolean;
47
+ /**
48
+ * Why a listed market is not tradable (with `tradable: false`), e.g. "nonUsdQuote", "offHours",
49
+ * "reduceOnly", "halted"; or the venue's own status. Absent / null = no reason published.
50
+ */
51
+ status?: string | null;
52
+ /**
53
+ * What `fundingRate` is, in the WS `rateKind` vocabulary: "accruing" (the current period so far),
54
+ * "predicted" (the rate expected at the next payment), "lastSettled" (the last payment). null =
55
+ * not verified for this venue's REST field. Absent on rows built before 0.15.1 conventions.
56
+ */
57
+ fundingRateKind?: FundingRateKind | null;
58
+ /**
59
+ * The venue's predicted rate for the running / next period, same unit as `fundingRate`
60
+ * (Pacifica next_funding_rate; Lighter market_stats current_funding_rate) — the perp-ws
61
+ * `predictedRate`. Absent = the venue publishes none on this path.
62
+ */
63
+ predictedFundingRate?: string | null;
35
64
  }
65
+ export type FundingRateKind = "accruing" | "predicted" | "lastSettled";
36
66
  /**
37
67
  * Effective max leverage for an order of `notional` USD.
38
68
  *
@@ -79,21 +109,131 @@ export interface ExchangeTrade {
79
109
  size: string;
80
110
  fee: string;
81
111
  }
112
+ /**
113
+ * A row of the PUBLIC trade tape (getRecentTrades). The tape carries no fee for the viewer —
114
+ * a fee exists only on the account's own fills (getTradeHistory) — so `fee` is always null
115
+ * here, never "0" as a stand-in.
116
+ */
117
+ export interface ExchangePublicTrade extends Omit<ExchangeTrade, "fee"> {
118
+ fee: null;
119
+ }
120
+ /**
121
+ * Rows of a public tape the adapter left out because they carry a value the venue documents but
122
+ * does not declare exhaustive (e.g. a new Pacifica event_type) — never guessed into a direction.
123
+ * Attached to the returned array under this symbol key (not serialized); `market trades` reports
124
+ * it as `meta.skippedRows`. Absent = nothing skipped.
125
+ */
126
+ export declare const TAPE_SKIPPED: unique symbol;
127
+ export interface TapeSkipped {
128
+ count: number;
129
+ reason: string;
130
+ }
131
+ export declare function withTapeSkipped<T>(rows: T[], skipped: TapeSkipped | null): T[];
132
+ /**
133
+ * Rows sorted by time (a copy), keeping every non-index property the adapter attached to the
134
+ * array (TAPE_SKIPPED and any other symbol / metadata key, with its descriptor) — a plain
135
+ * `[...rows].sort()` drops them.
136
+ */
137
+ export declare function sortByTime<T extends {
138
+ time: number;
139
+ }>(rows: readonly T[], order: "asc" | "desc"): T[];
140
+ export declare function tapeSkippedOf(rows: readonly unknown[]): TapeSkipped | null;
82
141
  export interface ExchangeFundingPayment {
83
142
  time: number;
84
143
  symbol: string;
85
144
  payment: string;
86
145
  }
146
+ /**
147
+ * One row of `market funding` (getFundingHistory). `rate` is a fraction per `intervalHours`
148
+ * (the hours one printed rate covers; null = unknown for that market), positive = longs pay.
149
+ * `rateKind` "lastSettled" = a rate the venue applied at `time`; null = the venue does not say.
150
+ */
151
+ export interface FundingHistoryRow {
152
+ time: number;
153
+ /** null = the venue published no rate for that print (e.g. the market was closed). Never "0" as a stand-in. */
154
+ rate: string | null;
155
+ price: string | null;
156
+ intervalHours: number | null;
157
+ rateKind: "lastSettled" | null;
158
+ /** true = the underlying market was closed for this print (no funding accrued); absent = not reported. */
159
+ marketClosed?: boolean;
160
+ }
87
161
  export interface ExchangeKline {
88
162
  time: number;
89
163
  open: string;
90
164
  high: string;
91
165
  low: string;
92
166
  close: string;
93
- volume: string;
167
+ /** Base-asset volume of the candle; null = venue does not publish it (never "0" as a stand-in) */
168
+ volume: string | null;
169
+ /** Quote (USD) notional volume of the candle; null = venue does not publish it */
170
+ quoteVolume: string | null;
94
171
  /** null = venue does not publish a trade count for the candle */
95
172
  trades: number | null;
96
173
  }
174
+ /**
175
+ * Guard for a candle row that states its own interval (HL / TxFlow / Pacifica `i`, RISEx
176
+ * `interval`): a row of another interval than requested is never returned as the requested one
177
+ * (RISEx answers unsupported intervals with 1m bars). `rowInterval` undefined = the row carries
178
+ * no interval field (nothing to check).
179
+ */
180
+ export declare function assertCandleInterval(venue: string, requested: string, rowInterval: unknown, remediation?: string): void;
181
+ /** One indicative quote of an RFQ venue's maker at a fixed size. */
182
+ export interface RfqQuoteTier {
183
+ /** Venue tier id ("base" = the market's minimum order size). */
184
+ tier: string;
185
+ /** USD notional of the tier; null when the venue does not publish it (minimum order size). */
186
+ notionalUsd: string | null;
187
+ bid: string;
188
+ ask: string;
189
+ }
190
+ /** An RFQ venue's indicative maker quotes — NOT order-book levels (`market book` on such a venue). */
191
+ export interface RfqQuotes {
192
+ kind: "rfqQuotes";
193
+ venue: string;
194
+ symbol: string;
195
+ ticker: string;
196
+ markPrice: string;
197
+ /** null = no quotes published right now (e.g. a closed market). */
198
+ updatedAt: string | null;
199
+ baseSpreadBps: string | null;
200
+ quotes: RfqQuoteTier[];
201
+ note: string;
202
+ }
203
+ /** Separate long / short rates of one daily swap funding payment (fractions). */
204
+ export interface SwapFundingRates {
205
+ annualizedLong: string;
206
+ annualizedShort: string;
207
+ intervalLong: string;
208
+ intervalShort: string;
209
+ }
210
+ /** Current funding terms of one market, for a venue that publishes no funding history (`market funding`). */
211
+ export interface CurrentFundingTerms {
212
+ kind: "currentFunding";
213
+ venue: string;
214
+ symbol: string;
215
+ ticker: string;
216
+ contractType: "perpetual" | "swap";
217
+ /** "predicted": the rate charged at nextFundingTime, recomputed during the window. */
218
+ rateKind: "predicted" | null;
219
+ /** Fraction per interval as published (perpetual); null for a swap or when unknown. */
220
+ intervalRate: string | null;
221
+ intervalHours: number | null;
222
+ /** intervalRate / intervalHours. */
223
+ hourlyRate: number | null;
224
+ /** hourlyRate × 24 × 365 × 100 (same normalization as arb scan). */
225
+ annualizedPct: number | null;
226
+ /** The venue's own annualized rate (fraction), for cross-checking. */
227
+ venueAnnualizedRate: string | null;
228
+ /** Unix ms; null when not published. */
229
+ nextFundingTime: number | null;
230
+ /** Swap only: long / short rates of the last applied and the upcoming payment. */
231
+ swap: {
232
+ last: SwapFundingRates | null;
233
+ next: SwapFundingRates | null;
234
+ } | null;
235
+ note: string;
236
+ }
97
237
  export interface ExchangeAdapter {
98
238
  readonly name: string;
99
239
  readonly chain?: string;
@@ -101,18 +241,22 @@ export interface ExchangeAdapter {
101
241
  /** True if perp and spot share the same balance (e.g., Hyperliquid). False if separate accounts (e.g., Lighter). */
102
242
  readonly isUnifiedAccount?: boolean;
103
243
  init?(): Promise<void>;
104
- getMarkets(): Promise<ExchangeMarketInfo[]>;
105
- getOrderbook(symbol: string): Promise<{
244
+ /** `opts.funding: false` = marks / precision only (Lighter skips its funding snapshot read). */
245
+ getMarkets(opts?: {
246
+ funding?: boolean;
247
+ }): Promise<ExchangeMarketInfo[]>;
248
+ /** `depth` (levels per side) sizes the request on venues that take it; callers cut the answer to it. */
249
+ getOrderbook(symbol: string, depth?: number): Promise<{
106
250
  bids: [string, string][];
107
251
  asks: [string, string][];
108
252
  }>;
109
- getRecentTrades(symbol: string, limit?: number): Promise<ExchangeTrade[]>;
110
- getFundingHistory(symbol: string, limit?: number): Promise<{
111
- time: number;
112
- rate: string;
113
- price: string | null;
114
- }[]>;
253
+ getRecentTrades(symbol: string, limit?: number): Promise<ExchangePublicTrade[]>;
254
+ getFundingHistory(symbol: string, limit?: number): Promise<FundingHistoryRow[]>;
115
255
  getKlines(symbol: string, interval: string, startTime: number, endTime: number): Promise<ExchangeKline[]>;
256
+ /** RFQ venue (no order book): the maker's indicative quotes. Absent = the venue has an order book. */
257
+ getRfqQuotes?(symbol: string): Promise<RfqQuotes>;
258
+ /** Venue without a funding-history API: the current funding terms. Absent = use getFundingHistory. */
259
+ getFundingTerms?(symbol: string): Promise<CurrentFundingTerms>;
116
260
  getBalance(): Promise<ExchangeBalance>;
117
261
  getPositions(): Promise<ExchangePosition[]>;
118
262
  getOpenOrders(): Promise<ExchangeOrder[]>;
@@ -120,7 +264,7 @@ export interface ExchangeAdapter {
120
264
  getTradeHistory(limit?: number): Promise<ExchangeTrade[]>;
121
265
  getFundingPayments(limit?: number): Promise<ExchangeFundingPayment[]>;
122
266
  /**
123
- * Market order = IOC within the resolved slippage bound (design §13.2). `opts` is
267
+ * Market order = IOC within the resolved slippage bound. `opts` is
124
268
  * required so every caller states reduceOnly and passes resolveSlippage() output.
125
269
  */
126
270
  marketOrder(symbol: string, side: "buy" | "sell", size: string, opts: {
@@ -142,7 +286,7 @@ export interface ExchangeAdapter {
142
286
  * `slippage` (resolveSlippage() output) bounds the execution price of a market
143
287
  * trigger on venues that send it as a protection-priced limit once triggered
144
288
  * (Lighter, Arcus: required there for a market trigger — adapters never read
145
- * settings, design §13.10 #1); venue-native market triggers ignore it.
289
+ * settings); venue-native market triggers ignore it.
146
290
  * `kind` ("tp" | "sl") states the protective intent explicitly: venues with distinct
147
291
  * take-profit / stop-loss trigger types (Aster, Lighter) send that type as given — no
148
292
  * price-based classification — and a trigger already crossed is left for the venue to
@@ -1,3 +1,4 @@
1
+ import { PerpError } from "../errors.js";
1
2
  /**
2
3
  * Effective max leverage for an order of `notional` USD.
3
4
  *
@@ -19,3 +20,49 @@ export function maxLeverageForNotional(market, notional) {
19
20
  }
20
21
  return effective;
21
22
  }
23
+ /**
24
+ * Rows of a public tape the adapter left out because they carry a value the venue documents but
25
+ * does not declare exhaustive (e.g. a new Pacifica event_type) — never guessed into a direction.
26
+ * Attached to the returned array under this symbol key (not serialized); `market trades` reports
27
+ * it as `meta.skippedRows`. Absent = nothing skipped.
28
+ */
29
+ export const TAPE_SKIPPED = Symbol.for("perp-cli.tapeSkipped");
30
+ export function withTapeSkipped(rows, skipped) {
31
+ if (skipped !== null && skipped.count > 0)
32
+ Object.defineProperty(rows, TAPE_SKIPPED, { value: skipped, enumerable: false });
33
+ return rows;
34
+ }
35
+ /**
36
+ * Rows sorted by time (a copy), keeping every non-index property the adapter attached to the
37
+ * array (TAPE_SKIPPED and any other symbol / metadata key, with its descriptor) — a plain
38
+ * `[...rows].sort()` drops them.
39
+ */
40
+ export function sortByTime(rows, order) {
41
+ const out = [...rows].sort((a, b) => (order === "asc" ? a.time - b.time : b.time - a.time));
42
+ for (const key of Reflect.ownKeys(rows)) {
43
+ if (key === "length" || (typeof key === "string" && /^\d+$/.test(key)))
44
+ continue;
45
+ const d = Object.getOwnPropertyDescriptor(rows, key);
46
+ if (d !== undefined)
47
+ Object.defineProperty(out, key, d);
48
+ }
49
+ return out;
50
+ }
51
+ export function tapeSkippedOf(rows) {
52
+ const v = rows[TAPE_SKIPPED];
53
+ return v === undefined ? null : v;
54
+ }
55
+ /**
56
+ * Guard for a candle row that states its own interval (HL / TxFlow / Pacifica `i`, RISEx
57
+ * `interval`): a row of another interval than requested is never returned as the requested one
58
+ * (RISEx answers unsupported intervals with 1m bars). `rowInterval` undefined = the row carries
59
+ * no interval field (nothing to check).
60
+ */
61
+ export function assertCandleInterval(venue, requested, rowInterval, remediation) {
62
+ if (rowInterval === undefined || rowInterval === requested)
63
+ return;
64
+ throw new PerpError("EXCHANGE_ERROR", `${venue} candles: requested ${requested} candles, got a row labelled ${JSON.stringify(rowInterval)}`, {
65
+ exchange: venue,
66
+ remediation: remediation ?? `Use an interval ${venue} serves (see perp -e ${venue} market kline --help)`,
67
+ });
68
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Venue-final IOC / market order outcome (design `docs/DESIGN-venue-abstraction.md` §13.10 #4).
2
+ * Venue-final IOC / market order outcome.
3
3
  *
4
4
  * An adapter whose market / IOC responses report the order's FINAL filled size (nothing
5
5
  * of the order can still execute) implements `iocOutcomeOf(raw)` on the RAW result its
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Venue-final IOC / market order outcome (design `docs/DESIGN-venue-abstraction.md` §13.10 #4).
2
+ * Venue-final IOC / market order outcome.
3
3
  *
4
4
  * An adapter whose market / IOC responses report the order's FINAL filled size (nothing
5
5
  * of the order can still execute) implements `iocOutcomeOf(raw)` on the RAW result its
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * TradingV2 for the four pre-existing venues (pacifica, hyperliquid, lighter /
3
- * lighter-rh, aster) — design §13.7, §13.10 #8.
3
+ * lighter-rh, aster).
4
4
  *
5
5
  * Composition, not modification: the legacy ExchangeAdapter methods keep returning
6
6
  * their raw venue responses (in-process contract for smart-order, perp-order,
@@ -17,7 +17,7 @@ import { type TradingV2 } from "./trading-v2.js";
17
17
  import { type Network, type OrderResult } from "./venue-types.js";
18
18
  export declare function tradingV2Of(adapter: ExchangeAdapter, network: Network): TradingV2;
19
19
  export declare function toTradingV2(adapter: ExchangeAdapter, network: Network): TradingV2;
20
- /** One reduce-only protective trigger (TP or SL) of a separateOrders venue (design §13.5). */
20
+ /** One reduce-only protective trigger (TP or SL) of a separateOrders venue. */
21
21
  export interface TpSlLeg {
22
22
  symbol: string;
23
23
  /** Side that closes the protected position (sell closes a long). */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * TradingV2 for the four pre-existing venues (pacifica, hyperliquid, lighter /
3
- * lighter-rh, aster) — design §13.7, §13.10 #8.
3
+ * lighter-rh, aster).
4
4
  *
5
5
  * Composition, not modification: the legacy ExchangeAdapter methods keep returning
6
6
  * their raw venue responses (in-process contract for smart-order, perp-order,
@@ -13,6 +13,7 @@
13
13
  */
14
14
  import { PerpError, orderOutcomeUnknown } from "../errors.js";
15
15
  import { isPacificaStopType, pacificaRefused } from "./pacifica.js";
16
+ import { isPacificaRateLimited } from "../pacifica/rate-limit.js";
16
17
  import { iocLotTolerance, isIocOutcomeCapable } from "./ioc-outcome.js";
17
18
  import { isQueryOrderCapable } from "./capabilities.js";
18
19
  import { floorSize, lotStepOf } from "./precision.js";
@@ -621,7 +622,11 @@ class LegacyTradingV2 {
621
622
  if (this.family !== "pacifica" || !pacificaRefused(e))
622
623
  throw e;
623
624
  raw = { error: e instanceof Error ? e.message : String(e) };
624
- refusal = await this.adapter.cancelRefusalOutcome(ref.value, e);
625
+ // RATE_LIMITED with sent:false (local throttle or HTTP 429): this cancel was not executed —
626
+ // failed (nothing cancelled), no history read needed. Unknown-after-send never lands here.
627
+ refusal = isPacificaRateLimited(e)
628
+ ? { kind: "failed", error: `cancel of ${ref.value} not executed (rate limited, nothing sent / refused): ${e instanceof Error ? e.message : String(e)}` }
629
+ : await this.adapter.cancelRefusalOutcome(ref.value, e);
625
630
  }
626
631
  const out = (v, reason = "") => {
627
632
  if (v === "cancelled")
@@ -1,34 +1,34 @@
1
1
  /**
2
- * Lighter-family public market data (`lighter`, `lighter-rh`) — design §10.6.
2
+ * Lighter-family public market data (`lighter`, `lighter-rh`).
3
3
  *
4
4
  * Sources (REST base from venues/lighter-family.ts, per venue + network):
5
5
  * GET /api/v1/orderBookDetails → perps in `order_book_details` (decimals, min
6
6
  * amounts, status, mark/index price, IMF, OI, volume). It carries every
7
7
  * field /orderBooks has, so /orderBooks is not fetched (one fewer call
8
8
  * under the 60 req/min standard limit).
9
- * GET /api/v1/funding-rates → MULTI-EXCHANGE aggregate (binance/bybit/
10
- * hyperliquid/lighter). Only rows with exchange === "lighter" are the
11
- * venue's own; the RH host labels its own rows "lighter" too (live
12
- * 2026-09-30: 57 "lighter" rows = RH's 57 perps, matched by market_id).
9
+ * WS market_stats/all (first frame) → per market `funding_rate` (LAST SETTLED, percent per
10
+ * 1 h; = the newest GET /fundings print) and `current_funding_rate` (predicted). REST
11
+ * /funding-rates is the predicted rate × 8 and is not read here (fetchLighterFundingStats).
13
12
  *
14
- * FUNDING: basis 8h per quoted rate, hourly settlement (design §10.1, Lighter
15
- * and Lighter RH identical).
13
+ * FUNDING: market / funding rows carry the settled rate per 1 h (hourly settlement; Lighter and
14
+ * Lighter RH identical).
16
15
  *
17
16
  * ASSET CLASS: the API has no asset-class field (the undocumented
18
17
  * `strategy_index` groups markets on Lighter main but is 0 for every RH market),
19
18
  * so classification is an explicit per-venue table built from live listings on
20
19
  * 2026-09-30:
21
- * - lighter-rh: every listed perp is in RH_CLASS. An unlisted symbol is
22
- * excluded with a warning until it is classified (RH lists mostly equities,
23
- * so no class can be assumed).
20
+ * - lighter-rh: every listed perp is in LIGHTER_RH_CLASS (src/ws/unclassified.ts). An unlisted symbol is
21
+ * "unclassified" (listed, canonical null) until it is classified (RH lists
22
+ * mostly equities, so no class can be assumed).
24
23
  * - lighter: crypto-centric venue. LIGHTER_NON_CRYPTO lists every non-crypto
25
24
  * perp; any other symbol is crypto by this venue's definition.
26
- * LIGHTER_AMBIGUOUS tickers are excluded with a warning so they cannot
27
- * produce a false cross-venue match.
25
+ * UNCLASSIFIED_TICKERS.lighter (src/ws/unclassified.ts) are "unclassified" (listed, canonical null) so
26
+ * they cannot produce a false cross-venue match.
28
27
  *
29
28
  * OPEN INTEREST: `open_interest` in base units (same value legacy getMarkets reports).
30
29
  */
31
30
  import { PerpError } from "../errors.js";
31
+ import type { Network } from "./venue-types.js";
32
32
  import type { VenuePublicData } from "./venue.js";
33
33
  import type { LighterVenueId } from "./venues/lighter-family.js";
34
34
  /**
@@ -40,4 +40,59 @@ import type { LighterVenueId } from "./venues/lighter-family.js";
40
40
  * The API's own answers are JSON, so a JSON 405 / 403 is not a challenge.
41
41
  */
42
42
  export declare function lighterWafChallenge(venue: string, status: number, body: string): PerpError | null;
43
+ /** `limit` of GET /api/v1/orderBookOrders: the documented maximum (apidocs.lighter.xyz/reference/orderbookorders, 1..250). */
44
+ export declare const LIGHTER_BOOK_ORDERS_LIMIT = 250;
45
+ /**
46
+ * One side of GET /api/v1/orderBookOrders (individual resting ORDERS, best price first) → price
47
+ * levels: `remaining_base_amount` summed per price, in the venue's order — the shape of the WS
48
+ * `order_book/{id}` channel (levels). A side of exactly `limit` orders may have more orders at its
49
+ * last price beyond the page, so that (possibly partial) level is dropped. A row without a price /
50
+ * remaining amount is a payload error (never skipped, never "0").
51
+ */
52
+ export declare function lighterBookLevels(venue: string, rows: unknown, what: string, limit?: number): [string, string][];
53
+ /**
54
+ * A GET /orderBookOrders answer → price levels per side, cut to `depth`. A side whose page is full
55
+ * (LIGHTER_BOOK_ORDERS_LIMIT orders, the endpoint max) but aggregates to fewer than `depth` levels
56
+ * cannot be paged: INVALID_PARAMS naming the 250-order cap, never a silently shallower book.
57
+ */
58
+ export declare function lighterBook(venue: string, res: {
59
+ asks?: unknown;
60
+ bids?: unknown;
61
+ }, what: string, depth?: number): {
62
+ bids: [string, string][];
63
+ asks: [string, string][];
64
+ };
65
+ /**
66
+ * Every account of an L1 (EVM) address — `GET /account?by=l1_address&value=` (public). One
67
+ * address can own several accounts (sub-accounts). An address without a Lighter account answers
68
+ * HTTP 400 `{"code":21100,"message":"account not found"}` (live 2026-10-19) → null, not an error.
69
+ */
70
+ export declare function fetchLighterAccountsByL1(venue: LighterVenueId, net: Network, address: string): Promise<Array<Record<string, unknown>> | null>;
71
+ /** Perp price decimals by symbol (upper case) — `GET /orderBooks` `supported_price_decimals`, as the adapter's market map. */
72
+ export declare function fetchLighterPriceDecimals(venue: LighterVenueId, net: Network): Promise<Map<string, number>>;
73
+ /** One market's funding from the WS `market_stats/all` snapshot, fractions per 1 h. */
74
+ export interface LighterFundingStat {
75
+ /** Last settled hourly rate (market_stats funding_rate; = the newest GET /fundings print). */
76
+ rate: string | null;
77
+ /** Predicted rate of the running hour (market_stats current_funding_rate). */
78
+ predictedRate: string | null;
79
+ }
80
+ /** Drop the shared market_stats snapshots and remembered failures (tests; a network switch). */
81
+ export declare function clearLighterFundingStatsCache(): void;
82
+ /**
83
+ * Why the settled rate of `venue` / `net` is unavailable right now (the remembered failure of the
84
+ * last snapshot read), null when it was read or not tried. Callers put it in `meta.warnings`
85
+ * (CLI --json, MCP) next to the rows whose fundingRate is null.
86
+ */
87
+ export declare function lighterFundingStatsWarning(venue: LighterVenueId, net: Network): string | null;
88
+ /**
89
+ * Settled + predicted hourly funding of every market, keyed by market_id: the SNAPSHOT frame
90
+ * (`subscribed/market_stats`, channel `market_stats:all` — later `update/…` frames carry only the
91
+ * markets that changed) of the WS `market_stats/all` channel, the source of the perp-ws `rate` /
92
+ * `predictedRate`. REST has no bulk settled source: /funding-rates is the PREDICTED rate × 8 (live
93
+ * 2026-10-19: ETH 0.0009 % /h predicted → 0.000072; settled 0.0012 % /h), and /fundings is one
94
+ * market per request. One snapshot per venue / network is shared STATS_TTL_MS; a failure is
95
+ * remembered STATS_FAILURE_TTL_MS (lighterFundingStatsWarning).
96
+ */
97
+ export declare function fetchLighterFundingStats(venue: LighterVenueId, net: Network): Promise<Map<number, LighterFundingStat>>;
43
98
  export declare function lighterPublicData(venue: LighterVenueId): VenuePublicData;