hedgequantx 1.2.96 → 1.2.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 +1 -1
- package/src/pages/algo.js +14 -5
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -787,11 +787,14 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
787
787
|
|
|
788
788
|
hqxServer.on('disconnected', () => {
|
|
789
789
|
hqxConnected = false;
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
stopReason
|
|
794
|
-
|
|
790
|
+
// Only log error if not intentionally stopped by user
|
|
791
|
+
if (!stopReason || stopReason === 'user') {
|
|
792
|
+
// Don't show error for user-initiated stop
|
|
793
|
+
if (!stopReason) {
|
|
794
|
+
printLog('error', 'Connection lost - Stopping algo');
|
|
795
|
+
stopReason = 'disconnected';
|
|
796
|
+
algoRunning = false;
|
|
797
|
+
}
|
|
795
798
|
}
|
|
796
799
|
});
|
|
797
800
|
|
|
@@ -854,6 +857,7 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
854
857
|
if (!key) return;
|
|
855
858
|
const keyName = key.name?.toLowerCase();
|
|
856
859
|
if (keyName === 'x' || (key.ctrl && keyName === 'c')) {
|
|
860
|
+
stopReason = 'user'; // Set stop reason before cleanup
|
|
857
861
|
cleanup();
|
|
858
862
|
}
|
|
859
863
|
});
|
|
@@ -920,6 +924,9 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
920
924
|
hqxServer.disconnect();
|
|
921
925
|
algoRunning = false;
|
|
922
926
|
|
|
927
|
+
// Clear screen and show final result
|
|
928
|
+
console.clear();
|
|
929
|
+
|
|
923
930
|
console.log();
|
|
924
931
|
if (stopReason === 'target') {
|
|
925
932
|
console.log(chalk.green.bold(' [OK] Daily target reached! Algo stopped.'));
|
|
@@ -927,6 +934,8 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
927
934
|
console.log(chalk.red.bold(' [X] Max risk reached! Algo stopped.'));
|
|
928
935
|
} else if (stopReason === 'disconnected' || stopReason === 'connection_error') {
|
|
929
936
|
console.log(chalk.red.bold(' [X] Connection lost! Algo stopped.'));
|
|
937
|
+
} else if (stopReason === 'user') {
|
|
938
|
+
console.log(chalk.yellow(' [OK] Algo stopped by user'));
|
|
930
939
|
} else {
|
|
931
940
|
console.log(chalk.yellow(' [OK] Algo stopped by user'));
|
|
932
941
|
}
|