An open API service indexing awesome lists of open source software.

https://github.com/willie-conway/financial-data-api-project

๐Ÿ“ŠReal-time stock market ๐Ÿ“API and dashboard with ๐Ÿ”„FastAPI, ๐Ÿ˜PostgreSQL, ๐Ÿ”ดRedis, and ๐Ÿ“ˆChart.js
https://github.com/willie-conway/financial-data-api-project

alpha-vantage api chartjs docker docker-compose fastapi financial-dashboard full-stack postgresql real-time-data redis stock-data yaml

Last synced: about 2 months ago
JSON representation

๐Ÿ“ŠReal-time stock market ๐Ÿ“API and dashboard with ๐Ÿ”„FastAPI, ๐Ÿ˜PostgreSQL, ๐Ÿ”ดRedis, and ๐Ÿ“ˆChart.js

Awesome Lists containing this project

README

          

# ๐Ÿ“ˆ Financial Data API

![Fast-API Dashboard](https://github.com/Willie-Conway/Financial-Data-API-Project/blob/bf54a4174eb83a4854e2887b845ec478ccbef603/Pics/Financial%20Data%20Dashboard.png)

Welcome to the **Financial Data API & Dashboard** โ€” a full-stack web application for retrieving, analyzing, and visualizing stock market data in real-time. Built with a robust FastAPI backend and a responsive JavaScript frontend, this project is perfect for investors, analysts, and developers seeking financial insights with beautiful visualizations.

---

## ๐ŸŒŸ Key Features

### ๐Ÿ”ง Backend Features
- โšก **Real-Time Quotes**: Retrieve up-to-date stock prices using Alpha Vantage API.
- ๐Ÿ“… **Historical Data**: Access daily price history for performance analysis.
- ๐Ÿ—ƒ๏ธ **Database Integration**: Store data efficiently in a PostgreSQL database.
- ๐Ÿง  **Caching**: Use Redis for caching popular symbols to boost speed.
- ๐Ÿณ **Dockerized Environment**: Run locally or in the cloud with Docker.

### ๐Ÿ’ป Frontend Features
- ๐Ÿ“Š **Interactive Visualizations**: Line and candlestick charts using Chart.js.
- ๐Ÿ” **Symbol Search**: Lookup stocks by ticker.
- ๐Ÿ“† **Date Range Filter**: Customize analysis periods for specific timeframes.
- ๐Ÿ“ฑ **Responsive UI**: Works seamlessly across desktop and mobile devices.

---

## ๐Ÿ› ๏ธ Tech Stack

| ๐Ÿงฉ Layer | โš™๏ธ Technology |
|----------------|--------------------------------------------|
| **Backend** | Python, FastAPI, PostgreSQL, Redis |
| **Frontend** | HTML5, CSS3, JavaScript, Chart.js |
| **DevOps** | Docker, Docker Compose, GitHub Actions |
| **API Provider**| Alpha Vantage |
| **Deployment** | GitHub Pages (Frontend), Render/Docker (API)|

---

## ๐Ÿš€ Deployment Options

### ๐ŸŒ Frontend via GitHub Pages

1. Push your `frontend/` code to your GitHub repository.
2. Enable GitHub Pages under your repo's Settings > Pages.
3. Your site will be live at:
`https://.github.io/financial-data-api`

---

### ๐Ÿณ Backend Deployment Options

#### Option 1: Docker Compose (Local or VPS)

```bash
cd backend
docker-compose up -d
````

This command spins up:

* FastAPI server
* PostgreSQL database
* Redis cache

Ensure `docker` and `docker-compose` are installed on your machine.

#### Option 2: Render.com

1. Create an account at [render.com](https://render.com).
2. Connect your GitHub repo.
3. Add the following **environment variables**:

```env
DATABASE_URL=your_postgres_url
REDIS_URL=your_redis_url
ALPHA_VANTAGE_API_KEY=your_alpha_vantage_key
```

4. Deploy and monitor from the Render dashboard.

---

## ๐Ÿง‘โ€๐Ÿ’ป Local Development Setup

### Prerequisites

* Python 3.9+
* Node.js (for frontend live server)
* PostgreSQL
* Redis
* Git

---

### ๐Ÿ” Backend Setup

```bash
# Clone the repository
git clone https://github.com/your-username/financial-data-api.git
cd financial-data-api/backend

# Create a Python virtual environment
python -m venv venv
source venv/bin/activate # On Linux/Mac
venv\Scripts\activate # On Windows

# Install dependencies
pip install -r requirements.txt

# Set environment variables
echo "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/financial_data" > .env
echo "REDIS_URL=redis://localhost:6379" >> .env
echo "ALPHA_VANTAGE_API_KEY=your_key" >> .env

# Apply migrations
alembic upgrade head

# Start development server
uvicorn app.main:app --reload
```

---

### ๐ŸŽจ Frontend Setup

```bash
cd ../frontend

# Install live-server globally (if not installed)
npm install -g live-server

# Launch development server
live-server --port=3000
```

---

## ๐ŸŒ API Endpoints Reference

| Endpoint | Method | Description |
| -------------------------- | ------ | --------------------------------------------------- |
| `/api/stocks/{symbol}` | GET | Get the latest stock quote for a given symbol |
| `/api/historical/{symbol}` | GET | Retrieve historical data (optionally by date range) |

### ๐Ÿ“ฆ Sample JSON Response

```json
{
"symbol": "AAPL",
"price": "175.34",
"change": "+1.23",
"change_percent": "+0.71%"
}
```

---

## ๐Ÿ—ƒ๏ธ Database Schema Overview

**Table: `financial_data`**

| Column | Data Type | Description |
| ------------- | --------- | --------------------------- |
| `id` | INT | Primary Key, auto-increment |
| `symbol` | VARCHAR | Stock ticker symbol |
| `date` | DATE | Trading day |
| `open_price` | FLOAT | Price at market open |
| `close_price` | FLOAT | Price at market close |
| `volume` | INT | Shares traded on that day |

Database is created automatically via Alembic migrations.

---

## ๐Ÿค Contribution Guide

We welcome contributions from the open-source community! Follow these steps:

1. Fork the repository.
2. Create a new branch:

```bash
git checkout -b feature/YourFeatureName
```
3. Make your changes and commit:

```bash
git commit -m "Add feature: YourFeatureName"
```
4. Push to your fork:

```bash
git push origin feature/YourFeatureName
```
5. Open a Pull Request ๐Ÿ“ฌ

---

## ๐Ÿงช Future Improvements

* ๐Ÿง  Add predictive analytics using machine learning
* ๐ŸŒ Support for global market indices
* ๐Ÿ” OAuth authentication for personalized dashboards
* ๐Ÿ“… Scheduler for automatic daily updates

---

## ๐Ÿ“œ License

This project is licensed under the [MIT License](LICENSE).
Feel free to fork, contribute, and use in personal or commercial projects.

---

## ๐Ÿ“ฌ Contact

**Your Name**
๐Ÿ“ง [hire.willie.conway@gmail.com](mailto:hire.willie.conway@gmail.com)
๐Ÿ”— GitHub Repo: [github.com/Willie-Conway/financial-data-api](https://github.com/Willie-Conway/financial-data-api)

---

## ๐Ÿ™ Acknowledgments

* ๐Ÿ’น [Alpha Vantage](https://www.alphavantage.co/) for free stock market data
* ๐Ÿ [FastAPI](https://fastapi.tiangolo.com/) for building high-performance APIs
* ๐Ÿ“Š [Chart.js](https://www.chartjs.org/) for dynamic charts
* ๐Ÿณ Docker for containerization