Add trade count to progress

This commit is contained in:
Matthias 2021-03-12 19:11:17 +01:00
parent 048008756f
commit 37b15e830a
2 changed files with 3 additions and 0 deletions

View File

@ -331,5 +331,6 @@ class BacktestResponse(BaseModel):
status_msg: str
step: str
progress: float
trade_count: Optional[float]
# TODO: Properly type backtestresult...
backtest_result: Optional[Dict[str, Any]]

View File

@ -339,12 +339,14 @@ def api_get_backtest():
Get backtesting result.
Returns Result after backtesting has been ran.
"""
from freqtrade.persistence import Trade
if ApiServer._bgtask_running:
return {
"status": "running",
"running": True,
"step": ApiServer._bt.get_action() if ApiServer._bt else str(BacktestState.STARTUP),
"progress": ApiServer._bt.get_progress() if ApiServer._bt else 0,
"trade_count": Trade.get_trades_proxy(is_open=False),
"status_msg": "Backtest running",
}