mirror of
https://github.com/autistic-symposium/blockchain-data-engineering-toolkit.git
synced 2025-04-25 10:19:13 -04:00
everything up data processing
This commit is contained in:
parent
36116f23c4
commit
97a581468f
14694
token-scanner-api/output/balances_2023-03-12_09-04-25.json
Normal file
14694
token-scanner-api/output/balances_2023-03-12_09-04-25.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,14 +14,12 @@ def process_balances(filepath) -> list:
|
||||
data = os_utils.open_json(filepath)
|
||||
balances = collections.defaultdict(Decimal)
|
||||
|
||||
for _, block_data in data.items():
|
||||
for _, tx_data in block_data.items():
|
||||
for _, event_data in tx_data.items():
|
||||
balances[event_data["from"]] -= Decimal(event_data["value"])
|
||||
balances[event_data["to"]] += Decimal(event_data["value"])
|
||||
for _tx, event_data in data.items():
|
||||
balances[event_data["from"]] -= Decimal(event_data["amount"])
|
||||
balances[event_data["to"]] += Decimal(event_data["amount"])
|
||||
|
||||
|
||||
balances = {key: float(value) for key, value in balances.items() if value >= Decimal('0')}
|
||||
balances = {key: float(value) for key, value in balances.items() if value > Decimal('0')}
|
||||
return dict(sorted(balances.items(), key=lambda x: x[1]))
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user