🐍 FastAPI Trading App: A fun, practice project for trading simulation 📈
This is a practice project for a simulated trading platform built with Python and FastAPI. The API also supports WebSockets for real-time updates of trading orders.
The trading-app is a RESTful API that simulates a trading platform with support for real-time order updates via WebSockets. It allows for the placement, retrieval, and cancellation of trading orders.
This project also makes use of Poetry for dependency management and Docker for easy setup and deployment.
- Python 3.10
- Docker (Optional)
- Clone the repository.
git clone https://github.com/42Mo/fastapi-trading-app-example
- Navigate into the project directory.
cd fastapi-trading-app-example
- Install the project dependencies using Poetry.
poetry install
- Run the application.
poetry run python -m trading_app
The server will start on http://localhost:8080.
- Clone the repository.
git clone https://github.com/42Mo/fastapi-trading-app-example
- Navigate into the project directory.
cd trading-app
- Build the Docker image.
docker build -t trading-app .
- Run the Docker container.
docker run -p 8080:8080 trading-app
The server will start on http://localhost:8080.
This project follows the OpenAPI Specification (OAS) for designing and documenting its API. Here is a brief overview of the available endpoints:
- GET /orders: Retrieve all orders
- POST /orders: Place a new order
- GET /orders/{orderId}: Retrieve a specific order
- DELETE /orders/{orderId}: Cancel an order
- GET /ws: Establish a WebSocket connection for real-time order information
For more detailed information, please refer to the api_spec.yaml file in the root of the project.