Skip to content

Commit c475254

Browse files
committed
[Coinbase] fix auth check
1 parent 0117402 commit c475254

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Trading/Exchange/coinbase/coinbase_exchange.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,14 @@ async def _ensure_auth(self):
253253
await self._unauth_ensure_exchange_init()
254254
# replace self.exchange_manager.exchange.get_balance by get_open_orders
255255
# to mitigate coinbase balance cache side effect
256-
await self.exchange_manager.exchange.get_open_orders(symbol="BTC/USDC")
256+
if self.client.markets:
257+
# fetch orders for any available symbol to ensure authentication is working
258+
first_symbol = next(iter(self.client.markets.keys()))
259+
await self.exchange_manager.exchange.get_open_orders(symbol=first_symbol)
260+
else:
261+
self.logger.error(
262+
f"Unexpected: No [{self.exchange_manager.exchange_name}] markets loaded. Impossible to check authentication."
263+
)
257264
except (
258265
octobot_trading.errors.AuthenticationError,
259266
octobot_trading.errors.ExchangeProxyError,

0 commit comments

Comments
 (0)