app / README.md
Ritesh1035's picture
Update README.md
2d96a95 verified

A newer version of the Gradio SDK is available: 6.12.0

Upgrade
metadata
title: Investment Portfolio Tracker API
emoji: πŸ“ˆ
colorFrom: green
colorTo: blue
sdk: gradio
sdk_version: 5.46.1
app_file: app.py
pinned: false
license: mit

Investment Portfolio Tracker - Backend API

A FastAPI backend service for managing investment portfolios with Supabase database integration.

Features

  • πŸ” User Authentication - JWT-based auth with Supabase
  • πŸ’° Investment Management - CRUD operations for stocks and crypto
  • πŸ“Š Portfolio Analytics - Summary calculations and performance metrics
  • 🌐 Live Market Data - Real-time prices from Yahoo Finance and CoinGecko
  • πŸ›‘οΈ Secure - User data isolation and input validation

API Endpoints

Authentication

  • POST /auth/signup - Create new user account
  • POST /auth/signin - User login
  • POST /auth/signout - User logout

Investments

  • GET /investments/ - Get user's investments
  • POST /investments/ - Add new investment
  • PUT /investments/{id} - Update investment
  • DELETE /investments/{id} - Delete investment

Analytics

  • GET /summary/ - Portfolio summary (total value, P&L)

Market Data

  • GET /price/stock/{ticker} - Get stock price
  • GET /price/crypto/{symbol} - Get crypto price

Live Demo

πŸ”— API Documentation: [Your HF Space URL]/docs

Tech Stack

  • FastAPI - Modern Python web framework
  • Supabase - Database and authentication
  • Pydantic - Data validation
  • yfinance - Stock market data
  • CoinGecko API - Cryptocurrency data

Environment Variables

Set these in your Hugging Face Space secrets:

SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_anon_key

Usage

import requests

# Sign up
response = requests.post(f"{API_URL}/auth/signup", json={
    "email": "user@example.com",
    "password": "password123"
})
token = response.json()["access_token"]

# Add investment
headers = {"Authorization": f"Bearer {token}"}
requests.post(f"{API_URL}/investments/", json={
    "asset_type": "Stock",
    "ticker": "AAPL",
    "quantity": 10,
    "buy_price": 150.50,
    "buy_date": "2024-01-15"
}, headers=headers)