hedgequantx 2.7.14 → 2.7.15
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
|
@@ -222,10 +222,19 @@ const getTradingAccounts = async (service) => {
|
|
|
222
222
|
debug(`Account ${acc.accountId} rmsInfo:`, JSON.stringify(rmsInfo));
|
|
223
223
|
|
|
224
224
|
// REAL DATA FROM RITHMIC ONLY - NO DEFAULTS
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
const
|
|
225
|
+
// Use !== undefined to handle 0 values correctly
|
|
226
|
+
const accountBalance = pnlData.accountBalance !== undefined ? parseFloat(pnlData.accountBalance) : null;
|
|
227
|
+
const openPnL = pnlData.openPositionPnl !== undefined ? parseFloat(pnlData.openPositionPnl) : null;
|
|
228
|
+
const closedPnL = pnlData.closedPositionPnl !== undefined ? parseFloat(pnlData.closedPositionPnl) : null;
|
|
229
|
+
const dayPnL = pnlData.dayPnl !== undefined ? parseFloat(pnlData.dayPnl) : null;
|
|
230
|
+
|
|
231
|
+
// Calculate P&L: prefer dayPnl, fallback to open+closed
|
|
232
|
+
let profitAndLoss = null;
|
|
233
|
+
if (dayPnL !== null) {
|
|
234
|
+
profitAndLoss = dayPnL;
|
|
235
|
+
} else if (openPnL !== null || closedPnL !== null) {
|
|
236
|
+
profitAndLoss = (openPnL || 0) + (closedPnL || 0);
|
|
237
|
+
}
|
|
229
238
|
|
|
230
239
|
return {
|
|
231
240
|
accountId: hashAccountId(acc.accountId),
|
|
@@ -233,11 +242,17 @@ const getTradingAccounts = async (service) => {
|
|
|
233
242
|
accountName: acc.accountId, // Never expose real name - only account ID
|
|
234
243
|
name: acc.accountId, // Never expose real name - only account ID
|
|
235
244
|
balance: accountBalance,
|
|
236
|
-
profitAndLoss:
|
|
245
|
+
profitAndLoss: profitAndLoss,
|
|
237
246
|
openPnL: openPnL,
|
|
238
247
|
todayPnL: closedPnL,
|
|
239
|
-
|
|
240
|
-
|
|
248
|
+
// Status/Type: Rithmic API doesn't provide user-friendly values
|
|
249
|
+
// "admin only" and "Max Loss" are RMS internal values, not account status
|
|
250
|
+
// Set to null to show "--" in UI (per RULES.md - no fake data)
|
|
251
|
+
status: null,
|
|
252
|
+
type: null,
|
|
253
|
+
// Keep RMS data for reference
|
|
254
|
+
rmsStatus: rmsInfo.status || null,
|
|
255
|
+
rmsAlgorithm: rmsInfo.algorithm || null,
|
|
241
256
|
lossLimit: rmsInfo.lossLimit || null,
|
|
242
257
|
minAccountBalance: rmsInfo.minAccountBalance || null,
|
|
243
258
|
buyLimit: rmsInfo.buyLimit || null,
|