No description
|
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Two changes that ship together so a single CI run lands both:
1) SlackNotifier — support bot-token + channel transport
- Previous version only supported a pinned webhook URL.
- New mode uses chat.postMessage with bot_token + channel.
- Channel can be changed via env var without rotating webhooks.
- bot-token transport wins when both are set.
- Fail-soft: ok=false (e.g. channel_not_found if the user
hasn't created #trading-bot yet) is logged + skipped, not
raised.
- 5 new tests (10 total): bot-token wins, channel_not_found
swallowed, headers/payload shape verified.
2) Image tags — switch from :${CI_PIPELINE_NUMBER} → :0.1.${N}
- 3-part semver so Keel patch policy (cluster-wide default
in inject-keel-annotations) is bounded to patch bumps
within 0.1.x. Prior 1-part tags (:53) were technically
parseable as major-only, which Keel patch wouldn't bump
but could still resolve oddly under digest tracking.
- Memory id=1935 documents Keel patch ≠ bulletproof for
non-semver; semver tags are the safer mode.
- update-deployment + verify-deploy steps updated to match.
- :latest still pushed for cache-from + bootstrap.
|
||
|---|---|---|
| .claude | ||
| .planning/codebase | ||
| alembic | ||
| backtester | ||
| dashboard | ||
| docker | ||
| docs/plans | ||
| scripts | ||
| services | ||
| shared | ||
| tests | ||
| .env.example | ||
| .gitignore | ||
| .woodpecker.yml | ||
| alembic.ini | ||
| docker-compose.yml | ||
| pyproject.toml | ||
| README.md | ||
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