- Python
- FastAPI
- Postgres
- celery
- Redis
- Apache Kafka
- Pytest
- Docker
- Sentry for monitoring the app
- Celery flower for monitoring the Celery tasks
- Alembic for Database Migrations
- pre-commit hooks
git clone git@github.com:MbxrAteeq/Stock-Market-Simulation.gitCreate a .env file and set database url's
cp .env-docker .envBuild and start Docker Services
sudo docker-compose up --build -dRun alembic migrations
sudo docker-compose run app alembic upgrade headRun Generate Stocks script
sudo docker-compose exec app bash
PYTHONPATH=. python scripts/genrate-stock-data.pyCreate and activate virtual environment:
cd Stock-Market-Simulation
python3 -m venv env
source env/bin/activatecp .env-sample .envNote: set .env values according to your local configurations.
Note: If you are running the app with PostgreSQL, you will probably need to create the databases as well:
createdb --host=localhost -U postgres -O postgres -E utf8 -T template0 stock_market_simulation
createdb --host=localhost -U postgres -O postgres -E utf8 -T template0 stock_market_simulation_testbash ./setup.shbash run.shThe API will be accessible at http://localhost:8000.
celery -A celery_service.celery worker --loglevel=infocelery -A celery_service.celery flowerPYTHONPATH=. python scripts/genrate-stock-data.pyFind swagger docs at http://127.0.1:8000/docs/swagger.
Find flower dashboard at http://127.0.1:5555.
To access the Swagger documentation and test the endpoints, visit http://localhost:8000/docs and http://localhost:8000/redoc in your web browser. The Swagger UI provides an interactive interface to explore the API, view the available endpoints, and test their functionalities.
Make sure the API server is running before accessing the Swagger UI.
To run test, run the following command
pytest -vv -s