- Complete MVP for tracking Fidelity brokerage account performance - Transaction import from CSV with deduplication - Automatic FIFO position tracking with options support - Real-time P&L calculations with market data caching - Dashboard with timeframe filtering (30/90/180 days, 1 year, YTD, all time) - Docker-based deployment with PostgreSQL backend - React/TypeScript frontend with TailwindCSS - FastAPI backend with SQLAlchemy ORM Features: - Multi-account support - Import via CSV upload or filesystem - Open and closed position tracking - Balance history charting - Performance analytics and metrics - Top trades analysis - Responsive UI design Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
67 lines
1.8 KiB
Python
67 lines
1.8 KiB
Python
"""
|
|
FastAPI application entry point for myFidelityTracker.
|
|
|
|
This module initializes the FastAPI application, configures CORS,
|
|
and registers all API routers.
|
|
"""
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.config import settings
|
|
from app.api.endpoints import accounts, transactions, positions, import_endpoint
|
|
from app.api.endpoints import analytics_v2 as analytics
|
|
|
|
# Create FastAPI application
|
|
app = FastAPI(
|
|
title=settings.PROJECT_NAME,
|
|
description="Track and analyze your Fidelity brokerage account performance",
|
|
version="1.0.0",
|
|
)
|
|
|
|
# Configure CORS middleware - allow all origins for local network access
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"], # Allow all origins for local development
|
|
allow_credentials=False, # Must be False when using allow_origins=["*"]
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
|
|
# Register API routers
|
|
app.include_router(
|
|
accounts.router, prefix=f"{settings.API_V1_PREFIX}/accounts", tags=["accounts"]
|
|
)
|
|
app.include_router(
|
|
transactions.router,
|
|
prefix=f"{settings.API_V1_PREFIX}/transactions",
|
|
tags=["transactions"],
|
|
)
|
|
app.include_router(
|
|
positions.router, prefix=f"{settings.API_V1_PREFIX}/positions", tags=["positions"]
|
|
)
|
|
app.include_router(
|
|
analytics.router, prefix=f"{settings.API_V1_PREFIX}/analytics", tags=["analytics"]
|
|
)
|
|
app.include_router(
|
|
import_endpoint.router,
|
|
prefix=f"{settings.API_V1_PREFIX}/import",
|
|
tags=["import"],
|
|
)
|
|
|
|
|
|
@app.get("/")
|
|
def root():
|
|
"""Root endpoint returning API information."""
|
|
return {
|
|
"name": settings.PROJECT_NAME,
|
|
"version": "1.0.0",
|
|
"message": "Welcome to myFidelityTracker API",
|
|
}
|
|
|
|
|
|
@app.get("/health")
|
|
def health_check():
|
|
"""Health check endpoint."""
|
|
return {"status": "healthy"}
|