Skip to content

Commit

Permalink
Create cross_chain_analysis.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 7, 2024
1 parent 9af2e32 commit 0bb6996
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Cross-Chain Analysis Notebook

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from pinnacle.data import load_cross_chain_data

# Load cross-chain data
cross_chain_data = load_cross_chain_data()

# Data cleaning and preprocessing
cross_chain_data['timestamp'] = pd.to_datetime(cross_chain_data['timestamp'], unit='s')
cross_chain_data.set_index('timestamp', inplace=True)

# Visualize bridge fees over time
plt.figure(figsize=(12, 6))
sns.lineplot(x=cross_chain_data.index, y=cross_chain_data['bridge_fee'])
plt.title('Bridge Fees Over Time')
plt.xlabel('Timestamp')
plt.ylabel('Bridge Fee')
plt.show()

# Analyze bridge fees by chain
chain_fees = cross_chain_data.groupby('chain')['bridge_fee'].mean()
print('Average Bridge Fees by Chain:')
print(chain_fees)

# Analyze bridge fees by token
token_fees = cross_chain_data.groupby('token')['bridge_fee'].mean()
print('Average Bridge Fees by Token:')
print(token_fees)

# Analyze bridge fees by bridge type
bridge_type_fees = cross_chain_data.groupby('bridge_type')['bridge_fee'].mean()
print('Average Bridge Fees by Bridge Type:')
print(bridge_type_fees)

# Correlation analysis
corr_matrix = cross_chain_data.corr()
print('Correlation Matrix:')
print(corr_matrix)

# Heatmap visualization
plt.figure(figsize=(10, 8))
sns.heatmap(corr_matrix, annot=True, cmap='coolwarm')
plt.title('Correlation Heatmap')
plt.show()

0 comments on commit 0bb6996

Please sign in to comment.