A lot of stuff is fixed. The strategies need to reflect the stats in the ui.
This commit is contained in:
parent
e1516a80cf
commit
dab122d15f
|
|
@ -830,14 +830,28 @@ class BrighterTrades:
|
||||||
required_fields = ['strategy', 'start_date', 'capital', 'commission', 'user_name']
|
required_fields = ['strategy', 'start_date', 'capital', 'commission', 'user_name']
|
||||||
if not all(field in msg_data for field in required_fields):
|
if not all(field in msg_data for field in required_fields):
|
||||||
return standard_reply("backtest_error", {"message": "Missing required fields."})
|
return standard_reply("backtest_error", {"message": "Missing required fields."})
|
||||||
|
|
||||||
|
try:
|
||||||
# Delegate backtest handling to the Backtester
|
# Delegate backtest handling to the Backtester
|
||||||
resp = self.backtester.handle_backtest_message(
|
resp = self.backtester.handle_backtest_message(
|
||||||
user_id=self.get_user_info(user_name=msg_data['user_name'], info='User_id'),
|
user_id=self.get_user_info(user_name=msg_data['user_name'], info='User_id'),
|
||||||
msg_data=msg_data,
|
msg_data=msg_data,
|
||||||
socket_conn_id=socket_conn_id)
|
socket_conn_id=socket_conn_id
|
||||||
|
)
|
||||||
|
|
||||||
|
if 'error' in resp:
|
||||||
|
# If there's an error, send a backtest_error message
|
||||||
|
return standard_reply("backtest_error", {"message": resp['error']})
|
||||||
|
else:
|
||||||
|
# If successful, send a backtest_submitted message
|
||||||
return standard_reply("backtest_submitted", resp)
|
return standard_reply("backtest_submitted", resp)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# Catch any unexpected exceptions and send a backtest_error message
|
||||||
|
logger.error(f"Unhandled exception during backtest submission: {e}", exc_info=True)
|
||||||
|
return standard_reply("backtest_error",
|
||||||
|
{"message": "An unexpected error occurred during backtest submission."})
|
||||||
|
|
||||||
if msg_type == 'delete_backtest':
|
if msg_type == 'delete_backtest':
|
||||||
response = self.delete_backtest(msg_data)
|
response = self.delete_backtest(msg_data)
|
||||||
return standard_reply("backtest_deleted", response)
|
return standard_reply("backtest_deleted", response)
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,6 @@ class Backtesting {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
handleBacktestError(data) {
|
handleBacktestError(data) {
|
||||||
console.error("Backtest error:", data.message);
|
console.error("Backtest error:", data.message);
|
||||||
|
|
||||||
|
|
@ -120,7 +117,6 @@ class Backtesting {
|
||||||
this.hideElement(this.resultsContainer);
|
this.hideElement(this.resultsContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
handleBacktestResults(data) {
|
handleBacktestResults(data) {
|
||||||
const test = this.tests.find(t => t.name === data.test_id);
|
const test = this.tests.find(t => t.name === data.test_id);
|
||||||
if (test) {
|
if (test) {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Status message (Initially Hidden) -->
|
<!-- Status message (Initially Hidden) -->
|
||||||
<div id="backtest-status-message" style="display: none; margin-top: 10px; color: blue;"></div>
|
<div id="backtest-status-message" style="margin-top: 10px; color: blue;"></div>
|
||||||
|
|
||||||
<!-- Progress bar (Initially Hidden) -->
|
<!-- Progress bar (Initially Hidden) -->
|
||||||
<div id="backtest-progress-container">
|
<div id="backtest-progress-container">
|
||||||
|
|
@ -163,5 +163,11 @@
|
||||||
#backtest-results.show {
|
#backtest-results.show {
|
||||||
display: block; /* Show when backtest is complete */
|
display: block; /* Show when backtest is complete */
|
||||||
}
|
}
|
||||||
|
#backtest-status-message {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#backtest-status-message.show{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue