fix syntax
This commit is contained in:
@ -3098,16 +3098,6 @@ class DataProvider:
|
||||
response = requests.get(url, headers=headers, timeout=10)
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
elif response.status_code in [418, 429, 451]:
|
||||
logger.warning(f"Rate limited (HTTP {response.status_code}) for {symbol}, using cached data")
|
||||
# Return cached data if available
|
||||
binance_symbol = symbol.replace('/', '').upper()
|
||||
if binance_symbol in self.cob_data_cache and self.cob_data_cache[binance_symbol]:
|
||||
return self.cob_data_cache[binance_symbol][-1]
|
||||
return {}
|
||||
else:
|
||||
logger.warning(f"Failed to fetch COB data for {symbol}: {response.status_code}")
|
||||
return {}
|
||||
|
||||
# Process order book data
|
||||
bids = [[float(price), float(qty)] for price, qty in data.get('bids', [])]
|
||||
@ -3164,6 +3154,13 @@ class DataProvider:
|
||||
self._notify_cob_subscribers(symbol, cob_snapshot)
|
||||
|
||||
return cob_snapshot
|
||||
elif response.status_code in [418, 429, 451]:
|
||||
logger.warning(f"Rate limited (HTTP {response.status_code}) for {symbol}, using cached data")
|
||||
# Return cached data if available
|
||||
binance_symbol = symbol.replace('/', '').upper()
|
||||
if binance_symbol in self.cob_data_cache and self.cob_data_cache[binance_symbol]:
|
||||
return self.cob_data_cache[binance_symbol][-1]
|
||||
return {}
|
||||
else:
|
||||
logger.warning(f"Failed to fetch COB data for {symbol}: {response.status_code}")
|
||||
return {}
|
||||
|
Reference in New Issue
Block a user