From 76aefccd03bf5ea20de77c70e82f68e5fc51d501 Mon Sep 17 00:00:00 2001 From: Axel-CH Date: Mon, 10 Mar 2025 16:18:42 -0400 Subject: [PATCH] fix: on custom-data endpoints key is now an optional parameter --- freqtrade/rpc/api_server/api_v1.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/freqtrade/rpc/api_server/api_v1.py b/freqtrade/rpc/api_server/api_v1.py index 6403c1819..3cb6965da 100644 --- a/freqtrade/rpc/api_server/api_v1.py +++ b/freqtrade/rpc/api_server/api_v1.py @@ -215,19 +215,21 @@ def trade_reload(tradeid: int, rpc: RPC = Depends(get_rpc)): @router.get("/trades/open/custom-data", response_model=list[ListCustomData], tags=["trading"]) -def list_open_trades_custom_data(rpc: RPC = Depends(get_rpc)): +def list_open_trades_custom_data(key: str | None = Query(None), rpc: RPC = Depends(get_rpc)): """ Fetch custom data for all open trades. + If a key is provided, it will be used to filter data accordingly. """ - return rpc._rpc_list_custom_data() + return rpc._rpc_list_custom_data(key=key) @router.get("/trades/{trade_id}/custom-data", response_model=list[ListCustomData], tags=["trading"]) -def list_custom_data(trade_id: int, rpc: RPC = Depends(get_rpc)): +def list_custom_data(trade_id: int, key: str | None = Query(None), rpc: RPC = Depends(get_rpc)): """ Fetch custom data for a specific trade. + If a key is provided, it will be used to filter data accordingly. """ - return rpc._rpc_list_custom_data(trade_id) + return rpc._rpc_list_custom_data(trade_id, key=key) # TODO: Missing response model