hedgequantx 1.2.37 → 1.2.38

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.2.37",
3
+ "version": "1.2.38",
4
4
  "description": "Prop Futures Algo Trading CLI - Connect to Topstep, Alpha Futures, and other prop firms",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -216,7 +216,7 @@ class RithmicService extends EventEmitter {
216
216
  await this.fetchAccounts();
217
217
  }
218
218
 
219
- const tradingAccounts = this.accounts.map((acc, index) => {
219
+ let tradingAccounts = this.accounts.map((acc, index) => {
220
220
  const pnl = this.accountPnL.get(acc.accountId) || {};
221
221
  const balance = parseFloat(pnl.accountBalance || pnl.marginBalance || pnl.cashOnHand || 0) || this.propfirm.defaultBalance;
222
222
  const startingBalance = this.propfirm.defaultBalance;
@@ -236,6 +236,23 @@ class RithmicService extends EventEmitter {
236
236
  };
237
237
  });
238
238
 
239
+ // If no accounts but user is logged in, create a default account from login info
240
+ if (tradingAccounts.length === 0 && this.user) {
241
+ const userName = this.user.userName || 'Unknown';
242
+ tradingAccounts = [{
243
+ accountId: this.hashAccountId(userName),
244
+ rithmicAccountId: userName,
245
+ accountName: userName,
246
+ name: userName,
247
+ balance: this.propfirm.defaultBalance,
248
+ startingBalance: this.propfirm.defaultBalance,
249
+ profitAndLoss: 0,
250
+ status: 0, // Active
251
+ platform: 'Rithmic',
252
+ propfirm: this.propfirm.name,
253
+ }];
254
+ }
255
+
239
256
  return { success: true, accounts: tradingAccounts };
240
257
  }
241
258