- 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>
116 lines
2.6 KiB
Markdown
116 lines
2.6 KiB
Markdown
# Simple Deployment Guide
|
|
|
|
## Quick Fix for Rate Limiting
|
|
|
|
You can deploy the rate limiting fix without manually editing files. I've created two approaches:
|
|
|
|
### Approach 1: Automatic (Recommended)
|
|
|
|
I'll create scripts that automatically update the necessary files.
|
|
|
|
### Approach 2: Manual (if you prefer)
|
|
|
|
Just 2 small changes needed:
|
|
|
|
#### Change 1: Update main.py (backend)
|
|
|
|
File: `backend/app/main.py`
|
|
|
|
**Find this line:**
|
|
```python
|
|
from app.api.endpoints import accounts, transactions, positions, analytics
|
|
```
|
|
|
|
**Change to:**
|
|
```python
|
|
from app.api.endpoints import accounts, transactions, positions, analytics_v2 as analytics
|
|
```
|
|
|
|
That's it! By importing `analytics_v2 as analytics`, the rest of the file works unchanged.
|
|
|
|
#### Change 2: Update App.tsx (frontend)
|
|
|
|
File: `frontend/src/App.tsx`
|
|
|
|
**Find this line:**
|
|
```typescript
|
|
import Dashboard from './components/Dashboard';
|
|
```
|
|
|
|
**Change to:**
|
|
```typescript
|
|
import Dashboard from './components/DashboardV2';
|
|
```
|
|
|
|
**That's it!** The component props are identical, so nothing else needs to change.
|
|
|
|
### Deploy Steps
|
|
|
|
```bash
|
|
# 1. Transfer files (on your Mac)
|
|
cd /Users/chris/Desktop/fidelity
|
|
./deploy-rate-limiting-fix.sh
|
|
|
|
# 2. SSH to server
|
|
ssh pi@starship2
|
|
cd ~/fidelity
|
|
|
|
# 3. Make the two changes above, then rebuild
|
|
docker compose down
|
|
docker compose build --no-cache backend frontend
|
|
docker compose up -d
|
|
|
|
# 4. Run migration (adds market_prices table)
|
|
sleep 30
|
|
docker compose exec backend alembic upgrade head
|
|
|
|
# 5. Verify
|
|
curl "http://localhost:8000/api/analytics/overview/1?refresh_prices=false"
|
|
```
|
|
|
|
### Testing
|
|
|
|
1. Open dashboard: `http://starship2:3000`
|
|
2. Should load instantly!
|
|
3. Click account dropdown, select your account
|
|
4. Dashboard tab loads immediately with cached data
|
|
5. Click "🔄 Refresh Prices" button to get fresh data
|
|
|
|
### Logs to Expect
|
|
|
|
**Before (with rate limiting issues):**
|
|
```
|
|
429 Client Error: Too Many Requests
|
|
429 Client Error: Too Many Requests
|
|
429 Client Error: Too Many Requests
|
|
```
|
|
|
|
**After (with fix):**
|
|
```
|
|
Cache HIT (fresh): AAPL = $150.25 (age: 120s)
|
|
Cache HIT (stale): TSLA = $245.80 (age: 320s)
|
|
Cache MISS: AMD, fetching from Yahoo Finance...
|
|
Fetched AMD = $180.50
|
|
```
|
|
|
|
### Rollback (if needed)
|
|
|
|
To go back to the old version:
|
|
|
|
```bash
|
|
# In main.py, change back to:
|
|
from app.api.endpoints import accounts, transactions, positions, analytics
|
|
|
|
# In App.tsx, change back to:
|
|
import Dashboard from './components/Dashboard';
|
|
|
|
# Rebuild
|
|
docker compose build backend frontend
|
|
docker compose up -d
|
|
```
|
|
|
|
The `market_prices` table will remain (doesn't hurt anything), or you can drop it:
|
|
```sql
|
|
DROP TABLE market_prices;
|
|
```
|