- 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>
54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
"""
|
|
Application configuration settings.
|
|
Loads configuration from environment variables with sensible defaults.
|
|
"""
|
|
from pydantic_settings import BaseSettings
|
|
from typing import Optional
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings loaded from environment variables."""
|
|
|
|
# Database configuration
|
|
POSTGRES_HOST: str = "postgres"
|
|
POSTGRES_PORT: int = 5432
|
|
POSTGRES_DB: str = "fidelitytracker"
|
|
POSTGRES_USER: str = "fidelity"
|
|
POSTGRES_PASSWORD: str = "fidelity123"
|
|
|
|
# API configuration
|
|
API_V1_PREFIX: str = "/api"
|
|
PROJECT_NAME: str = "myFidelityTracker"
|
|
|
|
# CORS configuration - allow all origins for local development
|
|
CORS_ORIGINS: str = "*"
|
|
|
|
@property
|
|
def cors_origins_list(self) -> list[str]:
|
|
"""Parse CORS origins from comma-separated string."""
|
|
if self.CORS_ORIGINS == "*":
|
|
return ["*"]
|
|
return [origin.strip() for origin in self.CORS_ORIGINS.split(",")]
|
|
|
|
# File import configuration
|
|
IMPORT_DIR: str = "/app/imports"
|
|
|
|
# Market data cache TTL (seconds)
|
|
MARKET_DATA_CACHE_TTL: int = 60
|
|
|
|
@property
|
|
def database_url(self) -> str:
|
|
"""Construct PostgreSQL database URL."""
|
|
return (
|
|
f"postgresql://{self.POSTGRES_USER}:{self.POSTGRES_PASSWORD}"
|
|
f"@{self.POSTGRES_HOST}:{self.POSTGRES_PORT}/{self.POSTGRES_DB}"
|
|
)
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
|
|
# Global settings instance
|
|
settings = Settings()
|