docs: add Common Pitfall #21 for CreateTradeParams interface sync

This commit is contained in:
mindesbunister
2025-11-12 10:02:05 +01:00
parent 7f9dcc00e2
commit 6b7082eef3

View File

@@ -674,6 +674,13 @@ trade.realizedPnL += actualRealizedPnL // NOT: result.realizedPnL from SDK
- **ActiveTrade interface:** Must include `atrAtEntry?: number` field for calculation
- See `ATR_TRAILING_STOP_FIX.md` for full details and database analysis
21. **CreateTradeParams interface sync:** When adding new database fields to Trade model, MUST update `CreateTradeParams` interface in `lib/database/trades.ts`:
- Interface defines what parameters `createTrade()` accepts
- Must add new field to interface (e.g., `indicatorVersion?: string`)
- Must add field to Prisma create data object in `createTrade()` function
- TypeScript build will fail if endpoint passes field not in interface
- Example: indicatorVersion tracking required 3-file update (execute route.ts, CreateTradeParams interface, createTrade function)
## File Conventions
- **API routes:** `app/api/[feature]/[action]/route.ts` (Next.js 15 App Router)