No description
Find a file
Viktor Barzin e035904e1c
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is running
fix(ci): add fakeredis to [dev] extras
CI test step in pipelines #41/#43/#44 (commits db103df, 06ede26,
552f5a1) failed during collection with ModuleNotFoundError:
fakeredis on test_blocklist.py, test_cursor.py, test_risk_counters.py.
The bridge tests use fakeredis.aioredis to mock Redis but the dep
wasn't pinned in pyproject. Locally it was installed manually, so
67 kevin tests pass via .venv but CI never installed it.

Unblocks the trading-bot-service rebuild that should ship the
PositionInfo.ticker fix the bridge pod is crash-looping on, and
also unblocks the dashboard rebuild (last pushed 2026-02-25, so
none of the Meet Kevin UI is live yet).
2026-05-26 19:47:15 +00:00
.claude fix: resolve all remaining TODOs, add dev mode auth bypass 2026-02-25 22:02:25 +00:00
.planning/codebase docs: map existing codebase 2026-02-23 20:04:05 +00:00
alembic feat(kevin): alembic migration for v2 trading tables 2026-05-24 00:50:00 +00:00
backtester feat(backtester): extend compute_metrics with alpha/beta/winners/best 2026-05-24 00:57:42 +00:00
dashboard feat(dashboard): /meet-kevin/strategy page wired 2026-05-24 00:48:27 +00:00
docker fix(docker): drop sentiment extras from runtime image 2026-05-22 20:15:06 +00:00
docs/plans add Meet Kevin v2 implementation plan (3 phases, 22 tasks) 2026-05-24 00:40:20 +00:00
scripts feat: wire 6 new strategies and fundamentals into signal generator 2026-02-23 21:55:59 +00:00
services fix(kevin_bridge): use PositionInfo.ticker + qty*avg_entry for cost basis 2026-05-24 01:22:40 +00:00
shared feat(kevin_bridge): service entrypoint with concrete wiring 2026-05-24 01:06:18 +00:00
tests feat(api): /api/meet-kevin/strategy/* routes 2026-05-24 01:12:16 +00:00
.env.example feat: productionize local service — fix signal pipeline, lower thresholds, add company-name ticker extraction 2026-02-22 22:17:26 +00:00
.gitignore feat: docker compose infrastructure — postgres+timescaledb, redis, ollama 2026-02-22 15:11:50 +00:00
.woodpecker.yml ci: include meet_kevin extras in test step (yt-dlp, feedparser, anthropic, httpx) 2026-05-22 20:00:59 +00:00
alembic.ini feat: database models and alembic migrations — all tables per design 2026-02-22 15:17:07 +00:00
docker-compose.yml feat: productionize local service — fix signal pipeline, lower thresholds, add company-name ticker extraction 2026-02-22 22:17:26 +00:00
pyproject.toml fix(ci): add fakeredis to [dev] extras 2026-05-26 19:47:15 +00:00
README.md fix: resolve all remaining TODOs, add dev mode auth bypass 2026-02-25 22:02:25 +00:00

Trading Bot

Automated stock trading bot combining news sentiment analysis with technical strategies. Built as event-driven Python microservices communicating via Redis Streams, with a React/TypeScript dashboard and Alpaca paper trading.

Architecture

RSS/Reddit ─→ news_fetcher ─→ [news:raw] ─→ sentiment_analyzer ─→ [news:scored] ┐
                                                                                  │
Alpaca OHLCV ─→ market_data ─→ [market:bars] ────────────────────────────────────┤
                                                                                  │
                                              signal_generator ←──────────────────┘
                                                    │
                                              [signals:generated]
                                                    │
                                              trade_executor ─→ [trades:executed] ─→ learning_engine
                                                    │                                       │
                                                Alpaca API                             Redis (weights)

Services: news-fetcher, sentiment-analyzer, signal-generator, trade-executor, learning-engine, market-data, api-gateway, dashboard

9 Trading Strategies: Momentum, Mean Reversion, News-Driven, Value, MACD Crossover, Bollinger Breakout, VWAP, Liquidity, MA Stack — combined via weighted ensemble with multi-armed bandit weight adjustment.

Tech Stack

  • Backend: Python 3.12, FastAPI, SQLAlchemy 2.0 (async), Pydantic v2, alpaca-py
  • Frontend: React 19, TypeScript, Vite, Tailwind CSS, TanStack Query, TradingView lightweight-charts
  • ML: transformers (FinBERT), Ollama (local LLM fallback)
  • Database: PostgreSQL 16 + TimescaleDB, Alembic migrations (16 tables)
  • Messaging: Redis Streams + pub/sub
  • Auth: WebAuthn/Passkeys + JWT sessions
  • Observability: OpenTelemetry + Prometheus metrics
  • CI/CD: Woodpecker → Docker → Kubernetes

Quick Start

# Full stack with Docker Compose
docker compose up -d

# Seed default strategies
docker compose exec api-gateway python -m scripts.seed_strategies

Development

# Create virtual environment
python3 -m venv .venv && source .venv/bin/activate

# Install all dependencies
pip install -e ".[api,news,sentiment,trading,backtester,dev]"

# Run unit tests (404 tests)
python -m pytest tests/ -v -m "not integration"

# Run integration tests (requires Redis + PostgreSQL)
python -m pytest tests/ -v -m integration

# Dashboard development
cd dashboard && npm install && npm run dev

Project Structure

trading-bot/
├── shared/              # Shared libraries (config, DB, Redis, models, schemas, broker, strategies, fundamentals)
├── services/            # 7 microservices (news_fetcher, sentiment_analyzer, signal_generator,
│                        #   trade_executor, learning_engine, market_data, api_gateway)
├── backtester/          # Historical replay engine with simulated broker
├── dashboard/           # React 19 / TypeScript / Vite frontend
├── docker/              # Dockerfiles and nginx configs
├── scripts/             # Seed scripts and smoke tests
├── tests/               # 404 unit + 9 integration tests
├── alembic/             # Database migrations
├── docker-compose.yml   # Full stack orchestration
├── .woodpecker.yml      # CI/CD pipeline
└── pyproject.toml       # Python monorepo with optional dependency groups