@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,52 +0,0 @@
1
- export interface OhlcvInput {
2
- open: number;
3
- high: number;
4
- low: number;
5
- close: number;
6
- volume: number;
7
- }
8
- export interface MACDResult {
9
- line: number;
10
- signal: number;
11
- histogram: number;
12
- crossover: 'bullish' | 'bearish' | 'none';
13
- }
14
- export interface BollingerResult {
15
- upper: number;
16
- middle: number;
17
- lower: number;
18
- bandwidth: number;
19
- percentB: number;
20
- }
21
- export interface StochRSIResult {
22
- k: number;
23
- d: number;
24
- }
25
- export interface IchimokuResult {
26
- tenkan: number;
27
- kijun: number;
28
- senkouA: number;
29
- senkouB: number;
30
- chikou: number;
31
- cloudPosition: 'above' | 'below' | 'inside';
32
- }
33
- export interface SupertrendResult {
34
- value: number;
35
- direction: 'bullish' | 'bearish';
36
- }
37
- export declare function computeMACD(closes: number[], fast?: number, slow?: number, signal?: number): MACDResult;
38
- export declare function computeBollingerBands(closes: number[], period?: number, stdDev?: number): BollingerResult;
39
- export declare function computeVWAP(bars: OhlcvInput[]): number;
40
- export declare function computeStochRSI(closes: number[], rsiPeriod?: number, stochPeriod?: number, kSmooth?: number, dSmooth?: number): StochRSIResult;
41
- export declare function computeADX(highs: number[], lows: number[], closes: number[], period?: number): {
42
- adx: number;
43
- plusDI: number;
44
- minusDI: number;
45
- };
46
- export declare function computeIchimoku(highs: number[], lows: number[], closes: number[], tenkanPeriod?: number, kijunPeriod?: number, senkouBPeriod?: number): IchimokuResult;
47
- export declare function computeOBV(closes: number[], volumes: number[]): {
48
- obv: number;
49
- slope: 'rising' | 'falling' | 'flat';
50
- };
51
- export declare function computeSupertrend(highs: number[], lows: number[], closes: number[], period?: number, multiplier?: number): SupertrendResult;
52
- export declare function computeWilliamsR(highs: number[], lows: number[], closes: number[], period?: number): number;
@@ -1,291 +0,0 @@
1
- // ⚠️ GENERATED FILE — DO NOT EDIT.
2
- // Canonical source of truth: shared/src/shared/indicators-extended.ts
3
- // Regenerate: node scripts/sync-shared-code.mjs (enforced by shared-code-sync.test.ts)
4
- //
5
- // This copy exists because this package builds with tsc and deploys as a
6
- // self-contained tree that strips workspace deps, so it cannot import
7
- // @reefclaw/shared runtime code across the deploy boundary.
8
- // Extended indicator computations for Phase 13 — Expanded Indicators.
9
- // Wraps technicalindicators library + custom implementations.
10
- // All functions take OHLCV arrays (oldest first) and return latest values.
11
- import { computeATRSeries, computeRSI, mean, computeStd } from './indicators.js';
12
- // ─── MACD (12, 26, 9) ──────────────────────────────────────────────────
13
- export function computeMACD(closes, fast = 12, slow = 26, signal = 9) {
14
- if (closes.length < slow + signal) {
15
- return { line: 0, signal: 0, histogram: 0, crossover: 'none' };
16
- }
17
- // Compute full EMA series (both aligned to start at index `slow - 1`)
18
- const emaFastSeries = emaSeries(closes, fast);
19
- const emaSlowSeries = emaSeries(closes, slow);
20
- // Align: fast series starts earlier, so take the tail matching slow series length
21
- const offset = emaFastSeries.length - emaSlowSeries.length;
22
- const macdLine = [];
23
- for (let i = 0; i < emaSlowSeries.length; i++) {
24
- macdLine.push(emaFastSeries[i + offset] - emaSlowSeries[i]);
25
- }
26
- // Signal line = EMA of MACD line
27
- const signalSeries = emaSeries(macdLine, signal);
28
- const sigOffset = macdLine.length - signalSeries.length;
29
- const currentLine = macdLine[macdLine.length - 1];
30
- const currentSignal = signalSeries[signalSeries.length - 1];
31
- const prevLine = macdLine.length >= 2 ? macdLine[macdLine.length - 2] : currentLine;
32
- const prevSignalIdx = signalSeries.length >= 2 ? signalSeries.length - 2 : signalSeries.length - 1;
33
- const prevSignal = signalSeries[prevSignalIdx];
34
- let crossover = 'none';
35
- if (prevLine <= prevSignal && currentLine > currentSignal)
36
- crossover = 'bullish';
37
- else if (prevLine >= prevSignal && currentLine < currentSignal)
38
- crossover = 'bearish';
39
- return {
40
- line: currentLine,
41
- signal: currentSignal,
42
- histogram: currentLine - currentSignal,
43
- crossover,
44
- };
45
- }
46
- // ─── Bollinger Bands (20, 2σ) ───────────────────────────────────────────
47
- export function computeBollingerBands(closes, period = 20, stdDev = 2) {
48
- if (closes.length < period) {
49
- const p = closes[closes.length - 1] ?? 0;
50
- return { upper: p, middle: p, lower: p, bandwidth: 0, percentB: 0.5 };
51
- }
52
- const slice = closes.slice(-period);
53
- const middle = mean(slice);
54
- const std = computeStd(slice);
55
- const upper = middle + stdDev * std;
56
- const lower = middle - stdDev * std;
57
- const bandwidth = middle > 0 ? ((upper - lower) / middle) * 100 : 0;
58
- const price = closes[closes.length - 1];
59
- const percentB = upper !== lower ? (price - lower) / (upper - lower) : 0.5;
60
- return { upper, middle, lower, bandwidth, percentB };
61
- }
62
- // ─── VWAP ───────────────────────────────────────────────────────────────
63
- export function computeVWAP(bars) {
64
- if (bars.length === 0)
65
- return 0;
66
- let cumVolume = 0;
67
- let cumTPxVol = 0;
68
- for (const bar of bars) {
69
- const tp = (bar.high + bar.low + bar.close) / 3;
70
- cumVolume += bar.volume;
71
- cumTPxVol += tp * bar.volume;
72
- }
73
- return cumVolume > 0 ? cumTPxVol / cumVolume : bars[bars.length - 1].close;
74
- }
75
- // ─── Stochastic RSI (14, 14, 3, 3) ─────────────────────────────────────
76
- export function computeStochRSI(closes, rsiPeriod = 14, stochPeriod = 14, kSmooth = 3, dSmooth = 3) {
77
- if (closes.length < rsiPeriod + stochPeriod + dSmooth) {
78
- return { k: 50, d: 50 };
79
- }
80
- // Compute RSI series
81
- const rsiValues = [];
82
- for (let i = rsiPeriod + 1; i <= closes.length; i++) {
83
- rsiValues.push(computeRSI(closes.slice(0, i), rsiPeriod));
84
- }
85
- if (rsiValues.length < stochPeriod)
86
- return { k: 50, d: 50 };
87
- // Stochastic of RSI
88
- const rawK = [];
89
- for (let i = stochPeriod - 1; i < rsiValues.length; i++) {
90
- const window = rsiValues.slice(i - stochPeriod + 1, i + 1);
91
- const min = Math.min(...window);
92
- const max = Math.max(...window);
93
- rawK.push(max !== min ? ((rsiValues[i] - min) / (max - min)) * 100 : 50);
94
- }
95
- // %K = SMA of raw stochastic
96
- const kValues = sma(rawK, kSmooth);
97
- // %D = SMA of %K
98
- const dValues = sma(kValues, dSmooth);
99
- return {
100
- k: Math.round(kValues[kValues.length - 1] ?? 50),
101
- d: Math.round(dValues[dValues.length - 1] ?? 50),
102
- };
103
- }
104
- // ─── ADX (14) ───────────────────────────────────────────────────────────
105
- export function computeADX(highs, lows, closes, period = 14) {
106
- if (highs.length < period * 2 + 1) {
107
- return { adx: 0, plusDI: 0, minusDI: 0 };
108
- }
109
- const plusDM = [];
110
- const minusDM = [];
111
- const tr = [];
112
- for (let i = 1; i < highs.length; i++) {
113
- const upMove = highs[i] - highs[i - 1];
114
- const downMove = lows[i - 1] - lows[i];
115
- plusDM.push(upMove > downMove && upMove > 0 ? upMove : 0);
116
- minusDM.push(downMove > upMove && downMove > 0 ? downMove : 0);
117
- tr.push(Math.max(highs[i] - lows[i], Math.abs(highs[i] - closes[i - 1]), Math.abs(lows[i] - closes[i - 1])));
118
- }
119
- // Smooth with Wilder's smoothing (equivalent to EMA with alpha=1/period)
120
- const smoothPlusDM = wilderSmooth(plusDM, period);
121
- const smoothMinusDM = wilderSmooth(minusDM, period);
122
- const smoothTR = wilderSmooth(tr, period);
123
- // +DI and -DI series
124
- const plusDISeries = [];
125
- const minusDISeries = [];
126
- for (let i = 0; i < smoothTR.length; i++) {
127
- plusDISeries.push(smoothTR[i] > 0 ? (smoothPlusDM[i] / smoothTR[i]) * 100 : 0);
128
- minusDISeries.push(smoothTR[i] > 0 ? (smoothMinusDM[i] / smoothTR[i]) * 100 : 0);
129
- }
130
- // DX series
131
- const dxSeries = [];
132
- for (let i = 0; i < plusDISeries.length; i++) {
133
- const sum = plusDISeries[i] + minusDISeries[i];
134
- dxSeries.push(sum > 0 ? (Math.abs(plusDISeries[i] - minusDISeries[i]) / sum) * 100 : 0);
135
- }
136
- // ADX = Wilder smooth of DX
137
- const adxSeries = wilderSmooth(dxSeries, period);
138
- return {
139
- adx: Math.round(adxSeries[adxSeries.length - 1] ?? 0),
140
- plusDI: Math.round(plusDISeries[plusDISeries.length - 1] ?? 0),
141
- minusDI: Math.round(minusDISeries[minusDISeries.length - 1] ?? 0),
142
- };
143
- }
144
- // ─── Ichimoku Cloud ─────────────────────────────────────────────────────
145
- export function computeIchimoku(highs, lows, closes, tenkanPeriod = 9, kijunPeriod = 26, senkouBPeriod = 52) {
146
- const n = highs.length;
147
- if (n < senkouBPeriod) {
148
- const p = closes[n - 1] ?? 0;
149
- return { tenkan: p, kijun: p, senkouA: p, senkouB: p, chikou: p, cloudPosition: 'inside' };
150
- }
151
- const midpoint = (arr, period, end) => {
152
- const slice = arr.slice(Math.max(0, end - period + 1), end + 1);
153
- return (Math.max(...slice) + Math.min(...slice)) / 2;
154
- };
155
- const tenkan = midpoint(highs.concat().map((h, i) => Math.max(h, lows[i])), tenkanPeriod, n - 1);
156
- const kijun = midpoint(highs.concat().map((h, i) => Math.max(h, lows[i])), kijunPeriod, n - 1);
157
- // Recalculate properly using highs and lows separately
158
- const tenkanH = Math.max(...highs.slice(-tenkanPeriod));
159
- const tenkanL = Math.min(...lows.slice(-tenkanPeriod));
160
- const tenkanVal = (tenkanH + tenkanL) / 2;
161
- const kijunH = Math.max(...highs.slice(-kijunPeriod));
162
- const kijunL = Math.min(...lows.slice(-kijunPeriod));
163
- const kijunVal = (kijunH + kijunL) / 2;
164
- const senkouA = (tenkanVal + kijunVal) / 2;
165
- const senkouBH = Math.max(...highs.slice(-senkouBPeriod));
166
- const senkouBL = Math.min(...lows.slice(-senkouBPeriod));
167
- const senkouB = (senkouBH + senkouBL) / 2;
168
- const chikou = closes[n - 1]; // Current close (projected back 26 periods)
169
- const price = closes[n - 1];
170
- const cloudTop = Math.max(senkouA, senkouB);
171
- const cloudBottom = Math.min(senkouA, senkouB);
172
- const cloudPosition = price > cloudTop ? 'above' : price < cloudBottom ? 'below' : 'inside';
173
- return { tenkan: tenkanVal, kijun: kijunVal, senkouA, senkouB, chikou, cloudPosition };
174
- }
175
- // ─── OBV (On-Balance Volume) ────────────────────────────────────────────
176
- export function computeOBV(closes, volumes) {
177
- if (closes.length < 2)
178
- return { obv: 0, slope: 'flat' };
179
- let obv = 0;
180
- const obvSeries = [0];
181
- for (let i = 1; i < closes.length; i++) {
182
- if (closes[i] > closes[i - 1])
183
- obv += volumes[i];
184
- else if (closes[i] < closes[i - 1])
185
- obv -= volumes[i];
186
- obvSeries.push(obv);
187
- }
188
- // Slope over last 10 bars
189
- const lookback = Math.min(10, obvSeries.length);
190
- const recent = obvSeries.slice(-lookback);
191
- const first = recent[0];
192
- const last = recent[recent.length - 1];
193
- const threshold = Math.abs(first) * 0.01; // 1% threshold
194
- const slope = last - first > threshold ? 'rising' : last - first < -threshold ? 'falling' : 'flat';
195
- return { obv, slope };
196
- }
197
- // ─── Supertrend (10, 3) ─────────────────────────────────────────────────
198
- export function computeSupertrend(highs, lows, closes, period = 10, multiplier = 3) {
199
- const atrSeries = computeATRSeries(highs, lows, closes, period);
200
- if (atrSeries.length === 0) {
201
- return { value: closes[closes.length - 1] ?? 0, direction: 'bullish' };
202
- }
203
- // ATR series starts at index 1 (needs previous close for TR)
204
- // Align: atrSeries[i] corresponds to bar index i+1
205
- let upperBand = 0;
206
- let lowerBand = 0;
207
- let supertrend = 0;
208
- let direction = 'bullish';
209
- for (let i = 0; i < atrSeries.length; i++) {
210
- const barIdx = i + 1; // offset for TR calculation
211
- const hl2 = (highs[barIdx] + lows[barIdx]) / 2;
212
- const atr = atrSeries[i];
213
- const basicUpper = hl2 + multiplier * atr;
214
- const basicLower = hl2 - multiplier * atr;
215
- upperBand = i > 0 && basicUpper < upperBand && closes[barIdx - 1] > upperBand ? upperBand : basicUpper;
216
- lowerBand = i > 0 && basicLower > lowerBand && closes[barIdx - 1] < lowerBand ? lowerBand : basicLower;
217
- if (i === 0) {
218
- supertrend = closes[barIdx] > upperBand ? lowerBand : upperBand;
219
- direction = closes[barIdx] > upperBand ? 'bullish' : 'bearish';
220
- }
221
- else {
222
- if (direction === 'bullish') {
223
- if (closes[barIdx] < lowerBand) {
224
- direction = 'bearish';
225
- supertrend = upperBand;
226
- }
227
- else {
228
- supertrend = lowerBand;
229
- }
230
- }
231
- else {
232
- if (closes[barIdx] > upperBand) {
233
- direction = 'bullish';
234
- supertrend = lowerBand;
235
- }
236
- else {
237
- supertrend = upperBand;
238
- }
239
- }
240
- }
241
- }
242
- return { value: supertrend, direction };
243
- }
244
- // ─── Williams %R (14) ───────────────────────────────────────────────────
245
- export function computeWilliamsR(highs, lows, closes, period = 14) {
246
- if (highs.length < period)
247
- return -50;
248
- const recentHighs = highs.slice(-period);
249
- const recentLows = lows.slice(-period);
250
- const hh = Math.max(...recentHighs);
251
- const ll = Math.min(...recentLows);
252
- const close = closes[closes.length - 1];
253
- return hh !== ll ? ((hh - close) / (hh - ll)) * -100 : -50;
254
- }
255
- // ─── Helper: EMA series ─────────────────────────────────────────────────
256
- function emaSeries(data, period) {
257
- if (data.length === 0)
258
- return [];
259
- if (data.length < period)
260
- return [data[data.length - 1]];
261
- const k = 2 / (period + 1);
262
- const result = [];
263
- let ema = mean(data.slice(0, period));
264
- result.push(ema);
265
- for (let i = period; i < data.length; i++) {
266
- ema = data[i] * k + ema * (1 - k);
267
- result.push(ema);
268
- }
269
- return result;
270
- }
271
- // ─── Helper: SMA series ─────────────────────────────────────────────────
272
- function sma(data, period) {
273
- if (data.length < period)
274
- return data.length > 0 ? [mean(data)] : [];
275
- const result = [];
276
- for (let i = period - 1; i < data.length; i++) {
277
- result.push(mean(data.slice(i - period + 1, i + 1)));
278
- }
279
- return result;
280
- }
281
- // ─── Helper: Wilder's smoothing ─────────────────────────────────────────
282
- function wilderSmooth(data, period) {
283
- if (data.length < period)
284
- return [];
285
- const result = [];
286
- result.push(mean(data.slice(0, period)));
287
- for (let i = period; i < data.length; i++) {
288
- result.push((result[result.length - 1] * (period - 1) + data[i]) / period);
289
- }
290
- return result;
291
- }
@@ -1,15 +0,0 @@
1
- export declare function computeEMA(data: number[], period: number): number;
2
- export declare function computeATR(highs: number[], lows: number[], closes: number[], period: number): number;
3
- export declare function computeATRSeries(highs: number[], lows: number[], closes: number[], period: number): number[];
4
- export declare function computeRSI(closes: number[], period: number): number;
5
- export declare function linearSlope(y: number[], x?: number[]): number;
6
- export declare function computeStd(data: number[]): number;
7
- export declare function mean(data: number[]): number;
8
- /** Find swing highs and lows from OHLCV bars (simple pivot-point method). */
9
- export declare function findSwingPoints(bars: {
10
- high: number;
11
- low: number;
12
- }[], lookback?: number): {
13
- highs: number[];
14
- lows: number[];
15
- };
@@ -1,114 +0,0 @@
1
- // ⚠️ GENERATED FILE — DO NOT EDIT.
2
- // Canonical source of truth: shared/src/shared/indicators.ts
3
- // Regenerate: node scripts/sync-shared-code.mjs (enforced by shared-code-sync.test.ts)
4
- //
5
- // This copy exists because this package builds with tsc and deploys as a
6
- // self-contained tree that strips workspace deps, so it cannot import
7
- // @reefclaw/shared runtime code across the deploy boundary.
8
- // Shared indicator computation helpers.
9
- // Used by both regime feature engineering and signal condition evaluation.
10
- export function computeEMA(data, period) {
11
- if (data.length < period)
12
- return data[data.length - 1] ?? 0;
13
- const k = 2 / (period + 1);
14
- let ema = mean(data.slice(0, period));
15
- for (let i = period; i < data.length; i++) {
16
- ema = data[i] * k + ema * (1 - k);
17
- }
18
- return ema;
19
- }
20
- export function computeATR(highs, lows, closes, period) {
21
- const series = computeATRSeries(highs, lows, closes, period);
22
- return series[series.length - 1] ?? 0;
23
- }
24
- export function computeATRSeries(highs, lows, closes, period) {
25
- if (highs.length < 2)
26
- return [];
27
- const tr = [];
28
- for (let i = 1; i < highs.length; i++) {
29
- tr.push(Math.max(highs[i] - lows[i], Math.abs(highs[i] - closes[i - 1]), Math.abs(lows[i] - closes[i - 1])));
30
- }
31
- const atr = [];
32
- atr[0] = mean(tr.slice(0, period));
33
- for (let i = 1; i < tr.length; i++) {
34
- atr[i] = (atr[i - 1] * (period - 1) + tr[i]) / period;
35
- }
36
- return atr;
37
- }
38
- export function computeRSI(closes, period) {
39
- if (closes.length < period + 1)
40
- return 50;
41
- const changes = [];
42
- for (let i = 1; i < closes.length; i++) {
43
- changes.push(closes[i] - closes[i - 1]);
44
- }
45
- let avgGain = 0;
46
- let avgLoss = 0;
47
- for (let i = 0; i < period; i++) {
48
- if (changes[i] > 0)
49
- avgGain += changes[i];
50
- else
51
- avgLoss -= changes[i];
52
- }
53
- avgGain /= period;
54
- avgLoss /= period;
55
- for (let i = period; i < changes.length; i++) {
56
- const gain = changes[i] > 0 ? changes[i] : 0;
57
- const loss = changes[i] < 0 ? -changes[i] : 0;
58
- avgGain = (avgGain * (period - 1) + gain) / period;
59
- avgLoss = (avgLoss * (period - 1) + loss) / period;
60
- }
61
- if (avgLoss === 0)
62
- return 100;
63
- const rs = avgGain / avgLoss;
64
- return 100 - 100 / (1 + rs);
65
- }
66
- export function linearSlope(y, x) {
67
- const n = y.length;
68
- if (n < 2)
69
- return 0;
70
- const xs = x ?? Array.from({ length: n }, (_, i) => i);
71
- const mx = mean(xs);
72
- const my = mean(y);
73
- let num = 0;
74
- let den = 0;
75
- for (let i = 0; i < n; i++) {
76
- num += (xs[i] - mx) * (y[i] - my);
77
- den += (xs[i] - mx) ** 2;
78
- }
79
- return den > 0 ? num / den : 0;
80
- }
81
- export function computeStd(data) {
82
- if (data.length < 2)
83
- return 0;
84
- const avg = mean(data);
85
- const variance = data.reduce((s, v) => s + (v - avg) ** 2, 0) / (data.length - 1);
86
- return Math.sqrt(variance);
87
- }
88
- export function mean(data) {
89
- if (data.length === 0)
90
- return 0;
91
- return data.reduce((s, v) => s + v, 0) / data.length;
92
- }
93
- /** Find swing highs and lows from OHLCV bars (simple pivot-point method). */
94
- export function findSwingPoints(bars, lookback = 5) {
95
- const highs = [];
96
- const lows = [];
97
- for (let i = lookback; i < bars.length - lookback; i++) {
98
- let isHigh = true;
99
- let isLow = true;
100
- for (let j = i - lookback; j <= i + lookback; j++) {
101
- if (j === i)
102
- continue;
103
- if (bars[j].high >= bars[i].high)
104
- isHigh = false;
105
- if (bars[j].low <= bars[i].low)
106
- isLow = false;
107
- }
108
- if (isHigh)
109
- highs.push(bars[i].high);
110
- if (isLow)
111
- lows.push(bars[i].low);
112
- }
113
- return { highs, lows };
114
- }
@@ -1,16 +0,0 @@
1
- import type { MarketContext, Direction } from '../types.js';
2
- import type { ConditionFn, ConditionConfig, ConditionContext } from './types.js';
3
- export declare function getConditionFn(type: string): ConditionFn | undefined;
4
- export declare function hasCondition(type: string): boolean;
5
- export declare function listConditionTypes(): string[];
6
- /** Evaluate an array of condition configs. Returns SignalCondition[] + shared context. */
7
- export declare function evaluateConditions(configs: ConditionConfig[], ctx: MarketContext, direction: Direction | null): {
8
- conditions: Array<{
9
- name: string;
10
- met: boolean;
11
- currentValue: number;
12
- threshold: number;
13
- description: string;
14
- }>;
15
- condCtx: ConditionContext;
16
- };