Microservice for real-time market data, quotes, historical OHLCV data, and streaming updates built with FastAPI.
src/market_service/
├── core/ ← Foundation: config, database, security, exceptions, dependencies, redis, celery
├── models/ ← SQLAlchemy ORM models (PostgreSQL)
├── schemas/ ← Pydantic request/response validation
├── services/ ← Domain business logic layer
├── workers/ ← Celery worker entrypoints
├── main.py ← FastAPI application factory
└── __init__.py
alembic/ ← Database migrations
| Concern | Library |
|---|---|
| Framework | FastAPI (async) |
| Database | PostgreSQL via asyncpg |
| Cache | Redis via redis.asyncio |
| Background Tasks | Celery + Celery Beat |
| ORM | SQLAlchemy 2.0 (async) |
| Migrations | Alembic |
| Auth Verification | Stateless JWT (PyJWT) |
| Settings | pydantic-settings |
| Package Manager | uv |
- Python 3.13+
- Docker & Docker Compose (or local PostgreSQL & Redis)
- uv installed
.\scripts\setup.ps1cp .env.example .envuv run uvicorn market_service.main:app --reloadOpen http://localhost:8000/docs for the interactive Swagger UI.
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | / |
❌ | Service status |
| GET | /health |
❌ | Health check |
# Run pytest suite
uv run pytest
# Linting & Type Checking
uv run ruff check .
uv run mypy src