Price Charts
Interactive 30-day price history charts for crypto projects.
Overview
The Price Chart component displays historical price data for any crypto project on the dashboard. It uses data from CoinGecko's market chart API, cached for optimal performance.
Features
- 30-Day History: Daily price points for the last month
- Price Change Badge: Shows percentage change (green/red color-coded)
- Hover Tooltips: Exact price on any date
- Responsive Design: Adapts to any screen size
API Endpoint
GET /api/crypto/chart/{slug}?days=30
Parameters:
slug: CoinGecko project slug (e.g.,bitcoin,ethereum)days: History length (1-365, default: 30)
Response:
{
"slug": "bitcoin",
"days": 30,
"prices": [
[1705536000000, 43250.50],
[1705622400000, 43180.25],
...
],
"market_caps": [...],
"total_volumes": [...]
}
Cache Strategy
| Data Type | Cache Duration |
|---|---|
| Chart data (≤7 days) | 1 hour |
| Chart data (>7 days) | 1 hour |
| Project data | 24 hours |
Time Ranges
Currently supported:
- 7D: Weekly trend
- 30D: Monthly trend (default)
- 90D: Quarterly trend
- 1Y: Annual trend
Visual Design
The chart uses a clean, minimal design:
- Area fill: Subtle gradient showing price movement
- Grid lines: Dashed horizontal lines for reference
- Color scheme:
- Green (#22c55e) for positive change
- Red (#ef4444) for negative change
Technical Stack
- Library: Nivo ResponsiveLine
- Data Source: CoinGecko API
- Caching: Redis (1 hour TTL)