chore: small refactor in _rpc_list_custom_data
This commit is contained in:
+14
-16
@@ -1151,22 +1151,20 @@ 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.
|
||||||
formatted_custom_data = [
|
if custom_data:
|
||||||
{
|
formatted_custom_data = [
|
||||||
"id": data_entry.id,
|
{
|
||||||
"ft_trade_id": data_entry.ft_trade_id,
|
"id": data_entry.id,
|
||||||
"cd_key": data_entry.cd_key,
|
"ft_trade_id": data_entry.ft_trade_id,
|
||||||
"cd_type": data_entry.cd_type,
|
"cd_key": data_entry.cd_key,
|
||||||
"cd_value": data_entry.cd_value,
|
"cd_type": data_entry.cd_type,
|
||||||
"created_at": data_entry.created_at,
|
"cd_value": data_entry.cd_value,
|
||||||
"updated_at": data_entry.updated_at,
|
"created_at": data_entry.created_at,
|
||||||
}
|
"updated_at": data_entry.updated_at,
|
||||||
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user