hedgequantx 2.9.151 → 2.9.152
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.
- package/package.json +1 -1
- package/src/lib/smart-logs-engine.js +309 -380
package/package.json
CHANGED
|
@@ -1,436 +1,365 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* =============================================================================
|
|
5
|
-
* Professional algorithmic trading logging engine
|
|
6
|
-
* - Institutional-grade market microstructure analysis
|
|
7
|
-
* - Strategy-adaptive message generation
|
|
8
|
-
* - Non-repetitive rotation with 50+ messages per context
|
|
2
|
+
* Smart Logs Engine - Institutional HFT Terminal
|
|
3
|
+
* Professional hedge fund terminology with extensive message variety
|
|
9
4
|
*/
|
|
10
5
|
|
|
11
6
|
'use strict';
|
|
12
7
|
|
|
13
8
|
const chalk = require('chalk');
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
// ENGINE CONFIGURATION
|
|
17
|
-
// =============================================================================
|
|
10
|
+
const CONFIG = { MAX_RECENT: 80, SESSION_LOG_INTERVAL: 10 };
|
|
18
11
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
const SYMBOLS = {
|
|
13
|
+
NQ: 'NQ', MNQ: 'MNQ', ES: 'ES', MES: 'MES', YM: 'YM', MYM: 'MYM',
|
|
14
|
+
CL: 'CL', MCL: 'MCL', GC: 'GC', MGC: 'MGC', SI: 'SI', SIL: 'SIL',
|
|
15
|
+
RTY: 'RTY', M2K: 'M2K', ZB: 'ZB', ZN: 'ZN',
|
|
22
16
|
};
|
|
23
17
|
|
|
18
|
+
function getSym(s) {
|
|
19
|
+
if (!s) return 'FUT';
|
|
20
|
+
const b = s.split(':')[0].replace(/[FGHJKMNQUVXZ]\d{1,2}$/, '').toUpperCase();
|
|
21
|
+
return SYMBOLS[b] || b;
|
|
22
|
+
}
|
|
24
23
|
|
|
24
|
+
function pick(arr) { return arr[Math.floor(Math.random() * arr.length)]; }
|
|
25
25
|
|
|
26
26
|
// =============================================================================
|
|
27
|
-
//
|
|
27
|
+
// HQX-2B: LIQUIDITY SWEEP STRATEGY
|
|
28
28
|
// =============================================================================
|
|
29
29
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
'Microstructure pattern forming',
|
|
146
|
-
'Quantitative signal developing',
|
|
147
|
-
'Multi-factor alignment in progress',
|
|
148
|
-
'Entry criteria approaching threshold',
|
|
149
|
-
'Statistical anomaly probability high',
|
|
150
|
-
],
|
|
151
|
-
ready: [
|
|
152
|
-
'Z-Score threshold breached - signal active',
|
|
153
|
-
'VPIN spike confirmed - toxic flow detected',
|
|
154
|
-
'Order flow imbalance confirmed - entry valid',
|
|
155
|
-
'Statistical edge threshold exceeded',
|
|
156
|
-
'Multi-factor consensus achieved - execute',
|
|
157
|
-
'Microstructure signal confirmed',
|
|
158
|
-
'Volatility regime optimal for entry',
|
|
159
|
-
'Tick imbalance ratio at extreme',
|
|
160
|
-
'Mean reversion entry criteria met',
|
|
161
|
-
'Cross-factor alignment confirmed',
|
|
162
|
-
'Execution window open - signal hot',
|
|
163
|
-
'Signal-to-noise ratio optimal',
|
|
164
|
-
'Statistical threshold exceeded',
|
|
165
|
-
'Factor model confidence maximum',
|
|
166
|
-
'Edge detection confirmed - entry',
|
|
167
|
-
'Microstructure pattern validated',
|
|
168
|
-
'Quantitative signal triggered',
|
|
169
|
-
'Multi-factor entry criteria satisfied',
|
|
170
|
-
'Statistical anomaly confirmed',
|
|
171
|
-
'HFT-grade entry opportunity active',
|
|
172
|
-
],
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
};
|
|
30
|
+
const HQX2B = {
|
|
31
|
+
building: (d) => pick([
|
|
32
|
+
`[${d.sym}] Microstructure scan | ${d.bars} bars | ${d.swings} swing pivots | Zone mapping active`,
|
|
33
|
+
`[${d.sym}] Order block detection | ${d.ticks} ticks | Institutional footprint analysis`,
|
|
34
|
+
`[${d.sym}] Liquidity topology build | ${d.swings} pivots | Stop cluster identification`,
|
|
35
|
+
`[${d.sym}] Structure analysis | ${d.bars} OHLC | Delta profile: ${d.delta > 0 ? '+' : ''}${d.delta}`,
|
|
36
|
+
`[${d.sym}] Sweep zone calibration | ${d.ticks} tick sample | ${d.swings} swing nodes`,
|
|
37
|
+
`[${d.sym}] Institutional level mapping | ${d.bars} bars processed | Awaiting zone formation`,
|
|
38
|
+
`[${d.sym}] Market structure parse | ${d.swings} pivots detected | Liquidity map loading`,
|
|
39
|
+
`[${d.sym}] Price action decomposition | ${d.ticks} ticks | Swing point extraction`,
|
|
40
|
+
`[${d.sym}] DOM reconstruction | ${d.ticks} ticks | Depth analysis initializing`,
|
|
41
|
+
`[${d.sym}] Volume profile build | ${d.bars} bars | POC/VAH/VAL computation`,
|
|
42
|
+
`[${d.sym}] Iceberg detection scan | ${d.ticks} tick flow | Hidden liquidity search`,
|
|
43
|
+
`[${d.sym}] Stop cluster triangulation | ${d.swings} swings | Sweep target identification`,
|
|
44
|
+
`[${d.sym}] Auction theory analysis | ${d.bars} bars | Value area computation`,
|
|
45
|
+
`[${d.sym}] Order flow calibration | ${d.ticks} ticks | Aggressor tagging active`,
|
|
46
|
+
`[${d.sym}] Footprint initialization | ${d.bars} bars | Delta/volume decomposition`,
|
|
47
|
+
`[${d.sym}] Swing structure mapping | ${d.swings} pivots | HH/HL/LH/LL detection`,
|
|
48
|
+
`[${d.sym}] Liquidity heatmap build | ${d.ticks} observations | Cluster density calc`,
|
|
49
|
+
`[${d.sym}] Market profile loading | ${d.bars} TPOs | Distribution analysis`,
|
|
50
|
+
`[${d.sym}] Absorption scan | ${d.ticks} ticks | Passive order detection`,
|
|
51
|
+
`[${d.sym}] Momentum calibration | ${d.bars} bars | Velocity/acceleration calc`,
|
|
52
|
+
]),
|
|
53
|
+
|
|
54
|
+
zones: (d) => pick([
|
|
55
|
+
`[${d.sym}] ${d.price} | ${d.zones} liquidity zones active | Sweep probability elevated`,
|
|
56
|
+
`[${d.sym}] ${d.price} | Stop cluster proximity | ${d.zones} institutional levels in range`,
|
|
57
|
+
`[${d.sym}] Zone convergence | ${d.zones} sweep targets | OFI: ${d.delta > 0 ? '+' : ''}${d.delta}`,
|
|
58
|
+
`[${d.sym}] ${d.price} | Liquidity pool vulnerable | ${d.zones} zones | Monitoring penetration`,
|
|
59
|
+
`[${d.sym}] Institutional zone active | ${d.zones} levels | ${d.swings} swing confirmation`,
|
|
60
|
+
`[${d.sym}] ${d.price} | ${d.zones} stop clusters mapped | Sweep trigger watch`,
|
|
61
|
+
`[${d.sym}] ${d.price} | High volume node proximity | ${d.zones} zones defended`,
|
|
62
|
+
`[${d.sym}] Resting liquidity detected | ${d.zones} pools | ${d.price} approach vector`,
|
|
63
|
+
`[${d.sym}] ${d.price} | ${d.zones} absorption zones | Delta: ${d.delta > 0 ? '+' : ''}${d.delta}`,
|
|
64
|
+
`[${d.sym}] Stop hunt proximity | ${d.zones} targets | Price: ${d.price}`,
|
|
65
|
+
`[${d.sym}] ${d.price} | Iceberg cluster ${d.zones} levels | Sweep imminent`,
|
|
66
|
+
`[${d.sym}] Liquidity vacuum ahead | ${d.zones} zones | Acceleration expected`,
|
|
67
|
+
`[${d.sym}] ${d.price} | ${d.zones} institutional traps | OFI shift monitoring`,
|
|
68
|
+
`[${d.sym}] POC rejection zone | ${d.price} | ${d.zones} confluences active`,
|
|
69
|
+
`[${d.sym}] ${d.price} | Value area boundary | ${d.zones} levels | Breakout watch`,
|
|
70
|
+
`[${d.sym}] Delta divergence @ ${d.price} | ${d.zones} zones | Reversal setup`,
|
|
71
|
+
`[${d.sym}] ${d.price} | Trapped traders ${d.zones} levels | Squeeze potential`,
|
|
72
|
+
`[${d.sym}] Order block test | ${d.price} | ${d.zones} institutional zones`,
|
|
73
|
+
`[${d.sym}] ${d.price} | Liquidity grab zone | ${d.zones} stops vulnerable`,
|
|
74
|
+
`[${d.sym}] Fair value gap ${d.price} | ${d.zones} imbalances | Fill expected`,
|
|
75
|
+
]),
|
|
76
|
+
|
|
77
|
+
bull: (d) => pick([
|
|
78
|
+
`[${d.sym}] ${d.price} | OFI: +${Math.abs(d.delta)} | Bid absorption | Shorts vulnerable`,
|
|
79
|
+
`[${d.sym}] ${d.price} | Delta +${Math.abs(d.delta)} | Institutional bid | ${d.zones} support zones`,
|
|
80
|
+
`[${d.sym}] Bullish microstructure | OFI +${Math.abs(d.delta)} | Stop hunt below pending`,
|
|
81
|
+
`[${d.sym}] ${d.price} | Positive delta divergence | Offer exhaustion detected`,
|
|
82
|
+
`[${d.sym}] ${d.price} | Buy imbalance +${Math.abs(d.delta)} | ${d.zones} zones defended`,
|
|
83
|
+
`[${d.sym}] Bid stack reinforcement | Delta +${Math.abs(d.delta)} | Sweep below imminent`,
|
|
84
|
+
`[${d.sym}] ${d.price} | Aggressive buyers | OFI +${Math.abs(d.delta)} | Momentum building`,
|
|
85
|
+
`[${d.sym}] Sell absorption complete | ${d.price} | Delta: +${Math.abs(d.delta)} | Longs loading`,
|
|
86
|
+
`[${d.sym}] ${d.price} | Bullish order flow | +${Math.abs(d.delta)} delta | Shorts trapped`,
|
|
87
|
+
`[${d.sym}] Passive bid detected | ${d.price} | OFI: +${Math.abs(d.delta)} | Accumulation`,
|
|
88
|
+
`[${d.sym}] ${d.price} | Offer depletion | Delta +${Math.abs(d.delta)} | Breakout setup`,
|
|
89
|
+
`[${d.sym}] Institutional buying | ${d.price} | +${Math.abs(d.delta)} imbalance | Trend continuation`,
|
|
90
|
+
`[${d.sym}] ${d.price} | Bullish footprint | OFI +${Math.abs(d.delta)} | ${d.zones} zones held`,
|
|
91
|
+
`[${d.sym}] Buy program detected | ${d.price} | Delta: +${Math.abs(d.delta)} | Momentum`,
|
|
92
|
+
`[${d.sym}] ${d.price} | Positive tick | +${Math.abs(d.delta)} OFI | Upside acceleration`,
|
|
93
|
+
`[${d.sym}] Short squeeze setup | ${d.price} | Delta +${Math.abs(d.delta)} | Covering expected`,
|
|
94
|
+
`[${d.sym}] ${d.price} | Bid aggression | OFI: +${Math.abs(d.delta)} | Offers lifted`,
|
|
95
|
+
`[${d.sym}] Bullish absorption | ${d.price} | +${Math.abs(d.delta)} delta | Continuation`,
|
|
96
|
+
`[${d.sym}] ${d.price} | Buy pressure | Delta: +${Math.abs(d.delta)} | Resistance test`,
|
|
97
|
+
`[${d.sym}] Demand zone active | ${d.price} | OFI +${Math.abs(d.delta)} | Support confirmed`,
|
|
98
|
+
]),
|
|
99
|
+
|
|
100
|
+
bear: (d) => pick([
|
|
101
|
+
`[${d.sym}] ${d.price} | OFI: ${d.delta} | Offer absorption | Longs vulnerable`,
|
|
102
|
+
`[${d.sym}] ${d.price} | Delta ${d.delta} | Institutional offer | ${d.zones} resistance zones`,
|
|
103
|
+
`[${d.sym}] Bearish microstructure | OFI ${d.delta} | Stop hunt above pending`,
|
|
104
|
+
`[${d.sym}] ${d.price} | Negative delta divergence | Bid exhaustion detected`,
|
|
105
|
+
`[${d.sym}] ${d.price} | Sell imbalance ${d.delta} | ${d.zones} zones pressured`,
|
|
106
|
+
`[${d.sym}] Offer stack reinforcement | Delta ${d.delta} | Sweep above imminent`,
|
|
107
|
+
`[${d.sym}] ${d.price} | Aggressive sellers | OFI ${d.delta} | Momentum building`,
|
|
108
|
+
`[${d.sym}] Buy absorption complete | ${d.price} | Delta: ${d.delta} | Shorts loading`,
|
|
109
|
+
`[${d.sym}] ${d.price} | Bearish order flow | ${d.delta} delta | Longs trapped`,
|
|
110
|
+
`[${d.sym}] Passive offer detected | ${d.price} | OFI: ${d.delta} | Distribution`,
|
|
111
|
+
`[${d.sym}] ${d.price} | Bid depletion | Delta ${d.delta} | Breakdown setup`,
|
|
112
|
+
`[${d.sym}] Institutional selling | ${d.price} | ${d.delta} imbalance | Trend continuation`,
|
|
113
|
+
`[${d.sym}] ${d.price} | Bearish footprint | OFI ${d.delta} | ${d.zones} zones failed`,
|
|
114
|
+
`[${d.sym}] Sell program detected | ${d.price} | Delta: ${d.delta} | Momentum`,
|
|
115
|
+
`[${d.sym}] ${d.price} | Negative tick | ${d.delta} OFI | Downside acceleration`,
|
|
116
|
+
`[${d.sym}] Long squeeze setup | ${d.price} | Delta ${d.delta} | Liquidation expected`,
|
|
117
|
+
`[${d.sym}] ${d.price} | Offer aggression | OFI: ${d.delta} | Bids hit`,
|
|
118
|
+
`[${d.sym}] Bearish absorption | ${d.price} | ${d.delta} delta | Continuation`,
|
|
119
|
+
`[${d.sym}] ${d.price} | Sell pressure | Delta: ${d.delta} | Support test`,
|
|
120
|
+
`[${d.sym}] Supply zone active | ${d.price} | OFI ${d.delta} | Resistance confirmed`,
|
|
121
|
+
]),
|
|
122
|
+
|
|
123
|
+
neutral: (d) => pick([
|
|
124
|
+
`[${d.sym}] ${d.price} | Delta neutral | Bilateral liquidity | Sweep catalyst pending`,
|
|
125
|
+
`[${d.sym}] ${d.price} | OFI balanced | ${d.zones} zones intact | Range compression`,
|
|
126
|
+
`[${d.sym}] Equilibrium @ ${d.price} | Stops accumulating both sides | ${d.ticks} ticks`,
|
|
127
|
+
`[${d.sym}] ${d.price} | No directional flow | ${d.zones} liquidity pools stable`,
|
|
128
|
+
`[${d.sym}] Range consolidation | ${d.price} | Awaiting institutional catalyst`,
|
|
129
|
+
`[${d.sym}] ${d.price} | Balanced book | ${d.zones} zones | Breakout + sweep imminent`,
|
|
130
|
+
`[${d.sym}] ${d.price} | Rotation mode | OFI flat | ${d.zones} levels holding`,
|
|
131
|
+
`[${d.sym}] Chop zone | ${d.price} | Delta: ${d.delta} | No edge detected`,
|
|
132
|
+
`[${d.sym}] ${d.price} | Two-sided flow | ${d.zones} zones | Expansion pending`,
|
|
133
|
+
`[${d.sym}] Value area rotation | ${d.price} | Balanced auction | ${d.ticks} ticks`,
|
|
134
|
+
`[${d.sym}] ${d.price} | Inside bar structure | ${d.zones} zones | Coiling`,
|
|
135
|
+
`[${d.sym}] Consolidation | ${d.price} | OFI: ${d.delta} | Range-bound`,
|
|
136
|
+
`[${d.sym}] ${d.price} | Balanced delta | Awaiting volume | ${d.zones} zones`,
|
|
137
|
+
`[${d.sym}] Low conviction | ${d.price} | Delta neutral | Patience mode`,
|
|
138
|
+
`[${d.sym}] ${d.price} | Tight range | ${d.zones} zones | Volatility compression`,
|
|
139
|
+
`[${d.sym}] Mean reversion zone | ${d.price} | No trend | ${d.ticks} ticks`,
|
|
140
|
+
`[${d.sym}] ${d.price} | Symmetric flow | ${d.zones} liquidity balanced`,
|
|
141
|
+
`[${d.sym}] Absorption both sides | ${d.price} | OFI: ${d.delta} | Standoff`,
|
|
142
|
+
`[${d.sym}] ${d.price} | Bracket forming | ${d.zones} levels | Expansion watch`,
|
|
143
|
+
`[${d.sym}] Balance area | ${d.price} | No aggression | ${d.ticks} ticks observed`,
|
|
144
|
+
]),
|
|
176
145
|
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
'
|
|
184
|
-
'
|
|
185
|
-
'
|
|
186
|
-
'
|
|
187
|
-
'
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
'Signal probability rising',
|
|
192
|
-
'Setup conditions developing',
|
|
193
|
-
'Entry criteria approaching',
|
|
194
|
-
'Pattern formation in progress',
|
|
195
|
-
],
|
|
196
|
-
ready: [
|
|
197
|
-
'Entry signal confirmed',
|
|
198
|
-
'Setup criteria satisfied',
|
|
199
|
-
'Execution window active',
|
|
200
|
-
'Signal validation complete',
|
|
201
|
-
'Entry conditions met',
|
|
202
|
-
],
|
|
146
|
+
ready: (d) => {
|
|
147
|
+
const side = d.delta > 0 ? 'LONG' : d.delta < 0 ? 'SHORT' : 'REVERSAL';
|
|
148
|
+
return pick([
|
|
149
|
+
`${chalk.green('■')} [${d.sym}] SWEEP EXECUTED @ ${d.price} | ${d.zones} stops triggered | ${side} SIGNAL`,
|
|
150
|
+
`${chalk.green('■')} [${d.sym}] 2B CONFIRMED | Liquidity taken @ ${d.price} | OFI shift | EXECUTE ${side}`,
|
|
151
|
+
`${chalk.green('■')} [${d.sym}] INSTITUTIONAL TRAP @ ${d.price} | Zone rejection | ${side} ENTRY`,
|
|
152
|
+
`${chalk.green('■')} [${d.sym}] STOP HUNT COMPLETE | ${d.price} | Delta reversal | ${side} TRIGGER`,
|
|
153
|
+
`${chalk.green('■')} [${d.sym}] LIQUIDITY GRAB @ ${d.price} | ${d.zones} zones swept | ${side} ACTIVE`,
|
|
154
|
+
`${chalk.green('■')} [${d.sym}] ZONE PENETRATION | ${d.price} | OFI: ${d.delta} | EXECUTE ${side}`,
|
|
155
|
+
`${chalk.green('■')} [${d.sym}] TRAP REVERSAL @ ${d.price} | Stops taken | ${side} CONFIRMED`,
|
|
156
|
+
`${chalk.green('■')} [${d.sym}] SWEEP COMPLETE | ${d.zones} levels hit @ ${d.price} | ${side}`,
|
|
157
|
+
`${chalk.green('■')} [${d.sym}] BREAKOUT FAILURE @ ${d.price} | Reversal confirmed | ${side} SIGNAL`,
|
|
158
|
+
`${chalk.green('■')} [${d.sym}] FALSE BREAK @ ${d.price} | Liquidity swept | TRIGGER ${side}`,
|
|
159
|
+
]);
|
|
203
160
|
},
|
|
204
161
|
};
|
|
205
162
|
|
|
206
163
|
// =============================================================================
|
|
207
|
-
//
|
|
164
|
+
// QUANT: STATISTICAL ARBITRAGE
|
|
208
165
|
// =============================================================================
|
|
209
166
|
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
// Russell
|
|
234
|
-
RTY: { name: 'RTY', floor: 'Russell', asset: 'index', slang: 'small caps' },
|
|
235
|
-
M2K: { name: 'M2K', floor: 'Micro Russell', asset: 'index', slang: 'micro russell' },
|
|
236
|
-
// Default
|
|
237
|
-
DEFAULT: { name: 'Contract', floor: 'Futures', asset: 'futures', slang: 'contract' }
|
|
238
|
-
};
|
|
167
|
+
const QUANT = {
|
|
168
|
+
building: (d) => pick([
|
|
169
|
+
`[${d.sym}] Factor model calibration | ${d.ticks} observations | Z-score baseline`,
|
|
170
|
+
`[${d.sym}] VPIN computation | ${d.ticks} tick volume | Toxicity threshold loading`,
|
|
171
|
+
`[${d.sym}] OFI model update | ${d.bars} bars | Imbalance coefficient: ${d.delta}`,
|
|
172
|
+
`[${d.sym}] Statistical baseline | ${d.ticks} samples | Multi-factor initialization`,
|
|
173
|
+
`[${d.sym}] Microstructure model | ${d.ticks} ticks | Kyle lambda estimation`,
|
|
174
|
+
`[${d.sym}] Tick imbalance scan | ${d.bars} bars | Factor weights calibrating`,
|
|
175
|
+
`[${d.sym}] Covariance matrix build | ${d.ticks} observations | PCA decomposition`,
|
|
176
|
+
`[${d.sym}] Volatility clustering | ${d.bars} bars | GARCH initialization`,
|
|
177
|
+
`[${d.sym}] Return distribution fit | ${d.ticks} samples | Tail risk calibration`,
|
|
178
|
+
`[${d.sym}] Cross-correlation scan | ${d.bars} bars | Lead-lag detection`,
|
|
179
|
+
`[${d.sym}] Mean reversion test | ${d.ticks} ticks | Half-life estimation`,
|
|
180
|
+
`[${d.sym}] Information ratio calc | ${d.bars} bars | Alpha extraction`,
|
|
181
|
+
`[${d.sym}] Regime detection | ${d.ticks} samples | HMM state probability`,
|
|
182
|
+
`[${d.sym}] Spread decomposition | ${d.bars} bars | Fair value model`,
|
|
183
|
+
`[${d.sym}] Momentum factor | ${d.ticks} ticks | Signal extraction`,
|
|
184
|
+
`[${d.sym}] Liquidity measure | ${d.bars} bars | Amihud ratio computation`,
|
|
185
|
+
`[${d.sym}] Autocorrelation test | ${d.ticks} samples | Serial dependence`,
|
|
186
|
+
`[${d.sym}] Kurtosis estimation | ${d.bars} bars | Fat tail adjustment`,
|
|
187
|
+
`[${d.sym}] Beta calibration | ${d.ticks} ticks | Systematic risk model`,
|
|
188
|
+
`[${d.sym}] Sharpe estimation | ${d.bars} bars | Risk-adjusted return`,
|
|
189
|
+
]),
|
|
239
190
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
191
|
+
zones: (d) => {
|
|
192
|
+
const z = (Math.abs(d.delta) / 8).toFixed(2);
|
|
193
|
+
return pick([
|
|
194
|
+
`[${d.sym}] ${d.price} | Z: ${z}σ | VPIN elevated | ${d.zones} factors converging`,
|
|
195
|
+
`[${d.sym}] ${d.price} | Statistical edge forming | Z-score: ${z}σ | OFI: ${d.delta}`,
|
|
196
|
+
`[${d.sym}] Factor alignment | ${d.zones}/${d.zones + 2} criteria | Threshold proximity`,
|
|
197
|
+
`[${d.sym}] ${d.price} | Multi-factor consensus: ${d.zones} | Z: ${z}σ approaching`,
|
|
198
|
+
`[${d.sym}] Edge probability rising | Z: ${z}σ | VPIN: elevated | OFI: ${d.delta}`,
|
|
199
|
+
`[${d.sym}] ${d.price} | Regime shift detected | ${d.zones} factors | Z: ${z}σ`,
|
|
200
|
+
`[${d.sym}] Information ratio spike | ${d.price} | ${d.zones} signals converging`,
|
|
201
|
+
`[${d.sym}] ${d.price} | Alpha opportunity | Z: ${z}σ | Mispricing detected`,
|
|
202
|
+
`[${d.sym}] Signal strength: ${d.zones}/5 | ${d.price} | Z approaching ${z}σ`,
|
|
203
|
+
`[${d.sym}] ${d.price} | Factor model alert | ${d.zones} criteria met | Z: ${z}σ`,
|
|
204
|
+
`[${d.sym}] Convergence detected | ${d.price} | OFI: ${d.delta} | Threshold: ${z}σ`,
|
|
205
|
+
`[${d.sym}] ${d.price} | Statistical tension | ${d.zones} factors | Snap expected`,
|
|
206
|
+
`[${d.sym}] Edge forming @ ${d.price} | Z: ${z}σ | ${d.zones} confirmations`,
|
|
207
|
+
`[${d.sym}] ${d.price} | Model confidence rising | ${d.zones} factors aligned`,
|
|
208
|
+
`[${d.sym}] Fair value divergence | ${d.price} | Z: ${z}σ | Reversion setup`,
|
|
209
|
+
]);
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
bull: (d) => {
|
|
213
|
+
const z = (Math.abs(d.delta) / 8).toFixed(2);
|
|
214
|
+
return pick([
|
|
215
|
+
`[${d.sym}] ${d.price} | Z: +${z}σ | OFI: +${Math.abs(d.delta)} | BUY edge detected`,
|
|
216
|
+
`[${d.sym}] ${d.price} | VPIN buy signal | Toxic sell absorbed | Delta: +${Math.abs(d.delta)}`,
|
|
217
|
+
`[${d.sym}] Statistical long | Z: +${z}σ | Mean reversion BUY | ${d.ticks} tick confirm`,
|
|
218
|
+
`[${d.sym}] ${d.price} | Factor model: LONG | OFI/VPIN/Z aligned | Positive expectancy`,
|
|
219
|
+
`[${d.sym}] Microstructure bullish | Z: +${z}σ | Order toxicity clearing`,
|
|
220
|
+
`[${d.sym}] ${d.price} | Positive alpha | Z: +${z}σ | Long bias confirmed`,
|
|
221
|
+
`[${d.sym}] Momentum factor bullish | ${d.price} | OFI: +${Math.abs(d.delta)} | Signal: BUY`,
|
|
222
|
+
`[${d.sym}] ${d.price} | Information ratio: positive | Z: +${z}σ | Long edge`,
|
|
223
|
+
`[${d.sym}] Mean below price | ${d.price} | Z: +${z}σ | Bullish regime`,
|
|
224
|
+
`[${d.sym}] ${d.price} | Buy signal confidence | Delta: +${Math.abs(d.delta)} | Z: +${z}σ`,
|
|
225
|
+
`[${d.sym}] Regime: bullish | ${d.price} | OFI: +${Math.abs(d.delta)} | Factor aligned`,
|
|
226
|
+
`[${d.sym}] ${d.price} | Positive skew | Z: +${z}σ | Upside distribution`,
|
|
227
|
+
`[${d.sym}] Alpha extraction: long | ${d.price} | OFI/Z positive | Execute`,
|
|
228
|
+
`[${d.sym}] ${d.price} | Model output: BUY | Z: +${z}σ | ${d.zones} factors`,
|
|
229
|
+
`[${d.sym}] Statistical momentum | ${d.price} | Delta: +${Math.abs(d.delta)} | Bullish`,
|
|
230
|
+
]);
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
bear: (d) => {
|
|
234
|
+
const z = (Math.abs(d.delta) / 8).toFixed(2);
|
|
235
|
+
return pick([
|
|
236
|
+
`[${d.sym}] ${d.price} | Z: -${z}σ | OFI: ${d.delta} | SELL edge detected`,
|
|
237
|
+
`[${d.sym}] ${d.price} | VPIN sell signal | Toxic buy absorbed | Delta: ${d.delta}`,
|
|
238
|
+
`[${d.sym}] Statistical short | Z: -${z}σ | Mean reversion SELL | ${d.ticks} tick confirm`,
|
|
239
|
+
`[${d.sym}] ${d.price} | Factor model: SHORT | OFI/VPIN/Z aligned | Negative expectancy`,
|
|
240
|
+
`[${d.sym}] Microstructure bearish | Z: -${z}σ | Order toxicity rising`,
|
|
241
|
+
`[${d.sym}] ${d.price} | Negative alpha | Z: -${z}σ | Short bias confirmed`,
|
|
242
|
+
`[${d.sym}] Momentum factor bearish | ${d.price} | OFI: ${d.delta} | Signal: SELL`,
|
|
243
|
+
`[${d.sym}] ${d.price} | Information ratio: negative | Z: -${z}σ | Short edge`,
|
|
244
|
+
`[${d.sym}] Mean above price | ${d.price} | Z: -${z}σ | Bearish regime`,
|
|
245
|
+
`[${d.sym}] ${d.price} | Sell signal confidence | Delta: ${d.delta} | Z: -${z}σ`,
|
|
246
|
+
`[${d.sym}] Regime: bearish | ${d.price} | OFI: ${d.delta} | Factor aligned`,
|
|
247
|
+
`[${d.sym}] ${d.price} | Negative skew | Z: -${z}σ | Downside distribution`,
|
|
248
|
+
`[${d.sym}] Alpha extraction: short | ${d.price} | OFI/Z negative | Execute`,
|
|
249
|
+
`[${d.sym}] ${d.price} | Model output: SELL | Z: -${z}σ | ${d.zones} factors`,
|
|
250
|
+
`[${d.sym}] Statistical momentum | ${d.price} | Delta: ${d.delta} | Bearish`,
|
|
251
|
+
]);
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
neutral: (d) => pick([
|
|
255
|
+
`[${d.sym}] ${d.price} | Z: 0σ | OFI: neutral | No statistical edge | HOLD`,
|
|
256
|
+
`[${d.sym}] ${d.price} | VPIN: normal | Factors inconclusive | Awaiting signal`,
|
|
257
|
+
`[${d.sym}] Factor model: FLAT | Z/VPIN/OFI within bounds | ${d.ticks} ticks`,
|
|
258
|
+
`[${d.sym}] ${d.price} | No alpha detected | Statistical threshold not met`,
|
|
259
|
+
`[${d.sym}] Microstructure neutral | No toxic flow | Edge probability: LOW`,
|
|
260
|
+
`[${d.sym}] ${d.price} | Model output: FLAT | Insufficient signal strength`,
|
|
261
|
+
`[${d.sym}] Regime: uncertain | ${d.price} | Factors divergent | No trade`,
|
|
262
|
+
`[${d.sym}] ${d.price} | Z within bounds | OFI: ${d.delta} | No edge`,
|
|
263
|
+
`[${d.sym}] Fair value @ ${d.price} | No mispricing | ${d.ticks} observations`,
|
|
264
|
+
`[${d.sym}] ${d.price} | Information ratio: flat | No alpha opportunity`,
|
|
265
|
+
`[${d.sym}] Statistical noise | ${d.price} | Delta: ${d.delta} | No signal`,
|
|
266
|
+
`[${d.sym}] ${d.price} | Model confidence: LOW | Factors unconverged`,
|
|
267
|
+
`[${d.sym}] Mean reversion pause | ${d.price} | Z centered | Waiting`,
|
|
268
|
+
`[${d.sym}] ${d.price} | No regime detected | OFI balanced | HOLD`,
|
|
269
|
+
`[${d.sym}] Factor equilibrium | ${d.price} | No edge | ${d.ticks} ticks`,
|
|
270
|
+
]),
|
|
271
|
+
|
|
272
|
+
ready: (d) => {
|
|
273
|
+
const side = d.delta > 0 ? 'LONG' : 'SHORT';
|
|
274
|
+
const z = (Math.abs(d.delta) / 8).toFixed(2);
|
|
275
|
+
return pick([
|
|
276
|
+
`${chalk.green('■')} [${d.sym}] Z-SCORE BREACH | ${z}σ @ ${d.price} | EXECUTE ${side}`,
|
|
277
|
+
`${chalk.green('■')} [${d.sym}] FACTOR CONSENSUS | OFI: ${d.delta} | ${side} SIGNAL @ ${d.price}`,
|
|
278
|
+
`${chalk.green('■')} [${d.sym}] STATISTICAL TRIGGER | VPIN spike | Z: ${z}σ | ${side} ENTRY`,
|
|
279
|
+
`${chalk.green('■')} [${d.sym}] ALPHA DETECTED | ${d.price} | Multi-factor ${side} | EXECUTE`,
|
|
280
|
+
`${chalk.green('■')} [${d.sym}] REGIME CONFIRMED | Z: ${z}σ | ${side} @ ${d.price}`,
|
|
281
|
+
`${chalk.green('■')} [${d.sym}] MODEL SIGNAL | Factor alignment | ${side} TRIGGER | ${d.price}`,
|
|
282
|
+
`${chalk.green('■')} [${d.sym}] THRESHOLD BREACH | OFI: ${d.delta} | EXECUTE ${side} @ ${d.price}`,
|
|
283
|
+
`${chalk.green('■')} [${d.sym}] MEAN REVERSION | Z: ${z}σ | ${side} CONFIRMED | ${d.price}`,
|
|
284
|
+
`${chalk.green('■')} [${d.sym}] EDGE CONFIRMED | ${d.price} | ${side} | Expectancy: +`,
|
|
285
|
+
`${chalk.green('■')} [${d.sym}] FACTOR SIGNAL | Z: ${z}σ | OFI: ${d.delta} | ${side} ACTIVE`,
|
|
286
|
+
]);
|
|
287
|
+
},
|
|
288
|
+
};
|
|
247
289
|
|
|
248
290
|
// =============================================================================
|
|
249
|
-
//
|
|
291
|
+
// ENGINE
|
|
250
292
|
// =============================================================================
|
|
251
293
|
|
|
252
294
|
class SmartLogsEngine {
|
|
253
295
|
constructor(strategyId, symbol) {
|
|
254
|
-
this.strategyId = strategyId || '
|
|
255
|
-
this.
|
|
256
|
-
this.symbol = getSymbolProfile(symbol);
|
|
257
|
-
this.recent = new Map();
|
|
296
|
+
this.strategyId = strategyId || 'hqx-2b';
|
|
297
|
+
this.symbolCode = symbol;
|
|
258
298
|
this.counter = 0;
|
|
299
|
+
this.recent = [];
|
|
259
300
|
}
|
|
260
301
|
|
|
261
|
-
|
|
262
|
-
setSymbol(symbol) {
|
|
263
|
-
this.symbol = getSymbolProfile(symbol);
|
|
264
|
-
}
|
|
302
|
+
setSymbol(s) { this.symbolCode = s; }
|
|
265
303
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
304
|
+
_phase(st) {
|
|
305
|
+
if (st.setupForming && st.zones > 0) return 'ready';
|
|
306
|
+
if (st.zones > 0 || st.swings >= 2) return 'zones';
|
|
307
|
+
return 'building';
|
|
269
308
|
}
|
|
270
309
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
if (available.length === 0) {
|
|
278
|
-
used = [];
|
|
279
|
-
available = pool;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
const msg = available[Math.floor(Math.random() * available.length)];
|
|
283
|
-
used.push(msg);
|
|
284
|
-
if (used.length > CONFIG.MAX_RECENT) used.shift();
|
|
285
|
-
this.recent.set(key, used);
|
|
286
|
-
|
|
310
|
+
_unique(gen, d) {
|
|
311
|
+
let msg, i = 0;
|
|
312
|
+
do { msg = gen(d); i++; } while (this.recent.includes(msg) && i < 15);
|
|
313
|
+
this.recent.push(msg);
|
|
314
|
+
if (this.recent.length > CONFIG.MAX_RECENT) this.recent.shift();
|
|
287
315
|
return msg;
|
|
288
316
|
}
|
|
289
317
|
|
|
290
|
-
/** Determine strategy phase from state */
|
|
291
|
-
_phase(state) {
|
|
292
|
-
const { bars = 0, swings = 0, zones = 0, setupForming = false } = state;
|
|
293
|
-
if (setupForming && zones > 0) return 'ready';
|
|
294
|
-
if (zones > 0 || swings >= 2) return 'scanning';
|
|
295
|
-
return 'building';
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Generate HFT-grade log with REAL market data embedded in PRO phrases
|
|
300
|
-
* @param {Object} state - Market/strategy state with real data
|
|
301
|
-
* @returns {Object} { type, message, logToSession }
|
|
302
|
-
*/
|
|
303
318
|
getLog(state = {}) {
|
|
304
319
|
this.counter++;
|
|
305
|
-
const {
|
|
306
|
-
|
|
307
|
-
price = 0, lastPrice = 0, bid = 0, ask = 0,
|
|
308
|
-
delta = 0, buyPct = 50, ticksPerSec = 0, tickCount = 0, volume = 0
|
|
309
|
-
} = state;
|
|
320
|
+
const { trend = 'neutral', position = 0, zones = 0, swings = 0, bars = 0,
|
|
321
|
+
price = 0, delta = 0, buyPct = 50, tickCount = 0 } = state;
|
|
310
322
|
|
|
311
323
|
const phase = this._phase(state);
|
|
312
|
-
const
|
|
313
|
-
const
|
|
314
|
-
const
|
|
324
|
+
const bull = trend === 'bullish' || buyPct > 55;
|
|
325
|
+
const bear = trend === 'bearish' || buyPct < 45;
|
|
326
|
+
const T = this.strategyId === 'hqx-2b' ? HQX2B : QUANT;
|
|
327
|
+
|
|
328
|
+
const d = {
|
|
329
|
+
sym: getSym(this.symbolCode),
|
|
330
|
+
price: price > 0 ? price.toFixed(2) : '-.--',
|
|
331
|
+
delta, zones, swings, bars,
|
|
332
|
+
ticks: tickCount > 1000 ? `${(tickCount/1000).toFixed(0)}k` : String(tickCount),
|
|
333
|
+
};
|
|
315
334
|
|
|
316
|
-
// Position active
|
|
317
335
|
if (position !== 0) {
|
|
318
336
|
const side = position > 0 ? 'LONG' : 'SHORT';
|
|
337
|
+
const pnl = (position > 0 && delta > 0) || (position < 0 && delta < 0) ? 'FAVOR' : 'ADVERSE';
|
|
319
338
|
return {
|
|
320
339
|
type: 'trade',
|
|
321
|
-
message: `▶ ${side}
|
|
340
|
+
message: `▶ [${d.sym}] ${side} ACTIVE @ ${d.price} | OFI: ${delta > 0 ? '+' : ''}${delta} | Flow: ${pnl}`,
|
|
322
341
|
logToSession: this.counter % CONFIG.SESSION_LOG_INTERVAL === 0
|
|
323
342
|
};
|
|
324
343
|
}
|
|
325
344
|
|
|
326
|
-
//
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
345
|
+
// Priority: ready > building > bull/bear > zones > neutral
|
|
346
|
+
let gen, type;
|
|
347
|
+
if (phase === 'ready') { gen = T.ready; type = 'signal'; }
|
|
348
|
+
else if (phase === 'building') { gen = T.building; type = 'system'; }
|
|
349
|
+
else if (bull) { gen = T.bull; type = 'bullish'; }
|
|
350
|
+
else if (bear) { gen = T.bear; type = 'bearish'; }
|
|
351
|
+
else if (phase === 'zones') { gen = T.zones; type = 'analysis'; }
|
|
352
|
+
else { gen = T.neutral; type = 'analysis'; }
|
|
330
353
|
|
|
331
|
-
return {
|
|
354
|
+
return {
|
|
355
|
+
type,
|
|
356
|
+
message: this._unique(gen, d),
|
|
357
|
+
logToSession: this.counter % CONFIG.SESSION_LOG_INTERVAL === 0
|
|
358
|
+
};
|
|
332
359
|
}
|
|
333
360
|
|
|
334
|
-
|
|
335
|
-
_getTemplates(state, phase, p, isBull, isBear) {
|
|
336
|
-
const { zones = 0, swings = 0, bars = 0, delta = 0, buyPct = 50, ticksPerSec = 0, tickCount = 0, bid = 0, ask = 0 } = state;
|
|
337
|
-
const s = this.symbol; // Symbol profile
|
|
338
|
-
const isHQX2B = this.strategyId === 'hqx-2b';
|
|
339
|
-
|
|
340
|
-
// Computed metrics
|
|
341
|
-
const spd = (ask > 0 && bid > 0) ? ((ask - bid) * 4).toFixed(0) : '1';
|
|
342
|
-
const d = delta > 0 ? `+${delta}` : `${delta}`;
|
|
343
|
-
const ofi = (delta * 1.3).toFixed(0);
|
|
344
|
-
const vpin = (0.4 + Math.abs(50 - buyPct) / 100).toFixed(2);
|
|
345
|
-
const tps = ticksPerSec || Math.max(1, Math.floor(tickCount / 30));
|
|
346
|
-
const zs = ((buyPct - 50) / 15).toFixed(1);
|
|
347
|
-
const imb = buyPct.toFixed(0);
|
|
348
|
-
|
|
349
|
-
// Colored elements
|
|
350
|
-
const P = chalk.yellow(p); // Price
|
|
351
|
-
const S = chalk.white.bold(s.floor); // Symbol floor name
|
|
352
|
-
const SL = chalk.gray(s.slang); // Symbol slang
|
|
353
|
-
const D = delta > 0 ? chalk.cyan(`δ${d}`) : delta < 0 ? chalk.magenta(`δ${d}`) : chalk.gray(`δ${d}`);
|
|
354
|
-
const OFI = delta > 0 ? chalk.cyan(`OFI ${ofi}`) : chalk.magenta(`OFI ${ofi}`);
|
|
355
|
-
const VPIN = chalk.yellow(`VPIN ${vpin}`);
|
|
356
|
-
const ZS = chalk.yellow(`Z ${zs}σ`);
|
|
357
|
-
const IMB = isBull ? chalk.cyan(`${imb}%`) : isBear ? chalk.magenta(`${imb}%`) : chalk.gray(`${imb}%`);
|
|
358
|
-
|
|
359
|
-
const t = [];
|
|
360
|
-
|
|
361
|
-
// === HQX-2B: Liquidity Sweep Strategy ===
|
|
362
|
-
if (isHQX2B) {
|
|
363
|
-
if (phase === 'ready' && zones > 0) {
|
|
364
|
-
t.push({ type: 'signal', message: `${chalk.green.bold('SWEEP')} ${S} ${P} | ${zones} stops triggered | Reversal confirmed` });
|
|
365
|
-
t.push({ type: 'signal', message: `${chalk.green.bold('2B TRAP')} ${SL} ${P} | Retail hunted | ${swings} pivots` });
|
|
366
|
-
t.push({ type: 'signal', message: `${chalk.green.bold('GRAB')} ${S} ${P} | ${zones} zones swept | Institutional reversal` });
|
|
367
|
-
} else if (phase === 'scanning' && zones > 0) {
|
|
368
|
-
t.push({ type: 'analysis', message: `${S} ${P} approaching liquidity | ${zones} clusters mapped | Sweep imminent` });
|
|
369
|
-
t.push({ type: 'analysis', message: `Stop hunt setup ${SL} ${P} | ${swings} swings | Watching penetration` });
|
|
370
|
-
t.push({ type: 'analysis', message: `${S} zone test at ${P} | ${zones} targets | Monitoring rejection` });
|
|
371
|
-
} else if (isBull) {
|
|
372
|
-
t.push({ type: 'bullish', message: `${S} ${P} bid absorption | ${D} | Stops below being hunted` });
|
|
373
|
-
t.push({ type: 'bullish', message: `${SL} liquidity building at ${P} | Sweep setup forming | ${swings} pivots` });
|
|
374
|
-
t.push({ type: 'bullish', message: `Institutional bid ${S} ${P} | ${OFI} | Retail shorts trapped` });
|
|
375
|
-
t.push({ type: 'bullish', message: `${S} false breakdown at ${P} | ${D} | Smart money buying dip` });
|
|
376
|
-
} else if (isBear) {
|
|
377
|
-
t.push({ type: 'bearish', message: `${S} ${P} offer absorption | ${D} | Stops above being hunted` });
|
|
378
|
-
t.push({ type: 'bearish', message: `${SL} liquidity building at ${P} | Sweep setup forming | ${swings} pivots` });
|
|
379
|
-
t.push({ type: 'bearish', message: `Institutional offer ${S} ${P} | ${OFI} | Retail longs trapped` });
|
|
380
|
-
t.push({ type: 'bearish', message: `${S} false breakout at ${P} | ${D} | Smart money selling rally` });
|
|
381
|
-
} else {
|
|
382
|
-
t.push({ type: 'system', message: `Mapping ${S} structure at ${P} | ${bars} bars | ${swings} swings` });
|
|
383
|
-
t.push({ type: 'system', message: `${SL} scanning zones at ${P} | ${tickCount} ticks | Detecting clusters` });
|
|
384
|
-
t.push({ type: 'analysis', message: `${S} ${P} consolidating | ${D} | Liquidity pooling at extremes` });
|
|
385
|
-
t.push({ type: 'analysis', message: `${SL} range at ${P} | Stops accumulating | Sweep pending` });
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
// === ULTRA-SCALPING: Quant/Stats Strategy ===
|
|
389
|
-
else {
|
|
390
|
-
if (phase === 'ready') {
|
|
391
|
-
t.push({ type: 'signal', message: `${chalk.green.bold('EDGE')} ${S} ${P} | ${ZS} breach | ${VPIN} | Execute` });
|
|
392
|
-
t.push({ type: 'signal', message: `${chalk.green.bold('TRIGGER')} ${SL} ${P} | Multi-factor consensus | ${OFI}` });
|
|
393
|
-
t.push({ type: 'signal', message: `${chalk.green.bold('ALPHA')} ${S} ${P} | Model convergence | ${D} | Entry` });
|
|
394
|
-
} else if (phase === 'scanning') {
|
|
395
|
-
t.push({ type: 'analysis', message: `${S} ${P} factors building | ${ZS} | Threshold proximity` });
|
|
396
|
-
t.push({ type: 'analysis', message: `${SL} edge forming at ${P} | ${VPIN} | Monitoring` });
|
|
397
|
-
t.push({ type: 'analysis', message: `Statistical setup ${S} ${P} | ${OFI} | Alignment ${IMB}` });
|
|
398
|
-
} else if (isBull) {
|
|
399
|
-
t.push({ type: 'bullish', message: `${S} ${P} heavy paper bid | ${D} | ${VPIN} rising` });
|
|
400
|
-
t.push({ type: 'bullish', message: `${SL} ${P} ${ZS} bullish | ${OFI} | Mean reversion long` });
|
|
401
|
-
t.push({ type: 'bullish', message: `${S} momentum ${P} | ${IMB} buy | Quant signal building` });
|
|
402
|
-
} else if (isBear) {
|
|
403
|
-
t.push({ type: 'bearish', message: `${S} ${P} heavy paper offer | ${D} | ${VPIN} rising` });
|
|
404
|
-
t.push({ type: 'bearish', message: `${SL} ${P} ${ZS} bearish | ${OFI} | Mean reversion short` });
|
|
405
|
-
t.push({ type: 'bearish', message: `${S} momentum ${P} | ${IMB} sell | Quant signal building` });
|
|
406
|
-
} else {
|
|
407
|
-
t.push({ type: 'system', message: `Calibrating ${S} models at ${P} | ${bars} bars | Computing factors` });
|
|
408
|
-
t.push({ type: 'system', message: `${SL} tick analysis at ${P} | ${tickCount} samples | ${tps} tps` });
|
|
409
|
-
t.push({ type: 'analysis', message: `${S} ${P} neutral | ${ZS} | ${VPIN} | Awaiting edge` });
|
|
410
|
-
t.push({ type: 'analysis', message: `${SL} range at ${P} | ${D} | Statistical mean reversion` });
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
return t;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/** Reset for new session */
|
|
418
|
-
reset() {
|
|
419
|
-
this.recent.clear();
|
|
420
|
-
this.counter = 0;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// =============================================================================
|
|
425
|
-
// FACTORY & EXPORTS
|
|
426
|
-
// =============================================================================
|
|
427
|
-
|
|
428
|
-
function createEngine(strategyId, symbol) {
|
|
429
|
-
return new SmartLogsEngine(strategyId, symbol);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
function getStrategies() {
|
|
433
|
-
return Object.entries(STRATEGIES).map(([id, s]) => ({ id, name: s.name, desc: s.desc }));
|
|
361
|
+
reset() { this.recent = []; this.counter = 0; }
|
|
434
362
|
}
|
|
435
363
|
|
|
436
|
-
|
|
364
|
+
function createEngine(strategyId, symbol) { return new SmartLogsEngine(strategyId, symbol); }
|
|
365
|
+
module.exports = { SmartLogsEngine, createEngine, CONFIG };
|