-
-
Save RaekwonIII/f92c8c4a3de8220752f1ac4c322e1311 to your computer and use it in GitHub Desktop.
Simple Python script that ingests and analyzes parquet files of Uniswap "Swap" events, from Parquet files, aggregates them by day, and plots a bar chart of the total daily amount of Swaps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from pathlib import Path | |
import matplotlib.pyplot as plt | |
df = pd.concat(map(lambda parquet_file: pd.read_parquet(parquet_file, engine="pyarrow"), Path(r'./').rglob('**/pool_event_Swap.parquet')), ignore_index=True) | |
df['datetime'] = pd.to_datetime(df['timestamp']) | |
sumDf = df.groupby(df.datetime.dt.date)["contractAddress"].count() | |
sumDf.plot(kind = 'bar', | |
x = 0, | |
y = 1, | |
color = 'blue', | |
title='Total Daily Swaps on Uniswap', | |
) | |
# show the plot | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment