- 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 [email protected]:MbxrAteeq/Stock-Market-Simulation.git
Create a .env
file and set database url's
cp .env-docker .env
Build and start Docker Services
sudo docker-compose up --build -d
Run alembic migrations
sudo docker-compose run app alembic upgrade head
Run Generate Stocks script
sudo docker-compose exec app bash
PYTHONPATH=. python scripts/genrate-stock-data.py
Create and activate virtual environment:
cd Stock-Market-Simulation
python3 -m venv env
source env/bin/activate
cp .env-sample .env
Note: 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_test
bash ./setup.sh
bash run.sh
The API will be accessible at http://localhost:8000.
celery -A celery_service.celery worker --loglevel=info
celery -A celery_service.celery flower
PYTHONPATH=. python scripts/genrate-stock-data.py
Find 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