Bitcoin Price Analytics Pipeline
A real-time data pipeline that ingests, stores, and analyzes Bitcoin price data — surfacing actionable market insights through an interactive analytics dashboard.

Problem / Objective
Cryptocurrency markets move fast and generate large volumes of price data that are difficult to interpret without structure. Raw price feeds alone offer little analytical value; the challenge is transforming continuous market data into meaningful signals that support decision-making.
This project addresses that challenge by building an end-to-end pipeline that:
- Continuously collects live Bitcoin price data from a public market API
- Stores and manages that data in a relational database optimized for time-series querying
- Applies statistical analysis to identify trends, volatility patterns, and trading signals
- Presents findings in a structured dashboard designed for rapid interpretation
The goal is not to predict the market with certainty, but to provide a clear, data-driven view of Bitcoin's recent behavior — the kind of foundation any analyst or decision-maker would need before drawing conclusions.
Data Overview
Source: CoinGecko Public API (no authentication required)
Endpoints used:
/simple/price — real-time price, market cap, 24h volume, and 24h percentage change
/coins/bitcoin/market_chart — historical daily price, market cap, and volume (up to 90 days)
What the data contains:
| Field | Description |
|---|
timestamp | Date and time of the record |
price_usd | Bitcoin price in US dollars |
market_cap | Total market capitalization |
volume_24h | Total trading volume over the preceding 24 hours |
change_24h | Percentage price change over the preceding 24 hours |
Limitations and challenges:
- The free CoinGecko API returns daily granularity for historical data, which limits intraday analysis
- API rate limits can cause fetch failures during high-frequency polling; the pipeline handles this gracefully with error logging
- The
change_24h field is not available in the historical endpoint and is only captured during live fetches, resulting in null values for seeded records
- Linear regression forecasting assumes price behavior follows a linear trend, which is rarely true in volatile markets — forecasts are directional indicators, not predictions
Data Preparation
Timestamp normalization
The historical endpoint returns timestamps in Unix milliseconds. These are converted to timezone-aware datetime objects (TIMESTAMPTZ) during ingestion to ensure consistent querying and correct time-series alignment across live and historical records.
Hourly aggregation for analytics
Live fetches can produce multiple records per hour depending on scheduler frequency. Before analytics are computed, records are grouped and averaged by hour using a SQL aggregation query. This prevents duplicate data points from inflating moving averages and distorting signal detection.
Duplicate prevention
A row count check runs before any historical seed operation. If the database already contains more than 10 records, seeding is skipped. This protects against accidental data duplication when the seed script is re-run.
Numeric precision
SQLite's REAL type was replaced with PostgreSQL's NUMERIC(18,2) and NUMERIC(24,2) for price and volume fields respectively. Floating-point imprecision in financial data compounds over time, making precise decimal storage essential for reliable aggregations.
Exploratory Analysis
The dataset covers 90 days of daily Bitcoin price history supplemented by live fetches. Several patterns emerged during exploration:
Price behavior is non-linear but trend-following over medium windows. Short-term noise is significant, but when smoothed with a 7-day or 30-day moving average, clear directional trends become visible. The gap between these two averages provides a reliable indicator of momentum shifts.
Volatility is cyclical, not random. Periods of high volatility consistently precede or follow major price movements. Observing volatility trends — rather than price alone — provides earlier warning of potential market shifts.
Buy and sell signals are sparse but meaningful. MA crossover events (where the 7-day average crosses the 30-day average) are infrequent, which makes each signal relatively significant. A high ratio of BUY to SELL signals over a 30-day window correlates with sustained upward price movement.
24-hour change is a noisy but useful sentiment indicator. Daily percentage changes fluctuate widely, but sustained positive or negative streaks in this metric often reflect broader market sentiment rather than isolated price events.
Key Insights
- Bitcoin's short-term price movements are unreliable in isolation; trend analysis using moving averages significantly reduces false signals
- The 7d/30d MA crossover strategy, while simple, captures the majority of significant trend reversals in the dataset
- Volatility (measured as rolling standard deviation) tends to spike at inflection points, making it a useful leading indicator rather than a lagging one
- Linear regression over a 90-day window consistently underestimates short-term volatility but provides a reasonable directional bias for the near term
- Market cap and volume trends often diverge from price during consolidation phases, suggesting that price alone is insufficient for assessing market health
- Periods where sell signals outnumber buy signals over a 30-day window correspond to sustained downward price pressure in the dataset
Dashboards / Visualizations
Live Dashboard
What it shows: A real-time view of the four most important market metrics: current price, 24-hour change, total records in the database, and the all-time high within the dataset.
Key takeaway: Provides an at-a-glance summary of current market conditions and confirms that the data pipeline is actively collecting data.
Price History
What it shows: A time-series line chart of Bitcoin's USD price across all stored records, with a filled area beneath the line to emphasize directional movement.
Key takeaway: The overall price trajectory and key inflection points are immediately visible, giving context to any single data point.
24h Trading Volume
What it shows: A bar chart of daily trading volume, reflecting market participation and liquidity over time.
Key takeaway: Volume spikes frequently coincide with significant price movements, reinforcing the connection between market activity and price action.
24h Price Change
What it shows: A bar chart of daily percentage price change, with positive and negative values color-coded to reflect bullish and bearish days.
Key takeaway: Streaks of consecutive positive or negative days are more informative than any single day's change, and are clearly visible in this view.
Moving Averages
What it shows: Bitcoin's price overlaid with 7-day and 30-day moving averages. Crossover points between the two averages are the basis for the buy/sell signal logic.
Key takeaway: The relationship between the 7d and 30d MA tells a cleaner story than raw price — it filters out daily noise and highlights sustained momentum shifts.
Buy / Sell Signals
What it shows: Price chart annotated with buy (triangle-up) and sell (triangle-down) signals generated by MA crossover detection. Each signal marks a point where the short-term average crossed the long-term average.
Key takeaway: Signals are deliberately infrequent, which increases their reliability. The ratio of buy to sell signals over any given window is a practical summary of trend direction.
Volatility
What it shows: Rolling 7-day standard deviation of Bitcoin's price, displayed as a filled area chart. Higher values indicate greater price instability.
Key takeaway: Volatility is not constant — it compresses and expands in cycles. Identifying when volatility is rising early allows for more informed risk assessment before a price move fully develops.
7-Day Forecast
What it shows: A linear regression model trained on the selected historical window, extended 7 days into the future. The actual price and the forecast line are overlaid for direct comparison.
Key takeaway: The forecast captures the dominant trend direction, which is useful for understanding whether recent price action is consistent with or diverging from the broader trend.
Data Pipeline / Workflow
Data moves through four stages from source to visualization:
CoinGecko API
|
v
Python Ingestion Layer (pipeline.py)
- Fetches live price data on a scheduled interval
- Validates and structures the API response
|
v
PostgreSQL Database
- Stores all records with timezone-aware timestamps
- Supports efficient time-range queries for analytics
|
v
Analytics Engine (analytics.py)
- Computes moving averages, volatility, signals, and forecast
- Aggregates data by hour to ensure clean inputs
|
v
Streamlit Dashboard (dashboard.py)
- Renders live and analytics views in a two-tab interface
- All metrics and charts update dynamically based on user controls
Tech Stack
| Layer | Tool |
|---|
| Data Source | CoinGecko REST API |
| Ingestion | Python, Requests |
| Storage | PostgreSQL, SQLAlchemy, psycopg2 |
| Analytics | Pandas, NumPy, scikit-learn |
| Visualization | Streamlit, Plotly |
| Scheduling | schedule (Python library) |
| Environment | python-dotenv |
| Version Control | Git |
Future Improvements
- Expand to multiple assets — extend the pipeline to track Ethereum, Solana, or other major cryptocurrencies for comparative analysis
- Improve forecasting models — replace linear regression with ARIMA or Prophet to better capture the non-linear, seasonal nature of crypto price behavior
- Intraday granularity — integrate a paid API tier or WebSocket feed to collect minute-level data, enabling more precise signal detection
- Anomaly detection — implement statistical anomaly detection to flag unusual price or volume behavior automatically
- Cloud deployment — migrate from a local PostgreSQL instance to a managed cloud database (e.g., AWS RDS or Supabase) and deploy the dashboard to Streamlit Cloud for public access
- Alert system — add threshold-based notifications via email or messaging platforms when key price or volatility levels are breached
Author
Aaron Creed P. Celindro