From 37b15e830a6b67ba5b7b89a2d393c650568bf82c Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 12 Mar 2021 19:11:17 +0100 Subject: [PATCH] Add trade count to progress --- freqtrade/rpc/api_server/api_schemas.py | 1 + freqtrade/rpc/api_server/api_v1.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/freqtrade/rpc/api_server/api_schemas.py b/freqtrade/rpc/api_server/api_schemas.py index 9a4ac5cd0..f10c501f7 100644 --- a/freqtrade/rpc/api_server/api_schemas.py +++ b/freqtrade/rpc/api_server/api_schemas.py @@ -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]] diff --git a/freqtrade/rpc/api_server/api_v1.py b/freqtrade/rpc/api_server/api_v1.py index 30b4c998c..339f8565a 100644 --- a/freqtrade/rpc/api_server/api_v1.py +++ b/freqtrade/rpc/api_server/api_v1.py @@ -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", }