hedgequantx 2.4.3 → 2.4.4
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/dist/lib/api.jsc +0 -0
- package/dist/lib/api2.jsc +0 -0
- package/dist/lib/core.jsc +0 -0
- package/dist/lib/core2.jsc +0 -0
- package/dist/lib/data.jsc +0 -0
- package/dist/lib/data2.jsc +0 -0
- package/dist/lib/decoder.jsc +0 -0
- package/dist/lib/m/mod1.jsc +0 -0
- package/dist/lib/m/mod2.jsc +0 -0
- package/dist/lib/n/r1.jsc +0 -0
- package/dist/lib/n/r2.jsc +0 -0
- package/dist/lib/n/r3.jsc +0 -0
- package/dist/lib/n/r4.jsc +0 -0
- package/dist/lib/n/r5.jsc +0 -0
- package/dist/lib/n/r6.jsc +0 -0
- package/dist/lib/n/r7.jsc +0 -0
- package/dist/lib/o/util1.jsc +0 -0
- package/dist/lib/o/util2.jsc +0 -0
- package/package.json +1 -1
- package/src/lib/data.js +24 -24
package/dist/lib/api.jsc
CHANGED
|
Binary file
|
package/dist/lib/api2.jsc
CHANGED
|
Binary file
|
package/dist/lib/core.jsc
CHANGED
|
Binary file
|
package/dist/lib/core2.jsc
CHANGED
|
Binary file
|
package/dist/lib/data.jsc
CHANGED
|
Binary file
|
package/dist/lib/data2.jsc
CHANGED
|
Binary file
|
package/dist/lib/decoder.jsc
CHANGED
|
Binary file
|
package/dist/lib/m/mod1.jsc
CHANGED
|
Binary file
|
package/dist/lib/m/mod2.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r1.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r2.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r3.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r4.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r5.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r6.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r7.jsc
CHANGED
|
Binary file
|
package/dist/lib/o/util1.jsc
CHANGED
|
Binary file
|
package/dist/lib/o/util2.jsc
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/lib/data.js
CHANGED
|
@@ -118,7 +118,7 @@ class MarketDataFeed extends EventEmitter {
|
|
|
118
118
|
async connect(userToken, propfirm, contractId = null) {
|
|
119
119
|
try {
|
|
120
120
|
const endpoints = PROPFIRM_RTC_ENDPOINTS[propfirm] || DEFAULT_ENDPOINTS;
|
|
121
|
-
console.log(`[MARKET] Connecting to ${propfirm} RTC: ${endpoints.market}`);
|
|
121
|
+
// // console.log(`[MARKET] Connecting to ${propfirm} RTC: ${endpoints.market}`);
|
|
122
122
|
|
|
123
123
|
// Build URL with access_token query parameter
|
|
124
124
|
const urlWithToken = `${endpoints.market}?access_token=${encodeURIComponent(userToken)}`;
|
|
@@ -140,24 +140,24 @@ class MarketDataFeed extends EventEmitter {
|
|
|
140
140
|
this._setupMarketEventHandlers();
|
|
141
141
|
|
|
142
142
|
// Start connection
|
|
143
|
-
console.log(`[MARKET] Starting SignalR connection...`);
|
|
143
|
+
// // console.log(`[MARKET] Starting SignalR connection...`);
|
|
144
144
|
await this.marketConnection.start();
|
|
145
|
-
console.log(`[MARKET] Connected! State: ${this.marketConnection.state}`);
|
|
145
|
+
// // console.log(`[MARKET] Connected! State: ${this.marketConnection.state}`);
|
|
146
146
|
|
|
147
147
|
// IMMEDIATELY subscribe if contractId provided - don't wait!
|
|
148
148
|
if (contractId && this.marketConnection.state === 'Connected') {
|
|
149
|
-
console.log(`[MARKET] Immediate subscribe to ${contractId}`);
|
|
149
|
+
// // console.log(`[MARKET] Immediate subscribe to ${contractId}`);
|
|
150
150
|
try {
|
|
151
151
|
await this.marketConnection.invoke('SubscribeContractQuotes', contractId);
|
|
152
|
-
console.log(`[MARKET] Quotes OK`);
|
|
152
|
+
// // console.log(`[MARKET] Quotes OK`);
|
|
153
153
|
await this.marketConnection.invoke('SubscribeContractTrades', contractId);
|
|
154
|
-
console.log(`[MARKET] Trades OK`);
|
|
154
|
+
// // console.log(`[MARKET] Trades OK`);
|
|
155
155
|
|
|
156
156
|
const subscriptionKey = `${contractId}:${contractId}`;
|
|
157
157
|
this.subscriptions.add(subscriptionKey);
|
|
158
158
|
this.dataBuffers.set(subscriptionKey, []);
|
|
159
159
|
} catch (subError) {
|
|
160
|
-
console.log(`[MARKET] Immediate subscribe failed: ${subError.message}`);
|
|
160
|
+
// // console.log(`[MARKET] Immediate subscribe failed: ${subError.message}`);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -168,7 +168,7 @@ class MarketDataFeed extends EventEmitter {
|
|
|
168
168
|
return true;
|
|
169
169
|
|
|
170
170
|
} catch (error) {
|
|
171
|
-
console.log(`[MARKET] Connection error: ${error.message}`);
|
|
171
|
+
// // console.log(`[MARKET] Connection error: ${error.message}`);
|
|
172
172
|
this.emit('error', error);
|
|
173
173
|
throw error;
|
|
174
174
|
}
|
|
@@ -195,23 +195,23 @@ class MarketDataFeed extends EventEmitter {
|
|
|
195
195
|
|
|
196
196
|
// Gateway logout - server is kicking us out
|
|
197
197
|
this.marketConnection.on('GatewayLogout', (...args) => {
|
|
198
|
-
console.log(`[MARKET] GatewayLogout received:`, args);
|
|
198
|
+
// // console.log(`[MARKET] GatewayLogout received:`, args);
|
|
199
199
|
});
|
|
200
200
|
|
|
201
201
|
// Also handle lowercase version
|
|
202
202
|
this.marketConnection.on('gatewaylogout', (...args) => {
|
|
203
|
-
console.log(`[MARKET] gatewaylogout received:`, args);
|
|
203
|
+
// // console.log(`[MARKET] gatewaylogout received:`, args);
|
|
204
204
|
});
|
|
205
205
|
|
|
206
206
|
// Connection state changes
|
|
207
207
|
this.marketConnection.onreconnecting((error) => {
|
|
208
|
-
console.log(`[MARKET] Reconnecting... Error: ${error?.message || 'none'}`);
|
|
208
|
+
// // console.log(`[MARKET] Reconnecting... Error: ${error?.message || 'none'}`);
|
|
209
209
|
this.isConnected = false;
|
|
210
210
|
this.emit('reconnecting', { error: error?.message });
|
|
211
211
|
});
|
|
212
212
|
|
|
213
213
|
this.marketConnection.onreconnected((connectionId) => {
|
|
214
|
-
console.log(`[MARKET] Reconnected! ConnectionId: ${connectionId}`);
|
|
214
|
+
// // console.log(`[MARKET] Reconnected! ConnectionId: ${connectionId}`);
|
|
215
215
|
this.isConnected = true;
|
|
216
216
|
this.emit('reconnected', { connectionId });
|
|
217
217
|
// Resubscribe to all symbols
|
|
@@ -219,7 +219,7 @@ class MarketDataFeed extends EventEmitter {
|
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
this.marketConnection.onclose((error) => {
|
|
222
|
-
console.log(`[MARKET] Connection CLOSED! Error: ${error?.message || 'none'}`);
|
|
222
|
+
// // console.log(`[MARKET] Connection CLOSED! Error: ${error?.message || 'none'}`);
|
|
223
223
|
this.isConnected = false;
|
|
224
224
|
this.emit('disconnected', { error: error?.message });
|
|
225
225
|
});
|
|
@@ -230,7 +230,7 @@ class MarketDataFeed extends EventEmitter {
|
|
|
230
230
|
* Implements retry logic for connection race conditions
|
|
231
231
|
*/
|
|
232
232
|
async subscribe(symbol, contractId, retryCount = 0) {
|
|
233
|
-
console.log(`[MARKET] Subscribe called - symbol: ${symbol}, contractId: ${contractId}`);
|
|
233
|
+
// // console.log(`[MARKET] Subscribe called - symbol: ${symbol}, contractId: ${contractId}`);
|
|
234
234
|
|
|
235
235
|
const subscriptionKey = `${symbol}:${contractId}`;
|
|
236
236
|
|
|
@@ -240,15 +240,15 @@ class MarketDataFeed extends EventEmitter {
|
|
|
240
240
|
|
|
241
241
|
// Check connection state
|
|
242
242
|
const state = this.marketConnection?.state;
|
|
243
|
-
console.log(`[MARKET] Connection state: ${state}`);
|
|
243
|
+
// // console.log(`[MARKET] Connection state: ${state}`);
|
|
244
244
|
|
|
245
245
|
if (state !== 'Connected') {
|
|
246
246
|
if (retryCount < 5) {
|
|
247
|
-
console.log(`[MARKET] Not connected, waiting 500ms and retrying... (${retryCount + 1}/5)`);
|
|
247
|
+
// // console.log(`[MARKET] Not connected, waiting 500ms and retrying... (${retryCount + 1}/5)`);
|
|
248
248
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
249
249
|
return this.subscribe(symbol, contractId, retryCount + 1);
|
|
250
250
|
} else {
|
|
251
|
-
console.log(`[MARKET] ERROR: Connection not available after 5 retries`);
|
|
251
|
+
// // console.log(`[MARKET] ERROR: Connection not available after 5 retries`);
|
|
252
252
|
this.emit('error', new Error('Connection not available'));
|
|
253
253
|
return false;
|
|
254
254
|
}
|
|
@@ -256,13 +256,13 @@ class MarketDataFeed extends EventEmitter {
|
|
|
256
256
|
|
|
257
257
|
try {
|
|
258
258
|
// Subscribe to quotes - do it immediately, no delay
|
|
259
|
-
console.log(`[MARKET] Subscribing to ${contractId}...`);
|
|
259
|
+
// // console.log(`[MARKET] Subscribing to ${contractId}...`);
|
|
260
260
|
await this.marketConnection.invoke('SubscribeContractQuotes', contractId);
|
|
261
|
-
console.log(`[MARKET] Quotes subscribed`);
|
|
261
|
+
// // console.log(`[MARKET] Quotes subscribed`);
|
|
262
262
|
|
|
263
263
|
// Subscribe to trades
|
|
264
264
|
await this.marketConnection.invoke('SubscribeContractTrades', contractId);
|
|
265
|
-
console.log(`[MARKET] Trades subscribed`);
|
|
265
|
+
// // console.log(`[MARKET] Trades subscribed`);
|
|
266
266
|
|
|
267
267
|
this.subscriptions.add(subscriptionKey);
|
|
268
268
|
this.dataBuffers.set(subscriptionKey, []);
|
|
@@ -272,11 +272,11 @@ class MarketDataFeed extends EventEmitter {
|
|
|
272
272
|
return true;
|
|
273
273
|
|
|
274
274
|
} catch (error) {
|
|
275
|
-
console.log(`[MARKET] Subscribe ERROR: ${error.message}`);
|
|
275
|
+
// // console.log(`[MARKET] Subscribe ERROR: ${error.message}`);
|
|
276
276
|
|
|
277
277
|
// If connection was closed, try to reconnect
|
|
278
278
|
if (error.message.includes('not in the') && retryCount < 3) {
|
|
279
|
-
console.log(`[MARKET] Connection lost, will retry on reconnect`);
|
|
279
|
+
// // console.log(`[MARKET] Connection lost, will retry on reconnect`);
|
|
280
280
|
this.isConnected = false;
|
|
281
281
|
}
|
|
282
282
|
|
|
@@ -332,7 +332,7 @@ class MarketDataFeed extends EventEmitter {
|
|
|
332
332
|
if (!this._quoteCount) this._quoteCount = 0;
|
|
333
333
|
this._quoteCount++;
|
|
334
334
|
if (this._quoteCount % 100 === 1) {
|
|
335
|
-
console.log(`[MARKET] Quote #${this._quoteCount}:`, JSON.stringify(args).substring(0, 200));
|
|
335
|
+
// // console.log(`[MARKET] Quote #${this._quoteCount}:`, JSON.stringify(args).substring(0, 200));
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
const contractId = args[0];
|
|
@@ -407,7 +407,7 @@ class MarketDataFeed extends EventEmitter {
|
|
|
407
407
|
if (!this._tradeCount) this._tradeCount = 0;
|
|
408
408
|
this._tradeCount++;
|
|
409
409
|
if (this._tradeCount % 50 === 1) {
|
|
410
|
-
console.log(`[MARKET] Trade #${this._tradeCount}:`, JSON.stringify(args).substring(0, 200));
|
|
410
|
+
// // console.log(`[MARKET] Trade #${this._tradeCount}:`, JSON.stringify(args).substring(0, 200));
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
const contractId = args[0];
|