@senpi/runtime 3.0.0-dev.openclaw-upgrade-mai.20260623210452 → 3.0.0-dev.runtime-phase-2.20260623210537

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 (196) hide show
  1. package/README.md +9 -10
  2. package/dist/actions/decision-engine.d.ts.map +1 -1
  3. package/dist/actions/decision-engine.js +0 -3
  4. package/dist/actions/decision-engine.js.map +1 -1
  5. package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
  6. package/dist/actions/open-position/open-position.action.js +2 -6
  7. package/dist/actions/open-position/open-position.action.js.map +1 -1
  8. package/dist/cli/guide-commands.d.ts.map +1 -1
  9. package/dist/cli/guide-commands.js +56 -43
  10. package/dist/cli/guide-commands.js.map +1 -1
  11. package/dist/cli/senpi-commands.d.ts.map +1 -1
  12. package/dist/cli/senpi-commands.js +108 -0
  13. package/dist/cli/senpi-commands.js.map +1 -1
  14. package/dist/constants/dsl/index.d.ts +0 -2
  15. package/dist/constants/dsl/index.d.ts.map +1 -1
  16. package/dist/constants/dsl/index.js +0 -2
  17. package/dist/constants/dsl/index.js.map +1 -1
  18. package/dist/dsl/engine-client/config-mapping.d.ts +0 -7
  19. package/dist/dsl/engine-client/config-mapping.d.ts.map +1 -1
  20. package/dist/dsl/engine-client/config-mapping.js +2 -16
  21. package/dist/dsl/engine-client/config-mapping.js.map +1 -1
  22. package/dist/dsl/events/handlers.d.ts +2 -18
  23. package/dist/dsl/events/handlers.d.ts.map +1 -1
  24. package/dist/dsl/events/handlers.js +213 -302
  25. package/dist/dsl/events/handlers.js.map +1 -1
  26. package/dist/dsl/monitor/create-monitor.d.ts +0 -15
  27. package/dist/dsl/monitor/create-monitor.d.ts.map +1 -1
  28. package/dist/dsl/monitor/create-monitor.js +9 -44
  29. package/dist/dsl/monitor/create-monitor.js.map +1 -1
  30. package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
  31. package/dist/dsl/monitor/process-one-position.js +1 -24
  32. package/dist/dsl/monitor/process-one-position.js.map +1 -1
  33. package/dist/dsl/plugin/index.d.ts +1 -16
  34. package/dist/dsl/plugin/index.d.ts.map +1 -1
  35. package/dist/dsl/plugin/index.js +4 -35
  36. package/dist/dsl/plugin/index.js.map +1 -1
  37. package/dist/dsl/plugin/options.d.ts +0 -18
  38. package/dist/dsl/plugin/options.d.ts.map +1 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +0 -4
  41. package/dist/index.js.map +1 -1
  42. package/dist/runtime/create-scanner-module.d.ts +3 -4
  43. package/dist/runtime/create-scanner-module.d.ts.map +1 -1
  44. package/dist/runtime/create-scanner-module.js +5 -14
  45. package/dist/runtime/create-scanner-module.js.map +1 -1
  46. package/dist/runtime/create-scanner-providers-for-run.d.ts.map +1 -1
  47. package/dist/runtime/create-scanner-providers-for-run.js +1 -12
  48. package/dist/runtime/create-scanner-providers-for-run.js.map +1 -1
  49. package/dist/runtime/load-runtime-config.js +1 -1
  50. package/dist/runtime/load-runtime-config.js.map +1 -1
  51. package/dist/runtime/map-strategies-registration.js +8 -7
  52. package/dist/runtime/map-strategies-registration.js.map +1 -1
  53. package/dist/runtime/map-strategies.d.ts.map +1 -1
  54. package/dist/runtime/map-strategies.js +3 -12
  55. package/dist/runtime/map-strategies.js.map +1 -1
  56. package/dist/runtime/reconcile-state.d.ts +0 -44
  57. package/dist/runtime/reconcile-state.d.ts.map +1 -1
  58. package/dist/runtime/reconcile-state.js +44 -80
  59. package/dist/runtime/reconcile-state.js.map +1 -1
  60. package/dist/runtime/risk-guard.d.ts.map +1 -1
  61. package/dist/runtime/risk-guard.js +12 -17
  62. package/dist/runtime/risk-guard.js.map +1 -1
  63. package/dist/runtime/runtime-schema.d.ts +995 -2855
  64. package/dist/runtime/runtime-schema.d.ts.map +1 -1
  65. package/dist/runtime/runtime-schema.js +40 -133
  66. package/dist/runtime/runtime-schema.js.map +1 -1
  67. package/dist/runtime/runtime.d.ts +0 -26
  68. package/dist/runtime/runtime.d.ts.map +1 -1
  69. package/dist/runtime/runtime.js +5 -233
  70. package/dist/runtime/runtime.js.map +1 -1
  71. package/dist/runtime/scanner-registry.d.ts +1 -1
  72. package/dist/runtime/scanner-registry.d.ts.map +1 -1
  73. package/dist/runtime/scanner-registry.js +12 -3
  74. package/dist/runtime/scanner-registry.js.map +1 -1
  75. package/dist/runtime/supervisor/long-running-supervisor.d.ts.map +1 -1
  76. package/dist/runtime/supervisor/long-running-supervisor.js +1 -1
  77. package/dist/runtime/supervisor/long-running-supervisor.js.map +1 -1
  78. package/dist/runtime/supervisor/orphan-sweep.js +1 -1
  79. package/dist/runtime/supervisor/orphan-sweep.js.map +1 -1
  80. package/dist/runtime/supervisor/supervisor-utils.d.ts +1 -1
  81. package/dist/runtime/supervisor/supervisor-utils.d.ts.map +1 -1
  82. package/dist/runtime/supervisor/supervisor-utils.js +1 -1
  83. package/dist/runtime/supervisor/supervisor-utils.js.map +1 -1
  84. package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -1
  85. package/dist/runtime-api/intake/intake-mount.js +36 -28
  86. package/dist/runtime-api/intake/intake-mount.js.map +1 -1
  87. package/dist/runtime-api/intake/process-signal-post.d.ts.map +1 -1
  88. package/dist/runtime-api/intake/process-signal-post.js +0 -0
  89. package/dist/runtime-api/intake/process-signal-post.js.map +1 -1
  90. package/dist/runtime-api/intake/scanner-launcher.d.ts +4 -18
  91. package/dist/runtime-api/intake/scanner-launcher.d.ts.map +1 -1
  92. package/dist/runtime-api/intake/scanner-launcher.js +3 -24
  93. package/dist/runtime-api/intake/scanner-launcher.js.map +1 -1
  94. package/dist/runtime-api/intake/types.d.ts +0 -6
  95. package/dist/runtime-api/intake/types.d.ts.map +1 -1
  96. package/dist/runtime-api/routes/signals.schema.d.ts +0 -1
  97. package/dist/runtime-api/routes/signals.schema.d.ts.map +1 -1
  98. package/dist/runtime-api/routes/signals.schema.js +0 -5
  99. package/dist/runtime-api/routes/signals.schema.js.map +1 -1
  100. package/dist/scanners/external/liquidation-watchdog/README.md +107 -0
  101. package/dist/scanners/external/liquidation-watchdog/liquidation-watchdog.yaml +48 -0
  102. package/dist/scanners/external/liquidation-watchdog/producer.mjs +336 -0
  103. package/dist/scanners/external/momentum/README.md +148 -0
  104. package/dist/scanners/external/momentum/momentum.yaml +116 -0
  105. package/dist/scanners/external/momentum/producer.mjs +251 -0
  106. package/dist/scanners/external/scaffold/__main__.py +24 -65
  107. package/dist/scanners/external/scaffold/delivery.py +22 -56
  108. package/dist/scanners/external/scaffold/entrypoint_loader.py +48 -42
  109. package/dist/scanners/external/scaffold/journal.py +2 -13
  110. package/dist/scanners/external/scaffold/scaffold.py +128 -159
  111. package/dist/scanners/external/scaffold/signal_envelope.py +34 -177
  112. package/dist/scanners/external/shared/ingest.mjs +112 -0
  113. package/dist/scanners/external-scanner-receiver.d.ts +0 -6
  114. package/dist/scanners/external-scanner-receiver.d.ts.map +1 -1
  115. package/dist/scanners/external-scanner-receiver.js +1 -14
  116. package/dist/scanners/external-scanner-receiver.js.map +1 -1
  117. package/dist/scripts/run-dsl-standalone-live.d.ts +1 -1
  118. package/dist/scripts/run-dsl-standalone-live.js +3 -5
  119. package/dist/scripts/run-dsl-standalone-live.js.map +1 -1
  120. package/dist/senpi/client.d.ts +0 -12
  121. package/dist/senpi/client.d.ts.map +1 -1
  122. package/dist/senpi/client.js +2 -31
  123. package/dist/senpi/client.js.map +1 -1
  124. package/dist/state/state-manager.d.ts +0 -17
  125. package/dist/state/state-manager.d.ts.map +1 -1
  126. package/dist/state/state-manager.js +0 -28
  127. package/dist/state/state-manager.js.map +1 -1
  128. package/dist/strategy/strategy-state.d.ts.map +1 -1
  129. package/dist/strategy/strategy-state.js +1 -7
  130. package/dist/strategy/strategy-state.js.map +1 -1
  131. package/dist/tracking/constants.d.ts.map +1 -1
  132. package/dist/tracking/constants.js +0 -2
  133. package/dist/tracking/constants.js.map +1 -1
  134. package/dist/types/dsl/index.d.ts +1 -1
  135. package/dist/types/dsl/index.d.ts.map +1 -1
  136. package/dist/types/scanner.d.ts +0 -7
  137. package/dist/types/scanner.d.ts.map +1 -1
  138. package/examples/README.md +89 -0
  139. package/examples/scanners-consumer-quickstart.mjs +134 -0
  140. package/examples/scanners-emerging-movers-v4.mjs +287 -0
  141. package/examples/scanners-liquidation-watchdog.mjs +341 -0
  142. package/examples/scanners-live-mcp.mjs +208 -0
  143. package/examples/scanners-multi-strategy.mjs +165 -0
  144. package/examples/scanners-position-tracker-e2e.mjs +225 -0
  145. package/examples/scanners-scheduled-events.mjs +96 -0
  146. package/examples/scanners-senpi-provider-client.mjs +182 -0
  147. package/examples/scanners-single-strategy.mjs +198 -0
  148. package/examples/strategies/README.md +12 -17
  149. package/examples/strategies/dsl-showcase.yaml +68 -0
  150. package/examples/strategies/dsl.yaml +51 -0
  151. package/examples/strategies/fox-minimal-loosened.yaml +240 -0
  152. package/examples/strategies/fox-minimal.yaml +242 -0
  153. package/examples/strategies/minimal.yaml +46 -0
  154. package/examples/strategies/momentum/how-it-works.md +48 -0
  155. package/examples/strategies/momentum/momentum-guarded.yaml +161 -0
  156. package/examples/strategies/risk-showcase.yaml +93 -0
  157. package/examples/strategies/viper.yaml +67 -0
  158. package/examples/strategies/wolf.yaml +72 -0
  159. package/examples/yamls/sample-with-dsl-and-emerging-movers.yaml +123 -0
  160. package/package.json +1 -1
  161. package/dist/runtime/reconcile-decide.d.ts +0 -73
  162. package/dist/runtime/reconcile-decide.d.ts.map +0 -1
  163. package/dist/runtime/reconcile-decide.js +0 -166
  164. package/dist/runtime/reconcile-decide.js.map +0 -1
  165. package/dist/runtime/reconcile-run.d.ts +0 -62
  166. package/dist/runtime/reconcile-run.d.ts.map +0 -1
  167. package/dist/runtime/reconcile-run.js +0 -173
  168. package/dist/runtime/reconcile-run.js.map +0 -1
  169. package/dist/scanners/external/scaffold/ctx.py +0 -78
  170. package/dist/scanners/external/scaffold/requirements.txt +0 -11
  171. package/dist/scanners/external/scaffold/senpi_mcp.py +0 -250
  172. package/dist/scanners/external/scaffold/state_manager.py +0 -175
  173. package/dist/utils/keyed-mutex.d.ts +0 -37
  174. package/dist/utils/keyed-mutex.d.ts.map +0 -1
  175. package/dist/utils/keyed-mutex.js +0 -77
  176. package/dist/utils/keyed-mutex.js.map +0 -1
  177. package/examples/strategies/iguana/README.md +0 -135
  178. package/examples/strategies/iguana/recipe.yaml +0 -137
  179. package/examples/strategies/iguana/scanners/scan.py +0 -243
  180. package/examples/strategies/iguana/scanners/scoring.py +0 -152
  181. package/examples/strategies/raptor/README.md +0 -156
  182. package/examples/strategies/raptor/recipe.yaml +0 -154
  183. package/examples/strategies/raptor/scanners/scan.py +0 -349
  184. package/examples/strategies/raptor/scanners/scoring.py +0 -452
  185. package/examples/strategies/spider/README.md +0 -97
  186. package/examples/strategies/spider/scalp/recipe.yaml +0 -129
  187. package/examples/strategies/spider/scalp/scanners/scan.py +0 -219
  188. package/examples/strategies/spider/scalp/scanners/scoring.py +0 -179
  189. package/examples/strategies/spider/swing/recipe.yaml +0 -141
  190. package/examples/strategies/spider/swing/scanners/scan.py +0 -334
  191. package/examples/strategies/spider/swing/scanners/scoring.py +0 -184
  192. package/examples/strategies/turbine/README.md +0 -167
  193. package/examples/strategies/turbine/recipe-runners.yaml +0 -123
  194. package/examples/strategies/turbine/recipe-volume.yaml +0 -129
  195. package/examples/strategies/turbine/scanners/scan.py +0 -283
  196. package/examples/strategies/turbine/scanners/scoring.py +0 -190
@@ -0,0 +1,198 @@
1
+ import { mkdtemp, rm } from "node:fs/promises";
2
+ import { tmpdir } from "node:os";
3
+ import { join } from "node:path";
4
+ import {
5
+ createScannerRuntimeModule,
6
+ emergingMoversScanner,
7
+ momentumScanner,
8
+ oiTrackerScanner,
9
+ prescreenerScanner,
10
+ } from "../dist/scanners/index.js";
11
+
12
+ function createInstruments() {
13
+ return [
14
+ {
15
+ name: "BTC",
16
+ isDelisted: false,
17
+ maxLeverage: 10,
18
+ context: {
19
+ markPx: 106,
20
+ prevDayPx: 100,
21
+ midPx: 106,
22
+ dayNtlVlm: 80_000_000,
23
+ openInterest: 2_000_000_000,
24
+ funding: 0.001,
25
+ },
26
+ },
27
+ {
28
+ name: "ETH",
29
+ isDelisted: false,
30
+ maxLeverage: 8,
31
+ context: {
32
+ markPx: 101,
33
+ prevDayPx: 100,
34
+ midPx: 101,
35
+ dayNtlVlm: 40_000_000,
36
+ openInterest: 1_000_000_000,
37
+ funding: 0.001,
38
+ },
39
+ },
40
+ ];
41
+ }
42
+
43
+ function createCandles() {
44
+ return {
45
+ BTC: {
46
+ candles: {
47
+ "1h": [
48
+ {
49
+ timestamp: 1,
50
+ open: 100,
51
+ high: 102,
52
+ low: 99,
53
+ close: 100,
54
+ volume: 1000,
55
+ },
56
+ {
57
+ timestamp: 2,
58
+ open: 100,
59
+ high: 107,
60
+ low: 100,
61
+ close: 106,
62
+ volume: 1400,
63
+ },
64
+ ],
65
+ },
66
+ },
67
+ ETH: {
68
+ candles: {
69
+ "1h": [
70
+ {
71
+ timestamp: 1,
72
+ open: 100,
73
+ high: 101,
74
+ low: 99,
75
+ close: 100,
76
+ volume: 900,
77
+ },
78
+ {
79
+ timestamp: 2,
80
+ open: 100,
81
+ high: 101,
82
+ low: 99,
83
+ close: 100.4,
84
+ volume: 920,
85
+ },
86
+ ],
87
+ },
88
+ },
89
+ };
90
+ }
91
+
92
+ function createSmDataRun1() {
93
+ return [
94
+ {
95
+ token: "SOL",
96
+ direction: "up",
97
+ pctOfTopTradersGain: 0.18,
98
+ traderCount: 220,
99
+ tokenPriceChangePct4h: 2.1,
100
+ },
101
+ {
102
+ token: "AVAX",
103
+ direction: "up",
104
+ pctOfTopTradersGain: 0.16,
105
+ traderCount: 200,
106
+ tokenPriceChangePct4h: 1.9,
107
+ },
108
+ ];
109
+ }
110
+
111
+ function createSmDataRun2() {
112
+ return [
113
+ {
114
+ token: "AVAX",
115
+ direction: "up",
116
+ pctOfTopTradersGain: 0.17,
117
+ traderCount: 230,
118
+ tokenPriceChangePct4h: 2.0,
119
+ },
120
+ {
121
+ token: "SOL",
122
+ direction: "up",
123
+ pctOfTopTradersGain: 0.35,
124
+ traderCount: 250,
125
+ tokenPriceChangePct4h: 4.2,
126
+ },
127
+ ];
128
+ }
129
+
130
+ async function main() {
131
+ const stateDir = await mkdtemp(join(tmpdir(), "scanners-example-single-"));
132
+ let smDataRun = 0;
133
+
134
+ const module = createScannerRuntimeModule({
135
+ stateDir,
136
+ scanners: [prescreenerScanner, oiTrackerScanner, momentumScanner, emergingMoversScanner],
137
+ strategies: [
138
+ {
139
+ id: "alpha",
140
+ name: "Alpha",
141
+ scannerOverrides: {
142
+ momentum: {
143
+ config: {
144
+ timeframe: "1h",
145
+ minMovePct: 1.5,
146
+ maxCandidates: 10,
147
+ minDayVolume: 1_000_000,
148
+ minSignalScore: 0.2,
149
+ requirePrescreened: true,
150
+ },
151
+ },
152
+ "emerging-movers": {
153
+ config: {
154
+ topN: 10,
155
+ minRankJump: 1,
156
+ minTopTradersGain: 0.15,
157
+ minScansBeforeSignals: 2,
158
+ historyLimit: 30,
159
+ },
160
+ },
161
+ },
162
+ },
163
+ ],
164
+ providers: {
165
+ getInstruments: async () => createInstruments(),
166
+ getCandles: async () => createCandles(),
167
+ getSmData: async () => {
168
+ smDataRun += 1;
169
+ return smDataRun === 1 ? createSmDataRun1() : createSmDataRun2();
170
+ },
171
+ },
172
+ });
173
+
174
+ try {
175
+ await module.runOnce("alpha", "prescreener");
176
+ await module.runOnce("alpha", "oi-tracker");
177
+ const momentumResult = await module.runOnce("alpha", "momentum");
178
+ await module.runOnce("alpha", "emerging-movers");
179
+ const emergingResult = await module.runOnce("alpha", "emerging-movers");
180
+
181
+ const signals = await module.querySignals({
182
+ strategyId: "alpha",
183
+ limit: 20,
184
+ });
185
+
186
+ console.log("single-strategy: momentum signals =", momentumResult.signals.length);
187
+ console.log("single-strategy: emerging signals =", emergingResult.signals.length);
188
+ console.log("single-strategy: queried signals =", signals.length);
189
+ } finally {
190
+ await module.stop();
191
+ await rm(stateDir, { recursive: true, force: true });
192
+ }
193
+ }
194
+
195
+ main().catch((error) => {
196
+ console.error(error);
197
+ process.exit(1);
198
+ });
@@ -1,17 +1,12 @@
1
- # Strategy Examples
1
+ # Strategy Templates
2
2
 
3
- Four supervised **runtime-v2** strategies ship as worked examples. Each is a
4
- complete, validated recipe (`version: 2.0.0`) with its own supervised
5
- `scanners/scan.py` (the runtime spawns a scaffold child and calls
6
- `scan(inputs, ctx)` on `interval_seconds` — there is no producer/push model).
7
- Each has its own README with the full thesis, scanner shape, and DSL profile.
8
-
9
- | Strategy | Thesis | Recipe(s) | README |
10
- |----------|--------|-----------|--------|
11
- | **iguana** | XYZ macro index-trend — index-fund-style equity exposure on Hyperliquid, no stock-picking. Two indices, one decision per tick. | `iguana/recipe.yaml` | [iguana/README.md](iguana/README.md) |
12
- | **raptor** | Whale copy-follow — takes a currently-winning quality trader's highest-conviction position when smart money agrees. | `raptor/recipe.yaml` | [raptor/README.md](raptor/README.md) |
13
- | **turbine** | Funding-fade rotation — one shared signal, two recipes that differ only in sizing + DSL exit + risk (volume vs runners). | `turbine/recipe-volume.yaml`, `turbine/recipe-runners.yaml` | [turbine/README.md](turbine/README.md) |
14
- | **spider** | Two genuinely different legs on separate wallets: `swing` (tech/AI multi-day momentum) + `scalp` (macro/majors fast mean-reversion). | `spider/swing/recipe.yaml`, `spider/scalp/recipe.yaml` | [spider/README.md](spider/README.md) |
3
+ | File | Style | Scanners | Decision | Use case |
4
+ |------|-------|----------|----------|----------|
5
+ | minimal.yaml | Watch-only | emerging_movers | no_decision | Verify setup; no positions |
6
+ | wolf.yaml | Aggressive | emerging_movers | llm | Early entry on FIRST_JUMP |
7
+ | viper.yaml | Moderate | prescreener + momentum | llm | Candle-based breakouts |
8
+ | fox.yaml | OI-driven | prescreener + oi_tracker | no_decision | OI spike entries |
9
+ | dsl-showcase.yaml | DSL reference | emerging_movers | no_decision | Annotated exit config |
15
10
 
16
11
  ## Quickstart
17
12
 
@@ -20,16 +15,16 @@ Each has its own README with the full thesis, scanner shape, and DSL profile.
20
15
  openclaw plugins install @senpi-ai/runtime
21
16
  ```
22
17
 
23
- 2. Copy a recipe and fill in its wallet env var:
18
+ 2. Copy a template and fill in your wallet:
24
19
  ```bash
25
- cp iguana/recipe.yaml my-recipe.yaml
26
- # edit: set the strategy's wallet env var (iguana uses ${IGUANA_WALLET})
20
+ cp wolf.yaml my-recipe.yaml
21
+ # edit: replace ${WALLET_ADDRESS}
27
22
  ```
28
23
 
29
24
  3. Set environment variables:
30
25
  ```bash
31
26
  cp ../.env.example .env
32
- # edit: SENPI_API_KEY plus the recipe's wallet env var
27
+ # edit: SENPI_API_KEY, WALLET_ADDRESS
33
28
  source .env
34
29
  ```
35
30
 
@@ -0,0 +1,68 @@
1
+ # DSL showcase — every DSL field annotated for reference.
2
+ # Use as a copy-paste reference when tuning exit behavior.
3
+ name: dsl-showcase
4
+ version: 1.0.0
5
+ description: >
6
+ Annotated DSL exit config reference.
7
+ Onchain position tracker — monitors the strategy wallet on Hyperliquid
8
+ for position lifecycle events (open, close, edit, flip) and wires them
9
+ into the DSL exit engine for automated trailing stop-loss management.
10
+
11
+
12
+ notifications:
13
+ telegram_chat_id: "${TELEGRAM_CHAT_ID}"
14
+
15
+ strategy:
16
+ wallet: "${WALLET_ADDRESS}"
17
+ slots: 2
18
+ margin_pct: 15
19
+ trading_risk: conservative
20
+ enabled: true
21
+
22
+ # ── SCANNERS ──
23
+ scanners:
24
+ - name: position_tracker
25
+ type: position_tracker
26
+ interval: 10s
27
+
28
+ # ── ACTIONS ──
29
+ actions:
30
+ - name: position_tracker_action
31
+ action_type: POSITION_TRACKER
32
+ decision_mode: rule
33
+ scanners: [position_tracker]
34
+
35
+ exit:
36
+ engine: dsl
37
+ # interval_seconds — how often the price monitor runs
38
+ interval_seconds: 30
39
+ # order_type — execution method for DSL exit closes: MARKET (default) or FEE_OPTIMIZED_LIMIT
40
+ order_type: FEE_OPTIMIZED_LIMIT
41
+ # fee_optimized_limit_options — only used when order_type is FEE_OPTIMIZED_LIMIT
42
+ fee_optimized_limit_options:
43
+ ensure_execution_as_taker: true # fall back to market if maker doesn't fill
44
+ execution_timeout_seconds: 15 # seconds to wait for maker fill (default 45)
45
+ # dsl_preset — single exit profile (required for DslPlugin).
46
+ dsl_preset:
47
+ hard_timeout:
48
+ enabled: true
49
+ interval_in_minutes: 360
50
+ weak_peak_cut:
51
+ enabled: true
52
+ interval_in_minutes: 120
53
+ min_value: 5
54
+ dead_weight_cut:
55
+ enabled: true
56
+ interval_in_minutes: 5
57
+ phase1:
58
+ enabled: true
59
+ max_loss_pct: 4.0
60
+ retrace_threshold: 7
61
+ consecutive_breaches_required: 1
62
+ phase2:
63
+ enabled: true
64
+ tiers:
65
+ - { trigger_pct: 7, lock_hw_pct: 40 }
66
+ - { trigger_pct: 12, lock_hw_pct: 55 }
67
+ - { trigger_pct: 15, lock_hw_pct: 75 }
68
+ - { trigger_pct: 20, lock_hw_pct: 85 }
@@ -0,0 +1,51 @@
1
+ name: position-tracker
2
+ version: 1.0.0
3
+ description: >
4
+ Onchain position tracker — monitors the strategy wallet on Hyperliquid
5
+ for position lifecycle events (open, close, edit, flip) and wires them
6
+ into the DSL exit engine for automated trailing stop-loss management.
7
+
8
+ # ── STRATEGY ──
9
+ # Minimal: only wallet address + optional fields (no slots/margin needed for watch-only)
10
+ strategy:
11
+ wallet: "${WALLET_ADDRESS}"
12
+ enabled: true
13
+
14
+ # ── SCANNERS ──
15
+ scanners:
16
+ - name: position_tracker
17
+ type: position_tracker
18
+ interval: 10s
19
+
20
+ # ── ACTIONS ──
21
+ actions:
22
+ - name: position_tracker_action
23
+ action_type: POSITION_TRACKER
24
+ decision_mode: rule
25
+ scanners: [position_tracker]
26
+
27
+ # ── EXIT (DSL) ──
28
+ exit:
29
+ engine: dsl
30
+ interval_seconds: 30
31
+ order_type: FEE_OPTIMIZED_LIMIT
32
+ fee_optimized_limit_options:
33
+ ensure_execution_as_taker: true
34
+ execution_timeout_seconds: 15
35
+ dsl_preset:
36
+ phase1:
37
+ enabled: true
38
+ max_loss_pct: 3.0
39
+ retrace_threshold: 7
40
+ consecutive_breaches_required: 3
41
+ phase2:
42
+ enabled: true
43
+ tiers:
44
+ - { trigger_pct: 7, lock_hw_pct: 40 }
45
+ - { trigger_pct: 12, lock_hw_pct: 55 }
46
+ - { trigger_pct: 15, lock_hw_pct: 75 }
47
+ - { trigger_pct: 20, lock_hw_pct: 85 }
48
+
49
+ # ── NOTIFICATIONS ──
50
+ notifications:
51
+ telegram_chat_id: "${TELEGRAM_CHAT_ID}"
@@ -0,0 +1,240 @@
1
+ name: fox-minimal-loosened
2
+ version: 1.0.0
3
+ description: >
4
+ FOX v1.6 — loosened configuration for functional evaluation.
5
+ Scanner thresholds relaxed, LLM gauntlet simplified, and slots increased
6
+ to maximize signal volume. NOT for live trading.
7
+
8
+ notifications:
9
+ telegram_chat_id: "${TELEGRAM_CHAT_ID}"
10
+
11
+ strategy:
12
+ wallet: "${FOX_WALLET}"
13
+ slots: 3
14
+ margin_pct: 10
15
+ trading_risk: aggressive
16
+ enabled: true
17
+
18
+ scanners:
19
+ # References in depends_on/actions use these scanner names, not the built-in types.
20
+ # ── Primary signal: emerging movers (every 60s, faster for eval) ──
21
+ - name: emerging_movers
22
+ type: emerging_movers
23
+ interval: 60s
24
+ depends_on:
25
+ - scanner: market_regime
26
+ required: false
27
+ max_age: 2h
28
+ on_missing: degrade
29
+ on_stale: degrade
30
+ blocked_assets: []
31
+ config:
32
+ topN: 100
33
+ minRankJump: 2
34
+ minTopTradersGain: 0.02
35
+ minScansBeforeSignals: 1
36
+ historyLimit: 60
37
+ immediateJumpThreshold: 5
38
+ deepClimbRankThreshold: 40
39
+ contribExplosionMultiplier: 1.5
40
+ contribAccelThreshold: 0.001
41
+ minVelocityForDeepClimber: 0.0001
42
+ erraticReversalThreshold: 10
43
+ climbStreakScans: 2
44
+ rankClimbThreshold: 2
45
+ firstJumpMinPrevRank: 15
46
+ minLeverage: 2
47
+ blacklist: []
48
+
49
+ # ── Macro context: BTC+ETH regime classification (every 4h) ──
50
+ - name: market_regime
51
+ type: market_regime
52
+ interval: 14400s
53
+ config:
54
+ btcWeight: 0.6
55
+ ethWeight: 0.4
56
+ emaFast: 9
57
+ emaSlow: 21
58
+ neutralThreshold: 0.3
59
+
60
+ # ── SM conviction reversal detection (every 5 min) ──
61
+ - name: sm_flip
62
+ type: sm_flip
63
+ interval: 300s
64
+ config:
65
+ minConviction: 4
66
+
67
+ # ── Margin safety net (every 5 min) ──
68
+ - name: watchdog
69
+ type: liquidation_watchdog
70
+ interval: 300s
71
+ config:
72
+ bufferWarningPct: 50
73
+ bufferCriticalPct: 30
74
+ liqDistanceWarningPct: 30
75
+ roeDangerPct: -15
76
+
77
+ # ── Infrastructure: prescreener for opportunity scanner (every 60s) ──
78
+ - name: prescreener
79
+ type: prescreener
80
+ interval: 60s
81
+ config:
82
+ topN: 50
83
+ minDayVolume: 200000
84
+ minLeverage: 2
85
+ minOpenInterest: 0
86
+
87
+ # ── Secondary deep scan: 4-pillar opportunity scoring (every 10 min) ──
88
+ - name: opportunity
89
+ type: opportunity
90
+ interval: 600s
91
+ depends_on:
92
+ - scanner: prescreener
93
+ required: true
94
+ max_age: 5m
95
+ - scanner: market_regime
96
+ required: false
97
+ max_age: 4h
98
+ on_missing: degrade
99
+ on_stale: degrade
100
+ config:
101
+ minCompositeScore: 30
102
+ maxCandidates: 30
103
+ minDayVolume: 200000
104
+
105
+ actions:
106
+ # ── Entry: LLM relaxed filter on emerging mover signals ──
107
+ - name: fox_entry
108
+ action_type: OPEN_POSITION
109
+ decision_mode: llm
110
+ decision_model: ${DECISION_MODEL}
111
+ scanners: [emerging_movers]
112
+ min_confidence: 4
113
+ params:
114
+ order_type: FEE_OPTIMIZED_LIMIT
115
+ fee_optimized_limit_options:
116
+ ensure_execution_as_taker: true
117
+ execution_timeout_seconds: 15
118
+ context:
119
+ - type: signal
120
+ scanner: emerging_movers
121
+ - type: context
122
+ scanner: market_regime
123
+ decision_prompt: |
124
+ You are the FOX v1.6 entry filter in EVALUATION MODE. Evaluate emerging mover
125
+ signals with relaxed thresholds to maximize signal throughput for functional testing.
126
+
127
+ SIGNAL DATA:
128
+ {{emerging_movers}}
129
+
130
+ MARKET REGIME:
131
+ {{regime}}
132
+
133
+ ═══ LAYER 1: SIGNAL DETECTION (relaxed) ═══
134
+ - Must have at least one of: FIRST_JUMP, IMMEDIATE_MOVER, DEEP_CLIMBER, CONTRIB_EXPLOSION
135
+ - rankJumpThisScan ≥ 5 OR contribVelocity > 5
136
+ - Asset at #1-5 for 3+ scans → SKIP (move is over)
137
+
138
+ ═══ LAYER 2: SCORING (minimum 4 points) ═══
139
+ FIRST_JUMP: +3
140
+ IMMEDIATE_MOVER: +2
141
+ contribVelocity > 5: +2
142
+ CONTRIB_EXPLOSION: +2
143
+ DEEP_CLIMBER: +1
144
+ RANK_UP: +1
145
+ CLIMBING: +1
146
+ ACCEL: +1
147
+ STREAK: +1
148
+ BTC 1h bias aligned: +1
149
+
150
+ Minimum requirements: score ≥ 4, reasons ≥ 2, contribVelocity > 2
151
+
152
+ ═══ LAYER 3: VELOCITY & PRICE ACTION (relaxed) ═══
153
+ - Negative velocity without any jump reason → SKIP
154
+ - Any positive velocity is sufficient for all signal types
155
+ - Erratic rank history → SKIP only if no strong reason (FIRST_JUMP/CONTRIB_EXPLOSION)
156
+
157
+ ═══ LAYER 4: LEVERAGE & ASSET CHECKS (relaxed) ═══
158
+ - Max leverage for asset must be ≥ 2x
159
+ - XYZ equities: ignore trader count, use leverageType "ISOLATED" and dex "xyz"
160
+ - ≥ 5 SM traders required (crypto only, waived for XYZ)
161
+
162
+ ═══ LAYER 5: MARKET REGIME (relaxed) ═══
163
+ - BEARISH: prefer SHORT, but LONG allowed if score ≥ 6
164
+ - BULLISH: prefer LONG, but SHORT allowed if score ≥ 6
165
+ - NEUTRAL or stale: both directions allowed
166
+
167
+ ═══ ROTATION (slots full + new signal) ═══
168
+ - Weakest position has negative ROE → CUT and ENTER new
169
+ - Weakest has positive ROE or SM conviction 3+ → HOLD
170
+ - Never rotate positions younger than 5 minutes
171
+
172
+ ═══ ANTI-PATTERNS (hard blocks) ═══
173
+ - Rank #1-5 for 3+ scans → move is over
174
+ - Burned/blacklisted asset → SKIP
175
+
176
+ Respond:
177
+ {
178
+ "execute": true/false,
179
+ "actionType": "OPEN_POSITION",
180
+ "confidence": 1-10,
181
+ "reasoning": "one sentence",
182
+ "payload": {
183
+ "signals": [
184
+ { "asset": "<ticker>", "direction": "LONG" or "SHORT", "reason": "one sentence", "rotate_out": "<asset_to_cut>", "leverage": "<optional number>", "margin": "<optional $ amount>" }
185
+ ]
186
+ }
187
+ }
188
+
189
+ # ── SM flip: immediate close on conviction reversal ──
190
+ - name: sm_flip_close
191
+ action_type: CLOSE_POSITION
192
+ decision_mode: rule
193
+ scanners: [sm_flip]
194
+ min_confidence: 1
195
+ params:
196
+ order_type: FEE_OPTIMIZED_LIMIT
197
+ fee_optimized_limit_options:
198
+ ensure_execution_as_taker: true
199
+ execution_timeout_seconds: 10
200
+
201
+ # ── Watchdog: emergency close on margin danger ──
202
+ - name: watchdog_close
203
+ action_type: CLOSE_POSITION
204
+ decision_mode: rule
205
+ scanners: [watchdog]
206
+ min_confidence: 1
207
+ params:
208
+ order_type: MARKET
209
+
210
+ # ── DSL — trailing exit
211
+ exit:
212
+ engine: dsl
213
+ interval_seconds: 30
214
+ order_type: FEE_OPTIMIZED_LIMIT
215
+ fee_optimized_limit_options:
216
+ ensure_execution_as_taker: true
217
+ execution_timeout_seconds: 15
218
+ dsl_preset:
219
+ hard_timeout:
220
+ enabled: false
221
+ interval_in_minutes: 360
222
+ weak_peak_cut:
223
+ enabled: false
224
+ interval_in_minutes: 120
225
+ min_value: 5
226
+ dead_weight_cut:
227
+ enabled: false
228
+ interval_in_minutes: 60
229
+ phase1:
230
+ enabled: true
231
+ max_loss_pct: 4.0
232
+ retrace_threshold: 3.0
233
+ consecutive_breaches_required: 1
234
+ phase2:
235
+ enabled: true
236
+ tiers:
237
+ - { trigger_pct: 7, lock_hw_pct: 40 }
238
+ - { trigger_pct: 12, lock_hw_pct: 55 }
239
+ - { trigger_pct: 15, lock_hw_pct: 75 }
240
+ - { trigger_pct: 20, lock_hw_pct: 85 }