hedgequantx 1.2.50 → 1.2.52
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/app.js +2 -1
- package/src/pages/stats.js +23 -17
- package/src/services/rithmic/index.js +21 -0
- package/src/services/tradovate/index.js +80 -0
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -158,9 +158,10 @@ const loginPrompt = async (propfirmName) => {
|
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
|
-
type: '
|
|
161
|
+
type: 'password',
|
|
162
162
|
name: 'password',
|
|
163
163
|
message: chalk.white.bold('Password:'),
|
|
164
|
+
mask: '*',
|
|
164
165
|
validate: (input) => {
|
|
165
166
|
try {
|
|
166
167
|
validatePassword(input);
|
package/src/pages/stats.js
CHANGED
|
@@ -117,27 +117,33 @@ const showStats = async (service) => {
|
|
|
117
117
|
const ordResult = await svc.getOrders(account.accountId);
|
|
118
118
|
if (ordResult.success) totalOpenOrders += ordResult.orders.filter(o => o.status === 1).length;
|
|
119
119
|
|
|
120
|
-
// Lifetime stats
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
// Lifetime stats (if available)
|
|
121
|
+
if (typeof svc.getLifetimeStats === 'function') {
|
|
122
|
+
const lifetimeResult = await svc.getLifetimeStats(account.accountId);
|
|
123
|
+
if (lifetimeResult.success && lifetimeResult.stats) {
|
|
124
|
+
account.lifetimeStats = lifetimeResult.stats;
|
|
125
|
+
}
|
|
124
126
|
}
|
|
125
127
|
|
|
126
|
-
// Daily stats
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
// Daily stats (if available)
|
|
129
|
+
if (typeof svc.getDailyStats === 'function') {
|
|
130
|
+
const dailyResult = await svc.getDailyStats(account.accountId);
|
|
131
|
+
if (dailyResult.success && dailyResult.stats) {
|
|
132
|
+
account.dailyStats = dailyResult.stats;
|
|
133
|
+
allDailyStats = allDailyStats.concat(dailyResult.stats);
|
|
134
|
+
}
|
|
131
135
|
}
|
|
132
136
|
|
|
133
|
-
// Trade history
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
// Trade history (if available)
|
|
138
|
+
if (typeof svc.getTradeHistory === 'function') {
|
|
139
|
+
const tradesResult = await svc.getTradeHistory(account.accountId, 30);
|
|
140
|
+
if (tradesResult.success && tradesResult.trades.length > 0) {
|
|
141
|
+
allTrades = allTrades.concat(tradesResult.trades.map(t => ({
|
|
142
|
+
...t,
|
|
143
|
+
accountName: account.accountName,
|
|
144
|
+
propfirm: account.propfirm
|
|
145
|
+
})));
|
|
146
|
+
}
|
|
141
147
|
}
|
|
142
148
|
}
|
|
143
149
|
|
|
@@ -578,6 +578,27 @@ class RithmicService extends EventEmitter {
|
|
|
578
578
|
});
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
+
/**
|
|
582
|
+
* Get lifetime stats (stub for Rithmic - not available via API)
|
|
583
|
+
*/
|
|
584
|
+
async getLifetimeStats(accountId) {
|
|
585
|
+
return { success: true, stats: null };
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Get daily stats (stub for Rithmic - not available via API)
|
|
590
|
+
*/
|
|
591
|
+
async getDailyStats(accountId) {
|
|
592
|
+
return { success: true, stats: [] };
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Get trade history (stub for Rithmic)
|
|
597
|
+
*/
|
|
598
|
+
async getTradeHistory(accountId, days = 30) {
|
|
599
|
+
return { success: true, trades: [] };
|
|
600
|
+
}
|
|
601
|
+
|
|
581
602
|
/**
|
|
582
603
|
* Get order history
|
|
583
604
|
* Uses RequestShowOrderHistorySummary (template 324)
|
|
@@ -257,6 +257,86 @@ class TradovateService extends EventEmitter {
|
|
|
257
257
|
return this.user;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Get orders for an account
|
|
262
|
+
*/
|
|
263
|
+
async getOrders(accountId) {
|
|
264
|
+
try {
|
|
265
|
+
const orders = await this._request(API_PATHS.ORDER_LIST, 'GET');
|
|
266
|
+
const filtered = accountId
|
|
267
|
+
? orders.filter(o => o.accountId === accountId)
|
|
268
|
+
: orders;
|
|
269
|
+
return {
|
|
270
|
+
success: true,
|
|
271
|
+
orders: filtered.map(o => ({
|
|
272
|
+
orderId: o.id,
|
|
273
|
+
accountId: o.accountId,
|
|
274
|
+
symbol: o.contractId,
|
|
275
|
+
side: o.action === 'Buy' ? 0 : 1,
|
|
276
|
+
quantity: o.orderQty,
|
|
277
|
+
filledQuantity: o.filledQty || 0,
|
|
278
|
+
price: o.price,
|
|
279
|
+
status: o.ordStatus === 'Working' ? 1 : (o.ordStatus === 'Filled' ? 2 : 0),
|
|
280
|
+
orderType: o.orderType,
|
|
281
|
+
}))
|
|
282
|
+
};
|
|
283
|
+
} catch (error) {
|
|
284
|
+
return { success: false, error: error.message, orders: [] };
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Get order history
|
|
290
|
+
*/
|
|
291
|
+
async getOrderHistory(days = 30) {
|
|
292
|
+
try {
|
|
293
|
+
const orders = await this._request(API_PATHS.ORDER_LIST, 'GET');
|
|
294
|
+
return { success: true, orders };
|
|
295
|
+
} catch (error) {
|
|
296
|
+
return { success: false, error: error.message, orders: [] };
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Get lifetime stats (stub - Tradovate doesn't provide this directly)
|
|
302
|
+
*/
|
|
303
|
+
async getLifetimeStats(accountId) {
|
|
304
|
+
return { success: true, stats: null };
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Get daily stats (stub - Tradovate doesn't provide this directly)
|
|
309
|
+
*/
|
|
310
|
+
async getDailyStats(accountId) {
|
|
311
|
+
return { success: true, stats: [] };
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Get trade history
|
|
316
|
+
*/
|
|
317
|
+
async getTradeHistory(accountId, days = 30) {
|
|
318
|
+
try {
|
|
319
|
+
const fills = await this.getFills();
|
|
320
|
+
const filtered = accountId
|
|
321
|
+
? fills.filter(f => f.accountId === accountId)
|
|
322
|
+
: fills;
|
|
323
|
+
return {
|
|
324
|
+
success: true,
|
|
325
|
+
trades: filtered.map(f => ({
|
|
326
|
+
tradeId: f.id,
|
|
327
|
+
accountId: f.accountId,
|
|
328
|
+
symbol: f.contractId,
|
|
329
|
+
side: f.action === 'Buy' ? 0 : 1,
|
|
330
|
+
quantity: f.qty,
|
|
331
|
+
price: f.price,
|
|
332
|
+
timestamp: f.timestamp,
|
|
333
|
+
}))
|
|
334
|
+
};
|
|
335
|
+
} catch (error) {
|
|
336
|
+
return { success: false, error: error.message, trades: [] };
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
260
340
|
/**
|
|
261
341
|
* Check market hours (same logic as ProjectX)
|
|
262
342
|
*/
|