2026
REST API and scheduler for financial time series
FastAPI service over PostgreSQL for assets and OHLC candles, with bulk historical import, a modular broker layer and a scheduled daily agent.
- Python
- FastAPI
- PostgreSQL
- SQLAlchemy
- Docker
- APScheduler
Problem
Market data arrives from different providers, in different shapes, with decimal precision that does not forgive rounding. Without a common model and a reliable store, every analysis ends up reimplementing ingestion.
Solution
A REST API over PostgreSQL with SQLAlchemy and the Repository pattern, normalising assets (stocks, crypto, forex, commodities, indices) and OHLC candles with decimal precision. Bulk TradingView import loads history, and the broker layer sits behind its own controllers so providers can be added without touching the domain.
A separate scheduler runs the daily decision for each configured pair, with a dry-run mode so it can be validated without trading.
Architecture
Docker Compose brings up the database; the API documents itself through Swagger and ReDoc.
Technical decisions
- Repository pattern so the domain does not depend on the ORM.
- Decimal for prices: floats accumulate error, and in prices that shows.
- Brokers behind swappable controllers, with unused ones explicitly disabled rather than deleted.
- Strict typing with basedpyright, Ruff as linter and formatter, plus pre-commit.
Result
Working API with asset and candle CRUD, historical import and a running scheduler. The ML prediction side is structurally prepared but not yet implemented.
Contact
Let's work together on your next project
If you have a SAP Business One project, a pending integration or simply a question, send me a message. I reply to everything.
- Location
- Palma, Mallorca
- in/ramon-artigues
- GitHub
- RamonArtigues