mirror of
https://github.com/aljazceru/hummingbot-dashboard.git
synced 2025-12-21 15:34:19 +01:00
Backtest errors returned in try-catch.
This commit is contained in:
@@ -196,6 +196,8 @@ class BackendAPIClient:
|
||||
}
|
||||
response = requests.post(url, json=payload)
|
||||
backtesting_results = response.json()
|
||||
if "error" in backtesting_results:
|
||||
raise Exception(backtesting_results["error"])
|
||||
if "processed_data" not in backtesting_results:
|
||||
data = None
|
||||
else:
|
||||
|
||||
@@ -22,6 +22,7 @@ def backtesting_section(inputs, backend_api_client):
|
||||
if run_backtesting:
|
||||
start_datetime = datetime.combine(start_date, datetime.min.time())
|
||||
end_datetime = datetime.combine(end_date, datetime.max.time())
|
||||
try:
|
||||
backtesting_results = backend_api_client.run_backtesting(
|
||||
start_time=int(start_datetime.timestamp()) * 1000,
|
||||
end_time=int(end_datetime.timestamp()) * 1000,
|
||||
@@ -29,6 +30,10 @@ def backtesting_section(inputs, backend_api_client):
|
||||
trade_cost=trade_cost / 100,
|
||||
config=inputs,
|
||||
)
|
||||
except Exception as e:
|
||||
st.error(e)
|
||||
return None
|
||||
|
||||
if len(backtesting_results["processed_data"]) == 0:
|
||||
st.error("No trades were executed during the backtesting period.")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user