hedgequantx 1.2.58 → 1.2.59

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/pages/algo.js +24 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.2.58",
3
+ "version": "1.2.59",
4
4
  "description": "Prop Futures Algo Trading CLI - Connect to Topstep, Alpha Futures, and other prop firms",
5
5
  "main": "src/app.js",
6
6
  "bin": {
package/src/pages/algo.js CHANGED
@@ -331,8 +331,30 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
331
331
  console.clear();
332
332
  };
333
333
 
334
+ // Check market hours
335
+ const checkMarketStatus = () => {
336
+ const now = new Date();
337
+ const utcDay = now.getUTCDay();
338
+ const utcHour = now.getUTCHours();
339
+ const isDST = (() => {
340
+ const jan = new Date(now.getFullYear(), 0, 1);
341
+ const jul = new Date(now.getFullYear(), 6, 1);
342
+ return now.getTimezoneOffset() < Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
343
+ })();
344
+ const ctOffset = isDST ? 5 : 6;
345
+ const ctHour = (utcHour - ctOffset + 24) % 24;
346
+ const ctDay = utcHour < ctOffset ? (utcDay + 6) % 7 : utcDay;
347
+
348
+ if (ctDay === 6) return { isOpen: false, message: 'Market closed (Saturday)' };
349
+ if (ctDay === 0 && ctHour < 17) return { isOpen: false, message: 'Market opens Sunday 5:00 PM CT' };
350
+ if (ctDay === 5 && ctHour >= 16) return { isOpen: false, message: 'Market closed (Friday after 4PM CT)' };
351
+ if (ctHour === 16 && ctDay >= 1 && ctDay <= 4) return { isOpen: false, message: 'Daily maintenance (4:00-5:00 PM CT)' };
352
+ return { isOpen: true, message: 'Market OPEN' };
353
+ };
354
+
334
355
  const displayUI = () => {
335
356
  clearScreen();
357
+ const marketStatus = checkMarketStatus();
336
358
  console.log();
337
359
  console.log(chalk.gray(getSeparator()));
338
360
  console.log(chalk.cyan.bold(' HQX Ultra-Scalping Algo'));
@@ -341,7 +363,8 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
341
363
  console.log(chalk.white(` Account: ${chalk.cyan(accountName)}`));
342
364
  console.log(chalk.white(` Symbol: ${chalk.cyan(symbolName)}`));
343
365
  console.log(chalk.white(` Contracts: ${chalk.cyan(numContracts)}`));
344
- console.log(chalk.white(` Mode: ${hqxConnected ? chalk.green('LIVE') : chalk.yellow('OFFLINE')}`));
366
+ console.log(chalk.white(` Server: ${hqxConnected ? chalk.green('CONNECTED') : chalk.red('DISCONNECTED')}`));
367
+ console.log(chalk.white(` Market: ${marketStatus.isOpen ? chalk.green(marketStatus.message) : chalk.red(marketStatus.message)}`));
345
368
  console.log(chalk.gray(getSeparator()));
346
369
 
347
370
  // Risk Management