hedgequantx 1.7.2 → 1.7.3
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
|
@@ -444,12 +444,32 @@ class ProjectXService {
|
|
|
444
444
|
// ==================== CONTRACTS ====================
|
|
445
445
|
|
|
446
446
|
/**
|
|
447
|
-
* Get popular contracts for trading
|
|
448
|
-
* Uses shared contract list for consistency with Rithmic
|
|
447
|
+
* Get popular contracts for trading from API
|
|
449
448
|
*/
|
|
450
449
|
async getContracts() {
|
|
451
|
-
|
|
452
|
-
|
|
450
|
+
try {
|
|
451
|
+
// Search for popular futures symbols from API
|
|
452
|
+
const symbols = ['ES', 'NQ', 'MES', 'MNQ', 'CL', 'GC', 'RTY', 'YM', 'SI', 'ZB', 'ZN', 'NG', 'MCL', 'MGC'];
|
|
453
|
+
const allContracts = [];
|
|
454
|
+
|
|
455
|
+
for (const sym of symbols) {
|
|
456
|
+
const response = await this._request(
|
|
457
|
+
this.propfirm.gatewayApi, '/api/Contract/search', 'POST',
|
|
458
|
+
{ searchText: sym, live: false }
|
|
459
|
+
);
|
|
460
|
+
if (response.statusCode === 200) {
|
|
461
|
+
const contracts = response.data.contracts || response.data || [];
|
|
462
|
+
// Take first contract for each symbol (front month)
|
|
463
|
+
if (contracts.length > 0) {
|
|
464
|
+
allContracts.push(contracts[0]);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
return { success: true, contracts: allContracts };
|
|
470
|
+
} catch (error) {
|
|
471
|
+
return { success: false, contracts: [], error: error.message };
|
|
472
|
+
}
|
|
453
473
|
}
|
|
454
474
|
|
|
455
475
|
async searchContracts(searchText) {
|
|
@@ -210,17 +210,37 @@ class RithmicService extends EventEmitter {
|
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Get contracts from Rithmic
|
|
215
|
+
* TODO: Implement TICKER_PLANT connection to fetch real contracts
|
|
216
|
+
* For now, returns common futures contracts that are available on Rithmic
|
|
217
|
+
*/
|
|
213
218
|
async getContracts() {
|
|
214
|
-
|
|
215
|
-
|
|
219
|
+
// These are the standard Rithmic contract symbols
|
|
220
|
+
// In production, this should connect to TICKER_PLANT
|
|
221
|
+
const contracts = [
|
|
222
|
+
{ symbol: 'ESH5', name: 'E-mini S&P 500 (Mar 25)', exchange: 'CME' },
|
|
223
|
+
{ symbol: 'NQH5', name: 'E-mini NASDAQ-100 (Mar 25)', exchange: 'CME' },
|
|
224
|
+
{ symbol: 'MESH5', name: 'Micro E-mini S&P 500 (Mar 25)', exchange: 'CME' },
|
|
225
|
+
{ symbol: 'MNQH5', name: 'Micro E-mini NASDAQ-100 (Mar 25)', exchange: 'CME' },
|
|
226
|
+
{ symbol: 'RTYH5', name: 'E-mini Russell 2000 (Mar 25)', exchange: 'CME' },
|
|
227
|
+
{ symbol: 'YMH5', name: 'E-mini Dow Jones (Mar 25)', exchange: 'CBOT' },
|
|
228
|
+
{ symbol: 'CLG5', name: 'Crude Oil (Feb 25)', exchange: 'NYMEX' },
|
|
229
|
+
{ symbol: 'GCG5', name: 'Gold (Feb 25)', exchange: 'COMEX' },
|
|
230
|
+
{ symbol: 'SIH5', name: 'Silver (Mar 25)', exchange: 'COMEX' },
|
|
231
|
+
{ symbol: 'NGG5', name: 'Natural Gas (Feb 25)', exchange: 'NYMEX' },
|
|
232
|
+
];
|
|
233
|
+
return { success: true, contracts };
|
|
216
234
|
}
|
|
217
235
|
|
|
218
236
|
async searchContracts(searchText) {
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
if (!searchText) return contracts;
|
|
237
|
+
const result = await this.getContracts();
|
|
238
|
+
if (!searchText || !result.success) return result.contracts || [];
|
|
222
239
|
const search = searchText.toUpperCase();
|
|
223
|
-
return contracts.filter(c =>
|
|
240
|
+
return result.contracts.filter(c =>
|
|
241
|
+
c.symbol.toUpperCase().includes(search) ||
|
|
242
|
+
c.name.toUpperCase().includes(search)
|
|
243
|
+
);
|
|
224
244
|
}
|
|
225
245
|
|
|
226
246
|
checkMarketHours() {
|