DigitB (Freelance)

Cryptocurrency Analysis & Trading Framework

Modular Python framework for real-time cryptocurrency analysis: multi-exchange price feeds, vectorised technical indicators, sentiment aggregation and a backtesting engine that validates a strategy before any capital is at risk.

Role
Systems Architect / Quantitative Developer
Period
Jun 2024–Jan 2026

01 Problem What was actually hard

Retail and small institutional traders have data but no analysis layer. Exchange APIs return prices; nothing joins those to indicators, to sentiment, or to a way of testing whether a strategy would actually have worked. Building the toolkit meant real-time feeds from several exchanges normalised into one timeline, indicators computed fast enough to stay ahead of the market, sentiment aggregated from social and news sources, and a backtester honest enough to include commission and slippage. Two properties mattered above raw speed: modularity, so an indicator or data source can be swapped, and determinism, so the same input always produces the same output and a result can be reproduced.

02 Data Sourcing and preparation

Ingested two years of OHLCV candles for 500+ trading pairs from Binance, Coinbase and Kraken, normalised to one-minute candles across exchanges whose data gaps and precisions do not agree. Minor gaps are forward-filled; pairs missing more than a per-cent of their history are rejected outright rather than silently interpolated. Sentiment is aggregated per coin from social mentions and news feeds on a rolling window. Ground truth came from 50 documented trading strategies with known historical performance, each replayed through the framework and checked against manual calculation to confirm the engine itself was not the source of error.

03 Models Evaluated, kept, cut

8 evaluated 4 kept 4 cut

Kept 4

  • Vectorised technical indicators (SMA, RSI, MACD, Bollinger)

    Deterministic, sub-millisecond over a million candles, and fully inspectable — no black box in the signal path

  • TextBlob + VADER sentiment

    Lightweight, CPU-only, good enough as a confirmation signal

  • Binance API (primary feed)

    Most reliable and most liquid; the reference timeline

  • Kraken API (cross-check)

    Second opinion — agreement between exchanges raises confidence in a candle

Cut 4

  • LLM-based sentiment (fine-tuned 7B)

    80ms per tweet for an accuracy gain that never justified the latency

  • LSTM price prediction

    High variance, overfits recent data; a confident wrong forecast is worse than none

  • Random Forest price prediction

    Generalised better than the LSTM and still landed near coin-flip accuracy

  • VectorBT (backtesting library)

    Built a custom engine instead, optimised for crypto-specific patterns

04 Architecture How it fits together

Two paths share one indicator core. The batch pipeline collects from three exchanges in parallel, deduplicates and normalises to a common candle, computes indicators as vectorised NumPy over the whole series, and stores the result in TimescaleDB with compression so two years of history stays queryable in about a second. The real-time path takes a WebSocket feed, applies signal rules to the live candle, and emits a signal with a confidence score to Telegram and Discord. The backtester replays historical candles through the same rule evaluator the live path uses — the point being that a backtested strategy and a live strategy execute identical code — accruing commission and slippage and reporting total return, Sharpe ratio, maximum drawdown, win rate and a full trade log.

Architecture flow: Exchange feeds then Normalise then TimescaleDB then Indicator core then Rule evaluator then Signal out 01 Exchange feeds Binance · Coinbase · Kraken, in parallel 02 Normalise one-minute candles, gaps rejected not interpolated Sentiment aggregation 03 TimescaleDB two years, compressed 04 Indicator core vectorised SMA · RSI · MACD · Bollinger Backtest — P&L, Sharpe, drawdown 05 Rule evaluator same code path live and in backtest 06 Signal out Telegram · Discord, with confidence score

05 Production Deployment and operation

Delivered as a web dashboard with a Telegram bot and Discord webhook for signal delivery, plus an API for programmatic access. Monitoring covers signal outcome (did the move actually happen), latency percentiles and feed freshness, with an alert if an exchange feed goes stale and automatic fallback to the secondary source. Deliberately advisory only: the framework never places a trade. Users execute manually, which keeps the system out of custody and out of the regulatory perimeter that automated execution would drag it into.

06 Deep dive The long version, in full

Problem

Cryptocurrency markets move fast. A price swing of 5% can happen in seconds. Retail traders need real-time analysis but lack infrastructure:

  • Data silos: Price feeds from Binance, sentiment from Twitter, news from crypto media—no unified view
  • Indicator computation: Technical indicators (RSI, MACD, Bollinger Bands) computed manually or via expensive APIs
  • No backtesting: Traders can’t validate strategies before risking capital
  • Latency: Stale signals are useless; framework must operate in <100ms to be useful

The challenge: build a modular, fast, reproducible framework that traders can extend with custom indicators or strategies.

Data Preparation

Price data:

  • Collected 2 years of OHLCV (open, high, low, close, volume) for 500+ pairs
  • Sources: Binance, Coinbase, Kraken (normalized to 1-minute candles)
  • Challenges: exchange data gaps (maintenance windows), different precisions (BTC vs shitcoins)
  • Solution: forward-fill minor gaps; reject pairs with >1% missing data
  • Result: 50GB dataset; compressed to 8GB in TimescaleDB

Sentiment data:

  • Twitter mentions: 4M tweets/month (via Twint scraper); filtered for top 200 coins
  • News feeds: CoinTelegraph API, The Block, Reddit communities
  • Processing: TextBlob polarity (-1 to 1), VADER intensity; per-coin rolling sentiment (24h window)
  • Validation: correlated sentiment swings with price moves (Spearman: 0.32 correlation)

Ground truth:

  • 50 known trading strategies with documented historical performance (e.g., “RSI > 70 = overbought sell signal”)
  • Back-tested each strategy against framework; verified accuracy within 0.1% of manual calculation
  • Result: framework is accurate enough for real trading

Models Evaluated

Component Model Result Note
Technical indicators Manual SMA/RSI/MACD Kept Deterministic, fast (<1ms), transparent; no black box
Sentiment TextBlob + VADER Kept 78% accuracy; lightweight; no GPU needed
Sentiment (alt) Llama 7B (fine-tuned) Cut 80ms per tweet; too slow; diminishing accuracy gains
Price prediction LSTM neural net Cut High variance; overfits to recent data; unpredictable
Price prediction (alt) Random Forest Cut Better generalization than LSTM, but still ~55% accuracy (near random)
Data source Binance API Kept Reliable, <500ms latency, high liquidity
Data source (alt) Kraken API Kept Cross-validation; if both agree, higher confidence
Backtester VectorBT (library) Cut Overkill; built custom engine optimized for crypto patterns

Architecture

Data pipeline (batch):

Binance, Coinbase, Kraken APIs
  v (parallel, deduplicate, normalize to 1-min candles)
TimescaleDB (2y history, compressed)
  v
Compute indicators (vectorized NumPy: SMA, RSI, MACD, Bollinger)
  v
Cache results (Redis, 1h TTL)
  v
Ready for backtesting / analysis

Real-time signal pipeline:

WebSocket feed from Binance (price updates, every 1s)
  v
Apply signal rules:
  IF RSI < 30 AND sentiment > 0.5 AND volume_surge THEN
    -> Emit LONG signal (confidence = 0.75)
  v
Telegram/Discord webhook (notify users)
  v
Log signal + outcome (did price move +5% within 24h?)

Backtesting engine:

User provides:
  - Strategy rules (e.g., "RSI crossover strategy")
  - Date range
  - Capital allocation
  v
Framework replays historical OHLCV:
  v
For each candle:
  - Compute indicators
  - Evaluate rules
  - Execute trade (simulated)
  - Track P&L (with commission + slippage)
  v
Output:
  - Total return, Sharpe ratio, max drawdown, win rate
  - Equity curve ($ over time)
  - Trade log (all fills, reasons)

Safety measures:

  • No real money automation (users manually execute trades; framework is advisory)
  • Confidence scores on signals (users can filter low-confidence)
  • Slippage + commission included in backtesting (realistic)
  • Risk warnings on high-leverage strategies

Production & Scale

Deployed Jun 2024:

  • Web dashboard (React): view signals, backtesting, portfolio
  • Telegram bot: real-time signal delivery (100+ subscribers)
  • Discord webhook: alternative notification channel
  • API: programmatic access to signals + backtesting

Metrics (as of Jan 2026):

  • 180+ active traders using framework
  • 500+ trading pairs supported
  • Real-time latency: P95 <100ms (WebSocket frame -> signal delivery)
  • Signal accuracy: 62% (buy signals predict 5%+ price move within 24h; market baseline ~50%)
  • Backtested strategies: 5,000+ (users upload custom rules)
  • Uptime: 99.4% (exchange API outages + maintenance windows = 0.6%)

Cost structure:

  • Starter: $10/month (basic signals, delayed by 1h)
  • Pro: $50/month (real-time signals, backtesting API, portfolio tracking)
  • Enterprise: custom (private deployment, strategy consulting)

Lessons learned:

  1. Sentiment lag: Sentiment data is 1–2 hours behind price (Twitter doesn’t move markets; markets move Twitter)
    • Solution: Use sentiment as confirmation signal (not primary)
  2. Backtesting overfitting: Users love strategies that returned 100% on historical data; 60% in forward testing
    • Solution: Require walk-forward validation (divide history into train/test, validate on unseen data)
  3. Exchange data quality: Kraken data had 2% gaps; Binance highly reliable
    • Solution: Use Binance as primary; Kraken for cross-check

Result: A framework trusted by 180+ traders for analysis and backtesting. Signals are modest (62% accuracy) but better than flipping a coin, and importantly—transparent and reproducible.

pairs covered
500+ across three exchanges
real-time latency
P95 under 100ms, feed to signal

Stack

  1. Models & inference What does the thinking
    • TextBlob / VADER (sentiment)
  2. Runtime & services What holds the connection open
    • Python (FastAPI, asyncio, multiprocessing)
    • NumPy / Pandas (vectorised computation)
    • WebSocket (real-time exchange feed)
    • Node.js (signal delivery API)
  3. Data & state What is remembered
    • TimescaleDB (compressed time-series storage)
    • Redis (signal cache, rate limiting)
  4. Cloud & delivery What it runs on
    • Docker
  5. Interfaces & integrations What people and other systems touch
    • React (dashboard, backtesting UI)
    • Binance / Coinbase / Kraken APIs