- 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>
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
"""Pydantic schemas for transaction-related API operations."""
|
|
from pydantic import BaseModel, Field
|
|
from datetime import date, datetime
|
|
from typing import Optional
|
|
from decimal import Decimal
|
|
|
|
|
|
class TransactionBase(BaseModel):
|
|
"""Base schema for transaction data."""
|
|
run_date: date
|
|
action: str
|
|
symbol: Optional[str] = None
|
|
description: Optional[str] = None
|
|
transaction_type: Optional[str] = None
|
|
exchange_quantity: Optional[Decimal] = None
|
|
exchange_currency: Optional[str] = None
|
|
currency: Optional[str] = None
|
|
price: Optional[Decimal] = None
|
|
quantity: Optional[Decimal] = None
|
|
exchange_rate: Optional[Decimal] = None
|
|
commission: Optional[Decimal] = None
|
|
fees: Optional[Decimal] = None
|
|
accrued_interest: Optional[Decimal] = None
|
|
amount: Optional[Decimal] = None
|
|
cash_balance: Optional[Decimal] = None
|
|
settlement_date: Optional[date] = None
|
|
|
|
|
|
class TransactionCreate(TransactionBase):
|
|
"""Schema for creating a new transaction."""
|
|
account_id: int
|
|
unique_hash: str
|
|
|
|
|
|
class TransactionResponse(TransactionBase):
|
|
"""Schema for transaction API responses."""
|
|
id: int
|
|
account_id: int
|
|
unique_hash: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|