hedgequantx 2.9.244 → 2.9.246
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
|
@@ -126,18 +126,15 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
126
126
|
sessionLogger.signal(dir, signal.entry, signal.confidence, signalLog.details);
|
|
127
127
|
|
|
128
128
|
if (!running) {
|
|
129
|
-
|
|
130
|
-
ui.addLog('risk', riskLog.message);
|
|
129
|
+
ui.addLog('risk', 'Algo stopped - ignoring signal');
|
|
131
130
|
return;
|
|
132
131
|
}
|
|
133
132
|
if (pendingOrder) {
|
|
134
|
-
|
|
135
|
-
ui.addLog('risk', riskLog.message);
|
|
133
|
+
ui.addLog('risk', 'Order pending - wait for fill');
|
|
136
134
|
return;
|
|
137
135
|
}
|
|
138
136
|
if (currentPosition !== 0) {
|
|
139
|
-
|
|
140
|
-
ui.addLog('risk', riskLog.message);
|
|
137
|
+
ui.addLog('risk', `Position open (${currentPosition}) - close first`);
|
|
141
138
|
return;
|
|
142
139
|
}
|
|
143
140
|
|
package/src/pages/algo/ui.js
CHANGED
|
@@ -77,17 +77,46 @@ const center = (text, width) => {
|
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Fit text to exact width (truncate or pad)
|
|
80
|
+
* Ensures output is EXACTLY width characters (visible)
|
|
80
81
|
*/
|
|
81
82
|
const fitToWidth = (text, width) => {
|
|
82
83
|
const plain = stripAnsi(text);
|
|
84
|
+
|
|
83
85
|
if (plain.length > width) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
// Need to truncate - find cut point accounting for ANSI codes
|
|
87
|
+
let visibleCount = 0;
|
|
88
|
+
let cutIndex = 0;
|
|
89
|
+
let inAnsi = false;
|
|
90
|
+
|
|
91
|
+
for (let i = 0; i < text.length; i++) {
|
|
92
|
+
if (text[i] === '\x1B') {
|
|
93
|
+
inAnsi = true;
|
|
94
|
+
} else if (inAnsi && text[i] === 'm') {
|
|
95
|
+
inAnsi = false;
|
|
96
|
+
} else if (!inAnsi) {
|
|
97
|
+
visibleCount++;
|
|
98
|
+
if (visibleCount >= width - 2) {
|
|
99
|
+
cutIndex = i + 1;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
cutIndex = i + 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Truncate and add ".." (2 chars to stay within width)
|
|
107
|
+
const truncated = text.substring(0, cutIndex);
|
|
108
|
+
const truncatedPlain = stripAnsi(truncated);
|
|
109
|
+
const remaining = width - truncatedPlain.length;
|
|
110
|
+
|
|
111
|
+
if (remaining >= 2) {
|
|
112
|
+
return truncated + '..' + ' '.repeat(remaining - 2);
|
|
113
|
+
} else if (remaining > 0) {
|
|
114
|
+
return truncated + ' '.repeat(remaining);
|
|
88
115
|
}
|
|
89
|
-
return
|
|
116
|
+
return truncated;
|
|
90
117
|
}
|
|
118
|
+
|
|
119
|
+
// Pad to exact width
|
|
91
120
|
return text + ' '.repeat(width - plain.length);
|
|
92
121
|
};
|
|
93
122
|
|