Legend
- Blue nodes → API/Data operations
- Green nodes → UI updates
- Orange nodes → Filtering logic
Trade List Data Flow
- Initial Load: Page load triggers
loadTradesWithPagination(1, 50)
- API Call:
GET /api/alerts?limit=50&offset=0
- Database Query: Joins
alerts, alert_results, and trade_execution_snapshots
- Filtering:
- Excludes:
failure, rejected, cancelled statuses
- Excludes:
is_flux_test = true (test trades)
- Live trades: Must have
topstepOrderId (actually placed on TopstepX)
- User ID: Only current user's trades
- Pagination: Applies LIMIT and OFFSET
- UI Update: Renders table with trade data
Trade List Columns
- ID: Trade ID
- Timestamp: Entry time
- Symbol: Trading symbol
- Action: Buy/Sell
- Entry Price: Entry price
- Stop Loss: Stop loss price
- Take Profit: Take profit price
- Status: Trade status (pending, done, etc.)
- Exit Price: Exit price (if closed)
- PnL: Profit/Loss
- Contracts: Number of contracts
- Risk Dollars: Risk amount
- Details: Button to view position sizing details
- Default Page Size: 50 trades
- Page Size Options: 25, 50, 100, 200
- Navigation: First, Previous, Next, Last buttons
- Page Input: Direct page number entry
Auto-Refresh
- Interval: 30 seconds
- Behavior: Refreshes trade list automatically
- Note: Only refreshes if user is on page 1 to avoid blinking