This is a Flask-based REST API for managing financial data, including exchange rates, stock prices, and currency details. The API allows users to store, retrieve, and manage financial data in a PostgreSQL database.
✅ User Authentication – Uses JWT for secure access.
✅ CRUD Operations – Create, Read, Update, and Delete financial data.
✅ PostgreSQL Database – Persistent data storage with SQLAlchemy.
✅ RESTful API – Clean and structured API endpoints.
- Python 3.8+
- PostgreSQL
- Virtual Environment (venv)
- Backend: Flask, Flask-SQLAlchemy, Flask-JWT-Extended
- Database: PostgreSQL
- Testing: Unittest, Pytest
- API Testing Tool: Postman
- Clone the repository:
git clone https://github.com/kw3ku/fin-api.git cd fin-api - Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On macOS/Linux venv\Scripts\activate # On Windows
- Install dependencies:
pip install -r requirements.txt
- Set up PostgreSQL database:
CREATE DATABASE financial_data;
- Configure environment variables:
- Copy
.env.exampleto.env - Update database connection details in
.env
- Copy
- Initialize the database:
flask db init flask db migrate -m "Initial migration" flask db upgrade - Run the application:
python run.py
| Method | Endpoint | Description |
|---|---|---|
| POST | /register |
Register a new user |
| POST | /login |
Authenticate user and return JWT |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/data |
Retrieve all financial data |
| POST | /api/data |
Add a new financial record |
| GET | /api/data/<id> |
Retrieve specific record by ID |
| PUT | /api/data/<id> |
Update an existing record |
| DELETE | /api/data/<id> |
Delete a record |
Run tests with:
pytest tests/Feel free to open issues or submit pull requests.
This project is licensed under the MIT License.
This is a Flask-based RESTful API...





