From d779d60812f29553d029182e7b8b7907c2d5fea0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 6 Mar 2023 07:10:02 +0100 Subject: [PATCH] Expose total_profit_ratio through API --- freqtrade/rpc/api_server/api_schemas.py | 1 + freqtrade/rpc/api_server/api_v1.py | 3 ++- tests/rpc/test_rpc_apiserver.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/freqtrade/rpc/api_server/api_schemas.py b/freqtrade/rpc/api_server/api_schemas.py index a751179b2..064a509fd 100644 --- a/freqtrade/rpc/api_server/api_schemas.py +++ b/freqtrade/rpc/api_server/api_schemas.py @@ -286,6 +286,7 @@ class OpenTradeSchema(TradeSchema): current_rate: float total_profit_abs: float total_profit_fiat: Optional[float] + total_profit_ratio: Optional[float] open_order: Optional[str] diff --git a/freqtrade/rpc/api_server/api_v1.py b/freqtrade/rpc/api_server/api_v1.py index f6bab3624..8ea70bb69 100644 --- a/freqtrade/rpc/api_server/api_v1.py +++ b/freqtrade/rpc/api_server/api_v1.py @@ -42,7 +42,8 @@ logger = logging.getLogger(__name__) # 2.22: Add FreqAI to backtesting # 2.23: Allow plot config request in webserver mode # 2.24: Add cancel_open_order endpoint -API_VERSION = 2.24 +# 2.25: Add several profit values to /status endpoint +API_VERSION = 2.25 # Public API, requires no auth. router_public = APIRouter() diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index e140a43f1..9c2c3ee3a 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -1012,6 +1012,7 @@ def test_api_status(botclient, mocker, ticker, fee, markets, is_short, 'profit_fiat': ANY, 'total_profit_abs': ANY, 'total_profit_fiat': ANY, + 'total_profit_ratio': ANY, 'realized_profit': 0.0, 'realized_profit_ratio': None, 'current_rate': current_rate,