Add 1-year BTC daily price history chart
New GET /history endpoint fetches 365 days of BTC/EUR data from CoinGecko, deduplicates by date, and joins the user's purchases. BTCHistoryChart component renders the price line with orange dot markers on purchase dates and a dashed cyan avg buy price line. Tooltip shows purchase details on marked dates. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,19 @@
|
||||
import requests
|
||||
|
||||
|
||||
def get_btc_history_eur() -> list:
|
||||
try:
|
||||
resp = requests.get(
|
||||
"https://api.coingecko.com/api/v3/coins/bitcoin/market_chart",
|
||||
params={"vs_currency": "eur", "days": "365", "interval": "daily"},
|
||||
timeout=15,
|
||||
)
|
||||
resp.raise_for_status()
|
||||
return resp.json().get("prices", []) # [[timestamp_ms, price], ...]
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
|
||||
def get_btc_price_eur() -> float:
|
||||
try:
|
||||
resp = requests.get(
|
||||
|
||||
Reference in New Issue
Block a user