This project is a stock monitoring platform that allows users to create and manage their own watchlists of stock symbols and monitor the latest stock values. The platform consists of a backend built with Django and a frontend built with React.
The backend uses a simple database schema with three models:
- User: Represents a user of the platform. This model is provided by Django's built-in authentication system.
- Watchlist: Represents a watchlist created by a user, containing a list of stock symbols.
The backend provides the following API endpoints:
- /api/users/:
GET
: Retrieves a list of all users.POST
: Creates a new user.
- /api/users//:
GET
: Retrieves details of a specific user.
- /api/watchlists/:
GET
: Retrieves a list of watchlists for the authenticated user.POST
: Creates a new watchlist for the authenticated user.
- /api/watchlists//:
GET
: Retrieves details of a specific watchlist for the authenticated user.DELETE
: Deletes a specific watchlist for the authenticated user.
The backend uses token-based authentication provided by Django REST Framework. Users are required to authenticate using their username and password to access protected endpoints. Upon successful authentication, a token is provided, which must be included in subsequent requests to authenticate the user.
-
Clone the repository:
git clone <repository_url>
-
Install dependencies:
pip install -r requirements.txt
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Navigate to the backend directory:
cd stock_monitor
-
Apply database migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
-
The backend will be accessible at
http://localhost:8000
- Navigate to the frontend directory:
cd src
- Install dependencies:
npm install
- Start the development server:
npm start
- The frontend will be accessible at
http://localhost:3000
Now, you can access the application at http://localhost:3000
and start monitoring stocks!
Feel free to reach out if you have any questions or encounter any issues during setup!