hedgequantx 2.9.81 → 2.9.83

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.
@@ -463,6 +463,8 @@ var require_core = __commonJS({
463
463
  this.barHistory = /* @__PURE__ */ new Map();
464
464
  this.swingPoints = /* @__PURE__ */ new Map();
465
465
  this.liquidityZones = /* @__PURE__ */ new Map();
466
+ this.currentBar = /* @__PURE__ */ new Map();
467
+ this.barIntervalMs = 6e4;
466
468
  this.lastSignalTime = 0;
467
469
  this.stats = { signals: 0, trades: 0, wins: 0, losses: 0, pnl: 0 };
468
470
  this.recentTrades = [];
@@ -475,26 +477,64 @@ var require_core = __commonJS({
475
477
  this.barHistory.set(contractId, []);
476
478
  this.swingPoints.set(contractId, []);
477
479
  this.liquidityZones.set(contractId, []);
480
+ this.currentBar.delete(contractId);
478
481
  this.emit("log", {
479
482
  type: "info",
480
- message: `[HQX-2B] Initialized for ${contractId}: tick=${tickSize}, value=${tickValue}`
483
+ message: `[HQX-2B] Initialized for ${contractId}: tick=${tickSize}, value=${tickValue}, TF=1min`
481
484
  });
482
485
  this.emit("log", {
483
486
  type: "info",
484
487
  message: `[HQX-2B] Params: Stop=${this.config.execution.stopTicks}t, Target=${this.config.execution.targetTicks}t, BE=${this.config.execution.breakevenTicks}t, Trail=${this.config.execution.trailTriggerTicks}/${this.config.execution.trailDistanceTicks}`
485
488
  });
486
489
  }
490
+ /**
491
+ * Process incoming tick and aggregate into 1-minute bars
492
+ * Only calls processBar() when a bar closes (every 60 seconds)
493
+ */
487
494
  processTick(tick) {
488
495
  const { contractId, price, volume, timestamp } = tick;
489
- const bar = {
490
- timestamp: timestamp || Date.now(),
491
- open: price,
492
- high: price,
493
- low: price,
494
- close: price,
495
- volume: volume || 1
496
- };
497
- return this.processBar(contractId, bar);
496
+ const ts = timestamp || Date.now();
497
+ const vol = volume || 1;
498
+ let bar = this.currentBar.get(contractId);
499
+ const barStartTime = Math.floor(ts / this.barIntervalMs) * this.barIntervalMs;
500
+ if (!bar || bar.startTime !== barStartTime) {
501
+ if (bar) {
502
+ const closedBar = {
503
+ timestamp: bar.startTime,
504
+ open: bar.open,
505
+ high: bar.high,
506
+ low: bar.low,
507
+ close: bar.close,
508
+ volume: bar.volume
509
+ };
510
+ const signal = this.processBar(contractId, closedBar);
511
+ this.currentBar.set(contractId, {
512
+ startTime: barStartTime,
513
+ open: price,
514
+ high: price,
515
+ low: price,
516
+ close: price,
517
+ volume: vol
518
+ });
519
+ return signal;
520
+ } else {
521
+ this.currentBar.set(contractId, {
522
+ startTime: barStartTime,
523
+ open: price,
524
+ high: price,
525
+ low: price,
526
+ close: price,
527
+ volume: vol
528
+ });
529
+ return null;
530
+ }
531
+ } else {
532
+ bar.high = Math.max(bar.high, price);
533
+ bar.low = Math.min(bar.low, price);
534
+ bar.close = price;
535
+ bar.volume += vol;
536
+ return null;
537
+ }
498
538
  }
499
539
  onTick(tick) {
500
540
  return this.processTick(tick);
@@ -622,6 +662,7 @@ var require_core = __commonJS({
622
662
  this.barHistory.set(contractId, []);
623
663
  this.swingPoints.set(contractId, []);
624
664
  this.liquidityZones.set(contractId, []);
665
+ this.currentBar.delete(contractId);
625
666
  this.emit("log", {
626
667
  type: "info",
627
668
  message: `[HQX-2B] Reset state for ${contractId}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.9.81",
3
+ "version": "2.9.83",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -51,10 +51,46 @@ const ORDER_SIDE = {
51
51
 
52
52
  // All symbols/contracts come from Rithmic API (TICKER_PLANT)
53
53
 
54
+ // Contract descriptions for display (API only returns short codes)
55
+ const CONTRACT_DESCRIPTIONS = {
56
+ // Equity Index Futures
57
+ ES: 'E-mini S&P 500', MES: 'Micro E-mini S&P 500',
58
+ NQ: 'E-mini Nasdaq 100', MNQ: 'Micro E-mini Nasdaq',
59
+ RTY: 'E-mini Russell 2000', M2K: 'Micro E-mini Russell',
60
+ YM: 'E-mini Dow $5', MYM: 'Micro E-mini Dow',
61
+ EMD: 'E-mini S&P MidCap', NKD: 'Nikkei 225',
62
+ // Metals
63
+ GC: 'Gold', MGC: 'Micro Gold', '1OZ': 'Micro Gold (1oz)',
64
+ SI: 'Silver', SIL: 'Micro Silver', HG: 'Copper', MHG: 'Micro Copper',
65
+ PL: 'Platinum', PA: 'Palladium',
66
+ // Energy
67
+ CL: 'Crude Oil WTI', MCL: 'Micro Crude Oil', NG: 'Natural Gas',
68
+ BZ: 'Brent Crude', RB: 'RBOB Gasoline', HO: 'Heating Oil',
69
+ // Currencies
70
+ '6E': 'Euro FX', M6E: 'Micro Euro', '6B': 'British Pound', M6B: 'Micro GBP',
71
+ '6A': 'Australian $', M6A: 'Micro AUD', '6J': 'Japanese Yen',
72
+ '6C': 'Canadian $', '6S': 'Swiss Franc', '6N': 'New Zealand $',
73
+ '6M': 'Mexican Peso', E7: 'E-mini Euro',
74
+ // Crypto
75
+ BTC: 'Bitcoin', MBT: 'Micro Bitcoin', ETH: 'Ether', MET: 'Micro Ether',
76
+ // Treasuries
77
+ ZB: '30Y T-Bond', ZN: '10Y T-Note', ZF: '5Y T-Note', ZT: '2Y T-Note',
78
+ ZQ: '30-Day Fed Funds', TN: 'Ultra 10Y',
79
+ // Grains
80
+ ZC: 'Corn', ZS: 'Soybeans', ZW: 'Wheat', ZM: 'Soybean Meal',
81
+ ZL: 'Soybean Oil', ZO: 'Oats',
82
+ // Livestock
83
+ LE: 'Live Cattle', HE: 'Lean Hogs', GF: 'Feeder Cattle',
84
+ };
85
+
86
+ const getContractDescription = (baseSymbol) => CONTRACT_DESCRIPTIONS[baseSymbol] || baseSymbol;
87
+
54
88
  module.exports = {
55
89
  ACCOUNT_STATUS,
56
90
  ACCOUNT_TYPE,
57
91
  ORDER_STATUS,
58
92
  ORDER_TYPE,
59
- ORDER_SIDE
93
+ ORDER_SIDE,
94
+ CONTRACT_DESCRIPTIONS,
95
+ getContractDescription,
60
96
  };
@@ -17,6 +17,8 @@ const {
17
17
  ORDER_STATUS,
18
18
  ORDER_TYPE,
19
19
  ORDER_SIDE,
20
+ CONTRACT_DESCRIPTIONS,
21
+ getContractDescription,
20
22
  } = require('./constants');
21
23
 
22
24
  const {
@@ -43,6 +45,8 @@ module.exports = {
43
45
  ORDER_STATUS,
44
46
  ORDER_TYPE,
45
47
  ORDER_SIDE,
48
+ CONTRACT_DESCRIPTIONS,
49
+ getContractDescription,
46
50
 
47
51
  // Settings
48
52
  TIMEOUTS,
@@ -9,6 +9,7 @@ const ora = require('ora');
9
9
 
10
10
  const { connections } = require('../../services');
11
11
  const { prompts } = require('../../utils');
12
+ const { getContractDescription } = require('../../config');
12
13
  const { checkMarketHours } = require('../../services/rithmic/market');
13
14
  const { getActiveAgentCount, getSupervisionConfig, getActiveAgents } = require('../ai-agents');
14
15
  const { launchCopyTrading } = require('./copy-executor');
@@ -383,10 +384,14 @@ const selectSymbol = async (service) => {
383
384
 
384
385
  spinner.succeed(`Found ${contracts.length} contracts`);
385
386
 
386
- const options = contracts.map(c => ({
387
- label: `${c.symbol} - ${c.name} (${c.exchange})`,
388
- value: c
389
- }));
387
+ const options = contracts.map(c => {
388
+ const desc = getContractDescription(c.baseSymbol || c.name);
389
+ const isMicro = desc.toLowerCase().includes('micro');
390
+ const label = isMicro
391
+ ? `${c.symbol} - ${chalk.cyan(desc)} (${c.exchange})`
392
+ : `${c.symbol} - ${desc} (${c.exchange})`;
393
+ return { label, value: c };
394
+ });
390
395
  options.push({ label: chalk.gray('< Back'), value: 'back' });
391
396
 
392
397
  const selected = await prompts.selectOption(chalk.yellow('Select Symbol:'), options);
@@ -12,6 +12,7 @@ const ora = require('ora');
12
12
  const { getLogoWidth, centerText, displayBanner , clearScreen } = require('../../ui');
13
13
  const { prompts } = require('../../utils');
14
14
  const { connections } = require('../../services');
15
+ const { getContractDescription } = require('../../config');
15
16
  const { getActiveProvider, getActiveAgents } = require('../ai-agents');
16
17
  const cliproxy = require('../../services/cliproxy');
17
18
  const { runPreflightCheck, formatPreflightResults, getPreflightSummary } = require('../../services/ai-supervision');
@@ -146,7 +147,14 @@ const selectSymbol = async (service) => {
146
147
 
147
148
  spinner.succeed(`Found ${result.contracts.length} contracts`);
148
149
 
149
- const options = result.contracts.map(c => ({ label: `${c.symbol} - ${c.name} (${c.exchange})`, value: c }));
150
+ const options = result.contracts.map(c => {
151
+ const desc = getContractDescription(c.baseSymbol || c.name);
152
+ const isMicro = desc.toLowerCase().includes('micro');
153
+ const label = isMicro
154
+ ? `${c.symbol} - ${chalk.cyan(desc)} (${c.exchange})`
155
+ : `${c.symbol} - ${desc} (${c.exchange})`;
156
+ return { label, value: c };
157
+ });
150
158
  options.push({ label: chalk.gray('< Back'), value: 'back' });
151
159
 
152
160
  const selected = await prompts.selectOption(chalk.yellow('Select Symbol:'), options);
@@ -8,6 +8,7 @@ const ora = require('ora');
8
8
 
9
9
  const { connections } = require('../../services');
10
10
  const { prompts } = require('../../utils');
11
+ const { getContractDescription } = require('../../config');
11
12
  const { checkMarketHours } = require('../../services/rithmic/market');
12
13
  const { executeAlgo } = require('./algo-executor');
13
14
  const { getActiveAgentCount, getSupervisionConfig, getActiveAgents } = require('../ai-agents');
@@ -281,11 +282,15 @@ const selectSymbol = async (service, account) => {
281
282
 
282
283
  spinner.succeed(`Found ${contracts.length} contracts`);
283
284
 
284
- // Display sorted contracts from API: symbol - name (exchange)
285
- const options = contracts.map(c => ({
286
- label: `${c.symbol} - ${c.name} (${c.exchange})`,
287
- value: c
288
- }));
285
+ // Display sorted contracts with full description
286
+ const options = contracts.map(c => {
287
+ const desc = getContractDescription(c.baseSymbol || c.name);
288
+ const isMicro = desc.toLowerCase().includes('micro');
289
+ const label = isMicro
290
+ ? `${c.symbol} - ${chalk.cyan(desc)} (${c.exchange})`
291
+ : `${c.symbol} - ${desc} (${c.exchange})`;
292
+ return { label, value: c };
293
+ });
289
294
 
290
295
  options.push({ label: chalk.gray('< Back'), value: 'back' });
291
296