chore: small refactor in _rpc_list_custom_data

This commit is contained in:
Axel-CH
2025-03-17 17:43:08 -04:00
parent ef58aaf9e9
commit 87a64cbe68
+2 -4
View File
@@ -1151,7 +1151,8 @@ class RPC:
else: else:
custom_data = trade.get_all_custom_data() custom_data = trade.get_all_custom_data()
# Format each custom data entry. # Format and Append result for the trade if any custom data was found.
if custom_data:
formatted_custom_data = [ formatted_custom_data = [
{ {
"id": data_entry.id, "id": data_entry.id,
@@ -1164,9 +1165,6 @@ class RPC:
} }
for data_entry in custom_data for data_entry in custom_data
] ]
# Append result for the trade if any custom data was found.
if formatted_custom_data:
results.append({"trade_id": trade.id, "custom_data": formatted_custom_data}) results.append({"trade_id": trade.id, "custom_data": formatted_custom_data})
# Handle case when there is no custom data found across trades. # Handle case when there is no custom data found across trades.