Skip to content

Commit d1cca4a

Browse files
authored
Merge pull request freqtrade#11796 from freqtrade/dependabot/pip/develop/ccxt-4.4.85
chore(deps): bump ccxt from 4.4.82 to 4.4.85
2 parents eb5d5e0 + 77dcc53 commit d1cca4a

File tree

4 files changed

+32
-28
lines changed

4 files changed

+32
-28
lines changed

freqtrade/exchange/exchange.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,9 @@ def ws_connection_reset(self):
637637
if self._exchange_ws:
638638
self._exchange_ws.reset_connections()
639639

640-
async def _api_reload_markets(self, reload: bool = False) -> dict[str, Any]:
640+
async def _api_reload_markets(self, reload: bool = False) -> None:
641641
try:
642-
return await self._api_async.load_markets(reload=reload, params={})
642+
await self._api_async.load_markets(reload=reload, params={})
643643
except ccxt.DDoSProtection as e:
644644
raise DDosProtection(e) from e
645645
except (ccxt.OperationFailed, ccxt.ExchangeError) as e:
@@ -649,14 +649,14 @@ async def _api_reload_markets(self, reload: bool = False) -> dict[str, Any]:
649649
except ccxt.BaseError as e:
650650
raise TemporaryError(e) from e
651651

652-
def _load_async_markets(self, reload: bool = False) -> dict[str, Any]:
652+
def _load_async_markets(self, reload: bool = False) -> None:
653653
try:
654654
with self._loop_lock:
655655
markets = self.loop.run_until_complete(self._api_reload_markets(reload=reload))
656656

657657
if isinstance(markets, Exception):
658658
raise markets
659-
return markets
659+
return None
660660
except asyncio.TimeoutError as e:
661661
logger.warning("Could not load markets. Reason: %s", e)
662662
raise TemporaryError from e
@@ -679,7 +679,8 @@ def reload_markets(self, force: bool = False, *, load_leverage_tiers: bool = Tru
679679
# on initial load, we retry 3 times to ensure we get the markets
680680
retries: int = 3 if force else 0
681681
# Reload async markets, then assign them to sync api
682-
self._markets = retrier(self._load_async_markets, retries=retries)(reload=True)
682+
retrier(self._load_async_markets, retries=retries)(reload=True)
683+
self._markets = self._api_async.markets
683684
self._api.set_markets(self._api_async.markets, self._api_async.currencies)
684685
# Assign options array, as it contains some temporary information from the exchange.
685686
self._api.options = self._api_async.options

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ bottleneck==1.4.2
44
numexpr==2.10.2
55
pandas-ta==0.3.14b
66

7-
ccxt==4.4.82
7+
ccxt==4.4.85
88
cryptography==45.0.3
9-
aiohttp==3.9.5
9+
aiohttp==3.11.18
1010
SQLAlchemy==2.0.41
1111
python-telegram-bot==22.1
1212
# can't be hard-pinned due to telegram-bot pinning httpx with ~

tests/exchange/test_exchange.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,8 @@ def test__load_markets(default_conf, mocker, caplog):
590590

591591
expected_return = {"ETH/BTC": "available"}
592592
api_mock = MagicMock()
593-
api_mock.load_markets = get_mock_coro(return_value=expected_return)
593+
api_mock.load_markets = get_mock_coro()
594+
api_mock.markets = expected_return
594595
mocker.patch(f"{EXMS}._init_ccxt", MagicMock(return_value=api_mock))
595596
default_conf["exchange"]["pair_whitelist"] = ["ETH/BTC"]
596597
ex = Exchange(default_conf)
@@ -606,6 +607,7 @@ def test_reload_markets(default_conf, mocker, caplog, time_machine):
606607
time_machine.move_to(start_dt, tick=False)
607608
api_mock = MagicMock()
608609
api_mock.load_markets = get_mock_coro(return_value=initial_markets)
610+
api_mock.markets = initial_markets
609611
default_conf["exchange"]["markets_refresh_interval"] = 10
610612
exchange = get_patched_exchange(
611613
mocker, default_conf, api_mock, exchange="binance", mock_markets=False
@@ -624,6 +626,7 @@ def test_reload_markets(default_conf, mocker, caplog, time_machine):
624626
api_mock.load_markets = get_mock_coro(return_value=updated_markets)
625627
# more than 10 minutes have passed, reload is executed
626628
time_machine.move_to(start_dt + timedelta(minutes=11), tick=False)
629+
api_mock.markets = updated_markets
627630
exchange.reload_markets()
628631
assert exchange.markets == updated_markets
629632
assert lam_spy.call_count == 1
@@ -669,34 +672,33 @@ def test_reload_markets_exception(default_conf, mocker, caplog):
669672

670673

671674
@pytest.mark.parametrize("stake_currency", ["ETH", "BTC", "USDT"])
672-
def test_validate_stakecurrency(default_conf, stake_currency, mocker, caplog):
675+
def test_validate_stakecurrency(default_conf, stake_currency, mocker):
673676
default_conf["stake_currency"] = stake_currency
674677
api_mock = MagicMock()
675-
type(api_mock).load_markets = get_mock_coro(
676-
return_value={
677-
"ETH/BTC": {"quote": "BTC"},
678-
"LTC/BTC": {"quote": "BTC"},
679-
"XRP/ETH": {"quote": "ETH"},
680-
"NEO/USDT": {"quote": "USDT"},
681-
}
682-
)
678+
api_mock.load_markets = get_mock_coro()
679+
api_mock.markets = {
680+
"ETH/BTC": {"quote": "BTC"},
681+
"LTC/BTC": {"quote": "BTC"},
682+
"XRP/ETH": {"quote": "ETH"},
683+
"NEO/USDT": {"quote": "USDT"},
684+
}
683685
mocker.patch(f"{EXMS}._init_ccxt", MagicMock(return_value=api_mock))
684686
mocker.patch(f"{EXMS}.validate_timeframes")
685687
mocker.patch(f"{EXMS}.validate_pricing")
686688
Exchange(default_conf)
687689

688690

689-
def test_validate_stakecurrency_error(default_conf, mocker, caplog):
691+
def test_validate_stakecurrency_error(default_conf, mocker):
690692
default_conf["stake_currency"] = "XRP"
691693
api_mock = MagicMock()
692-
type(api_mock).load_markets = get_mock_coro(
693-
return_value={
694-
"ETH/BTC": {"quote": "BTC"},
695-
"LTC/BTC": {"quote": "BTC"},
696-
"XRP/ETH": {"quote": "ETH"},
697-
"NEO/USDT": {"quote": "USDT"},
698-
}
699-
)
694+
api_mock.load_markets = get_mock_coro()
695+
api_mock.markets = {
696+
"ETH/BTC": {"quote": "BTC"},
697+
"LTC/BTC": {"quote": "BTC"},
698+
"XRP/ETH": {"quote": "ETH"},
699+
"NEO/USDT": {"quote": "USDT"},
700+
}
701+
700702
mocker.patch(f"{EXMS}._init_ccxt", MagicMock(return_value=api_mock))
701703
mocker.patch(f"{EXMS}.validate_timeframes")
702704
with pytest.raises(
@@ -705,7 +707,7 @@ def test_validate_stakecurrency_error(default_conf, mocker, caplog):
705707
):
706708
Exchange(default_conf)
707709

708-
type(api_mock).load_markets = get_mock_coro(side_effect=ccxt.NetworkError("No connection."))
710+
api_mock.load_markets = get_mock_coro(side_effect=ccxt.NetworkError("No connection."))
709711
mocker.patch(f"{EXMS}._init_ccxt", MagicMock(return_value=api_mock))
710712

711713
with pytest.raises(

tests/exchange/test_hyperliquid.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ def test_hyperliquid_dry_run_liquidation_price(default_conf, mocker):
283283
default_conf["trading_mode"] = "futures"
284284
default_conf["margin_mode"] = "isolated"
285285
default_conf["stake_currency"] = "USDC"
286-
api_mock.load_markets = get_mock_coro(return_value=markets)
286+
api_mock.load_markets = get_mock_coro()
287+
api_mock.markets = markets
287288
exchange = get_patched_exchange(
288289
mocker, default_conf, api_mock, exchange="hyperliquid", mock_markets=False
289290
)

0 commit comments

Comments
 (0)