Skip to content

Commit d384172

Browse files
Guillaume De Saint MartinGuillaumeDSM
authored andcommitted
[RestExchange] add ALLOW_TRADES_FROM_CLOSED_ORDERS
1 parent 26f5c3e commit d384172

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

octobot_trading/exchanges/connectors/ccxt/ccxt_connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ async def get_my_recent_trades(self, symbol: str = None, since: int = None,
334334
with self.error_describer():
335335
method = self.client.fetch_my_trades if self.client.has['fetchMyTrades'] else self.client.fetch_trades
336336
trades = self.adapter.adapt_trades(await method(symbol=symbol, since=since, limit=limit, params=kwargs))
337-
if trades:
337+
if trades or not self.exchange_manager.exchange.ALLOW_TRADES_FROM_CLOSED_ORDERS:
338338
return trades
339339
# on some exchanges, recent trades are only fetching very recent trade. also try closed orders
340340
return await self.exchange_manager.exchange.get_closed_orders(

octobot_trading/exchanges/types/rest_exchange.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class RestExchange(abstract_exchange.AbstractExchange):
4343
ecoc.SIDE.value, ecoc.PRICE.value, ecoc.AMOUNT.value, ecoc.STATUS.value]
4444
ORDER_REQUIRED_FIELDS = ORDER_NON_EMPTY_FIELDS + [ecoc.REMAINING.value]
4545
PRINT_DEBUG_LOGS = False
46+
ALLOW_TRADES_FROM_CLOSED_ORDERS = False # set True when get_my_recent_trades should use get_closed_orders
4647
"""
4748
RestExchange is using its exchange connector to interact with the exchange.
4849
It should be used regardless of the exchange or the exchange library (ccxt or other)

0 commit comments

Comments
 (0)