hedgequantx 1.5.0 → 1.5.2
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/menus/dashboard.js +2 -2
- package/src/pages/algo/index.js +12 -0
- package/src/ui/index.js +2 -18
package/package.json
CHANGED
package/src/menus/dashboard.js
CHANGED
|
@@ -113,9 +113,9 @@ const dashboardMenu = async (service) => {
|
|
|
113
113
|
console.log(chalk.cyan('╚' + '═'.repeat(W) + '╝'));
|
|
114
114
|
console.log();
|
|
115
115
|
|
|
116
|
-
//
|
|
117
|
-
await new Promise(resolve => setTimeout(resolve, 50));
|
|
116
|
+
// Ensure stdin is ready before prompt
|
|
118
117
|
prepareStdin();
|
|
118
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
119
119
|
|
|
120
120
|
const { action } = await inquirer.prompt([
|
|
121
121
|
{
|
package/src/pages/algo/index.js
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
const chalk = require('chalk');
|
|
7
7
|
const inquirer = require('inquirer');
|
|
8
8
|
const { getSeparator } = require('../../ui');
|
|
9
|
+
const { logger } = require('../../utils');
|
|
10
|
+
|
|
11
|
+
const log = logger.scope('AlgoMenu');
|
|
9
12
|
|
|
10
13
|
const { oneAccountMenu } = require('./one-account');
|
|
11
14
|
const { copyTradingMenu } = require('./copy-trading');
|
|
@@ -14,6 +17,8 @@ const { copyTradingMenu } = require('./copy-trading');
|
|
|
14
17
|
* Algo Trading Menu
|
|
15
18
|
*/
|
|
16
19
|
const algoTradingMenu = async (service) => {
|
|
20
|
+
log.info('Algo Trading menu opened');
|
|
21
|
+
|
|
17
22
|
console.log();
|
|
18
23
|
console.log(chalk.gray(getSeparator()));
|
|
19
24
|
console.log(chalk.magenta.bold(' Algo-Trading'));
|
|
@@ -36,13 +41,20 @@ const algoTradingMenu = async (service) => {
|
|
|
36
41
|
}
|
|
37
42
|
]);
|
|
38
43
|
|
|
44
|
+
log.debug('Algo mode selected', { action });
|
|
45
|
+
|
|
39
46
|
switch (action) {
|
|
40
47
|
case 'one_account':
|
|
48
|
+
log.info('Starting One Account mode');
|
|
41
49
|
await oneAccountMenu(service);
|
|
42
50
|
break;
|
|
43
51
|
case 'copy_trading':
|
|
52
|
+
log.info('Starting Copy Trading mode');
|
|
44
53
|
await copyTradingMenu();
|
|
45
54
|
break;
|
|
55
|
+
case 'back':
|
|
56
|
+
log.debug('User went back');
|
|
57
|
+
break;
|
|
46
58
|
}
|
|
47
59
|
|
|
48
60
|
return action;
|
package/src/ui/index.js
CHANGED
|
@@ -36,25 +36,9 @@ const prepareStdin = () => {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// Reset stdin to proper state for inquirer
|
|
39
|
-
if (process.stdin.isTTY) {
|
|
40
|
-
|
|
41
|
-
if (process.stdin.isRaw) {
|
|
42
|
-
process.stdin.setRawMode(false);
|
|
43
|
-
}
|
|
39
|
+
if (process.stdin.isTTY && process.stdin.isRaw) {
|
|
40
|
+
process.stdin.setRawMode(false);
|
|
44
41
|
}
|
|
45
|
-
|
|
46
|
-
// Clear any buffered input by removing old listeners temporarily
|
|
47
|
-
const oldListeners = process.stdin.listeners('data');
|
|
48
|
-
process.stdin.removeAllListeners('data');
|
|
49
|
-
|
|
50
|
-
// Restore listeners after a tick
|
|
51
|
-
setImmediate(() => {
|
|
52
|
-
oldListeners.forEach(listener => {
|
|
53
|
-
if (!process.stdin.listeners('data').includes(listener)) {
|
|
54
|
-
process.stdin.on('data', listener);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
42
|
} catch (e) {
|
|
59
43
|
// Ignore errors
|
|
60
44
|
}
|