Repository navigation
Expand file tree
/
Copy pathrun_all_analysis_auto.py
More file actions
executable file
·163 lines (135 loc) · 5.12 KB
/
Copy pathrun_all_analysis_auto.py
File metadata and controls
executable file
·163 lines (135 loc) · 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/usr/bin/env python3
"""
Automated script to run all cryptocurrency analysis
Non-interactive mode for batch processing
"""
import sys
import os
# Add current directory to path
sys.path.insert(0, os.path.dirname(__file__))
print("="*70)
print("AUTOMATED CRYPTOCURRENCY ANALYSIS PIPELINE")
print("="*70)
print()
# ============================================================================
# PHASE 1: Download Bitcoin 2025 Data
# ============================================================================
print("\n" + "="*70)
print("PHASE 1.1: Downloading Bitcoin 2025 Data")
print("="*70)
from download_2025_bitcoin_data import download_bitcoin_transactions, get_latest_block_height
try:
print("Getting current Bitcoin block height...")
current_height = get_latest_block_height()
if current_height:
print(f"✓ Current block height: {current_height:,}")
start_block = current_height - 1000
print(f"✓ Will download blocks {start_block:,} to {current_height:,}")
print(f"✓ Estimated time: ~17 minutes")
print()
df_btc = download_bitcoin_transactions(
start_block=start_block,
num_blocks=1000,
output_file='2025_bitcoin.csv'
)
if df_btc is not None:
print("\n✅ Bitcoin data downloaded successfully!")
print(f" File: 2025_bitcoin.csv")
print(f" Transactions: {len(df_btc):,}")
else:
print("\n❌ Bitcoin download failed")
sys.exit(1)
else:
print("❌ Could not get current block height")
sys.exit(1)
except Exception as e:
print(f"\n❌ Error downloading Bitcoin data: {e}")
import traceback
traceback.print_exc()
sys.exit(1)
# ============================================================================
# PHASE 1.2: Download Ethereum 2025 Data
# ============================================================================
print("\n" + "="*70)
print("PHASE 1.2: Downloading Ethereum 2025 Data")
print("="*70)
from download_ethereum_data import EtherscanDownloader
try:
# Check if API key is available in environment
api_key = os.environ.get('ETHERSCAN_API_KEY', None)
if api_key:
print(f"✓ Using Etherscan API key from environment")
else:
print("⚠ No API key found, using public API (slower)")
print(" Set ETHERSCAN_API_KEY environment variable for faster access")
downloader = EtherscanDownloader(api_key)
print("\nGetting current Ethereum block...")
current_block = downloader.get_block_number()
if current_block:
print(f"✓ Current block: {current_block:,}")
start_block = current_block - 1000
print(f"✓ Will download blocks {start_block:,} to {current_block:,}")
print(f"✓ Estimated time: ~3-5 minutes")
print()
df_eth = downloader.download_ethereum_data(
start_block=start_block,
num_blocks=1000,
output_file='ethereum_2025.csv'
)
if df_eth is not None:
print("\n✅ Ethereum data downloaded successfully!")
print(f" File: ethereum_2025.csv")
print(f" Transactions: {len(df_eth):,}")
else:
print("\n❌ Ethereum download failed")
sys.exit(1)
else:
print("❌ Could not get current block number")
sys.exit(1)
except Exception as e:
print(f"\n❌ Error downloading Ethereum data: {e}")
import traceback
traceback.print_exc()
sys.exit(1)
# ============================================================================
# PHASE 1.3: Generate BTC vs ETH Comparison
# ============================================================================
print("\n" + "="*70)
print("PHASE 1.3: Generating BTC vs ETH Comparison Analysis")
print("="*70)
from compare_btc_eth import load_crypto_data, analyze_crypto_comparison, create_btc_eth_comparison_plots
try:
# Load data
df_btc, df_eth = load_crypto_data('2025_bitcoin.csv', 'ethereum_2025.csv')
if df_btc is None or df_eth is None:
print("❌ Failed to load data for comparison")
sys.exit(1)
# Analyze
stats = analyze_crypto_comparison(df_btc, df_eth)
# Create plots
create_btc_eth_comparison_plots(df_btc, df_eth, '../fig')
print("\n✅ BTC vs ETH comparison complete!")
print(" Output: ../fig/bitcoin_vs_ethereum_2025.png")
except Exception as e:
print(f"\n❌ Error in comparison analysis: {e}")
import traceback
traceback.print_exc()
sys.exit(1)
# ============================================================================
# SUMMARY
# ============================================================================
print("\n" + "="*70)
print("✅ ALL ANALYSIS COMPLETE!")
print("="*70)
print()
print("Generated files:")
print(" 📊 2025_bitcoin.csv")
print(" 📊 ethereum_2025.csv")
print(" 📈 ../fig/bitcoin_vs_ethereum_2025.png")
print()
print("Next steps:")
print(" 1. View the comparison plot")
print(" 2. Run multi-LLM validation")
print(" 3. Update paper.tex with findings")
print()
print("="*70)