Compare commits
3 Commits
abf982d645
...
6b7082eef3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b7082eef3 | ||
|
|
7f9dcc00e2 | ||
|
|
2c6295367c |
7
.github/copilot-instructions.md
vendored
7
.github/copilot-instructions.md
vendored
@@ -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)
|
||||
|
||||
@@ -27,6 +27,7 @@ export interface ExecuteTradeRequest {
|
||||
rsi?: number
|
||||
volumeRatio?: number
|
||||
pricePosition?: number
|
||||
indicatorVersion?: string // Pine Script version (v5, v6, etc.)
|
||||
}
|
||||
|
||||
export interface ExecuteTradeResponse {
|
||||
@@ -357,6 +358,7 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
|
||||
volumeAtEntry: body.volumeRatio,
|
||||
pricePositionAtEntry: body.pricePosition,
|
||||
signalQualityScore: qualityResult.score,
|
||||
indicatorVersion: body.indicatorVersion || 'v5', // Default to v5 for backward compatibility
|
||||
// Phantom-specific fields
|
||||
status: 'phantom',
|
||||
isPhantom: true,
|
||||
@@ -576,6 +578,7 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
|
||||
volumeAtEntry: body.volumeRatio,
|
||||
pricePositionAtEntry: body.pricePosition,
|
||||
signalQualityScore: qualityResult.score,
|
||||
indicatorVersion: body.indicatorVersion || 'v5', // Default to v5 for backward compatibility
|
||||
})
|
||||
|
||||
console.log(`💾 Trade saved with quality score: ${qualityResult.score}/100`)
|
||||
|
||||
@@ -52,6 +52,7 @@ export interface CreateTradeParams {
|
||||
volumeAtEntry?: number
|
||||
pricePositionAtEntry?: number
|
||||
signalQualityScore?: number
|
||||
indicatorVersion?: string // TradingView Pine Script version (v5, v6, etc.)
|
||||
// Phantom trade fields
|
||||
status?: string
|
||||
isPhantom?: boolean
|
||||
@@ -143,6 +144,7 @@ export async function createTrade(params: CreateTradeParams) {
|
||||
volumeAtEntry: params.volumeAtEntry,
|
||||
pricePositionAtEntry: params.pricePositionAtEntry,
|
||||
signalQualityScore: params.signalQualityScore,
|
||||
indicatorVersion: params.indicatorVersion,
|
||||
// Phantom trade fields
|
||||
isPhantom: params.isPhantom || false,
|
||||
expectedSizeUSD: params.expectedSizeUSD,
|
||||
|
||||
Reference in New Issue
Block a user