hedgequantx 2.7.39 → 2.7.41
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/app.js +13 -10
- package/src/menus/dashboard.js +5 -1
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -141,8 +141,10 @@ const banner = async (withLoading = false) => {
|
|
|
141
141
|
const loadingPad = innerWidth - loadingText.length;
|
|
142
142
|
console.log(chalk.cyan('╠' + '═'.repeat(innerWidth) + '╣'));
|
|
143
143
|
console.log(chalk.cyan('║') + chalk.yellow(loadingText) + ' '.repeat(loadingPad) + chalk.cyan('║'));
|
|
144
|
-
console.log(chalk.cyan('╚' + '═'.repeat(innerWidth) + '╝'));
|
|
145
144
|
}
|
|
145
|
+
|
|
146
|
+
// ALWAYS close the banner
|
|
147
|
+
console.log(chalk.cyan('╚' + '═'.repeat(innerWidth) + '╝'));
|
|
146
148
|
};
|
|
147
149
|
|
|
148
150
|
const getFullLogo = () => [
|
|
@@ -183,9 +185,10 @@ const run = async () => {
|
|
|
183
185
|
while (true) {
|
|
184
186
|
try {
|
|
185
187
|
prepareStdin();
|
|
186
|
-
await banner();
|
|
187
188
|
|
|
188
189
|
if (!connections.isConnected()) {
|
|
190
|
+
// Not connected - show banner + propfirm selection
|
|
191
|
+
await banner();
|
|
189
192
|
// Not connected - show propfirm selection directly
|
|
190
193
|
const boxWidth = getLogoWidth();
|
|
191
194
|
const innerWidth = boxWidth - 2;
|
|
@@ -200,8 +203,8 @@ const run = async () => {
|
|
|
200
203
|
const totalContentWidth = numCols * colWidth;
|
|
201
204
|
const leftMargin = Math.max(2, Math.floor((innerWidth - totalContentWidth) / 2));
|
|
202
205
|
|
|
203
|
-
//
|
|
204
|
-
console.log(chalk.cyan('
|
|
206
|
+
// New rectangle (banner is always closed)
|
|
207
|
+
console.log(chalk.cyan('╔' + '═'.repeat(innerWidth) + '╗'));
|
|
205
208
|
console.log(chalk.cyan('║') + chalk.white.bold(centerText('SELECT PROPFIRM', innerWidth)) + chalk.cyan('║'));
|
|
206
209
|
console.log(chalk.cyan('╠' + '═'.repeat(innerWidth) + '╣'));
|
|
207
210
|
|
|
@@ -253,26 +256,26 @@ const run = async () => {
|
|
|
253
256
|
const credentials = await loginPrompt(selectedPropfirm.name);
|
|
254
257
|
|
|
255
258
|
if (credentials) {
|
|
256
|
-
const spinner = ora({ text: '
|
|
259
|
+
const spinner = ora({ text: 'CONNECTING TO RITHMIC...', color: 'yellow' }).start();
|
|
257
260
|
try {
|
|
258
261
|
const { RithmicService } = require('./services/rithmic');
|
|
259
262
|
const service = new RithmicService(selectedPropfirm.key);
|
|
260
263
|
const result = await service.login(credentials.username, credentials.password);
|
|
261
264
|
|
|
262
265
|
if (result.success) {
|
|
263
|
-
spinner.text = '
|
|
266
|
+
spinner.text = 'FETCHING ACCOUNTS...';
|
|
264
267
|
const accResult = await service.getTradingAccounts();
|
|
265
268
|
connections.add('rithmic', service, service.propfirm.name);
|
|
266
|
-
spinner.succeed(`
|
|
269
|
+
spinner.succeed(`CONNECTED TO ${service.propfirm.name.toUpperCase()} (${accResult.accounts?.length || 0} ACCOUNTS)`);
|
|
267
270
|
currentService = service;
|
|
268
271
|
await refreshStats();
|
|
269
272
|
await new Promise(r => setTimeout(r, 1500));
|
|
270
273
|
} else {
|
|
271
|
-
spinner.fail(result.error || '
|
|
274
|
+
spinner.fail((result.error || 'AUTHENTICATION FAILED').toUpperCase());
|
|
272
275
|
await new Promise(r => setTimeout(r, 2000));
|
|
273
276
|
}
|
|
274
277
|
} catch (error) {
|
|
275
|
-
spinner.fail(`
|
|
278
|
+
spinner.fail(`CONNECTION ERROR: ${error.message.toUpperCase()}`);
|
|
276
279
|
await new Promise(r => setTimeout(r, 2000));
|
|
277
280
|
}
|
|
278
281
|
}
|
|
@@ -305,7 +308,7 @@ const run = async () => {
|
|
|
305
308
|
try {
|
|
306
309
|
await algoTradingMenu(currentService);
|
|
307
310
|
} catch (err) {
|
|
308
|
-
console.log(chalk.red(`
|
|
311
|
+
console.log(chalk.red(` ALGO ERROR: ${err.message.toUpperCase()}`));
|
|
309
312
|
prepareStdin();
|
|
310
313
|
}
|
|
311
314
|
break;
|
package/src/menus/dashboard.js
CHANGED
|
@@ -7,7 +7,7 @@ const ora = require('ora');
|
|
|
7
7
|
const { execSync, spawn } = require('child_process');
|
|
8
8
|
|
|
9
9
|
const { connections } = require('../services');
|
|
10
|
-
const { getLogoWidth, centerText, prepareStdin } = require('../ui');
|
|
10
|
+
const { getLogoWidth, centerText, prepareStdin, displayBanner } = require('../ui');
|
|
11
11
|
const { getCachedStats } = require('../services/stats-cache');
|
|
12
12
|
const { prompts } = require('../utils');
|
|
13
13
|
|
|
@@ -17,6 +17,10 @@ const { prompts } = require('../utils');
|
|
|
17
17
|
const dashboardMenu = async (service) => {
|
|
18
18
|
prepareStdin();
|
|
19
19
|
|
|
20
|
+
// Clear screen and show banner (always closed)
|
|
21
|
+
console.clear();
|
|
22
|
+
displayBanner();
|
|
23
|
+
|
|
20
24
|
const boxWidth = getLogoWidth();
|
|
21
25
|
const W = boxWidth - 2;
|
|
22
26
|
|