Build Your Own AI Bitcoin Market Analyzer with Python & Streamlit — Free
While Bitcoin sits in extreme fear territory, you could be building a real AI tool that monitors market sentiment, tracks price data, and gives you an analytical edge — using 100% free tools. This tutorial takes you from zero to a deployed app in about 2 hours.
What You'll Build
By the end of this tutorial, you'll have a fully functional, publicly accessible AI web app that displays real-time Bitcoin data, AI sentiment scores, and market indicators — all for free.
Requirements — All 100% Free
This project is perfect for your AIByTec course portfolio. Once deployed on HuggingFace Spaces, add the link to your LinkedIn — it demonstrates real AI + financial data integration skills that employers love in 2026.
Step 1 Set Up Your Environment
Open your terminal and create a new project folder. We'll set up a virtual environment to keep dependencies clean and avoid conflicts with other projects.
# Create project directory mkdir ai-bitcoin-analyzer cd ai-bitcoin-analyzer # Create and activate virtual environment python -m venv venv # On Windows: venv\Scripts\activate # On Mac/Linux: source venv/bin/activate # Install required packages pip install streamlit requests plotly python-dotenv transformers
Create a requirements.txt file — you'll need this for deployment:
streamlit==1.32.0 requests==2.31.0 plotly==5.18.0 python-dotenv==1.0.0 transformers==4.38.0
Step 2 Fetch Live Bitcoin Data
We'll use the CoinGecko free API to get real-time Bitcoin price data and 30-day historical prices. No API key is required for the free tier endpoints we're using.
import requests from datetime import datetime def get_bitcoin_price(): """Fetch current Bitcoin price from CoinGecko free API""" url = "https://api.coingecko.com/api/v3/simple/price" params = { "ids": "bitcoin", "vs_currencies": "usd", "include_24hr_change": "true", "include_market_cap": "true", "include_24hr_vol": "true" } response = requests.get(url, params=params) data = response.json() return { "price": data["bitcoin"]["usd"], "change_24h": data["bitcoin"]["usd_24h_change"], "market_cap": data["bitcoin"]["usd_market_cap"], "volume_24h": data["bitcoin"]["usd_24h_vol"] } def get_price_history(days=30): """Get historical price data for chart""" url = "https://api.coingecko.com/api/v3/coins/bitcoin/market_chart" params = {"vs_currency": "usd", "days": days, "interval": "daily"} response = requests.get(url, params=params) data = response.json() prices = [p[1] for p in data["prices"]] timestamps = [datetime.fromtimestamp(p[0]/1000).strftime("%Y-%m-%d") for p in data["prices"]] return timestamps, prices def get_fear_greed_index(): """Fetch Fear & Greed Index from alternative.me""" url = "https://api.alternative.me/fng/" response = requests.get(url) data = response.json() return { "value": int(data["data"][0]["value"]), "classification": data["data"][0]["value_classification"] }
Step 3 Add AI Sentiment Analysis
Now the exciting part — we'll use a free HuggingFace financial sentiment model to analyze crypto headlines. FinBERT (ProsusAI/finbert) is specifically trained on financial text and classifies sentiment as Positive, Negative, or Neutral with high accuracy.
import requests import os # Free HuggingFace Inference API — get your token at: # https://huggingface.co/settings/tokens HF_TOKEN = os.getenv("HF_TOKEN", "") def analyze_sentiment(headlines: list) -> dict: """ Analyze a list of news headlines using FinBERT. Returns overall sentiment score and per-headline breakdown. """ API_URL = "https://api-inference.huggingface.co/models/ProsusAI/finbert" headers = {"Authorization": f"Bearer {HF_TOKEN}"} results = {"positive": 0, "negative": 0, "neutral": 0} detailed = [] for headline in headlines: response = requests.post( API_URL, headers=headers, json={"inputs": headline} ) if response.status_code == 200: scores = response.json()[0] top = max(scores, key=lambda x: x["score"]) label = top["label"].lower() results[label] += 1 detailed.append({ "headline": headline[:80] + "...", "sentiment": label, "confidence": round(top["score"] * 100, 1) }) total = max(sum(results.values()), 1) return { "overall": ("BULLISH" if results["positive"] > results["negative"] else "BEARISH" if results["negative"] > results["positive"] else "NEUTRAL"), "scores": results, "bull_pct": round(results["positive"] / total * 100), "bear_pct": round(results["negative"] / total * 100), "detailed": detailed } # Sample headlines — replace with live news API in production SAMPLE_HEADLINES = [ "Bitcoin falls below $63,000 amid extreme investor fear", "Crypto ETF sees $203 million in outflows this week", "CZ predicts Bitcoin could reach $200,000", "Bitcoin RSI more oversold than during 2020 COVID crash", "Institutional investors quietly accumulating Bitcoin", "U.S. tariff proposals spark crypto selloff", ]
Step 4 Build the Streamlit Dashboard
Now we bring everything together in the main Streamlit app file. This is where your data and AI model combine into a real interactive web dashboard:
import streamlit as st import plotly.graph_objects as go from data_fetcher import get_bitcoin_price, get_price_history, get_fear_greed_index from sentiment_analyzer import analyze_sentiment, SAMPLE_HEADLINES st.set_page_config( page_title="AI Bitcoin Monitor | AIByTec", page_icon="₿", layout="wide" ) st.title("₿ AI Bitcoin Market Analyzer") st.caption("Powered by FinBERT + CoinGecko API | Built with AIByTec") st.divider() # Fetch live data with st.spinner("Fetching live Bitcoin data..."): btc = get_bitcoin_price() fng = get_fear_greed_index() dates, prices = get_price_history(30) # Metrics row col1, col2, col3, col4 = st.columns(4) with col1: st.metric("Bitcoin Price", f"${btc['price']:,.0f}", f"{btc['change_24h']:.2f}%") with col2: st.metric("Market Cap", f"${btc['market_cap']/1e9:.1f}B") with col3: st.metric("24h Volume", f"${btc['volume_24h']/1e9:.1f}B") with col4: icon = "🔴" if fng['value'] < 25 else "🟡" if fng['value'] < 50 else "🟢" st.metric("Fear & Greed", f"{icon} {fng['value']}/100", fng['classification']) # Price chart st.subheader("📈 30-Day Price History") fig = go.Figure() fig.add_trace(go.Scatter( x=dates, y=prices, fill="tozeroy", line=dict(color="#6366f1", width=2), fillcolor="rgba(99,102,241,0.1)", name="BTC/USD" )) fig.update_layout( paper_bgcolor="rgba(0,0,0,0)", plot_bgcolor="rgba(0,0,0,0)", height=350, yaxis=dict(tickprefix="$") ) st.plotly_chart(fig, use_container_width=True) # AI Sentiment st.subheader("🧠 AI Sentiment Analysis (FinBERT)") if st.button("Run AI Sentiment Analysis", type="primary"): with st.spinner("Analyzing headlines with AI..."): sentiment = analyze_sentiment(SAMPLE_HEADLINES) st.metric("Overall Sentiment", sentiment["overall"], f"Bull: {sentiment['bull_pct']}% | Bear: {sentiment['bear_pct']}%") for item in sentiment["detailed"]: icon = "🟢" if item['sentiment']=='positive' else "🔴" if item['sentiment']=='negative' else "⚪" st.write(f"{icon} **{item['label'].upper()}** ({item['confidence']}%) — {item['headline']}") st.caption("⚠️ Educational tool only. Not financial advice. AIByTec.com")
Expected Output Preview
Step 5 Run Locally & Test
# Set your HuggingFace token (free at huggingface.co/settings/tokens) # Windows: set HF_TOKEN=hf_yourTokenHere # Mac/Linux: export HF_TOKEN=hf_yourTokenHere # Run the Streamlit app streamlit run app.py # Browser opens automatically at: http://localhost:8501
Step 6 Deploy Free on HuggingFace Spaces
HuggingFace Spaces gives you free hosting for Streamlit apps. Your app will be publicly accessible with a shareable URL — perfect for your LinkedIn portfolio and AIByTec course showcase.
Once the basic version works, consider: connecting CryptoPanic's free API for live headlines, adding Twilio SMS alerts when sentiment drops below 20, integrating RSI indicators with the ta-lib library, or expanding to multi-coin monitoring with an ETH/SOL dropdown. Any of these upgrades make excellent capstone projects for your AIByTec course.
Frequently Asked Questions
Do I need advanced Python to build this?
Is the CoinGecko API really free?
How accurate is the HuggingFace FinBERT sentiment model?
Can I add more cryptocurrencies beyond Bitcoin?
Can this project be used as a portfolio piece?
Learn to Build More AI-Powered Applications
This tutorial is just one project from our comprehensive Generative AI curriculum at AIByTec. Learn RAG chatbots, OpenAI Agents, FastAPI backends, and production-grade AI deployments.