build 040: restore quote REST fallback after build 039
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user