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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/app.js +21 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.9.161",
3
+ "version": "2.9.162",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
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: 'CONNECTING TO RITHMIC...', color: 'yellow' }).start();
274
+ const spinner = ora({ text: 'STARTING BROKER DAEMON...', color: 'yellow' }).start();
275
275
  try {
276
- const { RithmicService } = require('./services/rithmic');
277
- const service = new RithmicService(selectedPropfirm.key);
278
- const result = await service.login(credentials.username, credentials.password);
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 service.getTradingAccounts();
283
- connections.add('rithmic', service, service.propfirm.name);
284
- spinner.succeed(`CONNECTED TO ${service.propfirm.name.toUpperCase()} (${accResult.accounts?.length || 0} ACCOUNTS)`);
285
- currentService = service;
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 {