hedgequantx 2.7.40 → 2.7.42
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 +20 -20
- package/src/menus/dashboard.js +5 -1
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -109,7 +109,7 @@ const refreshStats = async () => {
|
|
|
109
109
|
|
|
110
110
|
// ==================== BANNER ====================
|
|
111
111
|
|
|
112
|
-
const banner = async (
|
|
112
|
+
const banner = async () => {
|
|
113
113
|
console.clear();
|
|
114
114
|
|
|
115
115
|
const termWidth = process.stdout.columns || 100;
|
|
@@ -135,14 +135,6 @@ const banner = async (withLoading = false) => {
|
|
|
135
135
|
const tagline = isMobile ? `HQX V${version}` : `PROP FUTURES ALGO TRADING V${version}`;
|
|
136
136
|
console.log(chalk.cyan('║') + chalk.white(centerText(tagline, innerWidth)) + chalk.cyan('║'));
|
|
137
137
|
|
|
138
|
-
// Show loading message if requested
|
|
139
|
-
if (withLoading) {
|
|
140
|
-
const loadingText = ' LOADING DASHBOARD...';
|
|
141
|
-
const loadingPad = innerWidth - loadingText.length;
|
|
142
|
-
console.log(chalk.cyan('╠' + '═'.repeat(innerWidth) + '╣'));
|
|
143
|
-
console.log(chalk.cyan('║') + chalk.yellow(loadingText) + ' '.repeat(loadingPad) + chalk.cyan('║'));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
138
|
// ALWAYS close the banner
|
|
147
139
|
console.log(chalk.cyan('╚' + '═'.repeat(innerWidth) + '╝'));
|
|
148
140
|
};
|
|
@@ -171,23 +163,31 @@ const run = async () => {
|
|
|
171
163
|
try {
|
|
172
164
|
log.info('Starting HQX CLI');
|
|
173
165
|
|
|
174
|
-
// First launch - show banner
|
|
175
|
-
await banner(
|
|
166
|
+
// First launch - show banner then spinner
|
|
167
|
+
await banner();
|
|
168
|
+
|
|
169
|
+
const spinner = ora({ text: 'LOADING DASHBOARD...', color: 'yellow' }).start();
|
|
176
170
|
|
|
177
171
|
const restored = await connections.restoreFromStorage();
|
|
178
172
|
|
|
179
173
|
if (restored) {
|
|
180
174
|
currentService = connections.getAll()[0].service;
|
|
181
175
|
await refreshStats();
|
|
176
|
+
spinner.succeed('SESSION RESTORED');
|
|
177
|
+
} else {
|
|
178
|
+
spinner.stop();
|
|
182
179
|
}
|
|
180
|
+
|
|
181
|
+
await new Promise(r => setTimeout(r, 500));
|
|
183
182
|
|
|
184
183
|
// Main loop
|
|
185
184
|
while (true) {
|
|
186
185
|
try {
|
|
187
186
|
prepareStdin();
|
|
188
|
-
await banner();
|
|
189
187
|
|
|
190
188
|
if (!connections.isConnected()) {
|
|
189
|
+
// Not connected - show banner + propfirm selection
|
|
190
|
+
await banner();
|
|
191
191
|
// Not connected - show propfirm selection directly
|
|
192
192
|
const boxWidth = getLogoWidth();
|
|
193
193
|
const innerWidth = boxWidth - 2;
|
|
@@ -202,8 +202,8 @@ const run = async () => {
|
|
|
202
202
|
const totalContentWidth = numCols * colWidth;
|
|
203
203
|
const leftMargin = Math.max(2, Math.floor((innerWidth - totalContentWidth) / 2));
|
|
204
204
|
|
|
205
|
-
//
|
|
206
|
-
console.log(chalk.cyan('
|
|
205
|
+
// New rectangle (banner is always closed)
|
|
206
|
+
console.log(chalk.cyan('╔' + '═'.repeat(innerWidth) + '╗'));
|
|
207
207
|
console.log(chalk.cyan('║') + chalk.white.bold(centerText('SELECT PROPFIRM', innerWidth)) + chalk.cyan('║'));
|
|
208
208
|
console.log(chalk.cyan('╠' + '═'.repeat(innerWidth) + '╣'));
|
|
209
209
|
|
|
@@ -255,26 +255,26 @@ const run = async () => {
|
|
|
255
255
|
const credentials = await loginPrompt(selectedPropfirm.name);
|
|
256
256
|
|
|
257
257
|
if (credentials) {
|
|
258
|
-
const spinner = ora({ text: '
|
|
258
|
+
const spinner = ora({ text: 'CONNECTING TO RITHMIC...', color: 'yellow' }).start();
|
|
259
259
|
try {
|
|
260
260
|
const { RithmicService } = require('./services/rithmic');
|
|
261
261
|
const service = new RithmicService(selectedPropfirm.key);
|
|
262
262
|
const result = await service.login(credentials.username, credentials.password);
|
|
263
263
|
|
|
264
264
|
if (result.success) {
|
|
265
|
-
spinner.text = '
|
|
265
|
+
spinner.text = 'FETCHING ACCOUNTS...';
|
|
266
266
|
const accResult = await service.getTradingAccounts();
|
|
267
267
|
connections.add('rithmic', service, service.propfirm.name);
|
|
268
|
-
spinner.succeed(`
|
|
268
|
+
spinner.succeed(`CONNECTED TO ${service.propfirm.name.toUpperCase()} (${accResult.accounts?.length || 0} ACCOUNTS)`);
|
|
269
269
|
currentService = service;
|
|
270
270
|
await refreshStats();
|
|
271
271
|
await new Promise(r => setTimeout(r, 1500));
|
|
272
272
|
} else {
|
|
273
|
-
spinner.fail(result.error || '
|
|
273
|
+
spinner.fail((result.error || 'AUTHENTICATION FAILED').toUpperCase());
|
|
274
274
|
await new Promise(r => setTimeout(r, 2000));
|
|
275
275
|
}
|
|
276
276
|
} catch (error) {
|
|
277
|
-
spinner.fail(`
|
|
277
|
+
spinner.fail(`CONNECTION ERROR: ${error.message.toUpperCase()}`);
|
|
278
278
|
await new Promise(r => setTimeout(r, 2000));
|
|
279
279
|
}
|
|
280
280
|
}
|
|
@@ -307,7 +307,7 @@ const run = async () => {
|
|
|
307
307
|
try {
|
|
308
308
|
await algoTradingMenu(currentService);
|
|
309
309
|
} catch (err) {
|
|
310
|
-
console.log(chalk.red(`
|
|
310
|
+
console.log(chalk.red(` ALGO ERROR: ${err.message.toUpperCase()}`));
|
|
311
311
|
prepareStdin();
|
|
312
312
|
}
|
|
313
313
|
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
|
|