hedgequantx 2.6.50 → 2.6.51
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 +1 -1
- package/src/pages/algo/ui.js +10 -76
package/package.json
CHANGED
package/src/pages/algo/ui.js
CHANGED
|
@@ -102,11 +102,7 @@ class AlgoUI {
|
|
|
102
102
|
this.config = config;
|
|
103
103
|
this.W = 96; // Fixed width
|
|
104
104
|
this.logs = [];
|
|
105
|
-
//
|
|
106
|
-
// Header (logo + titles): ~12 lines, Stats: ~12 lines, Log header: 2 lines, Bottom: 1 line = 27 fixed
|
|
107
|
-
const terminalHeight = process.stdout.rows || 50;
|
|
108
|
-
const fixedLines = 27;
|
|
109
|
-
this.maxLogs = Math.max(10, terminalHeight - fixedLines); // Min 10 logs
|
|
105
|
+
this.maxLogs = 40; // Fixed at 40 logs for one-account and copy-trading
|
|
110
106
|
this.spinnerFrame = 0;
|
|
111
107
|
this.firstDraw = true;
|
|
112
108
|
this.isDrawing = false;
|
|
@@ -186,83 +182,21 @@ class AlgoUI {
|
|
|
186
182
|
|
|
187
183
|
this._line(chalk.cyan(GM));
|
|
188
184
|
|
|
189
|
-
// Row 2:
|
|
190
|
-
const posQty = stats.position || 0;
|
|
191
|
-
const posStr = posQty === 0 ? 'FLAT' : (posQty > 0 ? `+${posQty} LONG` : `${posQty} SHORT`);
|
|
192
|
-
const posColor = posQty === 0 ? chalk.gray : (posQty > 0 ? chalk.green : chalk.red);
|
|
193
|
-
const r2c1 = buildCell('POSITION', posStr, posColor, colL);
|
|
194
|
-
const r2c2 = buildCell('P&L', pnlStr, pnlColor, colR);
|
|
195
|
-
row(r2c1.padded, r2c2.padded);
|
|
196
|
-
|
|
197
|
-
this._line(chalk.cyan(GM));
|
|
198
|
-
|
|
199
|
-
// Row 3: Open P&L | Closed P&L (R Trader style breakdown)
|
|
200
|
-
// Data from Rithmic PNL_PLANT WebSocket - show '--' if null (no data from API)
|
|
201
|
-
const openPnl = stats.openPnl;
|
|
202
|
-
const closedPnl = stats.closedPnl;
|
|
203
|
-
const openPnlStr = openPnl === null || openPnl === undefined
|
|
204
|
-
? '--'
|
|
205
|
-
: (openPnl >= 0 ? `+$${openPnl.toFixed(2)}` : `-$${Math.abs(openPnl).toFixed(2)}`);
|
|
206
|
-
const closedPnlStr = closedPnl === null || closedPnl === undefined
|
|
207
|
-
? '--'
|
|
208
|
-
: (closedPnl >= 0 ? `+$${closedPnl.toFixed(2)}` : `-$${Math.abs(closedPnl).toFixed(2)}`);
|
|
209
|
-
const openPnlColor = (openPnl || 0) >= 0 ? chalk.green : chalk.red;
|
|
210
|
-
const closedPnlColor = (closedPnl || 0) >= 0 ? chalk.green : chalk.red;
|
|
211
|
-
const r3c1 = buildCell('OPEN P&L', openPnlStr, openPnlColor, colL);
|
|
212
|
-
const r3c2 = buildCell('CLOSED P&L', closedPnlStr, closedPnlColor, colR);
|
|
213
|
-
row(r3c1.padded, r3c2.padded);
|
|
214
|
-
|
|
215
|
-
this._line(chalk.cyan(GM));
|
|
216
|
-
|
|
217
|
-
// Row 4: Balance | Net Liquidation (R Trader style)
|
|
218
|
-
const balanceStr = stats.balance !== null && stats.balance !== undefined
|
|
219
|
-
? '$' + stats.balance.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
220
|
-
: '--';
|
|
221
|
-
const netLiqStr = stats.netLiquidation !== null && stats.netLiquidation !== undefined
|
|
222
|
-
? '$' + stats.netLiquidation.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
223
|
-
: '--';
|
|
224
|
-
const r4c1 = buildCell('BALANCE', balanceStr, chalk.white, colL);
|
|
225
|
-
const r4c2 = buildCell('NET LIQ', netLiqStr, chalk.cyan, colR);
|
|
226
|
-
row(r4c1.padded, r4c2.padded);
|
|
227
|
-
|
|
228
|
-
this._line(chalk.cyan(GM));
|
|
229
|
-
|
|
230
|
-
// Row 5: Buying Power | Margin (R Trader style)
|
|
231
|
-
const bpStr = stats.buyingPower !== null && stats.buyingPower !== undefined
|
|
232
|
-
? '$' + stats.buyingPower.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
233
|
-
: '--';
|
|
234
|
-
const marginStr = stats.margin !== null && stats.margin !== undefined
|
|
235
|
-
? '$' + stats.margin.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
236
|
-
: '--';
|
|
237
|
-
const r5c1 = buildCell('BUYING PWR', bpStr, chalk.green, colL);
|
|
238
|
-
const r5c2 = buildCell('MARGIN', marginStr, chalk.yellow, colR);
|
|
239
|
-
row(r5c1.padded, r5c2.padded);
|
|
240
|
-
|
|
241
|
-
this._line(chalk.cyan(GM));
|
|
242
|
-
|
|
243
|
-
// Row 6: Target | Risk
|
|
185
|
+
// Row 2: Target | Risk
|
|
244
186
|
const targetStr = stats.target !== null && stats.target !== undefined ? '$' + stats.target.toFixed(2) : '--';
|
|
245
187
|
const riskStr = stats.risk !== null && stats.risk !== undefined ? '$' + stats.risk.toFixed(2) : '--';
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
row(
|
|
249
|
-
|
|
250
|
-
this._line(chalk.cyan(GM));
|
|
251
|
-
|
|
252
|
-
// Row 7: Trades W/L | Entry Price (if in position)
|
|
253
|
-
const r7c1t = ` ${chalk.bold('TRADES')}: ${chalk.cyan.bold(stats.trades || 0)} ${chalk.bold('W/L')}: ${chalk.green.bold(stats.wins || 0)}/${chalk.red.bold(stats.losses || 0)}`;
|
|
254
|
-
const r7c1p = ` TRADES: ${stats.trades || 0} W/L: ${stats.wins || 0}/${stats.losses || 0}`;
|
|
255
|
-
const entryStr = stats.entryPrice > 0 ? stats.entryPrice.toFixed(2) : '--';
|
|
256
|
-
const r7c2 = buildCell('ENTRY', entryStr, chalk.yellow, colR);
|
|
257
|
-
row(r7c1t + pad(colL - r7c1p.length), r7c2.padded);
|
|
188
|
+
const r2c1 = buildCell('TARGET', targetStr, chalk.green, colL);
|
|
189
|
+
const r2c2 = buildCell('RISK', riskStr, chalk.red, colR);
|
|
190
|
+
row(r2c1.padded, r2c2.padded);
|
|
258
191
|
|
|
259
192
|
this._line(chalk.cyan(GM));
|
|
260
193
|
|
|
261
|
-
// Row
|
|
194
|
+
// Row 3: Trades W/L | Connection
|
|
195
|
+
const r3c1t = ` ${chalk.bold('TRADES')}: ${chalk.cyan.bold(stats.trades || 0)} ${chalk.bold('W/L')}: ${chalk.green.bold(stats.wins || 0)}/${chalk.red.bold(stats.losses || 0)}`;
|
|
196
|
+
const r3c1p = ` TRADES: ${stats.trades || 0} W/L: ${stats.wins || 0}/${stats.losses || 0}`;
|
|
262
197
|
const connection = stats.platform || 'ProjectX';
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
row(r8c1.padded, r8c2.padded);
|
|
198
|
+
const r3c2 = buildCell('CONNECTION', connection, chalk.cyan, colR);
|
|
199
|
+
row(r3c1t + pad(colL - r3c1p.length), r3c2.padded);
|
|
266
200
|
|
|
267
201
|
this._line(chalk.cyan(GB));
|
|
268
202
|
}
|