FastAPI service for fetching and processing market data with Redis-backed storage, JWT authentication, gRPC streaming, and OpenTelemetry observability.
- Python 3.11+
- uv for dependency management
- Redis (local or Docker)
# Start Redis
make redis-up
# Install dependencies
cd python-api && uv sync
# Copy and configure env
cp .env.example ../config/python-api.env
# Edit python-api.env — set JWT_SECRET_KEY (min 32 chars)
# Run the API server
make py-runThe API is available at http://localhost:8000. Interactive docs at /docs.
# Run tests (requires Redis on localhost:6379)
make py-test
# Lint & format
make py-lint
make py-format
# Type checking
make py-checksrc/python_api/
├── api/ # FastAPI routes and dependencies
│ ├── routes/ # auth, health, market, price
│ └── dependencies.py
├── grpc/ # gRPC server and protobuf definitions
├── middleware/ # Rate limiting, request ID
├── models/ # Pydantic request/response schemas
├── services/ # Business logic (auth, Rust API client)
└── utils/ # Config, logging, telemetry, errors
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /health/live |
No | Liveness probe |
| GET | /health/ready |
No | Readiness probe (Redis) |
| POST | /api/v1/auth/signup |
No | Register a new user |
| POST | /api/v1/auth/signin |
No | Sign in and get JWT tokens |
| POST | /api/v1/auth/signout |
Yes | Revoke current token |
| GET | /api/v1/price/{pair} |
Yes | Get price for a pair |
| GET | /api/v1/prices?pairs= |
Yes | Get prices for multiple pairs |
| GET | /api/v1/pairs |
Yes | List available pairs |
| GET | /allmids |
No | Proxy to Rust API |
See .env.example for a full list with defaults.