This project is a simple stock management system built with Django. It helps users manage stock data, view transactions, and get stock prices quickly using Redis caching. The application has a clear API structure and is easy to deploy with Docker.
- Project Overview
- Features
- Installation
- Usage
- API Endpoints
- Caching with Redis
- Docker Setup
- Contributing
- License
This application allows users to:
- Register and manage their accounts.
- View stock information like prices and trading volume.
- Buy and sell stocks.
- See a history of their transactions.
It uses Redis to store frequently accessed data, making it faster to retrieve information.
- User registration and account management.
- Adding and viewing stock information.
- Keeping track of user transactions.
- Fast data retrieval using Redis caching.
- Documentation for APIs.
- Easy deployment with Docker.
Use this command to clone the project:
git clone https://github.com/Daniyal117/Stock-Management-System.git
cd Stock-Management-System
python3 -m venv env
. env\scripts\activate
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py runserver
You can access the app at http://127.0.0.1:8000.
API Documentation: Access the API documentation at http://127.0.0.1:8000/swagger/ to see available endpoints.
Here are some important API endpoints:
Method | Endpoint | Description |
---|---|---|
POST | /users/ |
Register a new user |
GET | /users/{username}/ |
Get user data |
DELETE | /users/{username}/ |
Delete a user |
POST | /stocks/ |
Add stock data |
GET | /stocks/ |
Get all stocks |
POST | /transactions/ |
Create a new transaction |
GET | /transactions/{username}/ |
Get all transactions for a user |
To make it easier to deploy this project, we use Docker. Here’s how to set it up
Run this command to build the Docker image:
docker build -t app .
Use this command to start the application in a Docker container:
docker-compose up --build