diff --git a/token-scanner-api/src/server/database.py b/token-scanner-api/src/server/database.py index faf54d7..856c12e 100644 --- a/token-scanner-api/src/server/database.py +++ b/token-scanner-api/src/server/database.py @@ -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 diff --git a/token-scanner-api/src/server/routes.py b/token-scanner-api/src/server/routes.py index a317cbb..05122c0 100644 --- a/token-scanner-api/src/server/routes.py +++ b/token-scanner-api/src/server/routes.py @@ -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)