hedgequantx 2.9.161 → 2.9.162
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 +21 -8
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -271,18 +271,31 @@ const run = async () => {
|
|
|
271
271
|
const credentials = await loginPrompt(selectedPropfirm.name);
|
|
272
272
|
|
|
273
273
|
if (credentials) {
|
|
274
|
-
const spinner = ora({ text: '
|
|
274
|
+
const spinner = ora({ text: 'STARTING BROKER DAEMON...', color: 'yellow' }).start();
|
|
275
275
|
try {
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
|
|
276
|
+
// Use BrokerClient to go through daemon (persists connections)
|
|
277
|
+
const { RithmicBrokerClient, manager: brokerManager } = require('./services/rithmic-broker');
|
|
278
|
+
|
|
279
|
+
// Ensure daemon is running
|
|
280
|
+
const daemonResult = await brokerManager.ensureRunning();
|
|
281
|
+
if (!daemonResult.success) {
|
|
282
|
+
spinner.fail('FAILED TO START BROKER DAEMON');
|
|
283
|
+
console.log(chalk.yellow(` → ${daemonResult.error}`));
|
|
284
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
spinner.text = 'CONNECTING TO RITHMIC...';
|
|
289
|
+
const client = new RithmicBrokerClient(selectedPropfirm.key);
|
|
290
|
+
const result = await client.login(credentials.username, credentials.password);
|
|
279
291
|
|
|
280
292
|
if (result.success) {
|
|
281
293
|
spinner.text = 'FETCHING ACCOUNTS...';
|
|
282
|
-
const accResult = await
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
294
|
+
const accResult = await client.getTradingAccounts();
|
|
295
|
+
client.accounts = accResult.accounts || [];
|
|
296
|
+
connections.add('rithmic', client, selectedPropfirm.name);
|
|
297
|
+
spinner.succeed(`CONNECTED TO ${selectedPropfirm.name.toUpperCase()} (${accResult.accounts?.length || 0} ACCOUNTS)`);
|
|
298
|
+
currentService = client;
|
|
286
299
|
await refreshStats();
|
|
287
300
|
await new Promise(r => setTimeout(r, 1500));
|
|
288
301
|
} else {
|