Fetching latest headlinesโ€ฆ
Run a Free Crypto Analysis Agent on Your Laptop Using Ollama and Llama3
NORTH AMERICA
๐Ÿ‡บ๐Ÿ‡ธ United Statesโ€ขMarch 22, 2026

Run a Free Crypto Analysis Agent on Your Laptop Using Ollama and Llama3

2 views0 likes0 comments
Originally published byDev.to

Disclaimer: Not financial advice. All examples are for educational purposes using paper trading / simulation only. Crypto is highly volatile never risk more than you can afford to lose completely.

You don't need a cloud subscription to run an AI crypto analysis agent.

You don't need to paste your exchange API keys into a third-party dashboard.

You don't need to pay $50/month for a trading bot someone else controls.

Here's how to build a fully local, completely free AI crypto analysis agent using Ollama, Llama3, and Python running entirely on your laptop.

What You'll Build

By the end of this guide, you'll have:

  • A Python script that fetches live crypto prices from CoinGecko (free, no API key needed)
  • Local LLM analysis using Llama3.2 via Ollama (runs offline)
  • A daily market brief generated automatically
  • A paper trade journal that logs AI-identified opportunities

The entire system runs locally. No subscriptions. No API key exposure. No cloud.

Prerequisites

  • A modern laptop (8GB RAM minimum, 16GB recommended)
  • Python 3.10+
  • About 30 minutes

That's it.

Step 1: Install Ollama

Ollama is a free tool that lets you run large language models locally. Download it from ollama.ai for Windows, Mac, or Linux.

After installation, pull the Llama3.2 model:

ollama pull llama3.2:3b

The 3B model is ~2GB and runs comfortably on 8GB RAM. If you have 16GB+, try the 8B model:

ollama pull llama3.2:8b

Verify it works:

ollama run llama3.2:3b "What is Bitcoin in one sentence?"

If you see a response, you're ready.

Step 2: Set Up Your Python Environment

mkdir crypto-agent
cd crypto-agent
python -m venv venv

# Windows
venv\Scripts\activate
# Mac/Linux
source venv/bin/activate

pip install requests rich schedule python-dateutil

Step 3: The Price Fetcher

Create price_fetcher.py:

"""price_fetcher.py  Fetch live crypto data from CoinGecko (free tier)"""

import requests
from datetime import datetime

COINS = ["bitcoin", "ethereum", "solana", "cardano", "polkadot"]
COINGECKO_URL = "https://api.coingecko.com/api/v3"


def get_market_data(coin_ids=None):
    """Fetch current prices, 24h change, market cap for multiple coins."""
    ids = coin_ids or COINS

    resp = requests.get(
        f"{COINGECKO_URL}/simple/price",
        params={
            "ids": ",".join(ids),
            "vs_currencies": "usd",
            "include_24hr_change": "true",
            "include_market_cap": "true",
            "include_24hr_vol": "true",
        },
        timeout=15
    )
    resp.raise_for_status()
    return resp.json()


def get_trending():
    """Get today's trending coins on CoinGecko."""
    resp = requests.get(f"{COINGECKO_URL}/search/trending", timeout=15)
    resp.raise_for_status()
    data = resp.json()
    return [item["item"]["name"] for item in data.get("coins", [])[:5]]


def format_market_summary(data):
    """Format price data into a readable summary string."""
    lines = []
    for coin, d in data.items():
        change = d.get("usd_24h_change", 0)
        arrow = "" if change > 0 else ""
        lines.append(
            f"{arrow} {coin.upper()}: ${d['usd']:,.2f} ({change:+.2f}% 24h) "
            f"| Vol: ${d.get('usd_24h_vol', 0)/1e9:.1f}B"
        )
    return "\n".join(lines)


if __name__ == "__main__":
    print(f"\n CryptoAgent Price Check  {datetime.now().strftime('%Y-%m-%d %H:%M')}\n")
    data = get_market_data()
    print(format_market_summary(data))

    trending = get_trending()
    print(f"\n Trending: {', '.join(trending)}")

Run it:

python price_fetcher.py

You should see live prices in your terminal.

Step 4: The Local AI Analyst

Create ai_analyst.py:

"""ai_analyst.py  Local LLM crypto analysis via Ollama"""

import subprocess
import json
from datetime import datetime
from pathlib import Path

JOURNAL_FILE = Path("analysis_journal.jsonl")


def query_ollama(prompt, model="llama3.2:3b"):
    """Send a prompt to local Ollama and get a response."""
    result = subprocess.run(
        ["ollama", "run", model, prompt],
        capture_output=True,
        text=True,
        timeout=60
    )
    if result.returncode != 0:
        return f"[Error: {result.stderr}]"
    return result.stdout.strip()


def analyze_market(market_summary, trending_coins):
    """Generate a comprehensive market analysis."""

    prompt = f"""
You are a cautious, analytical crypto market analyst. 
You believe in paper trading first and never risking more than you can afford to lose.
You are NOT a financial advisor.

Here is today's market data:
{market_summary}

Trending coins: {', '.join(trending_coins)}

Please provide a brief market analysis covering:
1. Overall market sentiment (2-3 sentences)
2. Any notable price action worth watching
3. One potential paper trade setup with entry idea, target, and stop loss
4. One risk factor to be aware of

IMPORTANT: Always emphasize this is for educational/paper trading purposes only.
Keep the total response under 200 words.
"""

    return query_ollama(prompt)


def identify_opportunities(coin, price, change_24h, volume):
    """Ask AI to identify if there's a paper trade opportunity."""

    prompt = f"""
Crypto paper trade analysis for {coin.upper()}:
- Current price: ${price:,}
- 24h change: {change_24h:+.2f}%
- 24h trading volume: ${volume/1e9:.2f}B

Based purely on this price action data:
1. Is this a potential paper trade entry? (Yes/No/Wait)
2. If yes: entry price, target (+%), stop loss (%)
3. Confidence level: Low/Medium/High
4. One-sentence reasoning

Remember: PAPER TRADE ONLY. Not financial advice.
"""

    response = query_ollama(prompt)

    # Log to journal
    entry = {
        "timestamp": datetime.now().isoformat(),
        "coin": coin,
        "price": price,
        "change_24h": change_24h,
        "analysis": response
    }
    with open(JOURNAL_FILE, "a") as f:
        f.write(json.dumps(entry) + "\n")

    return response


def generate_daily_brief(market_summary, trending):
    """Generate a daily market brief suitable for saving/sharing."""

    analysis = analyze_market(market_summary, trending)

    brief = f"""

 CRYPTOCLAW DAILY BRIEF  {datetime.now().strftime('%Y-%m-%d')}


 MARKET DATA:
{market_summary}

 TRENDING: {', '.join(trending)}

 AI ANALYSIS (Local Llama3  Paper Trading Only):
{analysis}

  DISCLAIMER: For educational purposes only. Not financial advice.
     All analysis is for paper trading simulation. You can lose 100% in crypto.

"""
    return brief


if __name__ == "__main__":
    from price_fetcher import get_market_data, get_trending, format_market_summary

    print("Fetching market data...")
    data = get_market_data()
    summary = format_market_summary(data)
    trending = get_trending()

    print("Generating AI analysis (this takes 10-30 seconds)...")
    brief = generate_daily_brief(summary, trending)
    print(brief)

    # Save to file
    Path("daily_briefs").mkdir(exist_ok=True)
    filename = f"daily_briefs/brief_{datetime.now().strftime('%Y%m%d')}.txt"
    Path(filename).write_text(brief)
    print(f" Brief saved to {filename}")

Step 5: The Scheduler (Run Every Morning)

Create run_agent.py:

"""run_agent.py  Schedule your crypto analysis agent"""

import schedule
import time
from datetime import datetime

def morning_brief():
    """Run the morning market analysis."""
    print(f"\n[{datetime.now()}] Running morning brief...")
    from price_fetcher import get_market_data, get_trending, format_market_summary
    from ai_analyst import generate_daily_brief

    data = get_market_data()
    summary = format_market_summary(data)
    trending = get_trending()
    brief = generate_daily_brief(summary, trending)
    print(brief)

def quick_scan():
    """Quick price check every 4 hours."""
    from price_fetcher import get_market_data, format_market_summary
    data = get_market_data(["bitcoin", "ethereum"])
    print(f"\n[{datetime.now()}] Quick scan:")
    print(format_market_summary(data))

# Schedule tasks
schedule.every().day.at("08:00").do(morning_brief)
schedule.every(4).hours.do(quick_scan)

print(" CryptoAgent running. Press Ctrl+C to stop.")
morning_brief()  # Run immediately on start

while True:
    schedule.run_pending()
    time.sleep(60)

Running the Agent

# One-time analysis
python ai_analyst.py

# Continuous scheduled agent
python run_agent.py

Your terminal will now show live AI analysis of crypto markets, generated entirely on your laptop.

What To Do With This

This agent is for learning and paper trading, not live execution. Use it to:

  1. Build market intuition read the AI analysis alongside price charts
  2. Journal your paper trades log what you would have done
  3. Test strategies does the AI's identified "opportunities" actually work?
  4. Develop your own signals build on top of this to add technical indicators

After 90 days of paper trading with this system, you'll have real data about whether your approach has edge.

Going Further

The CryptoClaw guide expands this into a full system with:

  • Technical indicator integration (RSI, MACD, Bollinger Bands)
  • Telegram alerts when AI identifies strong signals
  • Automated paper trade simulation and P&L tracking
  • Full OpenClaw skill integration for agent orchestration

CryptoClaw Local AI Crypto Trading Guide

Free skills for OpenClaw users:
CryptoClaw Skills Hub

The best crypto agent is one you understand, control, and own. Build it locally. Start with paper trading. Learn before you risk real money.

  • Not financial advice. Paper trading only. You can lose 100% of capital in crypto.*

Comments (0)

Sign in to join the discussion

Be the first to comment!