hedgequantx 1.8.38 → 1.8.40
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
|
@@ -72,7 +72,7 @@ const copyTradingMenu = async () => {
|
|
|
72
72
|
// Step 1: Select Lead Account
|
|
73
73
|
console.log(chalk.cyan(' Step 1: Select LEAD Account'));
|
|
74
74
|
const leadOptions = allAccounts.map((a, i) => ({
|
|
75
|
-
label: `${a.propfirm} - ${a.account.accountId}${a.account.balance !== null ? ` ($${a.account.balance.toLocaleString()})` : ''}`,
|
|
75
|
+
label: `${a.propfirm} - ${a.account.rithmicAccountId || a.account.name || a.account.accountId}${a.account.balance !== null ? ` ($${a.account.balance.toLocaleString()})` : ''}`,
|
|
76
76
|
value: i
|
|
77
77
|
}));
|
|
78
78
|
leadOptions.push({ label: '< Cancel', value: -1 });
|
|
@@ -88,7 +88,7 @@ const copyTradingMenu = async () => {
|
|
|
88
88
|
.map((a, i) => ({ a, i }))
|
|
89
89
|
.filter(x => x.i !== leadIdx)
|
|
90
90
|
.map(x => ({
|
|
91
|
-
label: `${x.a.propfirm} - ${x.a.account.accountId}${x.a.account.balance !== null ? ` ($${x.a.account.balance.toLocaleString()})` : ''}`,
|
|
91
|
+
label: `${x.a.propfirm} - ${x.a.account.rithmicAccountId || x.a.account.name || x.a.account.accountId}${x.a.account.balance !== null ? ` ($${x.a.account.balance.toLocaleString()})` : ''}`,
|
|
92
92
|
value: x.i
|
|
93
93
|
}));
|
|
94
94
|
followerOptions.push({ label: '< Cancel', value: -1 });
|
|
@@ -49,7 +49,7 @@ const oneAccountMenu = async (service) => {
|
|
|
49
49
|
|
|
50
50
|
// Select account
|
|
51
51
|
const options = activeAccounts.map(acc => ({
|
|
52
|
-
label: `${acc.accountId} (${acc.propfirm || 'Unknown'})${acc.balance !== null ? ` - $${acc.balance.toLocaleString()}` : ''}`,
|
|
52
|
+
label: `${acc.rithmicAccountId || acc.name || acc.accountId} (${acc.propfirm || 'Unknown'})${acc.balance !== null ? ` - $${acc.balance.toLocaleString()}` : ''}`,
|
|
53
53
|
value: acc
|
|
54
54
|
}));
|
|
55
55
|
options.push({ label: '< Back', value: 'back' });
|
package/src/utils/prompts.js
CHANGED
|
@@ -9,6 +9,11 @@ const readline = require('readline');
|
|
|
9
9
|
// Shared readline instance
|
|
10
10
|
let rl = null;
|
|
11
11
|
|
|
12
|
+
// Prevent readline from exiting on SIGINT during prompts
|
|
13
|
+
process.on('SIGINT', () => {
|
|
14
|
+
// Let the main app handle SIGINT
|
|
15
|
+
});
|
|
16
|
+
|
|
12
17
|
/**
|
|
13
18
|
* Get or create readline interface
|
|
14
19
|
*/
|
|
@@ -41,13 +46,37 @@ const prepareStdin = () => {
|
|
|
41
46
|
* Native readline prompt
|
|
42
47
|
*/
|
|
43
48
|
const nativePrompt = (message) => {
|
|
44
|
-
return new Promise((resolve) => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
try {
|
|
51
|
+
prepareStdin();
|
|
52
|
+
|
|
53
|
+
// Always create a fresh readline for each prompt to avoid state issues
|
|
54
|
+
if (rl && !rl.closed) {
|
|
55
|
+
rl.close();
|
|
56
|
+
rl = null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
rl = readline.createInterface({
|
|
60
|
+
input: process.stdin,
|
|
61
|
+
output: process.stdout,
|
|
62
|
+
terminal: true
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Handle readline close/error
|
|
66
|
+
rl.on('close', () => {
|
|
67
|
+
resolve('');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
rl.on('error', (err) => {
|
|
71
|
+
resolve('');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
rl.question(message + ' ', (answer) => {
|
|
75
|
+
resolve(answer || '');
|
|
76
|
+
});
|
|
77
|
+
} catch (e) {
|
|
78
|
+
resolve('');
|
|
79
|
+
}
|
|
51
80
|
});
|
|
52
81
|
};
|
|
53
82
|
|