mirror of
https://github.com/autistic-symposium/blockchain-data-engineering-toolkit.git
synced 2025-04-26 02:39:15 -04:00
fix api url
This commit is contained in:
parent
5a8dc6cc5f
commit
10fde4b2fc
@ -44,6 +44,8 @@ async def retrieve_top_balances(top_number: int, env_vars: dict) -> list:
|
|||||||
"""Retrieve top balances from the database."""
|
"""Retrieve top balances from the database."""
|
||||||
|
|
||||||
collection = _get_db_collection(env_vars)
|
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()
|
top_balances = collection.find()
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
@ -75,4 +77,10 @@ async def retrieve_holder_weekly_change(address: str, env_vars: dict) -> int:
|
|||||||
|
|
||||||
collection = _get_db_collection(env_vars)
|
collection = _get_db_collection(env_vars)
|
||||||
# todo
|
# 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
|
pass
|
||||||
|
@ -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:
|
async def get_top_holders(env_vars: dict, top_number=None) -> dict:
|
||||||
"""Get top holders of a given token."""
|
"""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)]
|
futures = [retrieve_top_balances(env_vars, top_number)]
|
||||||
result = await asyncio.gather(*futures)
|
result = await asyncio.gather(*futures)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user