Implement signal quality scoring system
- Updated execute endpoint to store context metrics in database - Updated CreateTradeParams interface with 5 context metrics - Updated Prisma schema with rsiAtEntry and pricePositionAtEntry - Ran migration: add_rsi_and_price_position_metrics - Complete flow: TradingView → n8n → check-risk (scores) → execute (stores)
This commit is contained in:
@@ -19,6 +19,12 @@ export interface ExecuteTradeRequest {
|
||||
timeframe: string // e.g., '5'
|
||||
signalStrength?: 'strong' | 'moderate' | 'weak'
|
||||
signalPrice?: number
|
||||
// Context metrics from TradingView
|
||||
atr?: number
|
||||
adx?: number
|
||||
rsi?: number
|
||||
volumeRatio?: number
|
||||
pricePosition?: number
|
||||
}
|
||||
|
||||
export interface ExecuteTradeResponse {
|
||||
@@ -360,6 +366,12 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
|
||||
// Market context
|
||||
expectedEntryPrice,
|
||||
fundingRateAtEntry,
|
||||
// Context metrics from TradingView
|
||||
atrAtEntry: body.atr,
|
||||
adxAtEntry: body.adx,
|
||||
rsiAtEntry: body.rsi,
|
||||
volumeAtEntry: body.volumeRatio,
|
||||
pricePositionAtEntry: body.pricePosition,
|
||||
})
|
||||
|
||||
console.log('💾 Trade saved to database')
|
||||
|
||||
Reference in New Issue
Block a user