hedgequantx 2.6.29 → 2.6.30

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.29",
3
+ "version": "2.6.30",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -76,9 +76,9 @@ class HFTTickStrategy extends EventEmitter {
76
76
  constructor() {
77
77
  super();
78
78
 
79
- // Configuration
80
- this.tickSize = 0.25;
81
- this.tickValue = 5.0;
79
+ // Configuration - MUST be set via initialize() with API data
80
+ this.tickSize = null;
81
+ this.tickValue = null;
82
82
  this.contractId = null;
83
83
  this.initialized = false;
84
84
 
@@ -94,42 +94,55 @@ class HFTTickStrategy extends EventEmitter {
94
94
  this.lastBid = 0;
95
95
  this.lastAsk = 0;
96
96
 
97
- // OFI calculation
98
- this.ofiWindow = 50; // Ticks for OFI calculation
99
- this.ofiValue = 0;
100
-
101
- // Momentum
102
- this.momentumWindow = 20;
103
- this.momentum = 0;
104
- this.acceleration = 0;
105
-
106
- // Mean reversion
107
- this.zscoreWindow = 100;
108
- this.zscore = 0;
109
- this.mean = 0;
110
- this.std = 0;
111
-
112
- // Signal thresholds
113
- this.ofiThreshold = 0.3; // |OFI| > 0.3 for signal
114
- this.zscoreThreshold = 1.5; // |Z| > 1.5 for mean reversion
115
- this.momentumThreshold = 0.5; // Momentum confirmation
116
- this.minConfidence = 0.6; // Minimum confidence for signal
117
-
118
- // Trade parameters
119
- this.baseStopTicks = 8;
120
- this.baseTargetTicks = 12;
121
-
122
- // State
123
- this.tickCount = 0;
124
- this.signalCount = 0;
125
- this.lastSignalTime = 0;
126
- this.cooldownMs = 5000; // 5 second cooldown between signals
97
+ // ═══════════════════════════════════════════════════════════════════════
98
+ // STRATEGY CONFIGURATION PARAMETERS
99
+ // These are algorithm tuning parameters, NOT trading data
100
+ // They define HOW the strategy calculates signals from real tick data
101
+ // ═══════════════════════════════════════════════════════════════════════
102
+
103
+ // OFI calculation windows (algorithm config)
104
+ this.ofiWindow = 50; // Number of ticks for OFI calculation
105
+ this.ofiValue = 0; // Calculated from real ticks
106
+
107
+ // Momentum windows (algorithm config)
108
+ this.momentumWindow = 20; // Number of ticks for momentum
109
+ this.momentum = 0; // Calculated from real tick prices
110
+ this.acceleration = 0; // Calculated from real tick prices
111
+
112
+ // Mean reversion windows (algorithm config)
113
+ this.zscoreWindow = 100; // Number of ticks for z-score
114
+ this.zscore = 0; // Calculated from real tick prices
115
+ this.mean = 0; // Calculated from real tick prices
116
+ this.std = 0; // Calculated from real tick prices
117
+
118
+ // Signal thresholds (algorithm tuning - from backtests)
119
+ this.ofiThreshold = 0.3; // |OFI| threshold for signal generation
120
+ this.zscoreThreshold = 1.5; // |Z| threshold for mean reversion
121
+ this.momentumThreshold = 0.5; // Momentum threshold for confirmation
122
+ this.minConfidence = 0.6; // Minimum composite score for signal
123
+
124
+ // Risk parameters in ticks (algorithm config)
125
+ this.baseStopTicks = 8; // Base stop distance in ticks
126
+ this.baseTargetTicks = 12; // Base target distance in ticks
127
+
128
+ // State tracking
129
+ this.tickCount = 0; // Counter from real ticks received
130
+ this.signalCount = 0; // Counter of signals generated
131
+ this.lastSignalTime = 0; // Timestamp of last signal
132
+ this.cooldownMs = 5000; // Cooldown between signals (ms)
127
133
  }
128
134
 
129
135
  /**
130
136
  * Initialize strategy for a contract
137
+ * @param {string} contractId - Contract identifier from API
138
+ * @param {number} tickSize - Tick size from API (REQUIRED - no default)
139
+ * @param {number} tickValue - Tick value from API (REQUIRED - no default)
131
140
  */
132
- initialize(contractId, tickSize = 0.25, tickValue = 5.0) {
141
+ initialize(contractId, tickSize, tickValue) {
142
+ if (!contractId || tickSize === undefined || tickValue === undefined) {
143
+ throw new Error('HFT Strategy requires contractId, tickSize, and tickValue from API');
144
+ }
145
+
133
146
  this.contractId = contractId;
134
147
  this.tickSize = tickSize;
135
148
  this.tickValue = tickValue;