fix api url

This commit is contained in:
osiris account 2023-03-12 13:06:48 -07:00
parent 5a8dc6cc5f
commit 10fde4b2fc
2 changed files with 9 additions and 1 deletions

View File

@ -44,6 +44,8 @@ async def retrieve_top_balances(top_number: int, env_vars: dict) -> list:
"""Retrieve top balances from the database."""
collection = _get_db_collection(env_vars)
# todo: need to sort? how to optimzie to not return all?
# something like for post in posts.find({"date": {"$lt": d}}).sort("author"):
top_balances = collection.find()
result = []
@ -75,4 +77,10 @@ async def retrieve_holder_weekly_change(address: str, env_vars: dict) -> int:
collection = _get_db_collection(env_vars)
# todo
# get today time
# get last week time
# find block last week
# get balance of address in block last week
# get balance of address in block today
# calculate difference and percentage
pass

View File

@ -35,7 +35,7 @@ async def get_token_balance(env_vars: dict, address: str) -> dict:
async def get_top_holders(env_vars: dict, top_number=None) -> dict:
"""Get top holders of a given token."""
top_number = top_number or 10
top_number = top_number or 100
futures = [retrieve_top_balances(env_vars, top_number)]
result = await asyncio.gather(*futures)