hedgequantx 1.2.63 → 1.2.65
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 +33 -16
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -342,11 +342,11 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
342
342
|
}
|
|
343
343
|
};
|
|
344
344
|
|
|
345
|
-
// Add log (newest
|
|
345
|
+
// Add log (oldest first, newest at bottom)
|
|
346
346
|
const addLog = (type, message) => {
|
|
347
347
|
const timestamp = new Date().toLocaleTimeString();
|
|
348
|
-
logs.
|
|
349
|
-
if (logs.length > MAX_LOGS) logs.
|
|
348
|
+
logs.push({ timestamp, type, message }); // Add at end
|
|
349
|
+
if (logs.length > MAX_LOGS) logs.shift(); // Remove oldest from top
|
|
350
350
|
};
|
|
351
351
|
|
|
352
352
|
// Print log and refresh display
|
|
@@ -381,33 +381,50 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
381
381
|
console.clear();
|
|
382
382
|
const marketStatus = checkMarketStatus();
|
|
383
383
|
|
|
384
|
-
//
|
|
384
|
+
// Logo
|
|
385
|
+
const logo = [
|
|
386
|
+
'██╗ ██╗ ██████╗ ██╗ ██╗',
|
|
387
|
+
'██║ ██║██╔═══██╗╚██╗██╔╝',
|
|
388
|
+
'███████║██║ ██║ ╚███╔╝ ',
|
|
389
|
+
'██╔══██║██║▄▄ ██║ ██╔██╗ ',
|
|
390
|
+
'██║ ██║╚██████╔╝██╔╝ ██╗',
|
|
391
|
+
'╚═╝ ╚═╝ ╚══▀▀═╝ ╚═╝ ╚═╝'
|
|
392
|
+
];
|
|
393
|
+
|
|
394
|
+
console.log();
|
|
395
|
+
logo.forEach(line => {
|
|
396
|
+
console.log(chalk.cyan(' ' + line));
|
|
397
|
+
});
|
|
398
|
+
console.log(chalk.gray(' Ultra-Scalping Algorithm'));
|
|
385
399
|
console.log();
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
console.log(chalk.
|
|
389
|
-
console.log(chalk.white(`
|
|
390
|
-
console.log(chalk.white(`
|
|
400
|
+
|
|
401
|
+
// Info Box
|
|
402
|
+
console.log(chalk.cyan(' ╔════════════════════════════════════════════════════════════════════╗'));
|
|
403
|
+
console.log(chalk.cyan(' ║') + chalk.white(` Account: ${chalk.cyan(accountName.padEnd(25))} Symbol: ${chalk.yellow(symbolName.padEnd(10))} Qty: ${chalk.cyan(numContracts.toString().padEnd(3))}`) + chalk.cyan('║'));
|
|
404
|
+
console.log(chalk.cyan(' ║') + chalk.white(` Target: ${chalk.green(('$' + dailyTarget.toFixed(2)).padEnd(12))} Risk: ${chalk.red(('$' + maxRisk.toFixed(2)).padEnd(12))} Server: ${hqxConnected ? chalk.green('ON ') : chalk.red('OFF')} `) + chalk.cyan('║'));
|
|
391
405
|
|
|
392
406
|
// Stats line
|
|
393
407
|
const pnlColor = stats.pnl >= 0 ? chalk.green : chalk.red;
|
|
394
|
-
const pnlStr = stats.pnl >= 0 ? '+$'
|
|
395
|
-
console.log(chalk.white(`
|
|
396
|
-
|
|
397
|
-
console.log(chalk.
|
|
408
|
+
const pnlStr = (stats.pnl >= 0 ? '+$' : '-$') + Math.abs(stats.pnl).toFixed(2);
|
|
409
|
+
console.log(chalk.cyan(' ║') + chalk.white(` P&L: ${pnlColor(pnlStr.padEnd(12))} Trades: ${chalk.cyan(stats.trades.toString().padEnd(4))} W: ${chalk.green(stats.wins.toString().padEnd(3))} L: ${chalk.red(stats.losses.toString().padEnd(3))} `) + chalk.cyan('║'));
|
|
410
|
+
console.log(chalk.cyan(' ╠════════════════════════════════════════════════════════════════════╣'));
|
|
411
|
+
console.log(chalk.cyan(' ║') + chalk.white(' Activity Log ') + chalk.yellow('Press X to stop') + chalk.cyan(' ║'));
|
|
412
|
+
console.log(chalk.cyan(' ╠════════════════════════════════════════════════════════════════════╣'));
|
|
398
413
|
|
|
399
414
|
// Logs (newest first - already in correct order)
|
|
400
415
|
if (logs.length === 0) {
|
|
401
|
-
console.log(chalk.gray(' Waiting for activity...'));
|
|
416
|
+
console.log(chalk.cyan(' ║') + chalk.gray(' Waiting for activity...'.padEnd(68)) + chalk.cyan('║'));
|
|
402
417
|
} else {
|
|
403
418
|
logs.forEach(log => {
|
|
404
419
|
const color = typeColors[log.type] || chalk.white;
|
|
405
420
|
const icon = getIcon(log.type);
|
|
406
|
-
|
|
421
|
+
const logLine = `[${log.timestamp}] ${icon} ${log.message}`;
|
|
422
|
+
const truncated = logLine.length > 66 ? logLine.substring(0, 63) + '...' : logLine;
|
|
423
|
+
console.log(chalk.cyan(' ║') + ' ' + color(truncated.padEnd(67)) + chalk.cyan('║'));
|
|
407
424
|
});
|
|
408
425
|
}
|
|
409
426
|
|
|
410
|
-
console.log(chalk.
|
|
427
|
+
console.log(chalk.cyan(' ╚════════════════════════════════════════════════════════════════════╝'));
|
|
411
428
|
};
|
|
412
429
|
|
|
413
430
|
// Connect to HQX Server
|