mirror of
https://github.com/autistic-symposium/blockchain-data-engineering-toolkit.git
synced 2025-08-13 17:05:34 -04:00
everything up data processing
This commit is contained in:
parent
36116f23c4
commit
97a581468f
2 changed files with 14698 additions and 6 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue