hedgequantx 2.9.100 → 2.9.102

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.9.100",
3
+ "version": "2.9.102",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -254,7 +254,7 @@ const RISK_BLOCKED_MESSAGES = [
254
254
  ];
255
255
 
256
256
  // =============================================================================
257
- // MESSAGE POOLS - Status
257
+ // MESSAGE POOLS - Status (GENERIC - used when no strategy specified)
258
258
  // =============================================================================
259
259
 
260
260
  const SCANNING_MESSAGES = [
@@ -288,6 +288,93 @@ const WAITING_MESSAGES = [
288
288
  'Awaiting confluence...',
289
289
  ];
290
290
 
291
+ // =============================================================================
292
+ // STRATEGY-SPECIFIC MESSAGES: HQX Scalping (ultra-scalping)
293
+ // Based on: Z-Score, VPIN, Kyle Lambda, Kalman Filter, Volatility, OFI
294
+ // =============================================================================
295
+
296
+ const SCALPING_SCANNING_MESSAGES = [
297
+ 'Running {flow:Z-Score} model on tick data...',
298
+ 'Computing {flow:VPIN} toxicity levels...',
299
+ 'Analyzing {flow:Kyle Lambda} price impact...',
300
+ 'Updating {flow:Kalman} filter estimates...',
301
+ 'Evaluating {flow:volatility} regime...',
302
+ 'Processing {flow:OFI} order flow imbalance...',
303
+ 'Multi-model consensus analysis...',
304
+ 'Statistical edge detection active...',
305
+ 'Quantitative signals processing...',
306
+ 'Factor model evaluation running...',
307
+ 'Microstructure analysis in progress...',
308
+ 'Real-time model calibration...',
309
+ 'Cross-model signal validation...',
310
+ 'Tick-by-tick factor computation...',
311
+ 'HFT-grade signal processing...',
312
+ ];
313
+
314
+ const SCALPING_WAITING_MESSAGES = [
315
+ 'Models aligned - awaiting threshold...',
316
+ 'Factor scores computing...',
317
+ '{flow:Z-Score} neutral - monitoring...',
318
+ '{flow:VPIN} within normal range...',
319
+ 'Awaiting model consensus...',
320
+ 'Statistical edge not yet present...',
321
+ 'Factors inconclusive - standby...',
322
+ 'Model convergence pending...',
323
+ 'Signal threshold not reached...',
324
+ 'Quantitative filters active...',
325
+ ];
326
+
327
+ // =============================================================================
328
+ // STRATEGY-SPECIFIC MESSAGES: HQX-2B Liquidity Sweep (hqx-2b)
329
+ // Based on: Swing detection, Liquidity zones, Sweep patterns
330
+ // =============================================================================
331
+
332
+ const SWEEP_SCANNING_MESSAGES = [
333
+ 'Scanning for {action:liquidity sweep}...',
334
+ 'Monitoring {zone:swing} point development...',
335
+ 'Detecting {zone:liquidity zones}...',
336
+ 'Watching for {action:stop hunt} patterns...',
337
+ 'Analyzing {zone:support/resistance} levels...',
338
+ 'Tracking {inst:institutional} liquidity...',
339
+ 'Monitoring for {action:false breakout}...',
340
+ 'Scanning {zone:order blocks}...',
341
+ 'Detecting {zone:imbalance zones}...',
342
+ 'Watching {zone:swing highs/lows}...',
343
+ 'Analyzing {action:sweep} quality...',
344
+ 'Monitoring zone {action:penetration}...',
345
+ 'Tracking liquidity {zone:pools}...',
346
+ 'Scanning for {action:rejection} candles...',
347
+ 'Evaluating {zone:zone} touch count...',
348
+ ];
349
+
350
+ const SWEEP_WAITING_MESSAGES = [
351
+ 'Waiting for {action:sweep} confirmation...',
352
+ 'Zone intact - awaiting {action:penetration}...',
353
+ 'Ready for {action:liquidity sweep}...',
354
+ 'Monitoring for zone {action:rejection}...',
355
+ 'Awaiting {zone:zone} test...',
356
+ 'Pending - no {action:sweep} detected...',
357
+ '{zone:Zones} mapped - watching price...',
358
+ 'Liquidity {zone:pool} identified - standby...',
359
+ 'Awaiting {action:false breakout} trigger...',
360
+ '{zone:Swing} structure forming...',
361
+ ];
362
+
363
+ // =============================================================================
364
+ // STRATEGY MESSAGE MAP
365
+ // =============================================================================
366
+
367
+ const STRATEGY_MESSAGES = {
368
+ 'ultra-scalping': {
369
+ scanning: SCALPING_SCANNING_MESSAGES,
370
+ waiting: SCALPING_WAITING_MESSAGES,
371
+ },
372
+ 'hqx-2b': {
373
+ scanning: SWEEP_SCANNING_MESSAGES,
374
+ waiting: SWEEP_WAITING_MESSAGES,
375
+ },
376
+ };
377
+
291
378
  // =============================================================================
292
379
  // MESSAGE POOLS - Data Flow
293
380
  // =============================================================================
@@ -366,4 +453,10 @@ module.exports = {
366
453
  TICK_FLOW_MESSAGES,
367
454
  BUILDING_BARS_MESSAGES,
368
455
  MODEL_ANALYSIS_MESSAGES,
456
+ // Strategy-specific
457
+ STRATEGY_MESSAGES,
458
+ SCALPING_SCANNING_MESSAGES,
459
+ SCALPING_WAITING_MESSAGES,
460
+ SWEEP_SCANNING_MESSAGES,
461
+ SWEEP_WAITING_MESSAGES,
369
462
  };
@@ -34,8 +34,33 @@ const {
34
34
  TICK_FLOW_MESSAGES,
35
35
  BUILDING_BARS_MESSAGES,
36
36
  MODEL_ANALYSIS_MESSAGES,
37
+ STRATEGY_MESSAGES,
37
38
  } = require('./smart-logs-messages');
38
39
 
40
+ // Current strategy ID for context-aware messages
41
+ let currentStrategyId = null;
42
+
43
+ /**
44
+ * Set the current strategy for context-aware messages
45
+ * @param {string} strategyId - 'ultra-scalping' or 'hqx-2b'
46
+ */
47
+ function setStrategy(strategyId) {
48
+ currentStrategyId = strategyId;
49
+ }
50
+
51
+ /**
52
+ * Get strategy-specific message pool or fallback to generic
53
+ */
54
+ function getStrategyPool(type, genericPool) {
55
+ if (currentStrategyId && STRATEGY_MESSAGES[currentStrategyId]) {
56
+ const strategyPool = STRATEGY_MESSAGES[currentStrategyId][type];
57
+ if (strategyPool && strategyPool.length > 0) {
58
+ return strategyPool;
59
+ }
60
+ }
61
+ return genericPool;
62
+ }
63
+
39
64
  // Track recently used messages to avoid repetition
40
65
  const recentMessages = new Map();
41
66
  const MAX_RECENT = 8;
@@ -166,8 +191,10 @@ function getRiskCheckLog(passed, reason) {
166
191
  }
167
192
 
168
193
  function getScanningLog(isScanning = true) {
169
- const pool = isScanning ? SCANNING_MESSAGES : WAITING_MESSAGES;
170
- const category = isScanning ? 'scanning' : 'waiting';
194
+ // Use strategy-specific messages if available
195
+ const genericPool = isScanning ? SCANNING_MESSAGES : WAITING_MESSAGES;
196
+ const pool = getStrategyPool(isScanning ? 'scanning' : 'waiting', genericPool);
197
+ const category = isScanning ? `scanning_${currentStrategyId || 'generic'}` : `waiting_${currentStrategyId || 'generic'}`;
171
198
  const message = getVariedMessage(category, pool, isScanning ? 'Scanning...' : 'Waiting...');
172
199
  return { message };
173
200
  }
@@ -233,4 +260,5 @@ module.exports = {
233
260
  getModelAnalysisLog,
234
261
  getPositionUpdateLog,
235
262
  getPriceChangeLog,
263
+ setStrategy,
236
264
  };
@@ -73,6 +73,9 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
73
73
  const strategy = new StrategyClass({ tickSize });
74
74
  strategy.initialize(contractId, tickSize);
75
75
 
76
+ // Set strategy for context-aware smart logs
77
+ smartLogs.setStrategy(strategyId);
78
+
76
79
  strategy.on('log', (log) => {
77
80
  const type = log.type === 'debug' ? 'debug' : log.type === 'info' ? 'analysis' : 'system';
78
81
  ui.addLog(type, log.message);
@@ -108,28 +108,28 @@ const oneAccountMenu = async (service) => {
108
108
  contract = contractsResult.contracts.find(c => c.baseSymbol === extractedBase);
109
109
  }
110
110
  }
111
- }
112
-
113
- // Find strategy
114
- const strategies = getAvailableStrategies();
115
- strategy = strategies.find(s => s.id === lastConfig.strategyId);
116
-
117
- // Restore config
118
- if (contract && strategy) {
119
- config = {
120
- contracts: lastConfig.contracts,
121
- dailyTarget: lastConfig.dailyTarget,
122
- maxRisk: lastConfig.maxRisk,
123
- showName: lastConfig.showName
124
- };
125
- loadSpinner.succeed('Configuration loaded');
111
+
112
+ // Find strategy
113
+ const strategies = getAvailableStrategies();
114
+ strategy = strategies.find(s => s.id === lastConfig.strategyId);
115
+
116
+ // Restore config
117
+ if (contract && strategy) {
118
+ config = {
119
+ contracts: lastConfig.contracts,
120
+ dailyTarget: lastConfig.dailyTarget,
121
+ maxRisk: lastConfig.maxRisk,
122
+ showName: lastConfig.showName
123
+ };
124
+ loadSpinner.succeed('Configuration loaded');
125
+ } else {
126
+ loadSpinner.fail('Symbol or strategy no longer available, please reconfigure');
127
+ selectedAccount = null;
128
+ }
126
129
  } else {
127
- loadSpinner.fail('Symbol or strategy no longer available, please reconfigure');
130
+ loadSpinner.fail('Failed to load contracts');
128
131
  selectedAccount = null;
129
132
  }
130
- } else {
131
- loadSpinner.fail('Failed to load contracts');
132
- selectedAccount = null;
133
133
  }
134
134
  }
135
135
  }