hedgequantx 2.9.183 → 2.9.184

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": "2.9.183",
3
+ "version": "2.9.184",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -152,9 +152,10 @@ const connections = {
152
152
  */
153
153
  async restoreFromStorage() {
154
154
  const sessions = storage.load();
155
- const rithmicSessions = sessions.filter(s => s.type === 'rithmic');
155
+ const rithmicSessions = sessions.filter(s => s.type === 'rithmic' && s.credentials);
156
156
 
157
157
  if (!rithmicSessions.length) {
158
+ log.debug('No saved sessions to restore');
158
159
  return false;
159
160
  }
160
161
 
@@ -162,9 +163,12 @@ const connections = {
162
163
 
163
164
  for (const session of rithmicSessions) {
164
165
  try {
165
- await this._restoreSession(session);
166
+ const success = await this._restoreSession(session);
167
+ if (!success) {
168
+ log.warn('Session restore returned false', { propfirm: session.propfirm });
169
+ }
166
170
  } catch (err) {
167
- log.warn('Failed to restore session', { error: err.message });
171
+ log.error('Failed to restore session', { propfirm: session.propfirm, error: err.message });
168
172
  }
169
173
  }
170
174
 
@@ -173,12 +177,13 @@ const connections = {
173
177
 
174
178
  /**
175
179
  * Restore a single session using direct RithmicService
180
+ * @returns {boolean} true if restore succeeded
176
181
  */
177
182
  async _restoreSession(session) {
178
183
  const { type, propfirm, propfirmKey } = session;
179
184
 
180
185
  if (type !== 'rithmic' || !session.credentials) {
181
- return;
186
+ return false;
182
187
  }
183
188
 
184
189
  const Service = loadRithmicService();
@@ -193,6 +198,13 @@ const connections = {
193
198
  if (validAccounts.length === 0) validAccounts = null;
194
199
  }
195
200
 
201
+ log.debug('Restoring session', {
202
+ propfirm,
203
+ propfirmKey,
204
+ hasCredentials: !!session.credentials,
205
+ cachedAccounts: validAccounts?.length || 0
206
+ });
207
+
196
208
  // Login with cached accounts to avoid Rithmic API limit
197
209
  const loginOptions = validAccounts
198
210
  ? { skipFetchAccounts: true, cachedAccounts: validAccounts }
@@ -212,9 +224,16 @@ const connections = {
212
224
  propfirmKey,
213
225
  connectedAt: new Date(),
214
226
  });
215
- log.info('Session restored', { propfirm, accounts: service.accounts?.length || 0 });
227
+ log.info('Session restored', {
228
+ propfirm,
229
+ accounts: service.accounts?.length || 0,
230
+ hasPnL: !!service.pnlConn,
231
+ hasOrder: !!service.orderConn
232
+ });
233
+ return true;
216
234
  } else {
217
235
  log.warn('Session restore failed', { propfirm, error: result.error });
236
+ return false;
218
237
  }
219
238
  },
220
239