-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcrypto-000.py
More file actions
53 lines (44 loc) · 1.04 KB
/
Copy pathcrypto-000.py
File metadata and controls
53 lines (44 loc) · 1.04 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
import yfinance as yf
import pandas as pd
import matplotlib.pyplot as plt
# =========================
# CONFIGURATION
# =========================
TICKERS = [
"BTC-USD", # Bitcoin
"ETH-USD", # Ethereum
"BNB-USD", # Binance Coin
"SOL-USD", # Solana
"ADA-USD", # Cardano
"XRP-USD" # Ripple
]
PERIOD = "1y"
INTERVAL = "1d"
# =========================
# DOWNLOAD DATA
# =========================
data = yf.download(
TICKERS,
period="1y",
interval="1d",
auto_adjust=False
)
# On récupère uniquement les clôtures
close = data["Close"]
# =========================
# NORMALISATION (base 100)
# =========================
normalized = close / close.iloc[0] * 100
# =========================
# PLOT
# =========================
plt.figure(figsize=(12, 6))
for col in normalized.columns:
plt.plot(normalized.index, normalized[col], label=col)
plt.title("Comparaison des principales cryptomonnaies (Base 100)")
plt.xlabel("Date")
plt.ylabel("Performance (%)")
plt.legend()
plt.grid()
plt.tight_layout()
plt.show()