hedgequantx 1.8.12 → 1.8.13
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
|
@@ -10,6 +10,7 @@ const { connections } = require('../../services');
|
|
|
10
10
|
const { HQXServerService } = require('../../services/hqx-server');
|
|
11
11
|
const { AlgoUI } = require('./ui');
|
|
12
12
|
const { logger, prompts } = require('../../utils');
|
|
13
|
+
const { checkMarketHours } = require('../../services/projectx/market');
|
|
13
14
|
|
|
14
15
|
const log = logger.scope('CopyTrading');
|
|
15
16
|
|
|
@@ -18,6 +19,18 @@ const log = logger.scope('CopyTrading');
|
|
|
18
19
|
*/
|
|
19
20
|
const copyTradingMenu = async () => {
|
|
20
21
|
log.info('Copy Trading menu opened');
|
|
22
|
+
|
|
23
|
+
// Check if market is open
|
|
24
|
+
const market = checkMarketHours();
|
|
25
|
+
if (!market.isOpen) {
|
|
26
|
+
console.log();
|
|
27
|
+
console.log(chalk.red(` ${market.message}`));
|
|
28
|
+
console.log(chalk.gray(' Algo trading is only available when market is open'));
|
|
29
|
+
console.log();
|
|
30
|
+
await prompts.waitForEnter();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
21
34
|
const allConns = connections.getAll();
|
|
22
35
|
|
|
23
36
|
if (allConns.length < 2) {
|
|
@@ -10,11 +10,23 @@ const { connections } = require('../../services');
|
|
|
10
10
|
const { HQXServerService } = require('../../services/hqx-server');
|
|
11
11
|
const { AlgoUI } = require('./ui');
|
|
12
12
|
const { prompts } = require('../../utils');
|
|
13
|
+
const { checkMarketHours } = require('../../services/projectx/market');
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* One Account Menu
|
|
16
17
|
*/
|
|
17
18
|
const oneAccountMenu = async (service) => {
|
|
19
|
+
// Check if market is open
|
|
20
|
+
const market = checkMarketHours();
|
|
21
|
+
if (!market.isOpen) {
|
|
22
|
+
console.log();
|
|
23
|
+
console.log(chalk.red(` ${market.message}`));
|
|
24
|
+
console.log(chalk.gray(' Algo trading is only available when market is open'));
|
|
25
|
+
console.log();
|
|
26
|
+
await prompts.waitForEnter();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
const spinner = ora({ text: 'Fetching active accounts...', color: 'yellow' }).start();
|
|
19
31
|
|
|
20
32
|
const allAccounts = await connections.getAllAccounts();
|