build 040: restore quote REST fallback after build 039

This commit is contained in:
2026-07-14 11:15:01 +03:00
parent 7b62873832
commit 9df9c0f5e0
4 changed files with 302 additions and 1 deletions

View File

@@ -395,7 +395,7 @@ class MarketDataRunner:
) -> None:
try:
await asyncio.to_thread(
ExchangeService().refresh_market_snapshot_cache,
ExchangeService().refresh_quote_cache,
symbol,
runtime_key=context.runtime_key,
)

View File

@@ -806,6 +806,33 @@ class ExchangeService:
)
return quote
# Принудительно обновить Quote cache через свежий REST Quotes Feed.
def refresh_quote_cache(
self,
symbol: str | None = None,
*,
runtime_key: str | None = None,
) -> Quote:
symbol_to_use = symbol or self.settings.default_symbol
normalized_runtime_key = self._runtime_key(runtime_key)
if not self.settings.exchange_enabled:
quote = mock_quote(symbol_to_use)
else:
validation = self.validate_symbol(symbol_to_use)
if not validation.is_valid:
raise ExchangeError(validation.message)
quote = self._get_fresh_quote(
validation.normalized_symbol
)
MarketPriceCache.set_quote(
quote,
runtime_key=normalized_runtime_key,
)
return quote
# Получить snapshot, пригодный для execution layer.
def get_execution_snapshot(
self,