hedgequantx 2.7.95 → 2.7.97
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
package/src/pages/accounts.js
CHANGED
|
@@ -130,12 +130,10 @@ const showAccounts = async (service) => {
|
|
|
130
130
|
const pnlColor2 = pnl2 === null || pnl2 === undefined ? chalk.gray : (pnl2 >= 0 ? chalk.green : chalk.red);
|
|
131
131
|
console.log(chalk.cyan('║') + fmtRow('P&L:', pnlColor1(pnlStr1), col1) + chalk.cyan(sep) + (acc2 ? fmtRow('P&L:', pnlColor2(pnlStr2), col2) : ' '.repeat(col2)) + chalk.cyan('║'));
|
|
132
132
|
|
|
133
|
-
// Status - from API
|
|
134
|
-
const getStatusDisplay = (
|
|
133
|
+
// Status - from Rithmic RMS API (field 154003), N/A if not available
|
|
134
|
+
const getStatusDisplay = (acc) => {
|
|
135
|
+
const status = acc.status;
|
|
135
136
|
if (status === null || status === undefined) return { text: 'N/A', color: 'gray' };
|
|
136
|
-
if (typeof status === 'number') {
|
|
137
|
-
return ACCOUNT_STATUS[status] || { text: String(status), color: 'yellow' };
|
|
138
|
-
}
|
|
139
137
|
if (typeof status === 'string') {
|
|
140
138
|
const lowerStatus = status.toLowerCase();
|
|
141
139
|
if (lowerStatus.includes('active') || lowerStatus.includes('open')) return { text: status, color: 'green' };
|
|
@@ -143,32 +141,28 @@ const showAccounts = async (service) => {
|
|
|
143
141
|
if (lowerStatus.includes('halt')) return { text: status, color: 'red' };
|
|
144
142
|
return { text: status, color: 'yellow' };
|
|
145
143
|
}
|
|
146
|
-
return { text:
|
|
144
|
+
return { text: String(status), color: 'yellow' };
|
|
147
145
|
};
|
|
148
|
-
const status1 = getStatusDisplay(acc1
|
|
149
|
-
const status2 = acc2 ? getStatusDisplay(acc2
|
|
146
|
+
const status1 = getStatusDisplay(acc1);
|
|
147
|
+
const status2 = acc2 ? getStatusDisplay(acc2) : null;
|
|
150
148
|
console.log(chalk.cyan('║') + fmtRow('Status:', chalk[status1.color](status1.text), col1) + chalk.cyan(sep) + (acc2 ? fmtRow('Status:', chalk[status2.color](status2.text), col2) : ' '.repeat(col2)) + chalk.cyan('║'));
|
|
151
149
|
|
|
152
|
-
//
|
|
153
|
-
const
|
|
154
|
-
const
|
|
155
|
-
if (
|
|
156
|
-
if (typeof
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
159
|
-
if (
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
return { text: value, color: 'cyan' };
|
|
163
|
-
}
|
|
164
|
-
if (typeof value === 'number') {
|
|
165
|
-
return ACCOUNT_TYPE[value] || { text: String(value), color: 'white' };
|
|
150
|
+
// Algorithm - from Rithmic RMS API (field 150142), N/A if not available
|
|
151
|
+
const getAlgorithmDisplay = (acc) => {
|
|
152
|
+
const algo = acc.algorithm;
|
|
153
|
+
if (algo === null || algo === undefined) return { text: 'N/A', color: 'gray' };
|
|
154
|
+
if (typeof algo === 'string') {
|
|
155
|
+
const lowerAlgo = algo.toLowerCase();
|
|
156
|
+
if (lowerAlgo.includes('eval')) return { text: algo, color: 'yellow' };
|
|
157
|
+
if (lowerAlgo.includes('live') || lowerAlgo.includes('funded')) return { text: algo, color: 'green' };
|
|
158
|
+
if (lowerAlgo.includes('sim') || lowerAlgo.includes('demo')) return { text: algo, color: 'gray' };
|
|
159
|
+
return { text: algo, color: 'cyan' };
|
|
166
160
|
}
|
|
167
|
-
return { text:
|
|
161
|
+
return { text: String(algo), color: 'cyan' };
|
|
168
162
|
};
|
|
169
|
-
const
|
|
170
|
-
const
|
|
171
|
-
console.log(chalk.cyan('║') + fmtRow('
|
|
163
|
+
const algo1 = getAlgorithmDisplay(acc1);
|
|
164
|
+
const algo2 = acc2 ? getAlgorithmDisplay(acc2) : null;
|
|
165
|
+
console.log(chalk.cyan('║') + fmtRow('Algorithm:', chalk[algo1.color](algo1.text), col1) + chalk.cyan(sep) + (acc2 ? fmtRow('Algorithm:', chalk[algo2.color](algo2.text), col2) : ' '.repeat(col2)) + chalk.cyan('║'));
|
|
172
166
|
|
|
173
167
|
if (i + 2 < allAccounts.length) {
|
|
174
168
|
console.log(chalk.cyan('╠') + chalk.cyan('═'.repeat(col1)) + chalk.cyan('╪') + chalk.cyan('═'.repeat(col2)) + chalk.cyan('╣'));
|
|
@@ -100,7 +100,7 @@ const drawProvidersTable = (providers, config, boxWidth) => {
|
|
|
100
100
|
|
|
101
101
|
// New rectangle (banner is always closed)
|
|
102
102
|
console.log(chalk.cyan('╔' + '═'.repeat(W) + '╗'));
|
|
103
|
-
console.log(chalk.cyan('║') + chalk.
|
|
103
|
+
console.log(chalk.cyan('║') + chalk.cyan.bold(centerText('AI AGENTS CONFIGURATION', W)) + chalk.cyan('║'));
|
|
104
104
|
console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
|
|
105
105
|
|
|
106
106
|
const rows = Math.ceil(providers.length / 2);
|
|
@@ -122,12 +122,12 @@ const drawProvidersTable = (providers, config, boxWidth) => {
|
|
|
122
122
|
let leftCol = '';
|
|
123
123
|
if (leftP) {
|
|
124
124
|
const num = row + 1;
|
|
125
|
-
// Show
|
|
125
|
+
// Show cyan dot if provider has auth file (connected via OAuth)
|
|
126
126
|
const isConnected = connected[leftP.id] || config.providers[leftP.id]?.active;
|
|
127
|
-
const status = isConnected ? chalk.
|
|
127
|
+
const status = isConnected ? chalk.cyan('● ') : ' ';
|
|
128
128
|
const name = leftP.provider ? leftP.provider.name : leftP.name;
|
|
129
129
|
const namePadded = name.toUpperCase().padEnd(maxNameLen);
|
|
130
|
-
const content = status + chalk.
|
|
130
|
+
const content = status + chalk.yellow(`[${num}]`) + ' ' + chalk.cyan(namePadded);
|
|
131
131
|
const contentLen = 2 + 3 + 1 + maxNameLen;
|
|
132
132
|
const padR = colWidth - leftPad - contentLen;
|
|
133
133
|
leftCol = ' '.repeat(leftPad) + content + ' '.repeat(Math.max(0, padR));
|
|
@@ -140,12 +140,12 @@ const drawProvidersTable = (providers, config, boxWidth) => {
|
|
|
140
140
|
const rightColWidth = W - colWidth;
|
|
141
141
|
if (rightP) {
|
|
142
142
|
const num = row + rows + 1;
|
|
143
|
-
// Show
|
|
143
|
+
// Show cyan dot if provider has auth file (connected via OAuth)
|
|
144
144
|
const isConnected = connected[rightP.id] || config.providers[rightP.id]?.active;
|
|
145
|
-
const status = isConnected ? chalk.
|
|
145
|
+
const status = isConnected ? chalk.cyan('● ') : ' ';
|
|
146
146
|
const name = rightP.provider ? rightP.provider.name : rightP.name;
|
|
147
147
|
const namePadded = name.toUpperCase().padEnd(maxNameLen);
|
|
148
|
-
const content = status + chalk.
|
|
148
|
+
const content = status + chalk.yellow(`[${num}]`) + ' ' + chalk.cyan(namePadded);
|
|
149
149
|
const contentLen = 2 + 3 + 1 + maxNameLen;
|
|
150
150
|
const padR2 = rightColWidth - rightPad - contentLen;
|
|
151
151
|
rightCol = ' '.repeat(rightPad) + content + ' '.repeat(Math.max(0, padR2));
|
|
@@ -245,18 +245,16 @@ const getTradingAccounts = async (service) => {
|
|
|
245
245
|
profitAndLoss: profitAndLoss,
|
|
246
246
|
openPnL: openPnL,
|
|
247
247
|
todayPnL: closedPnL,
|
|
248
|
-
// Status
|
|
249
|
-
|
|
250
|
-
//
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
// Keep RMS data for reference
|
|
254
|
-
rmsStatus: rmsInfo.status || null,
|
|
255
|
-
rmsAlgorithm: rmsInfo.algorithm || null,
|
|
248
|
+
// Status from Rithmic RMS API (field 154003 - ACCOUNT_STATUS)
|
|
249
|
+
status: rmsInfo.status || null,
|
|
250
|
+
// Algorithm/Type from Rithmic RMS API (field 150142 - ALGORITHM)
|
|
251
|
+
algorithm: rmsInfo.algorithm || null,
|
|
252
|
+
// Additional RMS data from API
|
|
256
253
|
lossLimit: rmsInfo.lossLimit || null,
|
|
257
254
|
minAccountBalance: rmsInfo.minAccountBalance || null,
|
|
258
255
|
buyLimit: rmsInfo.buyLimit || null,
|
|
259
256
|
sellLimit: rmsInfo.sellLimit || null,
|
|
257
|
+
currency: rmsInfo.currency || acc.accountCurrency || null,
|
|
260
258
|
platform: 'Rithmic',
|
|
261
259
|
propfirm: service.propfirm.name,
|
|
262
260
|
};
|