superacli 1.1.0 → 1.1.2

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 (261) hide show
  1. package/.beads/.br_history/issues.20260308_235202_180577215.jsonl +57 -0
  2. package/.beads/.br_history/issues.20260308_235202_387414163.jsonl +57 -0
  3. package/.beads/.br_history/issues.20260308_235202_564422794.jsonl +57 -0
  4. package/.beads/.br_history/issues.20260308_235202_742600597.jsonl +57 -0
  5. package/.beads/.br_history/issues.20260308_235208_133360069.jsonl +57 -0
  6. package/.beads/.br_history/issues.20260308_235505_473406307.jsonl +57 -0
  7. package/.beads/.br_history/issues.20260308_235505_662360489.jsonl +57 -0
  8. package/.beads/.br_history/issues.20260308_235505_843935624.jsonl +57 -0
  9. package/.beads/.br_history/issues.20260308_235506_044530221.jsonl +57 -0
  10. package/.beads/.br_history/issues.20260309_002618_115728731.jsonl +57 -0
  11. package/.beads/.br_history/issues.20260309_003748_878174586.jsonl +57 -0
  12. package/.beads/.br_history/issues.20260309_004057_868755623.jsonl +57 -0
  13. package/.beads/.br_history/issues.20260309_004058_512842163.jsonl +57 -0
  14. package/.beads/.br_history/issues.20260309_004058_994445226.jsonl +57 -0
  15. package/.beads/.br_history/issues.20260309_004059_475988596.jsonl +57 -0
  16. package/.beads/.br_history/issues.20260309_161902_566857851.jsonl +57 -0
  17. package/.beads/.br_history/issues.20260309_170512_277017739.jsonl +57 -0
  18. package/.beads/.br_history/issues.20260309_170512_477876921.jsonl +57 -0
  19. package/.beads/.br_history/issues.20260309_170512_664382701.jsonl +57 -0
  20. package/.beads/.br_history/issues.20260309_170512_859400333.jsonl +57 -0
  21. package/.beads/.br_history/issues.20260309_212326_082771164.jsonl +57 -0
  22. package/.beads/.br_history/issues.20260309_212326_245619716.jsonl +58 -0
  23. package/.beads/.br_history/issues.20260309_212326_403198317.jsonl +59 -0
  24. package/.beads/.br_history/issues.20260309_212332_539197678.jsonl +60 -0
  25. package/.beads/.br_history/issues.20260309_212332_731373599.jsonl +60 -0
  26. package/.beads/.br_history/issues.20260309_212332_928710953.jsonl +60 -0
  27. package/.beads/.br_history/issues.20260309_213021_341505240.jsonl +60 -0
  28. package/.beads/.br_history/issues.20260309_213022_023136934.jsonl +60 -0
  29. package/.beads/.br_history/issues.20260309_213022_400050719.jsonl +60 -0
  30. package/.beads/issues.jsonl +20 -17
  31. package/README.md +1 -1
  32. package/__tests__/adapter-schema.test.js +3 -0
  33. package/__tests__/aws-plugin.test.js +84 -0
  34. package/__tests__/az-plugin.test.js +84 -0
  35. package/__tests__/builtin-adapter.test.js +29 -0
  36. package/__tests__/cline-plugin.test.js +109 -0
  37. package/__tests__/cline-skill.test.js +49 -0
  38. package/__tests__/docker-plugin.test.js +3 -1
  39. package/__tests__/eza-plugin.test.js +81 -0
  40. package/__tests__/gcloud-plugin.test.js +86 -0
  41. package/__tests__/gh-plugin.test.js +86 -0
  42. package/__tests__/helm-plugin.test.js +81 -0
  43. package/__tests__/http-adapter.test.js +118 -0
  44. package/__tests__/just-plugin.test.js +82 -0
  45. package/__tests__/kubectl-plugin.test.js +83 -0
  46. package/__tests__/linear-plugin.test.js +81 -0
  47. package/__tests__/mcp-adapter.test.js +187 -0
  48. package/__tests__/nextest-plugin.test.js +82 -0
  49. package/__tests__/npm-plugin.test.js +81 -0
  50. package/__tests__/nullclaw-plugin.test.js +157 -0
  51. package/__tests__/openapi-adapter.test.js +199 -0
  52. package/__tests__/plugin-agency-agents.test.js +6 -6
  53. package/__tests__/plugin-nullclaw.test.js +78 -0
  54. package/__tests__/plugin-visual-explainer.test.js +62 -0
  55. package/__tests__/plugins-manager.test.js +59 -10
  56. package/__tests__/pnpm-plugin.test.js +81 -0
  57. package/__tests__/poetry-plugin.test.js +83 -0
  58. package/__tests__/process-adapter.test.js +124 -90
  59. package/__tests__/pulumi-plugin.test.js +81 -0
  60. package/__tests__/railway-plugin.test.js +84 -0
  61. package/__tests__/server-app.test.js +67 -0
  62. package/__tests__/server-config-service.test.js +79 -0
  63. package/__tests__/server-routes-ask.test.js +89 -0
  64. package/__tests__/server-routes-commands.test.js +55 -0
  65. package/__tests__/server-routes-config.test.js +87 -0
  66. package/__tests__/server-routes-jobs.test.js +53 -0
  67. package/__tests__/server-routes-misc.test.js +112 -0
  68. package/__tests__/server-storage-adapter.test.js +40 -0
  69. package/__tests__/server-storage-file.test.js +73 -0
  70. package/__tests__/server-storage-mongo.test.js +74 -0
  71. package/__tests__/shell-adapter.test.js +81 -22
  72. package/__tests__/stripe-plugin.test.js +3 -1
  73. package/__tests__/supabase-plugin.test.js +86 -0
  74. package/__tests__/terraform-plugin.test.js +83 -0
  75. package/__tests__/uv-plugin.test.js +81 -0
  76. package/__tests__/vercel-plugin.test.js +81 -0
  77. package/__tests__/watchexec-plugin.test.js +80 -0
  78. package/cli/adapter-schema.js +5 -0
  79. package/cli/adapters/process.js +53 -2
  80. package/cli/plugin-install-guidance.js +320 -0
  81. package/cli/plugins-manager.js +272 -212
  82. package/cli/skills.js +16 -5
  83. package/cli/supercli.js +26 -2
  84. package/docs/plugins.md +2 -0
  85. package/docs/skills/cline-non-interactive/SKILL.md +59 -0
  86. package/docs/skills-catalog.md +35 -0
  87. package/docs/visual-overview.md +21 -0
  88. package/jest.config.js +4 -1
  89. package/package.json +4 -3
  90. package/plugins/agency-agents/plugin.json +5 -0
  91. package/{cli/plugin-agency-agents.js → plugins/agency-agents/scripts/post-install.js} +13 -3
  92. package/plugins/aws/README.md +46 -0
  93. package/plugins/aws/plugin.json +42 -0
  94. package/plugins/az/README.md +46 -0
  95. package/plugins/az/plugin.json +42 -0
  96. package/plugins/clickup/plugin.json +38 -0
  97. package/plugins/clickup/scripts/post-install.js +107 -0
  98. package/plugins/clickup/scripts/post-uninstall.js +30 -0
  99. package/plugins/cline/README.md +48 -0
  100. package/plugins/cline/plugin.json +92 -0
  101. package/plugins/eza/README.md +40 -0
  102. package/plugins/eza/plugin.json +42 -0
  103. package/plugins/gcloud/README.md +46 -0
  104. package/plugins/gcloud/plugin.json +42 -0
  105. package/plugins/gh/README.md +46 -0
  106. package/plugins/gh/plugin.json +43 -0
  107. package/plugins/helm/README.md +42 -0
  108. package/plugins/helm/plugin.json +42 -0
  109. package/plugins/just/README.md +42 -0
  110. package/plugins/just/plugin.json +42 -0
  111. package/plugins/kubectl/README.md +46 -0
  112. package/plugins/kubectl/plugin.json +42 -0
  113. package/plugins/linear/README.md +60 -0
  114. package/plugins/linear/plugin.json +42 -0
  115. package/plugins/nextest/README.md +42 -0
  116. package/plugins/nextest/plugin.json +42 -0
  117. package/plugins/npm/README.md +46 -0
  118. package/plugins/npm/plugin.json +42 -0
  119. package/plugins/nullclaw/README.md +45 -0
  120. package/plugins/nullclaw/plugin.json +64 -0
  121. package/plugins/nullclaw/scripts/post-install.js +189 -0
  122. package/plugins/nullclaw/scripts/post-uninstall.js +25 -0
  123. package/plugins/openfang/plugin.json +37 -0
  124. package/plugins/openfang/scripts/post-install.js +163 -0
  125. package/plugins/openfang/scripts/post-uninstall.js +30 -0
  126. package/plugins/plugins.json +234 -0
  127. package/plugins/pnpm/README.md +46 -0
  128. package/plugins/pnpm/plugin.json +42 -0
  129. package/plugins/poetry/README.md +46 -0
  130. package/plugins/poetry/plugin.json +42 -0
  131. package/plugins/pulumi/README.md +46 -0
  132. package/plugins/pulumi/plugin.json +42 -0
  133. package/plugins/railway/README.md +58 -0
  134. package/plugins/railway/plugin.json +43 -0
  135. package/plugins/supabase/README.md +55 -0
  136. package/plugins/supabase/plugin.json +42 -0
  137. package/plugins/superpowers/plugin.json +22 -0
  138. package/plugins/superpowers/scripts/post-install.js +124 -0
  139. package/plugins/superpowers/scripts/post-uninstall.js +30 -0
  140. package/plugins/terraform/README.md +46 -0
  141. package/plugins/terraform/plugin.json +42 -0
  142. package/plugins/uv/README.md +46 -0
  143. package/plugins/uv/plugin.json +42 -0
  144. package/plugins/vercel/README.md +47 -0
  145. package/plugins/vercel/plugin.json +42 -0
  146. package/plugins/visual-explainer/plugin.json +15 -0
  147. package/plugins/visual-explainer/scripts/post-install.js +111 -0
  148. package/plugins/watchexec/README.md +40 -0
  149. package/plugins/watchexec/plugin.json +42 -0
  150. package/tests/test-aws-smoke.sh +56 -0
  151. package/tests/test-az-smoke.sh +56 -0
  152. package/tests/test-cline-smoke.sh +37 -0
  153. package/tests/test-eza-smoke.sh +33 -0
  154. package/tests/test-gcloud-smoke.sh +56 -0
  155. package/tests/test-gh-smoke.sh +56 -0
  156. package/tests/test-helm-smoke.sh +33 -0
  157. package/tests/test-just-smoke.sh +40 -0
  158. package/tests/test-kubectl-smoke.sh +37 -0
  159. package/tests/test-linear-smoke.sh +97 -0
  160. package/tests/test-nextest-smoke.sh +33 -0
  161. package/tests/test-npm-smoke.sh +32 -0
  162. package/tests/test-nullclaw-smoke.sh +51 -0
  163. package/tests/test-plugins-registry.js +110 -0
  164. package/tests/test-pnpm-smoke.sh +33 -0
  165. package/tests/test-poetry-smoke.sh +33 -0
  166. package/tests/test-pulumi-smoke.sh +33 -0
  167. package/tests/test-railway-smoke.sh +95 -0
  168. package/tests/test-supabase-smoke.sh +95 -0
  169. package/tests/test-terraform-smoke.sh +33 -0
  170. package/tests/test-uv-smoke.sh +33 -0
  171. package/tests/test-vercel-smoke.sh +55 -0
  172. package/tests/test-watchexec-smoke.sh +33 -0
  173. package/.beads/.br_history/issues.20260308_180927_477542428.jsonl +0 -12
  174. package/.beads/.br_history/issues.20260308_181032_020230108.jsonl +0 -12
  175. package/.beads/.br_history/issues.20260308_181032_180539413.jsonl +0 -12
  176. package/.beads/.br_history/issues.20260308_181032_372621506.jsonl +0 -12
  177. package/.beads/.br_history/issues.20260308_181032_565142225.jsonl +0 -12
  178. package/.beads/.br_history/issues.20260308_181311_336346464.jsonl +0 -12
  179. package/.beads/.br_history/issues.20260308_181444_039234498.jsonl +0 -13
  180. package/.beads/.br_history/issues.20260308_181503_794764403.jsonl +0 -13
  181. package/.beads/.br_history/issues.20260308_181503_950163105.jsonl +0 -13
  182. package/.beads/.br_history/issues.20260308_192031_852553505.jsonl +0 -13
  183. package/.beads/.br_history/issues.20260308_193552_846920518.jsonl +0 -14
  184. package/.beads/.br_history/issues.20260308_194054_394884833.jsonl +0 -14
  185. package/.beads/.br_history/issues.20260308_194209_440472460.jsonl +0 -15
  186. package/.beads/.br_history/issues.20260308_195319_099391899.jsonl +0 -15
  187. package/.beads/.br_history/issues.20260308_195324_176987204.jsonl +0 -16
  188. package/.beads/.br_history/issues.20260308_195436_929114019.jsonl +0 -16
  189. package/.beads/.br_history/issues.20260308_195437_055808298.jsonl +0 -17
  190. package/.beads/.br_history/issues.20260308_195437_304297399.jsonl +0 -18
  191. package/.beads/.br_history/issues.20260308_195437_556007332.jsonl +0 -19
  192. package/.beads/.br_history/issues.20260308_195444_987209695.jsonl +0 -20
  193. package/.beads/.br_history/issues.20260308_195445_133350193.jsonl +0 -20
  194. package/.beads/.br_history/issues.20260308_195445_400185615.jsonl +0 -20
  195. package/.beads/.br_history/issues.20260308_195445_689886334.jsonl +0 -20
  196. package/.beads/.br_history/issues.20260308_195445_949947727.jsonl +0 -20
  197. package/.beads/.br_history/issues.20260308_195745_580473297.jsonl +0 -20
  198. package/.beads/.br_history/issues.20260308_195745_725920532.jsonl +0 -20
  199. package/.beads/.br_history/issues.20260308_195745_968227911.jsonl +0 -20
  200. package/.beads/.br_history/issues.20260308_195746_224276322.jsonl +0 -20
  201. package/.beads/.br_history/issues.20260308_200018_386890807.jsonl +0 -20
  202. package/ref-btcbot/.env.example +0 -19
  203. package/ref-btcbot/README.md +0 -3
  204. package/ref-btcbot/docs/bot.md +0 -72
  205. package/ref-btcbot/docs/skills/btcbot.backtest/SKILL.md +0 -70
  206. package/ref-btcbot/docs/skills/btcbot.config/SKILL.md +0 -79
  207. package/ref-btcbot/docs/skills/btcbot.orders/SKILL.md +0 -60
  208. package/ref-btcbot/docs/skills/btcbot.positions/SKILL.md +0 -54
  209. package/ref-btcbot/docs/skills/btcbot.risk/SKILL.md +0 -69
  210. package/ref-btcbot/docs/skills/btcbot.run-loop/SKILL.md +0 -63
  211. package/ref-btcbot/docs/skills/btcbot.run-once/SKILL.md +0 -63
  212. package/ref-btcbot/docs/skills/btcbot.status/SKILL.md +0 -59
  213. package/ref-btcbot/examples/sample-candles.json +0 -52
  214. package/ref-btcbot/package.json +0 -18
  215. package/ref-btcbot/plugin/plugin.json +0 -146
  216. package/ref-btcbot/src/cli.js +0 -104
  217. package/ref-btcbot/src/config.js +0 -80
  218. package/ref-btcbot/src/core/bot-runner.js +0 -78
  219. package/ref-btcbot/src/core/exchange-factory.js +0 -19
  220. package/ref-btcbot/src/core/live-exchange.js +0 -12
  221. package/ref-btcbot/src/core/paper-exchange.js +0 -82
  222. package/ref-btcbot/src/core/risk-engine.js +0 -42
  223. package/ref-btcbot/src/core/state-repository.js +0 -47
  224. package/ref-btcbot/src/services/backtest-service.js +0 -44
  225. package/ref-btcbot/src/services/market-data.js +0 -32
  226. package/ref-btcbot/src/storage/json-store.js +0 -45
  227. package/ref-btcbot/src/strategy/hedge-strategy.js +0 -65
  228. package/ref-btcbot/src/strategy/indicators.js +0 -56
  229. package/ref-btcbot/src/web/api.js +0 -50
  230. package/ref-btcbot/src/web/app.js +0 -51
  231. package/ref-btcbot/src/web/index.html +0 -70
  232. package/ref-btcbot/src/web/server.js +0 -33
  233. /package/.beads/.br_history/{issues.20260308_180927_477542428.jsonl.meta.json → issues.20260308_235202_180577215.jsonl.meta.json} +0 -0
  234. /package/.beads/.br_history/{issues.20260308_181032_020230108.jsonl.meta.json → issues.20260308_235202_387414163.jsonl.meta.json} +0 -0
  235. /package/.beads/.br_history/{issues.20260308_181032_180539413.jsonl.meta.json → issues.20260308_235202_564422794.jsonl.meta.json} +0 -0
  236. /package/.beads/.br_history/{issues.20260308_181032_372621506.jsonl.meta.json → issues.20260308_235202_742600597.jsonl.meta.json} +0 -0
  237. /package/.beads/.br_history/{issues.20260308_181032_565142225.jsonl.meta.json → issues.20260308_235208_133360069.jsonl.meta.json} +0 -0
  238. /package/.beads/.br_history/{issues.20260308_181311_336346464.jsonl.meta.json → issues.20260308_235505_473406307.jsonl.meta.json} +0 -0
  239. /package/.beads/.br_history/{issues.20260308_181444_039234498.jsonl.meta.json → issues.20260308_235505_662360489.jsonl.meta.json} +0 -0
  240. /package/.beads/.br_history/{issues.20260308_181503_794764403.jsonl.meta.json → issues.20260308_235505_843935624.jsonl.meta.json} +0 -0
  241. /package/.beads/.br_history/{issues.20260308_181503_950163105.jsonl.meta.json → issues.20260308_235506_044530221.jsonl.meta.json} +0 -0
  242. /package/.beads/.br_history/{issues.20260308_192031_852553505.jsonl.meta.json → issues.20260309_002618_115728731.jsonl.meta.json} +0 -0
  243. /package/.beads/.br_history/{issues.20260308_193552_846920518.jsonl.meta.json → issues.20260309_003748_878174586.jsonl.meta.json} +0 -0
  244. /package/.beads/.br_history/{issues.20260308_194054_394884833.jsonl.meta.json → issues.20260309_004057_868755623.jsonl.meta.json} +0 -0
  245. /package/.beads/.br_history/{issues.20260308_194209_440472460.jsonl.meta.json → issues.20260309_004058_512842163.jsonl.meta.json} +0 -0
  246. /package/.beads/.br_history/{issues.20260308_195319_099391899.jsonl.meta.json → issues.20260309_004058_994445226.jsonl.meta.json} +0 -0
  247. /package/.beads/.br_history/{issues.20260308_195324_176987204.jsonl.meta.json → issues.20260309_004059_475988596.jsonl.meta.json} +0 -0
  248. /package/.beads/.br_history/{issues.20260308_195436_929114019.jsonl.meta.json → issues.20260309_161902_566857851.jsonl.meta.json} +0 -0
  249. /package/.beads/.br_history/{issues.20260308_195437_055808298.jsonl.meta.json → issues.20260309_170512_277017739.jsonl.meta.json} +0 -0
  250. /package/.beads/.br_history/{issues.20260308_195437_304297399.jsonl.meta.json → issues.20260309_170512_477876921.jsonl.meta.json} +0 -0
  251. /package/.beads/.br_history/{issues.20260308_195437_556007332.jsonl.meta.json → issues.20260309_170512_664382701.jsonl.meta.json} +0 -0
  252. /package/.beads/.br_history/{issues.20260308_195444_987209695.jsonl.meta.json → issues.20260309_170512_859400333.jsonl.meta.json} +0 -0
  253. /package/.beads/.br_history/{issues.20260308_195445_133350193.jsonl.meta.json → issues.20260309_212326_082771164.jsonl.meta.json} +0 -0
  254. /package/.beads/.br_history/{issues.20260308_195445_400185615.jsonl.meta.json → issues.20260309_212326_245619716.jsonl.meta.json} +0 -0
  255. /package/.beads/.br_history/{issues.20260308_195445_689886334.jsonl.meta.json → issues.20260309_212326_403198317.jsonl.meta.json} +0 -0
  256. /package/.beads/.br_history/{issues.20260308_195445_949947727.jsonl.meta.json → issues.20260309_212332_539197678.jsonl.meta.json} +0 -0
  257. /package/.beads/.br_history/{issues.20260308_195745_580473297.jsonl.meta.json → issues.20260309_212332_731373599.jsonl.meta.json} +0 -0
  258. /package/.beads/.br_history/{issues.20260308_195745_725920532.jsonl.meta.json → issues.20260309_212332_928710953.jsonl.meta.json} +0 -0
  259. /package/.beads/.br_history/{issues.20260308_195745_968227911.jsonl.meta.json → issues.20260309_213021_341505240.jsonl.meta.json} +0 -0
  260. /package/.beads/.br_history/{issues.20260308_195746_224276322.jsonl.meta.json → issues.20260309_213022_023136934.jsonl.meta.json} +0 -0
  261. /package/.beads/.br_history/{issues.20260308_200018_386890807.jsonl.meta.json → issues.20260309_213022_400050719.jsonl.meta.json} +0 -0
@@ -1,56 +0,0 @@
1
- function sma(values, window) {
2
- if (values.length < window) return null
3
- const slice = values.slice(-window)
4
- return slice.reduce((sum, value) => sum + value, 0) / window
5
- }
6
-
7
- function stddev(values, window) {
8
- if (values.length < window) return null
9
- const slice = values.slice(-window)
10
- const mean = sma(values, window)
11
- const variance = slice.reduce((sum, value) => sum + (value - mean) ** 2, 0) / window
12
- return Math.sqrt(variance)
13
- }
14
-
15
- function atr(candles, window) {
16
- if (candles.length < window + 1) return null
17
- const ranges = []
18
- for (let i = candles.length - window; i < candles.length; i += 1) {
19
- const current = candles[i]
20
- const previous = candles[i - 1]
21
- const tr = Math.max(
22
- current.high - current.low,
23
- Math.abs(current.high - previous.close),
24
- Math.abs(current.low - previous.close)
25
- )
26
- ranges.push(tr)
27
- }
28
- return ranges.reduce((sum, value) => sum + value, 0) / ranges.length
29
- }
30
-
31
- function zscore(values, window) {
32
- if (values.length < window) return null
33
- const latest = values[values.length - 1]
34
- const mean = sma(values, window)
35
- const sigma = stddev(values, window)
36
- if (!sigma) return 0
37
- return (latest - mean) / sigma
38
- }
39
-
40
- function realizedVol(values, window) {
41
- if (values.length < window + 1) return null
42
- const returns = []
43
- for (let i = values.length - window; i < values.length; i += 1) {
44
- returns.push(Math.log(values[i] / values[i - 1]))
45
- }
46
- const sigma = stddev(returns, returns.length)
47
- return sigma ? sigma * Math.sqrt(96) : null
48
- }
49
-
50
- module.exports = {
51
- sma,
52
- stddev,
53
- atr,
54
- zscore,
55
- realizedVol
56
- }
@@ -1,50 +0,0 @@
1
- const express = require("express")
2
- const { runCycle } = require("../core/bot-runner")
3
- const { loadCandles, runBacktest } = require("../services/backtest-service")
4
-
5
- function createApiRouter(config, repository) {
6
- const router = express.Router()
7
-
8
- router.get("/health", (req, res) => {
9
- res.json({ ok: true, service: "ref-btcbot" })
10
- })
11
-
12
- router.get("/status", (req, res) => {
13
- res.json({
14
- ok: true,
15
- state: repository.getState(),
16
- snapshot: repository.getSnapshot(),
17
- orders: repository.listOrders().slice(0, 20),
18
- runs: repository.listRuns().slice(0, 20)
19
- })
20
- })
21
-
22
- router.post("/run-once", async (req, res, next) => {
23
- try {
24
- const report = await runCycle(config, repository)
25
- res.json({ ok: true, report })
26
- } catch (error) {
27
- next(error)
28
- }
29
- })
30
-
31
- router.post("/backtest", (req, res, next) => {
32
- try {
33
- if (!req.body || !req.body.file) {
34
- res.status(400).json({ ok: false, error: "file is required" })
35
- return
36
- }
37
- const candles = loadCandles(req.body.file)
38
- const result = runBacktest(config, candles)
39
- res.json(result)
40
- } catch (error) {
41
- next(error)
42
- }
43
- })
44
-
45
- return router
46
- }
47
-
48
- module.exports = {
49
- createApiRouter
50
- }
@@ -1,51 +0,0 @@
1
- const { createApp } = Vue
2
-
3
- createApp({
4
- data() {
5
- return {
6
- data: {
7
- state: null,
8
- snapshot: null,
9
- orders: [],
10
- runs: []
11
- },
12
- loading: false
13
- }
14
- },
15
- computed: {
16
- cards() {
17
- const snapshot = this.data.snapshot || {}
18
- const state = this.data.state || {}
19
- return [
20
- { label: "Mode", value: state.mode || "paper" },
21
- { label: "Spot BTC", value: state.position ? state.position.spotQty : "-" },
22
- { label: "Perp BTC", value: state.position ? state.position.perpQty : "-" },
23
- { label: "Hedge Ratio", value: snapshot.signal ? snapshot.signal.hedgeRatio : "-" },
24
- { label: "Net Delta BTC", value: snapshot.mark ? snapshot.mark.netDeltaBtc : "-" },
25
- { label: "Equity", value: snapshot.mark ? snapshot.mark.equityEstimate : "-" },
26
- { label: "Volatility", value: snapshot.signal ? snapshot.signal.volatility : "-" },
27
- { label: "Last Run", value: state.runtime ? state.runtime.lastRunAt || "never" : "never" }
28
- ]
29
- }
30
- },
31
- methods: {
32
- pretty(value) {
33
- return JSON.stringify(value || {}, null, 2)
34
- },
35
- async refresh() {
36
- this.loading = true
37
- const response = await fetch("/api/status")
38
- this.data = await response.json()
39
- this.loading = false
40
- },
41
- async runOnce() {
42
- this.loading = true
43
- await fetch("/api/run-once", { method: "POST", headers: { "Content-Type": "application/json" } })
44
- await this.refresh()
45
- this.loading = false
46
- }
47
- },
48
- async mounted() {
49
- await this.refresh()
50
- }
51
- }).mount("#app")
@@ -1,70 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>ref-btcbot</title>
7
- <script src="https://cdn.tailwindcss.com"></script>
8
- <script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
9
- </head>
10
- <body class="bg-slate-950 text-slate-100 min-h-screen">
11
- <div id="app" class="max-w-7xl mx-auto p-6 space-y-6">
12
- <header class="flex flex-col gap-3 md:flex-row md:items-center md:justify-between">
13
- <div>
14
- <h1 class="text-3xl font-bold">BTC 15m Hedging Bot</h1>
15
- <p class="text-slate-400">Paper-first hedge orchestration with dcli operator integration.</p>
16
- </div>
17
- <div class="flex gap-3">
18
- <button @click="refresh" class="px-4 py-2 rounded bg-slate-800 hover:bg-slate-700">Refresh</button>
19
- <button @click="runOnce" class="px-4 py-2 rounded bg-emerald-600 hover:bg-emerald-500">Run Once</button>
20
- </div>
21
- </header>
22
-
23
- <section class="grid md:grid-cols-4 gap-4">
24
- <article class="bg-slate-900 rounded p-4" v-for="card in cards" :key="card.label">
25
- <p class="text-sm text-slate-400">{{ card.label }}</p>
26
- <p class="text-2xl font-semibold mt-2">{{ card.value }}</p>
27
- </article>
28
- </section>
29
-
30
- <section class="grid lg:grid-cols-2 gap-6">
31
- <article class="bg-slate-900 rounded p-4 space-y-3">
32
- <h2 class="text-xl font-semibold">Latest Signal</h2>
33
- <pre class="text-xs overflow-auto text-emerald-300">{{ pretty(data.snapshot?.signal) }}</pre>
34
- </article>
35
- <article class="bg-slate-900 rounded p-4 space-y-3">
36
- <h2 class="text-xl font-semibold">Position & Mark</h2>
37
- <pre class="text-xs overflow-auto text-cyan-300">{{ pretty({ position: data.state?.position, mark: data.snapshot?.mark }) }}</pre>
38
- </article>
39
- </section>
40
-
41
- <section class="grid lg:grid-cols-2 gap-6">
42
- <article class="bg-slate-900 rounded p-4">
43
- <h2 class="text-xl font-semibold mb-3">Recent Orders</h2>
44
- <div class="space-y-3 max-h-96 overflow-auto">
45
- <div class="border border-slate-800 rounded p-3" v-for="order in data.orders" :key="order.id">
46
- <div class="flex justify-between text-sm">
47
- <span class="uppercase font-semibold" :class="order.side === 'sell' ? 'text-rose-400' : 'text-emerald-400'">{{ order.side }}</span>
48
- <span class="text-slate-400">{{ order.ts }}</span>
49
- </div>
50
- <div class="text-sm mt-2">Qty: {{ order.qty }} | Price: {{ order.price }} | Realized PnL: {{ order.realizedPnl }}</div>
51
- </div>
52
- </div>
53
- </article>
54
- <article class="bg-slate-900 rounded p-4">
55
- <h2 class="text-xl font-semibold mb-3">Recent Runs</h2>
56
- <div class="space-y-3 max-h-96 overflow-auto">
57
- <div class="border border-slate-800 rounded p-3" v-for="run in data.runs" :key="run.ts">
58
- <div class="flex justify-between text-sm">
59
- <span>{{ run.signal?.reasons?.join(', ') || 'n/a' }}</span>
60
- <span class="text-slate-400">{{ run.ts }}</span>
61
- </div>
62
- <div class="text-sm mt-2">Target perp: {{ run.signal?.targetPerpBtc }} | Delta: {{ run.signal?.deltaBtc }} | Risk: {{ run.risk?.violations?.join(', ') || 'ok' }}</div>
63
- </div>
64
- </div>
65
- </article>
66
- </section>
67
- </div>
68
- <script src="/app.js"></script>
69
- </body>
70
- </html>
@@ -1,33 +0,0 @@
1
- const path = require("path")
2
- const express = require("express")
3
- const { createApiRouter } = require("./api")
4
-
5
- function createServer(config, repository) {
6
- const app = express()
7
- const webDir = path.join(__dirname)
8
-
9
- app.use(express.json())
10
- app.use("/api", createApiRouter(config, repository))
11
- app.get("/", (req, res) => {
12
- res.sendFile(path.join(webDir, "index.html"))
13
- })
14
- app.get("/app.js", (req, res) => {
15
- res.sendFile(path.join(webDir, "app.js"))
16
- })
17
- app.use((error, req, res, next) => {
18
- res.status(500).json({ ok: false, error: error.message })
19
- })
20
-
21
- return {
22
- app,
23
- start() {
24
- return new Promise((resolve) => {
25
- const server = app.listen(config.port, () => resolve(server))
26
- })
27
- }
28
- }
29
- }
30
-
31
- module.exports = {
32
- createServer
33
- }