Specify coingecko id's and remove async keyword from cli
This commit is contained in:
parent
7af515d1ac
commit
3072e4a826
2
cli.py
2
cli.py
@ -108,7 +108,7 @@ def enqueue_many_blocks_command(after_block: int, before_block: int, batch_size:
|
||||
|
||||
@cli.command()
|
||||
@coro
|
||||
async def fetch_all_prices():
|
||||
def fetch_all_prices():
|
||||
inspect_db_session = get_inspect_session()
|
||||
|
||||
logger.info("Fetching prices")
|
||||
|
@ -3,7 +3,7 @@ from typing import List
|
||||
|
||||
from pycoingecko import CoinGeckoAPI
|
||||
|
||||
from mev_inspect.schemas.prices import TOKEN_ADDRESSES, TOKEN_NAME_BY_ADDRESS, Price
|
||||
from mev_inspect.schemas.prices import COINGECKO_ID_BY_ADDRESS, TOKEN_ADDRESSES, Price
|
||||
|
||||
|
||||
def fetch_prices() -> List[Price]:
|
||||
@ -12,7 +12,7 @@ def fetch_prices() -> List[Price]:
|
||||
|
||||
for token_address in TOKEN_ADDRESSES:
|
||||
price_data = cg.get_coin_market_chart_by_id(
|
||||
id=TOKEN_NAME_BY_ADDRESS[token_address], vs_currency="usd", days="max"
|
||||
id=COINGECKO_ID_BY_ADDRESS[token_address], vs_currency="usd", days="max"
|
||||
)
|
||||
price_time_series = price_data["prices"]
|
||||
|
||||
|
@ -29,7 +29,7 @@ TOKEN_ADDRESSES = [
|
||||
CDAI_TOKEN_ADDRESS,
|
||||
]
|
||||
|
||||
TOKEN_NAME_BY_ADDRESS = {
|
||||
COINGECKO_ID_BY_ADDRESS = {
|
||||
WETH_ADDRESS: "weth",
|
||||
ETH_TOKEN_ADDRESS: "ethereum",
|
||||
WBTC_TOKEN_ADDRESS: "wrapped-bitcoin",
|
||||
|
Loading…
x
Reference in New Issue
Block a user