My solutions to the test assignment
To work with this repo you will need
- Docker >= v20.10.14
- GNU Make >= v3.81
- websocat or any other websocket client
Please make sure you have the correct version of Docker installed
Note: Because docker-compose.yaml
uses env variables substitution,
docker compose ...
should be called from the project root dir
- Download test_data and trades_sample.parquet from my Google Drive
- Create
.env
file withcp example.env .env
. Specify path to the downloaded files in .env file - Run
make first_run
to initialize db and populate it with the sample data
Database structure is defined in init.sql
I had decided to not include test files in to the repo, because they are not small. And there is no straightforward way to download them with a script, because they are too large (to be scanned for viruses, and Google Drive asks to press confirm to continue)
- Run
docker compose up -d notebooks
to start Jupyter notebooks server - In your browser go to http://127.0.0.1:8888/lab/tree/notebooks. You should be able to see and execute my solutions now
- Run
docker compose up cron_job
to start cron job. You should be able to see some logs now
- Run
docker compose up websocket
to start WebSocket. You should be able to see some logs now - Run in another terminal
websocat ws://127.0.0.1:8080/live_trades
to connect to the WebSocket. You should see streaming trades, and some logs in another terminal - Run
docker compose exec websocket python -m unittest /service/tests.py
to start tests
Note: It might take a few seconds for the endpoint to become available