hedgequantx 1.2.116 → 1.2.118
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 +1 -1
- package/src/pages/algo.js +11 -43
- package/src/services/projectx.js +17 -0
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -174,35 +174,19 @@ const selectSymbolMenu = async (service, account) => {
|
|
|
174
174
|
];
|
|
175
175
|
|
|
176
176
|
try {
|
|
177
|
+
const seenIds = new Set();
|
|
178
|
+
|
|
177
179
|
for (const search of commonSearches) {
|
|
178
180
|
const result = await service.searchContracts(search, false);
|
|
179
181
|
if (result.success && result.contracts && result.contracts.length > 0) {
|
|
180
182
|
for (const contract of result.contracts) {
|
|
181
|
-
//
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const contractId = contract.id || contract.contractId;
|
|
187
|
-
if (!contractId) continue;
|
|
188
|
-
|
|
189
|
-
const existing = availableSymbols.find(s => s.id === contractId);
|
|
190
|
-
if (existing) continue;
|
|
191
|
-
|
|
192
|
-
// Use 'name' field which contains the symbol code like "NQH6", "ESH6", "MNQH6"
|
|
193
|
-
const symbolCode = contract.name || contract.symbol || '';
|
|
194
|
-
if (!symbolCode) continue;
|
|
183
|
+
// Skip if already added (by contract ID)
|
|
184
|
+
const contractId = contract.id || '';
|
|
185
|
+
if (!contractId || seenIds.has(contractId)) continue;
|
|
186
|
+
seenIds.add(contractId);
|
|
195
187
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
name: symbolCode,
|
|
199
|
-
symbol: symbolCode,
|
|
200
|
-
description: contract.description || '',
|
|
201
|
-
tickSize: contract.tickSize,
|
|
202
|
-
tickValue: contract.tickValue,
|
|
203
|
-
exchange: contract.exchange || 'CME',
|
|
204
|
-
activeContract: contract.activeContract || false
|
|
205
|
-
});
|
|
188
|
+
// Add the raw contract data from API
|
|
189
|
+
availableSymbols.push(contract);
|
|
206
190
|
}
|
|
207
191
|
}
|
|
208
192
|
}
|
|
@@ -223,28 +207,12 @@ const selectSymbolMenu = async (service, account) => {
|
|
|
223
207
|
console.log();
|
|
224
208
|
|
|
225
209
|
// Format symbols for display - show ALL contracts from API (REAL DATA ONLY)
|
|
226
|
-
const seenIds = new Set();
|
|
227
210
|
const symbolChoices = [];
|
|
228
211
|
|
|
229
212
|
for (const contract of availableSymbols) {
|
|
230
|
-
//
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
seenIds.add(contractId);
|
|
234
|
-
|
|
235
|
-
// Get the symbol code from API - 'name' field contains code like "NQH6"
|
|
236
|
-
const symbolCode = contract.name || contract.symbol || '';
|
|
237
|
-
if (!symbolCode) continue;
|
|
238
|
-
|
|
239
|
-
// Get description from API ONLY
|
|
240
|
-
let description = contract.description || '';
|
|
241
|
-
if (description.includes(':')) {
|
|
242
|
-
// API format: "E-mini NASDAQ-100: March 2026" -> keep full description
|
|
243
|
-
description = description.trim();
|
|
244
|
-
}
|
|
245
|
-
if (!description) {
|
|
246
|
-
description = symbolCode; // Fallback to symbol code if no description
|
|
247
|
-
}
|
|
213
|
+
// Get symbol code and description directly from API
|
|
214
|
+
const symbolCode = contract.name || contract.id || 'Unknown';
|
|
215
|
+
const description = contract.description || symbolCode;
|
|
248
216
|
|
|
249
217
|
// Format: "NQH6 E-mini NASDAQ-100: March 2026"
|
|
250
218
|
symbolChoices.push({
|
package/src/services/projectx.js
CHANGED
|
@@ -26,6 +26,7 @@ class ProjectXService {
|
|
|
26
26
|
*/
|
|
27
27
|
constructor(propfirmKey = 'topstep') {
|
|
28
28
|
this.propfirm = PROPFIRMS[propfirmKey] || PROPFIRMS.topstep;
|
|
29
|
+
this.propfirmKey = propfirmKey;
|
|
29
30
|
this.token = null;
|
|
30
31
|
this.user = null;
|
|
31
32
|
this.rateLimiter = getLimiter('api');
|
|
@@ -33,6 +34,22 @@ class ProjectXService {
|
|
|
33
34
|
this.orderLimiter = getLimiter('orders');
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Get current auth token
|
|
39
|
+
* @returns {string|null} The JWT token
|
|
40
|
+
*/
|
|
41
|
+
getToken() {
|
|
42
|
+
return this.token;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Get propfirm key
|
|
47
|
+
* @returns {string} The propfirm identifier
|
|
48
|
+
*/
|
|
49
|
+
getPropfirm() {
|
|
50
|
+
return this.propfirmKey;
|
|
51
|
+
}
|
|
52
|
+
|
|
36
53
|
/**
|
|
37
54
|
* Makes a rate-limited HTTPS request
|
|
38
55
|
* @param {string} host - API host
|