mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-17 13:21:15 +00:00
fix: update _rpc_list_custom_data with proper typing and custom_data collection loop
This commit is contained in:
@@ -1121,6 +1121,7 @@ class RPC:
|
|||||||
"""
|
"""
|
||||||
Fetch custom data for a specific trade, or all open trades if `trade_id` is not provided.
|
Fetch custom data for a specific trade, or all open trades if `trade_id` is not provided.
|
||||||
"""
|
"""
|
||||||
|
trades: Sequence[Trade]
|
||||||
if trade_id is None:
|
if trade_id is None:
|
||||||
# get all open trades
|
# get all open trades
|
||||||
trades = Trade.get_open_trades()
|
trades = Trade.get_open_trades()
|
||||||
@@ -1130,14 +1131,14 @@ class RPC:
|
|||||||
if not trades:
|
if not trades:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
# Collect custom data
|
|
||||||
custom_data = []
|
custom_data = []
|
||||||
|
for trade in trades:
|
||||||
|
# Collect custom data
|
||||||
if key:
|
if key:
|
||||||
data = trades.get_custom_data(key=key)
|
data = trade.get_custom_data(key=key)
|
||||||
if data:
|
if data:
|
||||||
custom_data = [data]
|
custom_data = [data]
|
||||||
else:
|
|
||||||
for trade in trades:
|
|
||||||
custom_data.extend(trade.get_all_custom_data())
|
custom_data.extend(trade.get_all_custom_data())
|
||||||
|
|
||||||
# Format the results
|
# Format the results
|
||||||
|
|||||||
Reference in New Issue
Block a user