@reefclaw/connect 0.1.11 → 0.1.12

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 (397) hide show
  1. package/assets/bridge/gateway/heartbeat-cron.d.ts +27 -0
  2. package/assets/bridge/gateway/heartbeat-cron.js +85 -0
  3. package/assets/bridge/providers/gateway.d.ts +2 -0
  4. package/assets/bridge/providers/gateway.js +57 -16
  5. package/assets/bridge/setup.js +6 -51
  6. package/dist/deps.js +2 -2
  7. package/dist/plugin.js +35 -7
  8. package/package.json +1 -1
  9. package/assets/plugin/audit/mode-transition-audit.d.ts +0 -11
  10. package/assets/plugin/audit/mode-transition-audit.js +0 -29
  11. package/assets/plugin/balance-utils.d.ts +0 -36
  12. package/assets/plugin/balance-utils.js +0 -98
  13. package/assets/plugin/ccxt/binance-ban-gate.d.ts +0 -47
  14. package/assets/plugin/ccxt/binance-ban-gate.js +0 -420
  15. package/assets/plugin/ccxt/binance-private.d.ts +0 -346
  16. package/assets/plugin/ccxt/binance-private.js +0 -1525
  17. package/assets/plugin/ccxt/binance-public.d.ts +0 -34
  18. package/assets/plugin/ccxt/binance-public.js +0 -180
  19. package/assets/plugin/ccxt/intel-public.d.ts +0 -25
  20. package/assets/plugin/ccxt/intel-public.js +0 -80
  21. package/assets/plugin/ccxt/public-market-data-api.d.ts +0 -26
  22. package/assets/plugin/ccxt/public-market-data-api.js +0 -23
  23. package/assets/plugin/config/agent-config-client.d.ts +0 -77
  24. package/assets/plugin/config/agent-config-client.js +0 -188
  25. package/assets/plugin/config/agent-config-poller.d.ts +0 -32
  26. package/assets/plugin/config/agent-config-poller.js +0 -101
  27. package/assets/plugin/config/brackets-config.d.ts +0 -22
  28. package/assets/plugin/config/brackets-config.js +0 -58
  29. package/assets/plugin/config/entitlement-gate.d.ts +0 -51
  30. package/assets/plugin/config/entitlement-gate.js +0 -137
  31. package/assets/plugin/config/gate-store.d.ts +0 -18
  32. package/assets/plugin/config/gate-store.js +0 -61
  33. package/assets/plugin/config/plugin-config-io.d.ts +0 -222
  34. package/assets/plugin/config/plugin-config-io.js +0 -126
  35. package/assets/plugin/config/position-review-config.d.ts +0 -35
  36. package/assets/plugin/config/position-review-config.js +0 -105
  37. package/assets/plugin/config/tool-gate.d.ts +0 -53
  38. package/assets/plugin/config/tool-gate.js +0 -128
  39. package/assets/plugin/config/user-data-stream-config.d.ts +0 -89
  40. package/assets/plugin/config/user-data-stream-config.js +0 -239
  41. package/assets/plugin/connector-supervisor.d.ts +0 -36
  42. package/assets/plugin/connector-supervisor.js +0 -149
  43. package/assets/plugin/exchange-adapter.d.ts +0 -65
  44. package/assets/plugin/exchange-adapter.js +0 -4
  45. package/assets/plugin/index.d.ts +0 -30
  46. package/assets/plugin/index.js +0 -2756
  47. package/assets/plugin/ingest/pending-entry-metadata.d.ts +0 -74
  48. package/assets/plugin/ingest/pending-entry-metadata.js +0 -236
  49. package/assets/plugin/ingest/position-auto-capture.d.ts +0 -171
  50. package/assets/plugin/ingest/position-auto-capture.js +0 -709
  51. package/assets/plugin/ingest/position-decisions-client.d.ts +0 -327
  52. package/assets/plugin/ingest/position-decisions-client.js +0 -306
  53. package/assets/plugin/ingest/readiness-reporter.d.ts +0 -42
  54. package/assets/plugin/ingest/readiness-reporter.js +0 -163
  55. package/assets/plugin/ingest/reconcile-db-vs-exchange.d.ts +0 -51
  56. package/assets/plugin/ingest/reconcile-db-vs-exchange.js +0 -170
  57. package/assets/plugin/ingest/reconciler-cleanup.d.ts +0 -37
  58. package/assets/plugin/ingest/reconciler-cleanup.js +0 -147
  59. package/assets/plugin/ingest/rest-gap-filler.d.ts +0 -191
  60. package/assets/plugin/ingest/rest-gap-filler.js +0 -565
  61. package/assets/plugin/ingest/touched-symbols-store.d.ts +0 -25
  62. package/assets/plugin/ingest/touched-symbols-store.js +0 -96
  63. package/assets/plugin/ingest/trade-store-client.d.ts +0 -40
  64. package/assets/plugin/ingest/trade-store-client.js +0 -125
  65. package/assets/plugin/ingest/ws-ingest.d.ts +0 -43
  66. package/assets/plugin/ingest/ws-ingest.js +0 -126
  67. package/assets/plugin/learning/setup-family.d.ts +0 -21
  68. package/assets/plugin/learning/setup-family.js +0 -103
  69. package/assets/plugin/lifecycle/install-signal-handlers.d.ts +0 -33
  70. package/assets/plugin/lifecycle/install-signal-handlers.js +0 -112
  71. package/assets/plugin/lifecycle/shutdown-coordinator.d.ts +0 -43
  72. package/assets/plugin/lifecycle/shutdown-coordinator.js +0 -131
  73. package/assets/plugin/lifecycle/trading-operation-lock.d.ts +0 -17
  74. package/assets/plugin/lifecycle/trading-operation-lock.js +0 -14
  75. package/assets/plugin/live/bracket-id.d.ts +0 -26
  76. package/assets/plugin/live/bracket-id.js +0 -112
  77. package/assets/plugin/live/bracket-ledger.d.ts +0 -54
  78. package/assets/plugin/live/bracket-ledger.js +0 -267
  79. package/assets/plugin/live/bracket-manager.d.ts +0 -82
  80. package/assets/plugin/live/bracket-manager.js +0 -478
  81. package/assets/plugin/live/bracket-params.d.ts +0 -22
  82. package/assets/plugin/live/bracket-params.js +0 -124
  83. package/assets/plugin/live/bracket-reconciler.d.ts +0 -95
  84. package/assets/plugin/live/bracket-reconciler.js +0 -573
  85. package/assets/plugin/live/bracket-types.d.ts +0 -102
  86. package/assets/plugin/live/bracket-types.js +0 -8
  87. package/assets/plugin/live/deposit-tracker.d.ts +0 -62
  88. package/assets/plugin/live/deposit-tracker.js +0 -97
  89. package/assets/plugin/live/emergency-controls.d.ts +0 -32
  90. package/assets/plugin/live/emergency-controls.js +0 -226
  91. package/assets/plugin/live/exchange-errors.d.ts +0 -12
  92. package/assets/plugin/live/exchange-errors.js +0 -130
  93. package/assets/plugin/live/exchange-info-cache.d.ts +0 -37
  94. package/assets/plugin/live/exchange-info-cache.js +0 -134
  95. package/assets/plugin/live/fact-subscriber.d.ts +0 -78
  96. package/assets/plugin/live/fact-subscriber.js +0 -182
  97. package/assets/plugin/live/fill-price.d.ts +0 -13
  98. package/assets/plugin/live/fill-price.js +0 -37
  99. package/assets/plugin/live/intent-journal.d.ts +0 -42
  100. package/assets/plugin/live/intent-journal.js +0 -122
  101. package/assets/plugin/live/listen-key-manager.d.ts +0 -70
  102. package/assets/plugin/live/listen-key-manager.js +0 -169
  103. package/assets/plugin/live/live-adapter.d.ts +0 -319
  104. package/assets/plugin/live/live-adapter.js +0 -1906
  105. package/assets/plugin/live/live-balance-enricher.d.ts +0 -32
  106. package/assets/plugin/live/live-balance-enricher.js +0 -104
  107. package/assets/plugin/live/live-bracket-api.d.ts +0 -13
  108. package/assets/plugin/live/live-bracket-api.js +0 -20
  109. package/assets/plugin/live/live-state-store.d.ts +0 -194
  110. package/assets/plugin/live/live-state-store.js +0 -450
  111. package/assets/plugin/live/local-signal-service.d.ts +0 -57
  112. package/assets/plugin/live/local-signal-service.js +0 -151
  113. package/assets/plugin/live/local-strategy-evaluator.d.ts +0 -62
  114. package/assets/plugin/live/local-strategy-evaluator.js +0 -131
  115. package/assets/plugin/live/microstructure-assembler.d.ts +0 -54
  116. package/assets/plugin/live/microstructure-assembler.js +0 -148
  117. package/assets/plugin/live/order-poller.d.ts +0 -29
  118. package/assets/plugin/live/order-poller.js +0 -125
  119. package/assets/plugin/live/position-state-store.d.ts +0 -87
  120. package/assets/plugin/live/position-state-store.js +0 -237
  121. package/assets/plugin/live/proposal-decision-listener.d.ts +0 -70
  122. package/assets/plugin/live/proposal-decision-listener.js +0 -292
  123. package/assets/plugin/live/proposal-manager.d.ts +0 -76
  124. package/assets/plugin/live/proposal-manager.js +0 -140
  125. package/assets/plugin/live/rate-limiter.d.ts +0 -47
  126. package/assets/plugin/live/rate-limiter.js +0 -159
  127. package/assets/plugin/live/reconciler.d.ts +0 -39
  128. package/assets/plugin/live/reconciler.js +0 -175
  129. package/assets/plugin/live/setup-buckets.d.ts +0 -7
  130. package/assets/plugin/live/setup-buckets.js +0 -33
  131. package/assets/plugin/live/slippage-tracker.d.ts +0 -45
  132. package/assets/plugin/live/slippage-tracker.js +0 -78
  133. package/assets/plugin/live/stop-watcher.d.ts +0 -67
  134. package/assets/plugin/live/stop-watcher.js +0 -218
  135. package/assets/plugin/live/user-data-active-probe.d.ts +0 -54
  136. package/assets/plugin/live/user-data-active-probe.js +0 -180
  137. package/assets/plugin/live/user-data-stream-controller.d.ts +0 -200
  138. package/assets/plugin/live/user-data-stream-controller.js +0 -579
  139. package/assets/plugin/live/user-data-stream-ws.d.ts +0 -22
  140. package/assets/plugin/live/user-data-stream-ws.js +0 -63
  141. package/assets/plugin/live/user-data-stream.d.ts +0 -243
  142. package/assets/plugin/live/user-data-stream.js +0 -704
  143. package/assets/plugin/logger.d.ts +0 -2
  144. package/assets/plugin/logger.js +0 -2
  145. package/assets/plugin/mfe.d.ts +0 -21
  146. package/assets/plugin/mfe.js +0 -68
  147. package/assets/plugin/onboarding/mode-ladder.d.ts +0 -1
  148. package/assets/plugin/onboarding/mode-ladder.js +0 -3
  149. package/assets/plugin/onboarding/runtime.d.ts +0 -90
  150. package/assets/plugin/onboarding/runtime.js +0 -184
  151. package/assets/plugin/openclaw.plugin.json +0 -92
  152. package/assets/plugin/paper-adapter.d.ts +0 -24
  153. package/assets/plugin/paper-adapter.js +0 -91
  154. package/assets/plugin/persistence/state-manager.d.ts +0 -66
  155. package/assets/plugin/persistence/state-manager.js +0 -222
  156. package/assets/plugin/pinned-plan.d.ts +0 -9
  157. package/assets/plugin/pinned-plan.js +0 -23
  158. package/assets/plugin/portfolio/reentry-tracker.d.ts +0 -36
  159. package/assets/plugin/portfolio/reentry-tracker.js +0 -127
  160. package/assets/plugin/portfolio/wave9-admission.d.ts +0 -67
  161. package/assets/plugin/portfolio/wave9-admission.js +0 -262
  162. package/assets/plugin/portfolio/wave9-policy.d.ts +0 -36
  163. package/assets/plugin/portfolio/wave9-policy.js +0 -183
  164. package/assets/plugin/risk/pre-trade-check.d.ts +0 -38
  165. package/assets/plugin/risk/pre-trade-check.js +0 -345
  166. package/assets/plugin/risk/pre-trade-types.d.ts +0 -60
  167. package/assets/plugin/risk/pre-trade-types.js +0 -3
  168. package/assets/plugin/shadow/shadow-tracker.d.ts +0 -36
  169. package/assets/plugin/shadow/shadow-tracker.js +0 -151
  170. package/assets/plugin/shadow/types.d.ts +0 -42
  171. package/assets/plugin/shadow/types.js +0 -20
  172. package/assets/plugin/shared/indicators-extended.d.ts +0 -52
  173. package/assets/plugin/shared/indicators-extended.js +0 -291
  174. package/assets/plugin/shared/indicators.d.ts +0 -15
  175. package/assets/plugin/shared/indicators.js +0 -114
  176. package/assets/plugin/signals/conditions/registry.d.ts +0 -16
  177. package/assets/plugin/signals/conditions/registry.js +0 -1333
  178. package/assets/plugin/signals/conditions/types.d.ts +0 -1
  179. package/assets/plugin/signals/conditions/types.js +0 -4
  180. package/assets/plugin/signals/direction-rules.d.ts +0 -3
  181. package/assets/plugin/signals/direction-rules.js +0 -24
  182. package/assets/plugin/signals/entry-rules.d.ts +0 -6
  183. package/assets/plugin/signals/entry-rules.js +0 -33
  184. package/assets/plugin/signals/serialize-context.d.ts +0 -4
  185. package/assets/plugin/signals/serialize-context.js +0 -39
  186. package/assets/plugin/signals/stop-rules.d.ts +0 -3
  187. package/assets/plugin/signals/stop-rules.js +0 -48
  188. package/assets/plugin/signals/strategy-adapter.d.ts +0 -47
  189. package/assets/plugin/signals/strategy-adapter.js +0 -209
  190. package/assets/plugin/signals/types.d.ts +0 -1
  191. package/assets/plugin/signals/types.js +0 -8
  192. package/assets/plugin/simulator/exchange-simulator.d.ts +0 -105
  193. package/assets/plugin/simulator/exchange-simulator.js +0 -759
  194. package/assets/plugin/simulator/fill-engine.d.ts +0 -53
  195. package/assets/plugin/simulator/fill-engine.js +0 -280
  196. package/assets/plugin/simulator/paper-market-feed.d.ts +0 -26
  197. package/assets/plugin/simulator/paper-market-feed.js +0 -104
  198. package/assets/plugin/simulator/realistic-fills.d.ts +0 -59
  199. package/assets/plugin/simulator/realistic-fills.js +0 -175
  200. package/assets/plugin/simulator/types.d.ts +0 -228
  201. package/assets/plugin/simulator/types.js +0 -43
  202. package/assets/plugin/strategy/builtin-strategies.d.ts +0 -2
  203. package/assets/plugin/strategy/builtin-strategies.js +0 -113
  204. package/assets/plugin/strategy/condition-registry.d.ts +0 -3
  205. package/assets/plugin/strategy/condition-registry.js +0 -153
  206. package/assets/plugin/strategy/evaluator.d.ts +0 -70
  207. package/assets/plugin/strategy/evaluator.js +0 -98
  208. package/assets/plugin/tools/assessment-validation.d.ts +0 -141
  209. package/assets/plugin/tools/assessment-validation.js +0 -473
  210. package/assets/plugin/tools/attach-brackets.d.ts +0 -39
  211. package/assets/plugin/tools/attach-brackets.js +0 -564
  212. package/assets/plugin/tools/audit-bracket-protection.d.ts +0 -49
  213. package/assets/plugin/tools/audit-bracket-protection.js +0 -683
  214. package/assets/plugin/tools/bracket-control.d.ts +0 -12
  215. package/assets/plugin/tools/bracket-control.js +0 -35
  216. package/assets/plugin/tools/cancel-all-orders.d.ts +0 -9
  217. package/assets/plugin/tools/cancel-all-orders.js +0 -8
  218. package/assets/plugin/tools/cancel-order.d.ts +0 -14
  219. package/assets/plugin/tools/cancel-order.js +0 -60
  220. package/assets/plugin/tools/check-position-health.d.ts +0 -46
  221. package/assets/plugin/tools/check-position-health.js +0 -194
  222. package/assets/plugin/tools/clear-exchange-credentials.d.ts +0 -24
  223. package/assets/plugin/tools/clear-exchange-credentials.js +0 -70
  224. package/assets/plugin/tools/close-position.d.ts +0 -45
  225. package/assets/plugin/tools/close-position.js +0 -722
  226. package/assets/plugin/tools/create-order.d.ts +0 -82
  227. package/assets/plugin/tools/create-order.js +0 -1544
  228. package/assets/plugin/tools/exit-gate.d.ts +0 -58
  229. package/assets/plugin/tools/exit-gate.js +0 -162
  230. package/assets/plugin/tools/fetch-balance.d.ts +0 -5
  231. package/assets/plugin/tools/fetch-balance.js +0 -4
  232. package/assets/plugin/tools/fetch-ohlcv.d.ts +0 -11
  233. package/assets/plugin/tools/fetch-ohlcv.js +0 -8
  234. package/assets/plugin/tools/fetch-open-orders.d.ts +0 -7
  235. package/assets/plugin/tools/fetch-open-orders.js +0 -4
  236. package/assets/plugin/tools/fetch-positions.d.ts +0 -7
  237. package/assets/plugin/tools/fetch-positions.js +0 -4
  238. package/assets/plugin/tools/fetch-ticker.d.ts +0 -11
  239. package/assets/plugin/tools/fetch-ticker.js +0 -5
  240. package/assets/plugin/tools/get-agent-profile.d.ts +0 -4
  241. package/assets/plugin/tools/get-agent-profile.js +0 -6
  242. package/assets/plugin/tools/get-analytics.d.ts +0 -6
  243. package/assets/plugin/tools/get-analytics.js +0 -7
  244. package/assets/plugin/tools/get-backtest.d.ts +0 -12
  245. package/assets/plugin/tools/get-backtest.js +0 -91
  246. package/assets/plugin/tools/get-basis.d.ts +0 -7
  247. package/assets/plugin/tools/get-basis.js +0 -7
  248. package/assets/plugin/tools/get-bracket-config.d.ts +0 -11
  249. package/assets/plugin/tools/get-bracket-config.js +0 -24
  250. package/assets/plugin/tools/get-cascade-risk.d.ts +0 -7
  251. package/assets/plugin/tools/get-cascade-risk.js +0 -8
  252. package/assets/plugin/tools/get-crypto-metrics.d.ts +0 -18
  253. package/assets/plugin/tools/get-crypto-metrics.js +0 -62
  254. package/assets/plugin/tools/get-cvd.d.ts +0 -6
  255. package/assets/plugin/tools/get-cvd.js +0 -6
  256. package/assets/plugin/tools/get-divergences.d.ts +0 -6
  257. package/assets/plugin/tools/get-divergences.js +0 -6
  258. package/assets/plugin/tools/get-funding-context.d.ts +0 -6
  259. package/assets/plugin/tools/get-funding-context.js +0 -16
  260. package/assets/plugin/tools/get-liquidation-levels.d.ts +0 -7
  261. package/assets/plugin/tools/get-liquidation-levels.js +0 -7
  262. package/assets/plugin/tools/get-liquidation-pulse.d.ts +0 -9
  263. package/assets/plugin/tools/get-liquidation-pulse.js +0 -22
  264. package/assets/plugin/tools/get-market-breadth.d.ts +0 -6
  265. package/assets/plugin/tools/get-market-breadth.js +0 -8
  266. package/assets/plugin/tools/get-market-intel.d.ts +0 -19
  267. package/assets/plugin/tools/get-market-intel.js +0 -116
  268. package/assets/plugin/tools/get-market-structure.d.ts +0 -47
  269. package/assets/plugin/tools/get-market-structure.js +0 -198
  270. package/assets/plugin/tools/get-my-mined-patterns.d.ts +0 -20
  271. package/assets/plugin/tools/get-my-mined-patterns.js +0 -61
  272. package/assets/plugin/tools/get-my-proposed-learnings.d.ts +0 -20
  273. package/assets/plugin/tools/get-my-proposed-learnings.js +0 -55
  274. package/assets/plugin/tools/get-my-recent-reviews.d.ts +0 -22
  275. package/assets/plugin/tools/get-my-recent-reviews.js +0 -66
  276. package/assets/plugin/tools/get-orderbook.d.ts +0 -21
  277. package/assets/plugin/tools/get-orderbook.js +0 -32
  278. package/assets/plugin/tools/get-pattern-scan.d.ts +0 -7
  279. package/assets/plugin/tools/get-pattern-scan.js +0 -8
  280. package/assets/plugin/tools/get-regime.d.ts +0 -6
  281. package/assets/plugin/tools/get-regime.js +0 -7
  282. package/assets/plugin/tools/get-relevant-learnings.d.ts +0 -21
  283. package/assets/plugin/tools/get-relevant-learnings.js +0 -65
  284. package/assets/plugin/tools/get-resting-liquidity.d.ts +0 -6
  285. package/assets/plugin/tools/get-resting-liquidity.js +0 -11
  286. package/assets/plugin/tools/get-risk-scenario.d.ts +0 -29
  287. package/assets/plugin/tools/get-risk-scenario.js +0 -47
  288. package/assets/plugin/tools/get-risk-summary.d.ts +0 -51
  289. package/assets/plugin/tools/get-risk-summary.js +0 -118
  290. package/assets/plugin/tools/get-sentiment.d.ts +0 -4
  291. package/assets/plugin/tools/get-sentiment.js +0 -6
  292. package/assets/plugin/tools/get-session-review.d.ts +0 -7
  293. package/assets/plugin/tools/get-session-review.js +0 -8
  294. package/assets/plugin/tools/get-setup-detail.d.ts +0 -7
  295. package/assets/plugin/tools/get-setup-detail.js +0 -322
  296. package/assets/plugin/tools/get-signals.d.ts +0 -15
  297. package/assets/plugin/tools/get-signals.js +0 -54
  298. package/assets/plugin/tools/get-sizing.d.ts +0 -6
  299. package/assets/plugin/tools/get-sizing.js +0 -6
  300. package/assets/plugin/tools/get-trade-feedback.d.ts +0 -7
  301. package/assets/plugin/tools/get-trade-feedback.js +0 -8
  302. package/assets/plugin/tools/get-trade-flow.d.ts +0 -7
  303. package/assets/plugin/tools/get-trade-flow.js +0 -7
  304. package/assets/plugin/tools/get-volume-analysis.d.ts +0 -21
  305. package/assets/plugin/tools/get-volume-analysis.js +0 -74
  306. package/assets/plugin/tools/get-volume-profile.d.ts +0 -7
  307. package/assets/plugin/tools/get-volume-profile.js +0 -7
  308. package/assets/plugin/tools/get-wave9-status.d.ts +0 -127
  309. package/assets/plugin/tools/get-wave9-status.js +0 -796
  310. package/assets/plugin/tools/helpers.d.ts +0 -26
  311. package/assets/plugin/tools/helpers.js +0 -39
  312. package/assets/plugin/tools/intel-api.d.ts +0 -34
  313. package/assets/plugin/tools/intel-api.js +0 -119
  314. package/assets/plugin/tools/intel-cache.d.ts +0 -25
  315. package/assets/plugin/tools/intel-cache.js +0 -148
  316. package/assets/plugin/tools/list-strategies.d.ts +0 -17
  317. package/assets/plugin/tools/list-strategies.js +0 -23
  318. package/assets/plugin/tools/modify-stop.d.ts +0 -21
  319. package/assets/plugin/tools/modify-stop.js +0 -120
  320. package/assets/plugin/tools/modify-target.d.ts +0 -21
  321. package/assets/plugin/tools/modify-target.js +0 -110
  322. package/assets/plugin/tools/propose-learning.d.ts +0 -22
  323. package/assets/plugin/tools/propose-learning.js +0 -65
  324. package/assets/plugin/tools/query-review-outcomes.d.ts +0 -30
  325. package/assets/plugin/tools/query-review-outcomes.js +0 -64
  326. package/assets/plugin/tools/query-trades.d.ts +0 -21
  327. package/assets/plugin/tools/query-trades.js +0 -37
  328. package/assets/plugin/tools/record-position-reviews.d.ts +0 -38
  329. package/assets/plugin/tools/record-position-reviews.js +0 -147
  330. package/assets/plugin/tools/save-strategy.d.ts +0 -16
  331. package/assets/plugin/tools/save-strategy.js +0 -46
  332. package/assets/plugin/tools/scan-pairs.d.ts +0 -22
  333. package/assets/plugin/tools/scan-pairs.js +0 -234
  334. package/assets/plugin/tools/score-setup.d.ts +0 -31
  335. package/assets/plugin/tools/score-setup.js +0 -268
  336. package/assets/plugin/tools/set-bracket-requirement.d.ts +0 -18
  337. package/assets/plugin/tools/set-bracket-requirement.js +0 -81
  338. package/assets/plugin/tools/set-exchange-credentials.d.ts +0 -25
  339. package/assets/plugin/tools/set-exchange-credentials.js +0 -80
  340. package/assets/plugin/tools/set-trading-mode.d.ts +0 -26
  341. package/assets/plugin/tools/set-trading-mode.js +0 -135
  342. package/assets/plugin/tools/test-exchange-credentials.d.ts +0 -16
  343. package/assets/plugin/tools/test-exchange-credentials.js +0 -100
  344. package/assets/plugin/tools/toggle-strategy.d.ts +0 -8
  345. package/assets/plugin/tools/toggle-strategy.js +0 -15
  346. package/assets/plugin/trading-params-cache.d.ts +0 -26
  347. package/assets/plugin/trading-params-cache.js +0 -52
  348. package/assets/plugin/types.d.ts +0 -134
  349. package/assets/plugin/types.js +0 -7
  350. package/assets/plugin/util/plugin-paths.d.ts +0 -3
  351. package/assets/plugin/util/plugin-paths.js +0 -15
  352. package/assets/plugin/venues/hyperliquid/hl-balance.d.ts +0 -116
  353. package/assets/plugin/venues/hyperliquid/hl-balance.js +0 -145
  354. package/assets/plugin/venues/hyperliquid/hl-bracket-coordinator.d.ts +0 -123
  355. package/assets/plugin/venues/hyperliquid/hl-bracket-coordinator.js +0 -533
  356. package/assets/plugin/venues/hyperliquid/hl-brackets.d.ts +0 -102
  357. package/assets/plugin/venues/hyperliquid/hl-brackets.js +0 -172
  358. package/assets/plugin/venues/hyperliquid/hl-cloid.d.ts +0 -22
  359. package/assets/plugin/venues/hyperliquid/hl-cloid.js +0 -82
  360. package/assets/plugin/venues/hyperliquid/hl-info-cache.d.ts +0 -46
  361. package/assets/plugin/venues/hyperliquid/hl-info-cache.js +0 -125
  362. package/assets/plugin/venues/hyperliquid/hl-live-adapter.d.ts +0 -146
  363. package/assets/plugin/venues/hyperliquid/hl-live-adapter.js +0 -728
  364. package/assets/plugin/venues/hyperliquid/hl-precision.d.ts +0 -61
  365. package/assets/plugin/venues/hyperliquid/hl-precision.js +0 -176
  366. package/assets/plugin/venues/hyperliquid/hl-private.d.ts +0 -88
  367. package/assets/plugin/venues/hyperliquid/hl-private.js +0 -357
  368. package/assets/plugin/venues/hyperliquid/hl-public.d.ts +0 -79
  369. package/assets/plugin/venues/hyperliquid/hl-public.js +0 -436
  370. package/assets/plugin/venues/hyperliquid/hl-rate-gate.d.ts +0 -57
  371. package/assets/plugin/venues/hyperliquid/hl-rate-gate.js +0 -220
  372. package/assets/plugin/venues/hyperliquid/hl-user-stream.d.ts +0 -90
  373. package/assets/plugin/venues/hyperliquid/hl-user-stream.js +0 -220
  374. package/assets/plugin/venues/registry.d.ts +0 -38
  375. package/assets/plugin/venues/registry.js +0 -46
  376. package/assets/plugin/venues/symbols.d.ts +0 -43
  377. package/assets/plugin/venues/symbols.js +0 -107
  378. package/assets/plugin/wave9/live-account-capture.d.ts +0 -67
  379. package/assets/plugin/wave9/live-account-capture.js +0 -435
  380. package/assets/plugin/wave9/live-autonomous-protection.d.ts +0 -39
  381. package/assets/plugin/wave9/live-autonomous-protection.js +0 -112
  382. package/assets/plugin/wave9/live-durable-reconciliation-scheduler.d.ts +0 -33
  383. package/assets/plugin/wave9/live-durable-reconciliation-scheduler.js +0 -115
  384. package/assets/plugin/wave9/live-execution-ledger.d.ts +0 -107
  385. package/assets/plugin/wave9/live-execution-ledger.js +0 -498
  386. package/assets/plugin/wave9/live-position-confirmation.d.ts +0 -18
  387. package/assets/plugin/wave9/live-position-confirmation.js +0 -111
  388. package/assets/plugin/wave9/live-residual-protection.d.ts +0 -18
  389. package/assets/plugin/wave9/live-residual-protection.js +0 -250
  390. package/assets/plugin/wave9/live-startup-reconciliation.d.ts +0 -38
  391. package/assets/plugin/wave9/live-startup-reconciliation.js +0 -454
  392. package/assets/plugin/wave9/live-symbol-ownership.d.ts +0 -20
  393. package/assets/plugin/wave9/live-symbol-ownership.js +0 -132
  394. package/assets/plugin/wave9/paper-admission-guard.d.ts +0 -199
  395. package/assets/plugin/wave9/paper-admission-guard.js +0 -650
  396. package/assets/plugin/wave9/usdm-evidence-provider.d.ts +0 -42
  397. package/assets/plugin/wave9/usdm-evidence-provider.js +0 -133
@@ -1,322 +0,0 @@
1
- // Tool: get_setup_detail — detailed setup info for a specific symbol.
2
- // Fetches the symbol's fact, evaluates best-matching strategy,
3
- // computes entry/stop/targets, returns full detail (~500 tokens).
4
- //
5
- // 2026-05-15 hardening: this tool used to (a) silently zero entry/stop/target
6
- // when `currentPrice` or `atr14` were missing from the fact (the 1000PEPE
7
- // "zeroed levels" pattern, ~5 occurrences in one session) and (b) always
8
- // compute a LONG-style ladder regardless of the strategy's directionRule
9
- // (the AVAX/SUI/TIA "TREND_DOWN label + LONG geometry" pattern). Both surface
10
- // as the agent rejecting setups as "data integrity failure" or "directionally
11
- // inconsistent" and standing down. Now we (1) refuse-to-emit when key
12
- // indicators are missing, (2) resolve direction via the strategy's
13
- // directionRule + fact context, and (3) compute stop/target geometry from
14
- // that direction so long and short setups produce ladders that match.
15
- // Cache is shared with scan_pairs (intel-cache.ts) so drill-down sees the
16
- // same fact snapshot the scan ranked the symbol from.
17
- import { resolveIntelSymbol } from './intel-api.js';
18
- import { evaluateStrategy, } from '../strategy/evaluator.js';
19
- import { getFactBySymbolCached, getStrategyRowsCached } from './intel-cache.js';
20
- export async function getSetupDetailTool(args, deps) {
21
- // Venue-aware symbol resolution (plan §5.3). Binance keeps the historical
22
- // sanitizer byte-identically; the hyperliquid arm maps agent-facing forms
23
- // ('BTC/USDC', 'BTCUSDC') to the HL_ intel namespace and must NOT uppercase
24
- // or strip '_' — HL coins are case-sensitive ('kPEPE' is real, 'KPEPE' is
25
- // not) and the legacy sanitizer would mangle 'HL_BTC' into 'HLBTC'.
26
- const symbol = (deps.venue ?? 'binance') === 'hyperliquid'
27
- ? resolveIntelSymbol(deps, args.symbol)
28
- : args.symbol.toUpperCase().replace(/[^A-Z0-9]/g, '');
29
- // 1. Fetch fact for this symbol — shared cache with scan_pairs, so a
30
- // drill-down after a heartbeat scan hits the same snapshot the scan
31
- // ranked the symbol from.
32
- const factRes = await getFactBySymbolCached(symbol, deps);
33
- if ('error' in factRes)
34
- return factRes;
35
- const fact = factRes;
36
- if (!fact.symbol) {
37
- return { error: `No facts available for ${symbol}` };
38
- }
39
- // 2. Fetch user's active strategy rows (cached, shared with scan_pairs).
40
- const rowsRes = await getStrategyRowsCached(deps);
41
- if ('error' in rowsRes)
42
- return rowsRes;
43
- const strategyRows = rowsRes;
44
- // 3. Evaluate all strategies, pick best match
45
- let bestResult = null;
46
- let bestScore = -1;
47
- for (const row of strategyRows) {
48
- const result = evaluateStrategy(row.config, fact);
49
- if (result && result.score > bestScore) {
50
- bestScore = result.score;
51
- bestResult = result;
52
- }
53
- }
54
- // Validate indicators BEFORE branching on bestResult — even the "no setup"
55
- // path returns price, and a zero/missing price is misleading.
56
- const price = readNumericIndicator(fact, 'currentPrice');
57
- if (price === null) {
58
- return {
59
- error: `Fact for ${symbol} is missing currentPrice — intelligence fact-computer ` +
60
- `may still be warming up, or this symbol has no recent klines. Retry on ` +
61
- `next heartbeat; do not size a trade off this payload.`,
62
- };
63
- }
64
- if (!bestResult) {
65
- return {
66
- symbol,
67
- price,
68
- regime: fact.regime,
69
- regime_confidence: fact.regime_confidence,
70
- setup: 'none',
71
- note: 'No active strategy matches this symbol\'s current conditions.',
72
- indicators: buildIndicatorSummary(fact),
73
- };
74
- }
75
- // 4. Validate that the inputs needed for stop/target geometry are present.
76
- const atr = readNumericIndicator(fact, 'atr14');
77
- if (atr === null || atr <= 0) {
78
- return {
79
- error: `Fact for ${symbol} is missing atr14 (got ${atr ?? 'undefined'}) — cannot ` +
80
- `compute stop/target geometry without ATR. Retry on next heartbeat.`,
81
- };
82
- }
83
- // 5. Resolve direction from the strategy's directionRule. Refuse to emit a
84
- // setup when direction is ambiguous — better to return no setup than to
85
- // fabricate a long ladder for what might be a short trade.
86
- const strategyConfig = strategyRows.find(r => r.config.name === bestResult.strategy)?.config;
87
- if (!strategyConfig) {
88
- return {
89
- error: `Internal: strategy ${bestResult.strategy} matched but its config ` +
90
- `disappeared between scan and drill-down. Retry on next heartbeat.`,
91
- };
92
- }
93
- const direction = resolveDirection(strategyConfig, fact);
94
- if (direction === null) {
95
- return {
96
- symbol: fact.symbol,
97
- price,
98
- regime: fact.regime,
99
- regime_confidence: fact.regime_confidence,
100
- strategy: bestResult.strategy,
101
- score: bestResult.score,
102
- setup: 'ambiguous_direction',
103
- note: `Strategy ${bestResult.strategy} matched but its directionRule ` +
104
- `(${strategyConfig.directionRule}) could not resolve a clean long/short ` +
105
- `from the current fact (regime=${fact.regime}). Skip — wait for cleaner ` +
106
- `context or run score_setup with an explicit direction if you want to force the trade.`,
107
- indicators: buildIndicatorSummary(fact),
108
- };
109
- }
110
- // 6. Compute entry/stop/targets from the matching strategy + direction.
111
- const entry = computeEntry(strategyConfig, fact, atr, price);
112
- const stop = computeStop(strategyConfig, atr, entry.price, direction);
113
- const risk = Math.abs(entry.price - stop.price);
114
- // Sanity check: if risk collapsed to zero (rounding pathology, weird ATR),
115
- // refuse rather than emit zeroed targets that look executable.
116
- if (!Number.isFinite(risk) || risk <= 0) {
117
- return {
118
- error: `Computed risk for ${symbol} is ${risk} — entry=${entry.price} stop=${stop.price} ` +
119
- `collapsed to a zero-risk ladder. Likely cause: ATR=${atr} too small relative to ` +
120
- `rounding precision. Skip this symbol.`,
121
- };
122
- }
123
- const sign = direction === 'long' ? 1 : -1;
124
- const targets = (strategyConfig.targetRMultiples ?? [1.5, 2.5]).map(r => ({
125
- price: roundPrice(entry.price + risk * r * sign),
126
- r_multiple: r,
127
- }));
128
- // 7. Build risks list
129
- const risks = [];
130
- const ind = fact.indicators;
131
- if (readNumericIndicator(fact, 'obImbalance') === 0.5) {
132
- risks.push('Orderbook neutral - no clear bid/ask dominance');
133
- }
134
- const bb = ind.bb;
135
- if (bb && bb.bandwidth && bb.bandwidth > 6) {
136
- risks.push(`High volatility - BB bandwidth ${bb.bandwidth.toFixed(1)}%`);
137
- }
138
- const fundingZ = readNumericIndicator(fact, 'fundingZScore');
139
- if (fundingZ !== null && Math.abs(fundingZ) > 2) {
140
- risks.push(`Elevated funding z-score: ${fundingZ.toFixed(1)}σ`);
141
- }
142
- return {
143
- symbol: fact.symbol,
144
- price,
145
- regime: fact.regime,
146
- regime_confidence: fact.regime_confidence,
147
- strategy: bestResult.strategy,
148
- direction,
149
- score: bestResult.score,
150
- entry: { price: entry.price, type: entry.type, rationale: entry.rationale },
151
- stop: { price: stop.price, type: stop.type, rationale: stop.rationale },
152
- targets,
153
- indicators: buildIndicatorSummary(fact),
154
- conditions: `${bestResult.conditionsMet}/${bestResult.conditionsTotal} met`,
155
- risks: risks.length > 0 ? risks : ['No significant risks identified'],
156
- };
157
- }
158
- // ─── Helpers ────────────────────────────────────────────────────────────
159
- /** Read an indicator as a finite number. Returns null when the value is
160
- * missing, NaN, or non-finite — callers MUST handle null explicitly rather
161
- * than treating it as zero (the pre-fix `?? 0` behaviour was the root cause
162
- * of the 1000PEPE zeroed-levels bug). */
163
- function readNumericIndicator(fact, key) {
164
- const raw = fact.indicators[key];
165
- if (typeof raw === 'number' && Number.isFinite(raw))
166
- return raw;
167
- if (typeof raw === 'string') {
168
- const n = Number(raw);
169
- if (Number.isFinite(n))
170
- return n;
171
- }
172
- return null;
173
- }
174
- /** Resolve a clean long/short for a strategy given the current fact. Returns
175
- * null when the directionRule cannot be unambiguously satisfied — the caller
176
- * must refuse to emit a setup in that case rather than guess. */
177
- function resolveDirection(strategy, fact) {
178
- switch (strategy.directionRule) {
179
- case 'fixed_long':
180
- return 'long';
181
- case 'fixed_short':
182
- return 'short';
183
- case 'from_regime': {
184
- const r = (fact.regime || '').toUpperCase();
185
- if (r === 'TREND_UP')
186
- return 'long';
187
- if (r === 'TREND_DOWN')
188
- return 'short';
189
- // RANGE_TIGHT / RANGE_WIDE / VOLATILITY_EXPANSION / UNKNOWN: ambiguous.
190
- return null;
191
- }
192
- case 'from_funding': {
193
- const z = readNumericIndicator(fact, 'fundingZScore');
194
- if (z === null)
195
- return null;
196
- // Crowded longs (positive z) → contrarian short; crowded shorts → long.
197
- if (z >= 1)
198
- return 'short';
199
- if (z <= -1)
200
- return 'long';
201
- return null; // Z between -1 and 1: no edge.
202
- }
203
- case 'from_sweep': {
204
- // The sweep direction lives inside the price_sweep condition's metadata,
205
- // which evaluateStrategy doesn't surface to us as a single field. Without
206
- // that signal we'd be guessing; refuse to emit and let the agent run
207
- // score_setup with an explicit direction.
208
- return null;
209
- }
210
- default:
211
- return null;
212
- }
213
- }
214
- function buildIndicatorSummary(fact) {
215
- const ind = fact.indicators;
216
- const macd = ind.macd;
217
- const stochRsi = ind.stochRsi;
218
- const supertrend = ind.supertrend;
219
- const price = readNumericIndicator(fact, 'currentPrice');
220
- const vwap = readNumericIndicator(fact, 'vwap');
221
- const fundingZ = readNumericIndicator(fact, 'fundingZScore');
222
- const oi = readNumericIndicator(fact, 'oiRatio');
223
- return {
224
- rsi: ind.rsi14,
225
- adx: ind.adx,
226
- macd: macd?.crossover && macd.crossover !== 'none'
227
- ? `${macd.crossover} cross`
228
- : `histogram ${macd?.histogram ?? 0}`,
229
- vwap: price !== null && vwap !== null && vwap !== 0
230
- ? `price ${price > vwap ? 'above' : 'below'} (${((price - vwap) / vwap * 100).toFixed(2)}%)`
231
- : 'vwap unavailable',
232
- supertrend: supertrend?.direction,
233
- stochRsi: stochRsi?.k,
234
- funding: fundingZ !== null
235
- ? `${fundingZ > 0 ? '+' : ''}${fundingZ.toFixed(1)}σ`
236
- : 'unavailable',
237
- oi: oi !== null ? `${oi.toFixed(2)}x avg` : 'unavailable',
238
- };
239
- }
240
- function computeEntry(strategy, fact, atr, currentPrice) {
241
- const ind = fact.indicators;
242
- const { type, params } = strategy.entryRule;
243
- switch (type) {
244
- case 'ema_offset': {
245
- const emaKey = `ema${params.period ?? 20}`;
246
- const emaRaw = ind[emaKey];
247
- const ema = typeof emaRaw === 'number' && Number.isFinite(emaRaw) ? emaRaw : currentPrice;
248
- const offset = atr * (params.atrFraction ?? 0.3);
249
- return {
250
- price: roundPrice(ema),
251
- type: 'ema_offset',
252
- rationale: `EMA${params.period ?? 20} pullback (±${offset.toFixed(0)} ATR offset)`,
253
- };
254
- }
255
- case 'atr_offset': {
256
- const fraction = params.atrFraction ?? 0.2;
257
- return {
258
- price: roundPrice(currentPrice),
259
- type: 'atr_offset',
260
- rationale: `Current price ±${(fraction * atr).toFixed(0)} ATR offset`,
261
- };
262
- }
263
- case 'sweep_range':
264
- default:
265
- return {
266
- price: roundPrice(currentPrice),
267
- type: type || 'market',
268
- rationale: 'At current price',
269
- };
270
- }
271
- }
272
- function computeStop(strategy, atr, entryPrice, direction) {
273
- const { type, params } = strategy.stopRule;
274
- // Direction sign: long → stop below entry (entry - ATR*mult), short → above.
275
- const sign = direction === 'long' ? -1 : 1;
276
- switch (type) {
277
- case 'swing_atr': {
278
- const mult = params.atrFraction ?? 0.5;
279
- return {
280
- price: roundPrice(entryPrice + sign * atr * (1 + mult)),
281
- type: 'swing_atr',
282
- rationale: `${direction === 'long' ? 'Below' : 'Above'} swing - ${mult} ATR buffer`,
283
- };
284
- }
285
- case 'fixed_atr': {
286
- const mult = params.atrMultiple ?? 1.5;
287
- return {
288
- price: roundPrice(entryPrice + sign * atr * mult),
289
- type: 'fixed_atr',
290
- rationale: `${mult}x ATR ${direction === 'long' ? 'below' : 'above'} entry`,
291
- };
292
- }
293
- case 'recent_extreme_atr': {
294
- const mult = params.atrFraction ?? 0.3;
295
- return {
296
- price: roundPrice(entryPrice + sign * atr * (1 + mult)),
297
- type: 'recent_extreme_atr',
298
- rationale: `Recent extreme - ${mult} ATR`,
299
- };
300
- }
301
- default:
302
- return {
303
- price: roundPrice(entryPrice + sign * atr * 1.5),
304
- type: type || 'default',
305
- rationale: `1.5x ATR default stop (${direction === 'long' ? 'below' : 'above'} entry)`,
306
- };
307
- }
308
- }
309
- function roundPrice(p) {
310
- // 2 decimals for $1+ prices; below that, 6 significant digits — a flat
311
- // 2-decimal round collapses entry/stop/targets onto the same value for the
312
- // sub-cent class (1000PEPE/1000SHIB/…, ATR below the $0.01 granularity),
313
- // tripping the zero-risk guard and refusing every setup on those symbols.
314
- if (!Number.isFinite(p) || p === 0)
315
- return p;
316
- const abs = Math.abs(p);
317
- if (abs >= 1)
318
- return Math.round(p * 100) / 100;
319
- const decimals = 5 - Math.floor(Math.log10(abs));
320
- const f = Math.pow(10, decimals);
321
- return Math.round(p * f) / f;
322
- }
@@ -1,15 +0,0 @@
1
- import type { IntelApiDeps } from './intel-api.js';
2
- import type { LocalSignalService } from '../live/local-signal-service.js';
3
- export interface GetSignalsDeps extends IntelApiDeps {
4
- evaluatorMode?: 'central' | 'shadow' | 'enforce';
5
- localSignalService?: LocalSignalService | null;
6
- logger?: {
7
- info: (tag: string, msg: string) => void;
8
- };
9
- }
10
- export declare function getSignalsTool(args: {
11
- symbol: string;
12
- hours?: number;
13
- }, deps: GetSignalsDeps): Promise<Record<string, unknown> | {
14
- error: string;
15
- }>;
@@ -1,54 +0,0 @@
1
- // Tool: get_signals — active trading signals for a symbol.
2
- //
3
- // Default (`central`): fetches the snapshot + recent history from the intel
4
- // engine, exactly as before. With facts-out (docs/FACTS_OUT_ARCHITECTURE.md
5
- // step 5) the operator can flip `signals.evaluator`:
6
- // shadow — return central, but ALSO log the locally-evaluated snapshot for
7
- // comparison (zero behaviour change).
8
- // enforce — return the locally-evaluated snapshot, falling back to central
9
- // when the local service has no fact for the symbol yet.
10
- import { fetchIntelApi, enc, resolveIntelSymbol } from './intel-api.js';
11
- async function central(args, deps) {
12
- const s = enc(resolveIntelSymbol(deps, args.symbol));
13
- const [snapshot, history] = await Promise.all([
14
- fetchIntelApi(`/api/signals/${s}`, deps),
15
- fetchIntelApi(`/api/signals/${s}/history?hours=${args.hours ?? 24}`, deps),
16
- ]);
17
- if ('error' in snapshot)
18
- return snapshot;
19
- if ('error' in history)
20
- return { ...snapshot, history: [] };
21
- return { ...snapshot, history };
22
- }
23
- export async function getSignalsTool(args, deps) {
24
- const mode = deps.evaluatorMode ?? 'central';
25
- const svc = deps.localSignalService ?? null;
26
- // ENFORCE — serve the local snapshot; fall back to central if no fact yet
27
- // (or the streamed fact has gone stale — getSnapshot refuses those).
28
- if (mode === 'enforce' && svc) {
29
- const local = svc.getSnapshot(args.symbol);
30
- if (local) {
31
- return { ...local, history: local.recentSignals, source: 'local' };
32
- }
33
- // Fail open to central, but LOUDLY and tagged: during rollout the
34
- // operator needs to see how often enforce actually serves local vs
35
- // silently falling back (otherwise the capture rate is unmeasurable).
36
- deps.logger?.info('signal-enforce-fallback', `${args.symbol} no fresh local fact — serving central`);
37
- const fallback = await central(args, deps);
38
- if (!('error' in fallback))
39
- return { ...fallback, source: 'central_fallback' };
40
- return fallback;
41
- }
42
- const result = await central(args, deps);
43
- // SHADOW — central authoritative; log the local snapshot alongside for compare.
44
- if (mode === 'shadow' && svc && !('error' in result)) {
45
- const local = svc.getSnapshot(args.symbol);
46
- const centralStrats = Array.isArray(result.activeStrategies)
47
- ? result.activeStrategies.length
48
- : 0;
49
- deps.logger?.info('signal-shadow', `${args.symbol} central_strategies=${centralStrats} ` +
50
- `local_strategies=${local ? local.activeStrategies.length : 'no-fact'} ` +
51
- `local_signals=${local ? local.recentSignals.length : 'n/a'}`);
52
- }
53
- return result;
54
- }
@@ -1,6 +0,0 @@
1
- import type { IntelApiDeps } from './intel-api.js';
2
- export declare function getSizingTool(args: {
3
- symbol: string;
4
- }, deps: IntelApiDeps): Promise<Record<string, unknown> | {
5
- error: string;
6
- }>;
@@ -1,6 +0,0 @@
1
- // Tool: get_sizing — fetches Half-Kelly position sizing recommendation from Intelligence API.
2
- // Returns recommended size as % of account, Kelly fraction, win rate, avg W/L ratio, vol adjustment.
3
- import { fetchIntelApi, enc, resolveIntelSymbol } from './intel-api.js';
4
- export async function getSizingTool(args, deps) {
5
- return fetchIntelApi(`/api/sizing/${enc(resolveIntelSymbol(deps, args.symbol))}`, deps);
6
- }
@@ -1,7 +0,0 @@
1
- import type { IntelApiDeps } from './intel-api.js';
2
- export declare function getTradeFeedbackTool(args: {
3
- symbol: string;
4
- hours?: number;
5
- }, deps: IntelApiDeps): Promise<Record<string, unknown> | {
6
- error: string;
7
- }>;
@@ -1,8 +0,0 @@
1
- // Tool: get_trade_feedback — fetches structured performance feedback from Intelligence API.
2
- // Returns per-setup-type win rates, regime breakdown, recent outcomes, and current streak.
3
- // Designed for the agent to review before entering trades.
4
- import { fetchIntelApi, enc, resolveIntelSymbol } from './intel-api.js';
5
- export async function getTradeFeedbackTool(args, deps) {
6
- const hours = args.hours ?? 168;
7
- return fetchIntelApi(`/api/analytics/${enc(resolveIntelSymbol(deps, args.symbol))}/feedback?hours=${hours}`, deps);
8
- }
@@ -1,7 +0,0 @@
1
- import type { IntelApiDeps } from './intel-api.js';
2
- export declare function getTradeFlowTool(args: {
3
- symbol: string;
4
- minutes?: number;
5
- }, deps: IntelApiDeps): Promise<Record<string, unknown> | {
6
- error: string;
7
- }>;
@@ -1,7 +0,0 @@
1
- // Tool: get_trade_flow — fetches aggregated trade flow / institutional flow data.
2
- // Returns buy/sell volume, large trade (whale) activity, net delta, and whale pressure verdict.
3
- import { fetchIntelApi, enc, resolveIntelSymbol } from './intel-api.js';
4
- export async function getTradeFlowTool(args, deps) {
5
- const minutes = args.minutes ?? 5;
6
- return fetchIntelApi(`/api/trade-flow/${enc(resolveIntelSymbol(deps, args.symbol))}?minutes=${minutes}`, deps);
7
- }
@@ -1,21 +0,0 @@
1
- import type { PublicMarketDataApi } from '../ccxt/public-market-data-api.js';
2
- export interface VolumeAnalysisResult {
3
- symbol: string;
4
- timeframe: string;
5
- volumeExpansion: number;
6
- closePosition: number;
7
- directionalThrust: number;
8
- buyVolEstimate: number;
9
- latestVolume: number;
10
- avgVolume: number;
11
- interpretation: string;
12
- timestamp: string;
13
- }
14
- export declare function getVolumeAnalysisTool(args: {
15
- symbol: string;
16
- timeframe?: string;
17
- }, deps: {
18
- binanceApi: PublicMarketDataApi;
19
- }): Promise<VolumeAnalysisResult | {
20
- error: string;
21
- }>;
@@ -1,74 +0,0 @@
1
- // Tool: get_volume_analysis — volume expansion, directional thrust, close position
2
- // Fetches 25 bars of 5m OHLCV and computes volume metrics for the latest bar.
3
- export async function getVolumeAnalysisTool(args, deps) {
4
- const timeframe = args.timeframe ?? '5m';
5
- try {
6
- const candles = await deps.binanceApi.fetchOHLCV(args.symbol, timeframe, 25);
7
- if (!candles || candles.length < 3) {
8
- return { error: `Insufficient OHLCV data for ${args.symbol} ${timeframe}` };
9
- }
10
- // Filter valid bars (volume > 0)
11
- const valid = candles.filter((c) => c[5] > 0);
12
- if (valid.length < 3) {
13
- return { error: `Insufficient valid bars for ${args.symbol} ${timeframe}` };
14
- }
15
- // Latest bar
16
- const latest = valid[valid.length - 1];
17
- const [, , latestHigh, latestLow, latestClose, latestVolume] = latest;
18
- // 20-bar average volume (excluding latest bar)
19
- const lookback = valid.slice(Math.max(0, valid.length - 21), valid.length - 1);
20
- const avgVolume = lookback.length > 0
21
- ? lookback.reduce((sum, r) => sum + r[5], 0) / lookback.length
22
- : latestVolume;
23
- // Volume expansion ratio
24
- const volumeExpansion = avgVolume > 0 ? latestVolume / avgVolume : 1;
25
- // Close position: where close sits in the bar's range (0 = low, 1 = high)
26
- const range = latestHigh - latestLow;
27
- const closePosition = range > 0 ? (latestClose - latestLow) / range : 0.5;
28
- // Directional thrust: combines volume expansion with close position
29
- // -1 = high volume bearish (close at low), +1 = high volume bullish (close at high)
30
- const dirMultiplier = (closePosition - 0.5) * 2;
31
- const cappedExpansion = Math.min(volumeExpansion, 5);
32
- const directionalThrust = dirMultiplier * Math.min(1, cappedExpansion / 2);
33
- // Buy volume estimate (proxy)
34
- const buyVolEstimate = closePosition;
35
- // Human-readable interpretation
36
- let interpretation;
37
- if (volumeExpansion > 2 && directionalThrust > 0.3) {
38
- interpretation = 'Strong bullish volume surge — buyers aggressive';
39
- }
40
- else if (volumeExpansion > 2 && directionalThrust < -0.3) {
41
- interpretation = 'Strong bearish volume surge — sellers aggressive';
42
- }
43
- else if (volumeExpansion > 1.5 && Math.abs(directionalThrust) < 0.15) {
44
- interpretation = 'High volume indecision — battle between buyers and sellers';
45
- }
46
- else if (volumeExpansion < 0.5) {
47
- interpretation = 'Low volume — lack of participation, potential breakout setup';
48
- }
49
- else if (directionalThrust > 0.2) {
50
- interpretation = 'Moderate bullish bias — close near highs';
51
- }
52
- else if (directionalThrust < -0.2) {
53
- interpretation = 'Moderate bearish bias — close near lows';
54
- }
55
- else {
56
- interpretation = 'Normal volume, neutral positioning';
57
- }
58
- return {
59
- symbol: args.symbol,
60
- timeframe,
61
- volumeExpansion: +volumeExpansion.toFixed(2),
62
- closePosition: +closePosition.toFixed(3),
63
- directionalThrust: +directionalThrust.toFixed(3),
64
- buyVolEstimate: +buyVolEstimate.toFixed(3),
65
- latestVolume: Math.round(latestVolume),
66
- avgVolume: Math.round(avgVolume),
67
- interpretation,
68
- timestamp: new Date().toISOString(),
69
- };
70
- }
71
- catch (err) {
72
- return { error: `get_volume_analysis failed: ${err instanceof Error ? err.message : String(err)}` };
73
- }
74
- }
@@ -1,7 +0,0 @@
1
- import type { IntelApiDeps } from './intel-api.js';
2
- export declare function getVolumeProfileTool(args: {
3
- symbol: string;
4
- period?: number;
5
- }, deps: IntelApiDeps): Promise<Record<string, unknown> | {
6
- error: string;
7
- }>;
@@ -1,7 +0,0 @@
1
- // Tool: get_volume_profile — fetches volume profile from the Intelligence API.
2
- // Returns price buckets with buy/sell volume, POC, value area, and current price.
3
- import { fetchIntelApi, enc, resolveIntelSymbol } from './intel-api.js';
4
- export async function getVolumeProfileTool(args, deps) {
5
- const period = args.period ?? 24;
6
- return fetchIntelApi(`/api/volume-profile/${enc(resolveIntelSymbol(deps, args.symbol))}?period=${period}`, deps);
7
- }