Skip to content

About

A simulated stock portfolio tracker built with React and Flask, buy and sell mock holdings at real live market prices.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

25 Commits

Folders and files

Repository files navigation

StockFolio

React Flask Python SQLite Vercel Render

A simulated stock portfolio tracker that runs on real, live market data. Add mock holdings, buy and sell at actual current prices, and watch your gains and losses move with the real market.

Live demo: stockfolio-tracker.vercel.app (Note: First load takes about a minute due to the free Render backend.)

What it does

  • Buy and sell mock holdings at live prices
  • Set a starting cash balance, buying is capped at what you can afford
  • Realized and unrealized gains tracked separately
  • Sector breakdown and portfolio allocation charts
  • Value over time chart, adjustable range, whole portfolio or one ticker
  • Shows a banner when the market's closed instead of faking live prices
  • No login, each browser gets its own portfolio automatically

Screenshots

Dashboard overview Main dashboard with header stats and the add holding form.

Sector breakdown and portfolio allocation Sector breakdown and portfolio allocation side by side.

Value over time chart Portfolio value over a selected range.

Holdings table Holdings with live prices and gain/loss per stock.

Tech stack

  • Frontend: React (Vite), Recharts
  • Backend: Flask (Python), yfinance
  • Database: SQLite
  • Deployed on: Render (backend), Vercel (frontend)

How it works

Each browser gets a random ID on first load, saved in local storage. That ID goes with every request, and the backend only touches data tied to that ID. No accounts, but everyone's portfolio stays separate.

Prices come from yfinance. Every buy and sell checks that ID first, so one browser can never see or touch another's data. Gains are split into two categories: unrealized (stuff you still hold, value changes with the market) and realized (stuff you've sold, locked in at the price you sold at), the same way a real brokerage statement would show it.

Nothing here is real, no real money or trades. Some things are simplified on purpose: no fees, no bid-ask spread, orders go through instantly, and market hours use a hardcoded holiday list for 2026 and 2027 instead of a live calendar. The database also resets on every backend redeploy since the free hosting tier doesn't keep files.

API

Method Route What it does
GET /api/portfolio Holdings with live prices and gain/loss attached
GET /api/portfolio/history Value over time, filterable by range and ticker
POST /api/holdings Buy a holding, validates the ticker and checks cash balance
POST /api/holdings/<id>/sell Sell shares, logs a realized gain
GET /api/account Current cash balance and setup status
POST /api/account/deposit Add cash to the balance
GET /api/realized-gains Full history of sold trades

Running it locally

Backend

cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 app.py

Runs on http://localhost:5001

Frontend

cd frontend
npm install
npm run dev

Runs on http://localhost:5173

About

A simulated stock portfolio tracker built with React and Flask, buy and sell mock holdings at real live market prices.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages