hedgequantx 1.2.55 → 1.2.56
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 +49 -0
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -519,6 +519,55 @@ const copyTradingMenu = async () => {
|
|
|
519
519
|
console.log(chalk.gray(getSeparator()));
|
|
520
520
|
console.log();
|
|
521
521
|
|
|
522
|
+
// Check market status first
|
|
523
|
+
const marketSpinner = ora('Checking market status...').start();
|
|
524
|
+
|
|
525
|
+
// Use a simple market hours check
|
|
526
|
+
const now = new Date();
|
|
527
|
+
const utcDay = now.getUTCDay();
|
|
528
|
+
const utcHour = now.getUTCHours();
|
|
529
|
+
const isDST = (() => {
|
|
530
|
+
const jan = new Date(now.getFullYear(), 0, 1);
|
|
531
|
+
const jul = new Date(now.getFullYear(), 6, 1);
|
|
532
|
+
return now.getTimezoneOffset() < Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
|
|
533
|
+
})();
|
|
534
|
+
const ctOffset = isDST ? 5 : 6;
|
|
535
|
+
const ctHour = (utcHour - ctOffset + 24) % 24;
|
|
536
|
+
const ctDay = utcHour < ctOffset ? (utcDay + 6) % 7 : utcDay;
|
|
537
|
+
|
|
538
|
+
let marketClosed = false;
|
|
539
|
+
let marketMessage = '';
|
|
540
|
+
|
|
541
|
+
if (ctDay === 6) {
|
|
542
|
+
marketClosed = true;
|
|
543
|
+
marketMessage = 'Market closed (Saturday)';
|
|
544
|
+
} else if (ctDay === 0 && ctHour < 17) {
|
|
545
|
+
marketClosed = true;
|
|
546
|
+
marketMessage = 'Market opens Sunday 5:00 PM CT';
|
|
547
|
+
} else if (ctDay === 5 && ctHour >= 16) {
|
|
548
|
+
marketClosed = true;
|
|
549
|
+
marketMessage = 'Market closed (Friday after 4PM CT)';
|
|
550
|
+
} else if (ctHour === 16 && ctDay >= 1 && ctDay <= 4) {
|
|
551
|
+
marketClosed = true;
|
|
552
|
+
marketMessage = 'Daily maintenance (4:00-5:00 PM CT)';
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
if (marketClosed) {
|
|
556
|
+
marketSpinner.fail('Market is CLOSED');
|
|
557
|
+
console.log();
|
|
558
|
+
console.log(chalk.red.bold(' [X] ' + marketMessage));
|
|
559
|
+
console.log();
|
|
560
|
+
console.log(chalk.gray(' Futures markets (CME) trading hours:'));
|
|
561
|
+
console.log(chalk.gray(' Sunday 5:00 PM CT - Friday 4:00 PM CT'));
|
|
562
|
+
console.log(chalk.gray(' Daily maintenance: 4:00 PM - 5:00 PM CT'));
|
|
563
|
+
console.log();
|
|
564
|
+
await inquirer.prompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
marketSpinner.succeed('Market is OPEN - Ready to trade!');
|
|
569
|
+
console.log();
|
|
570
|
+
|
|
522
571
|
// Get all active accounts from all connections
|
|
523
572
|
const allAccounts = await connections.getAllAccounts();
|
|
524
573
|
const activeAccounts = allAccounts.filter(acc => acc.status === 0);
|