Initial release v1.1.0
- 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>
This commit is contained in:
29
backend/app/models/market_price.py
Normal file
29
backend/app/models/market_price.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""Market price cache model for storing Yahoo Finance data."""
|
||||
from sqlalchemy import Column, Integer, String, Numeric, DateTime, Index
|
||||
from datetime import datetime
|
||||
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class MarketPrice(Base):
|
||||
"""
|
||||
Cache table for market prices from Yahoo Finance.
|
||||
|
||||
Stores the last fetched price for each symbol to reduce API calls.
|
||||
"""
|
||||
|
||||
__tablename__ = "market_prices"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
symbol = Column(String(20), unique=True, nullable=False, index=True)
|
||||
price = Column(Numeric(precision=20, scale=6), nullable=False)
|
||||
fetched_at = Column(DateTime, nullable=False, default=datetime.utcnow)
|
||||
source = Column(String(50), default="yahoo_finance")
|
||||
|
||||
# Index for quick lookups by symbol and freshness checks
|
||||
__table_args__ = (
|
||||
Index('idx_symbol_fetched', 'symbol', 'fetched_at'),
|
||||
)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<MarketPrice(symbol={self.symbol}, price={self.price}, fetched_at={self.fetched_at})>"
|
||||
Reference in New Issue
Block a user