fix: api url and rm key

This commit is contained in:
David Arena
2024-12-17 19:22:02 +01:00
parent 47613b1cf9
commit 83e56a09c2
2 changed files with 10 additions and 18 deletions

View File

@@ -1097,26 +1097,21 @@ class RPC:
"cancel_order_count": c_count,
}
def _rpc_list_custom_data(self, trade_id: int | None = None, key: str | None = None) -> list[dict[str, Any]]:
def _rpc_list_custom_data(self, trade_id: int) -> list[dict[str, Any]]:
# Query trades based on trade_id
if trade_id:
trades = Trade.get_trades(trade_filter=[Trade.id == trade_id]).all()
else:
# If no trade_id, get all open trades
if trade_id == -1:
#get all open trades
trades = Trade.get_open_trades()
else:
trades = Trade.get_trades(trade_filter=[Trade.id == trade_id]).all()
if not trades:
return []
# Collect custom data
custom_data = []
for trade in trades:
if key:
data = trade.get_custom_data(key=key)
if data:
custom_data.append(data)
else:
custom_data.extend(trade.get_all_custom_data())
custom_data.extend(trade.get_all_custom_data())
# Format the results
return [