python
Yesterday, I received a backend assignment from Invsto. the goal was to build a containerized API service that could store, serve, and analyze Stock price data.
I built a complete FastAPI backend with the following key components:
but beyond the checklist, what made this project worthwhile was how it felt like building something production-ready—debugging tests, handling edge cases, and documenting everything like it mattered; because I had planned to log it in this blogging website (finally)
at the core is a simple but Effective Trading Strategy:
the system scans the data for crossover points and calculates basic profit/loss from those trades. simple logic, but implementing it cleanly, testably, and in a way that integrates into an API—that’s where the challenge lies.
Early on, tests kept failing even though they used a separate sqlite database. turned out they were accidentally connecting to the dev postgres container—resulting in state bleed and weird errors.
fix: I updated the test setup to fully isolate the sqlite test DB, and cleaned stale containers using make down
. lesson: To double-check your test environment assumptions.
My tests expected a buy signal—but the logic returned nothing.
fix: Turns out my strategy only counts full trades (buy + sell). the test data had a buy signal, but no corresponding sell. I had to redesign the test to simulate a full market cycle. lesson: Test data should reflect the exact logic you’re testing—not just part of it.
This project taught me a lot—not just about FastAPI, Docker, or (specially)pandas—but about treating small assignments like real systems. the biggest win wasn’t just getting it to work, but making it clean, testable, and explainable.
There is a live recorded demo in the GitHub Repo as well!
Check out the full code, project structure, and setup instructions here: github.com/ryu-ryuk/inv