This commit is contained in:
Dobromir Popov 2024-10-09 18:57:37 +03:00
parent 560ccb7498
commit ec7c66f617

View File

@ -170,23 +170,12 @@ async def get_token_prices(token_addresses: List[str]) -> Dict[str, float]:
prices[token] = 0.0 prices[token] = 0.0
logging.warning(f"Price not found for token {token}. Setting to 0.") logging.warning(f"Price not found for token {token}. Setting to 0.")
# update token info with prices
# for token, price in prices.items():
# if token in TOKENS_INFO:
# TOKENS_INFO[token]['price'] = price
# else:
# TOKENS_INFO[token] = {'price': price}
for token, price in prices.items(): for token, price in prices.items():
if not token in TOKENS_INFO or not TOKENS_INFO[token].get('symbol'): token_info = TOKENS_INFO.setdefault(token, {})
token_name = await get_token_metadata_symbol(token) if 'symbol' not in token_info:
TOKENS_INFO[token]['symbol'] = token_name token_info['symbol'] = await get_token_metadata_symbol(token)
TOKENS_INFO[token]['priice'] = price token_info['price'] = price
# if mint_address in TOKENS_INFO:
# TOKENS_INFO[mint_address].update(metadata)
# else:
# TOKENS_INFO[mint_address] = metadata
# await save_token_info()
return prices return prices