hedgequantx 2.6.32 → 2.6.34

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.6.32",
3
+ "version": "2.6.34",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -581,8 +581,8 @@ const launchAlgo = async (service, account, contract, config) => {
581
581
  });
582
582
 
583
583
  // Get momentum data from strategy if available
584
- const modelValues = strategy.getModelValues?.(contractId);
585
- if (modelValues) {
584
+ const modelValues = strategy.getModelValues?.() || strategy.getModelValues?.(contractId);
585
+ if (modelValues && typeof positionManager.updateMomentum === 'function') {
586
586
  positionManager.updateMomentum(symbolName, {
587
587
  ofi: modelValues.ofi || 0,
588
588
  zscore: modelValues.zscore || 0,
@@ -523,6 +523,8 @@ const handleOrderNotification = (service, data) => {
523
523
 
524
524
  // Emit fill event if this is a fill
525
525
  if (isFill) {
526
+ console.log(`[FILL] Received: ${orderTag} | ${fillInfo.transactionType === 1 ? 'BUY' : 'SELL'} ${fillQty}x @ ${fillInfo.avgFillPrice} | latency=${roundTripLatency}ms`);
527
+
526
528
  debug('ORDER FILLED:', {
527
529
  orderTag,
528
530
  side: fillInfo.transactionType === 1 ? 'BUY' : 'SELL',
@@ -533,6 +535,8 @@ const handleOrderNotification = (service, data) => {
533
535
 
534
536
  // Clone for fill event (async handlers may need to keep the data)
535
537
  service.emit('orderFilled', FillInfoPool.clone(fillInfo));
538
+ } else {
539
+ console.log(`[ORDER STATUS] ${orderTag} | status=${fillInfo.status} text=${fillInfo.text || 'N/A'}`);
536
540
  }
537
541
  } catch (e) {
538
542
  debug('Error decoding order notification:', e.message);
@@ -25,60 +25,64 @@ const { logger } = require('../../utils/logger');
25
25
  const log = logger.scope('Rithmic');
26
26
 
27
27
  /**
28
- * CME Contract Specifications - Official exchange tick sizes and values
28
+ * CME Contract Specifications - Official exchange tick sizes, values, and names
29
29
  * These are technical constants defined by the exchange, not market data.
30
30
  * Source: CME Group contract specifications
31
31
  */
32
32
  const CME_CONTRACT_SPECS = {
33
33
  // E-mini Index Futures (CME)
34
- ES: { tickSize: 0.25, tickValue: 12.50 }, // E-mini S&P 500
35
- NQ: { tickSize: 0.25, tickValue: 5.00 }, // E-mini NASDAQ-100
36
- RTY: { tickSize: 0.10, tickValue: 5.00 }, // E-mini Russell 2000
37
- YM: { tickSize: 1.00, tickValue: 5.00 }, // E-mini Dow ($5)
34
+ ES: { tickSize: 0.25, tickValue: 12.50, name: 'E-mini S&P 500' },
35
+ NQ: { tickSize: 0.25, tickValue: 5.00, name: 'E-mini NASDAQ-100' },
36
+ RTY: { tickSize: 0.10, tickValue: 5.00, name: 'E-mini Russell 2000' },
37
+ YM: { tickSize: 1.00, tickValue: 5.00, name: 'E-mini Dow' },
38
38
 
39
39
  // Micro Index Futures (CME)
40
- MES: { tickSize: 0.25, tickValue: 1.25 }, // Micro E-mini S&P 500
41
- MNQ: { tickSize: 0.25, tickValue: 0.50 }, // Micro E-mini NASDAQ-100
42
- M2K: { tickSize: 0.10, tickValue: 0.50 }, // Micro E-mini Russell 2000
43
- MYM: { tickSize: 1.00, tickValue: 0.50 }, // Micro E-mini Dow
40
+ MES: { tickSize: 0.25, tickValue: 1.25, name: 'Micro E-mini S&P 500' },
41
+ MNQ: { tickSize: 0.25, tickValue: 0.50, name: 'Micro E-mini NASDAQ-100' },
42
+ M2K: { tickSize: 0.10, tickValue: 0.50, name: 'Micro E-mini Russell 2000' },
43
+ MYM: { tickSize: 1.00, tickValue: 0.50, name: 'Micro E-mini Dow' },
44
44
 
45
45
  // Energy Futures (NYMEX)
46
- CL: { tickSize: 0.01, tickValue: 10.00 }, // Crude Oil
47
- QM: { tickSize: 0.025, tickValue: 12.50 }, // E-mini Crude Oil
48
- MCL: { tickSize: 0.01, tickValue: 1.00 }, // Micro Crude Oil
49
- NG: { tickSize: 0.001, tickValue: 10.00 }, // Natural Gas
50
- QG: { tickSize: 0.005, tickValue: 12.50 }, // E-mini Natural Gas
46
+ CL: { tickSize: 0.01, tickValue: 10.00, name: 'Crude Oil' },
47
+ QM: { tickSize: 0.025, tickValue: 12.50, name: 'E-mini Crude Oil' },
48
+ MCL: { tickSize: 0.01, tickValue: 1.00, name: 'Micro Crude Oil' },
49
+ NG: { tickSize: 0.001, tickValue: 10.00, name: 'Natural Gas' },
50
+ QG: { tickSize: 0.005, tickValue: 12.50, name: 'E-mini Natural Gas' },
51
51
 
52
52
  // Metal Futures (COMEX)
53
- GC: { tickSize: 0.10, tickValue: 10.00 }, // Gold
54
- MGC: { tickSize: 0.10, tickValue: 1.00 }, // Micro Gold
55
- SI: { tickSize: 0.005, tickValue: 25.00 }, // Silver
56
- SIL: { tickSize: 0.005, tickValue: 2.50 }, // Micro Silver (1000oz)
57
- HG: { tickSize: 0.0005, tickValue: 12.50 }, // Copper
58
- MHG: { tickSize: 0.0005, tickValue: 1.25 }, // Micro Copper
53
+ GC: { tickSize: 0.10, tickValue: 10.00, name: 'Gold' },
54
+ MGC: { tickSize: 0.10, tickValue: 1.00, name: 'Micro Gold' },
55
+ SI: { tickSize: 0.005, tickValue: 25.00, name: 'Silver' },
56
+ SIL: { tickSize: 0.005, tickValue: 2.50, name: '1000oz Silver' },
57
+ HG: { tickSize: 0.0005, tickValue: 12.50, name: 'Copper' },
58
+ MHG: { tickSize: 0.0005, tickValue: 1.25, name: 'Micro Copper' },
59
59
 
60
60
  // Treasury Futures (CBOT)
61
- ZB: { tickSize: 0.03125, tickValue: 31.25 }, // 30-Year T-Bond
62
- ZN: { tickSize: 0.015625, tickValue: 15.625 }, // 10-Year T-Note
63
- ZF: { tickSize: 0.0078125, tickValue: 7.8125 }, // 5-Year T-Note
64
- ZT: { tickSize: 0.0078125, tickValue: 15.625 }, // 2-Year T-Note
61
+ ZB: { tickSize: 0.03125, tickValue: 31.25, name: '30-Year T-Bond' },
62
+ ZN: { tickSize: 0.015625, tickValue: 15.625, name: '10-Year T-Note' },
63
+ ZF: { tickSize: 0.0078125, tickValue: 7.8125, name: '5-Year T-Note' },
64
+ ZT: { tickSize: 0.0078125, tickValue: 15.625, name: '2-Year T-Note' },
65
65
 
66
66
  // Agricultural Futures (CBOT)
67
- ZC: { tickSize: 0.25, tickValue: 12.50 }, // Corn
68
- ZS: { tickSize: 0.25, tickValue: 12.50 }, // Soybeans
69
- ZW: { tickSize: 0.25, tickValue: 12.50 }, // Wheat
70
- ZL: { tickSize: 0.01, tickValue: 6.00 }, // Soybean Oil
71
- ZM: { tickSize: 0.10, tickValue: 10.00 }, // Soybean Meal
67
+ ZC: { tickSize: 0.25, tickValue: 12.50, name: 'Corn' },
68
+ ZS: { tickSize: 0.25, tickValue: 12.50, name: 'Soybeans' },
69
+ ZW: { tickSize: 0.25, tickValue: 12.50, name: 'Wheat' },
70
+ ZL: { tickSize: 0.01, tickValue: 6.00, name: 'Soybean Oil' },
71
+ ZM: { tickSize: 0.10, tickValue: 10.00, name: 'Soybean Meal' },
72
72
 
73
73
  // Currency Futures (CME)
74
- '6E': { tickSize: 0.00005, tickValue: 6.25 }, // Euro FX
75
- '6J': { tickSize: 0.0000005, tickValue: 6.25 }, // Japanese Yen
76
- '6B': { tickSize: 0.0001, tickValue: 6.25 }, // British Pound
77
- '6A': { tickSize: 0.0001, tickValue: 10.00 }, // Australian Dollar
78
- '6C': { tickSize: 0.00005, tickValue: 5.00 }, // Canadian Dollar
74
+ '6E': { tickSize: 0.00005, tickValue: 6.25, name: 'Euro FX' },
75
+ '6J': { tickSize: 0.0000005, tickValue: 6.25, name: 'Japanese Yen' },
76
+ '6B': { tickSize: 0.0001, tickValue: 6.25, name: 'British Pound' },
77
+ '6A': { tickSize: 0.0001, tickValue: 10.00, name: 'Australian Dollar' },
78
+ '6C': { tickSize: 0.00005, tickValue: 5.00, name: 'Canadian Dollar' },
79
+ '6M': { tickSize: 0.0001, tickValue: 5.00, name: 'Mexican Peso' },
80
+
81
+ // Nikkei (CME)
82
+ NKD: { tickSize: 5.0, tickValue: 25.00, name: 'Nikkei 225' },
79
83
 
80
84
  // VIX Futures (CFE)
81
- VX: { tickSize: 0.05, tickValue: 50.00 }, // VIX Futures
85
+ VX: { tickSize: 0.05, tickValue: 50.00, name: 'VIX Futures' },
82
86
  };
83
87
 
84
88
  /** PropFirm configurations */
@@ -825,14 +829,15 @@ class RithmicService extends EventEmitter {
825
829
  const product = productsToCheck.get(productKey);
826
830
 
827
831
  // API data + CME contract specs (technical constants)
828
- const productName = product?.productName || baseSymbol;
829
832
  const specs = CME_CONTRACT_SPECS[baseSymbol] || null;
833
+ // Use CME spec name first, then API productName, then baseSymbol as fallback
834
+ const productName = specs?.name || product?.productName || baseSymbol;
830
835
 
831
836
  results.push({
832
837
  symbol: contract.symbol,
833
838
  baseSymbol,
834
839
  name: contract.symbol, // Use trading symbol as name
835
- description: productName, // Product name as description (like ProjectX)
840
+ description: productName, // Product name as description
836
841
  exchange: contract.exchange,
837
842
  // CME contract specifications (official exchange constants)
838
843
  tickSize: specs?.tickSize ?? null,
@@ -105,6 +105,9 @@ const fastEntry = (service, orderData) => {
105
105
  // OPTIMIZED: Use pre-allocated order object
106
106
  const order = OrderPool.fill(orderTag, service.loginInfo, orderData);
107
107
 
108
+ // DEBUG: Log order details
109
+ console.log(`[ORDER] Sending: ${orderTag} | ${orderData.side === 0 ? 'BUY' : 'SELL'} ${orderData.size}x ${orderData.symbol} | acct=${orderData.accountId}`);
110
+
108
111
  // OPTIMIZED: Use fastEncode with cached type
109
112
  const buffer = proto.fastEncode('RequestNewOrder', order);
110
113
 
@@ -117,6 +120,8 @@ const fastEntry = (service, orderData) => {
117
120
  service.orderConn.fastSend(buffer);
118
121
  }
119
122
 
123
+ console.log(`[ORDER] Sent to Rithmic: ${orderTag} | buffer=${buffer.length} bytes`);
124
+
120
125
  // Track for round-trip latency measurement
121
126
  LatencyTracker.recordEntry(orderTag, entryTime);
122
127