Files
myTradeTracker/backend/alembic/versions/add_market_prices_table.py
Chris eea4469095 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>
2026-01-22 14:27:43 -05:00

41 lines
1.3 KiB
Python

"""Add market_prices table for price caching
Revision ID: 003_market_prices
Revises: 002_add_positions
Create Date: 2026-01-20 16:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
from datetime import datetime
# revision identifiers, used by Alembic.
revision = '003_market_prices'
down_revision = '002_add_positions'
branch_labels = None
depends_on = None
def upgrade() -> None:
# Create market_prices table
op.create_table(
'market_prices',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('symbol', sa.String(length=20), nullable=False),
sa.Column('price', sa.Numeric(precision=20, scale=6), nullable=False),
sa.Column('fetched_at', sa.DateTime(), nullable=False, default=datetime.utcnow),
sa.Column('source', sa.String(length=50), default='yahoo_finance'),
sa.PrimaryKeyConstraint('id')
)
# Create indexes
op.create_index('idx_market_prices_symbol', 'market_prices', ['symbol'], unique=True)
op.create_index('idx_symbol_fetched', 'market_prices', ['symbol', 'fetched_at'])
def downgrade() -> None:
op.drop_index('idx_symbol_fetched', table_name='market_prices')
op.drop_index('idx_market_prices_symbol', table_name='market_prices')
op.drop_table('market_prices')