chore: revert unnecessary get_custom_data changes
This commit is contained in:
@@ -1351,20 +1351,15 @@ class LocalTrade:
|
|||||||
"""
|
"""
|
||||||
CustomDataWrapper.set_custom_data(trade_id=self.id, key=key, value=value)
|
CustomDataWrapper.set_custom_data(trade_id=self.id, key=key, value=value)
|
||||||
|
|
||||||
def get_custom_data(self, key: str, default: Any = None, retrieval_mode: str = "value") -> Any:
|
def get_custom_data(self, key: str, default: Any = None) -> Any:
|
||||||
"""
|
"""
|
||||||
Get custom data for this trade.
|
Get custom data for this trade.
|
||||||
|
|
||||||
:param key: key of the custom data
|
:param key: key of the custom data
|
||||||
:param default: value to return if no data is found
|
:param default: value to return if no data is found
|
||||||
:param retrieval_mode: 'value' (default) to return the custom data's value,
|
|
||||||
or 'object' to return the entire custom data object.
|
|
||||||
"""
|
"""
|
||||||
data = CustomDataWrapper.get_custom_data(trade_id=self.id, key=key)
|
data = CustomDataWrapper.get_custom_data(trade_id=self.id, key=key)
|
||||||
if data:
|
if data:
|
||||||
if retrieval_mode == "object":
|
|
||||||
return data[0]
|
|
||||||
# default behavior: return only the value
|
|
||||||
return data[0].value
|
return data[0].value
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
|||||||
@@ -1145,7 +1145,7 @@ class RPC:
|
|||||||
for trade in trades:
|
for trade in trades:
|
||||||
# Depending on whether a specific key is provided, retrieve custom data accordingly.
|
# Depending on whether a specific key is provided, retrieve custom data accordingly.
|
||||||
if key:
|
if key:
|
||||||
data = trade.get_custom_data(key=key, retrieval_mode="object")
|
data = trade.get_custom_data_entry(key=key)
|
||||||
# If data exists, wrap it in a list so the output remains consistent.
|
# If data exists, wrap it in a list so the output remains consistent.
|
||||||
custom_data = [data] if data else []
|
custom_data = [data] if data else []
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user