hedgequantx 2.3.20 → 2.3.22
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/dist/lib/api.jsc +0 -0
- package/dist/lib/api2.jsc +0 -0
- package/dist/lib/core.jsc +0 -0
- package/dist/lib/core2.jsc +0 -0
- package/dist/lib/data.jsc +0 -0
- package/dist/lib/data2.jsc +0 -0
- package/dist/lib/decoder.jsc +0 -0
- package/dist/lib/m/mod1.jsc +0 -0
- package/dist/lib/m/mod2.jsc +0 -0
- package/dist/lib/n/r1.jsc +0 -0
- package/dist/lib/n/r2.jsc +0 -0
- package/dist/lib/n/r3.jsc +0 -0
- package/dist/lib/n/r4.jsc +0 -0
- package/dist/lib/n/r5.jsc +0 -0
- package/dist/lib/n/r6.jsc +0 -0
- package/dist/lib/n/r7.jsc +0 -0
- package/dist/lib/o/util1.jsc +0 -0
- package/dist/lib/o/util2.jsc +0 -0
- package/package.json +1 -1
- package/src/pages/algo/one-account.js +7 -19
package/dist/lib/api.jsc
CHANGED
|
Binary file
|
package/dist/lib/api2.jsc
CHANGED
|
Binary file
|
package/dist/lib/core.jsc
CHANGED
|
Binary file
|
package/dist/lib/core2.jsc
CHANGED
|
Binary file
|
package/dist/lib/data.jsc
CHANGED
|
Binary file
|
package/dist/lib/data2.jsc
CHANGED
|
Binary file
|
package/dist/lib/decoder.jsc
CHANGED
|
Binary file
|
package/dist/lib/m/mod1.jsc
CHANGED
|
Binary file
|
package/dist/lib/m/mod2.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r1.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r2.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r3.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r4.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r5.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r6.jsc
CHANGED
|
Binary file
|
package/dist/lib/n/r7.jsc
CHANGED
|
Binary file
|
package/dist/lib/o/util1.jsc
CHANGED
|
Binary file
|
package/dist/lib/o/util2.jsc
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -200,19 +200,9 @@ const launchAlgo = async (service, account, contract, config) => {
|
|
|
200
200
|
ui.addLog('info', `Target: $${dailyTarget} | Max Risk: $${maxRisk}`);
|
|
201
201
|
ui.addLog('info', 'Monitoring positions from API...');
|
|
202
202
|
|
|
203
|
-
//
|
|
204
|
-
const measureLatency = async () => {
|
|
205
|
-
try {
|
|
206
|
-
const start = Date.now();
|
|
207
|
-
await service.getPositions(account.accountId);
|
|
208
|
-
stats.latency = Date.now() - start;
|
|
209
|
-
} catch (e) {
|
|
210
|
-
stats.latency = 0;
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
// Poll data from API - 100% real data
|
|
203
|
+
// Poll data from API - 100% real data, measure latency during poll
|
|
215
204
|
const pollAPI = async () => {
|
|
205
|
+
const pollStart = Date.now();
|
|
216
206
|
try {
|
|
217
207
|
pollCount++;
|
|
218
208
|
|
|
@@ -223,10 +213,9 @@ const launchAlgo = async (service, account, contract, config) => {
|
|
|
223
213
|
if (acc && acc.profitAndLoss !== undefined) {
|
|
224
214
|
const accountPnL = acc.profitAndLoss;
|
|
225
215
|
|
|
226
|
-
// Set starting P&L on first poll
|
|
216
|
+
// Set starting P&L on first poll (silent - don't expose account P&L)
|
|
227
217
|
if (startingPnL === null) {
|
|
228
218
|
startingPnL = accountPnL;
|
|
229
|
-
ui.addLog('info', `Starting P&L: $${startingPnL.toFixed(2)}`);
|
|
230
219
|
}
|
|
231
220
|
|
|
232
221
|
// Session P&L = current - starting (both from API)
|
|
@@ -290,17 +279,17 @@ const launchAlgo = async (service, account, contract, config) => {
|
|
|
290
279
|
ui.addLog('error', `SESSION MAX RISK! -$${Math.abs(stats.pnl).toFixed(2)}`);
|
|
291
280
|
}
|
|
292
281
|
|
|
282
|
+
// Update latency (measured during this poll)
|
|
283
|
+
stats.latency = Date.now() - pollStart;
|
|
284
|
+
|
|
293
285
|
} catch (e) {
|
|
286
|
+
stats.latency = Date.now() - pollStart;
|
|
294
287
|
ui.addLog('error', `API: ${e.message}`);
|
|
295
288
|
}
|
|
296
289
|
};
|
|
297
290
|
|
|
298
291
|
const refreshInterval = setInterval(() => { if (running) ui.render(stats); }, 250);
|
|
299
292
|
|
|
300
|
-
// Measure API latency every 5 seconds
|
|
301
|
-
measureLatency(); // Initial measurement
|
|
302
|
-
const latencyInterval = setInterval(() => { if (running) measureLatency(); }, 5000);
|
|
303
|
-
|
|
304
293
|
// Poll data from API every 2 seconds
|
|
305
294
|
pollAPI(); // Initial poll
|
|
306
295
|
const apiInterval = setInterval(() => { if (running) pollAPI(); }, 2000);
|
|
@@ -331,7 +320,6 @@ const launchAlgo = async (service, account, contract, config) => {
|
|
|
331
320
|
});
|
|
332
321
|
|
|
333
322
|
clearInterval(refreshInterval);
|
|
334
|
-
clearInterval(latencyInterval);
|
|
335
323
|
clearInterval(apiInterval);
|
|
336
324
|
if (cleanupKeys) cleanupKeys();
|
|
337
325
|
ui.cleanup();
|