hedgequantx 2.9.142 → 2.9.143
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
|
@@ -214,15 +214,25 @@ const SYMBOLS = {
|
|
|
214
214
|
// S&P
|
|
215
215
|
ES: { name: 'ES', floor: 'Spooz', asset: 'index', slang: 'the Spooz' },
|
|
216
216
|
MES: { name: 'MES', floor: 'Micro S&P', asset: 'index', slang: 'micro spooz' },
|
|
217
|
+
// Dow
|
|
218
|
+
YM: { name: 'YM', floor: 'Dow', asset: 'index', slang: 'the Dow' },
|
|
219
|
+
MYM: { name: 'MYM', floor: 'Micro Dow', asset: 'index', slang: 'mini Dow' },
|
|
217
220
|
// Crude
|
|
218
221
|
CL: { name: 'CL', floor: 'Crude', asset: 'energy', slang: 'oil' },
|
|
219
222
|
MCL: { name: 'MCL', floor: 'Micro Crude', asset: 'energy', slang: 'micro crude' },
|
|
220
223
|
// Gold
|
|
221
224
|
GC: { name: 'GC', floor: 'Gold', asset: 'metals', slang: 'yellow metal' },
|
|
222
225
|
MGC: { name: 'MGC', floor: 'Micro Gold', asset: 'metals', slang: 'micro gold' },
|
|
226
|
+
'1OZ': { name: '1OZ', floor: 'Micro Gold', asset: 'metals', slang: '1oz gold' },
|
|
227
|
+
// Silver
|
|
228
|
+
SI: { name: 'SI', floor: 'Silver', asset: 'metals', slang: 'silver' },
|
|
229
|
+
SIL: { name: 'SIL', floor: 'Micro Silver', asset: 'metals', slang: 'micro silver' },
|
|
223
230
|
// Bonds
|
|
224
231
|
ZB: { name: 'ZB', floor: 'Bonds', asset: 'rates', slang: 'long bond' },
|
|
225
232
|
ZN: { name: 'ZN', floor: '10Y', asset: 'rates', slang: 'tens' },
|
|
233
|
+
// Russell
|
|
234
|
+
RTY: { name: 'RTY', floor: 'Russell', asset: 'index', slang: 'small caps' },
|
|
235
|
+
M2K: { name: 'M2K', floor: 'Micro Russell', asset: 'index', slang: 'micro russell' },
|
|
226
236
|
// Default
|
|
227
237
|
DEFAULT: { name: 'Contract', floor: 'Futures', asset: 'futures', slang: 'contract' }
|
|
228
238
|
};
|
|
@@ -362,7 +362,11 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
362
362
|
try {
|
|
363
363
|
const accountResult = await service.getTradingAccounts();
|
|
364
364
|
if (accountResult.success && accountResult.accounts) {
|
|
365
|
-
|
|
365
|
+
// Match by rithmicAccountId (original) or accountId (hashed)
|
|
366
|
+
const accId = account.rithmicAccountId || account.accountId;
|
|
367
|
+
const acc = accountResult.accounts.find(a =>
|
|
368
|
+
a.rithmicAccountId === accId || a.accountId === account.accountId
|
|
369
|
+
);
|
|
366
370
|
if (acc && acc.profitAndLoss !== undefined) {
|
|
367
371
|
if (startingPnL === null) startingPnL = acc.profitAndLoss;
|
|
368
372
|
stats.pnl = acc.profitAndLoss - startingPnL;
|
|
@@ -370,7 +374,7 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
370
374
|
}
|
|
371
375
|
}
|
|
372
376
|
|
|
373
|
-
const posResult = await service.getPositions(account.accountId);
|
|
377
|
+
const posResult = await service.getPositions(account.rithmicAccountId || account.accountId);
|
|
374
378
|
if (posResult.success && posResult.positions) {
|
|
375
379
|
const pos = posResult.positions.find(p => {
|
|
376
380
|
const sym = p.contractId || p.symbol || '';
|
|
@@ -287,15 +287,24 @@ const executeMultiSymbol = async ({ service, account, contracts, config, strateg
|
|
|
287
287
|
try {
|
|
288
288
|
const accountResult = await service.getTradingAccounts();
|
|
289
289
|
if (accountResult.success && accountResult.accounts) {
|
|
290
|
-
|
|
290
|
+
// Match by rithmicAccountId (original) or accountId (hashed)
|
|
291
|
+
const accId = account.rithmicAccountId || account.accountId;
|
|
292
|
+
const acc = accountResult.accounts.find(a =>
|
|
293
|
+
a.rithmicAccountId === accId || a.accountId === account.accountId
|
|
294
|
+
);
|
|
291
295
|
if (acc && acc.profitAndLoss !== undefined) {
|
|
292
|
-
//
|
|
293
|
-
|
|
296
|
+
// Track session P&L (relative to start)
|
|
297
|
+
const data = symbolData.values().next().value;
|
|
298
|
+
if (data && data.startingPnL === null) {
|
|
299
|
+
data.startingPnL = acc.profitAndLoss;
|
|
300
|
+
}
|
|
301
|
+
const startPnL = data?.startingPnL || 0;
|
|
302
|
+
globalStats.pnl = acc.profitAndLoss - startPnL;
|
|
294
303
|
}
|
|
295
304
|
}
|
|
296
305
|
|
|
297
306
|
// Check positions per symbol
|
|
298
|
-
const posResult = await service.getPositions(account.accountId);
|
|
307
|
+
const posResult = await service.getPositions(account.rithmicAccountId || account.accountId);
|
|
299
308
|
if (posResult.success && posResult.positions) {
|
|
300
309
|
for (const [sym, data] of symbolData) {
|
|
301
310
|
const pos = posResult.positions.find(p => (p.contractId || p.symbol || '').includes(sym));
|