fix: Enable virtual trading & AI learning - UI improvements and setup guide
- Add comprehensive setup guide (VIRTUAL_TRADING_SETUP_GUIDE.md) - Improve UI to clearly show required steps for AI learning - Make auto-execute toggle always visible with clear instructions - Add blue info panel explaining the learning setup process - User can now easily enable: Continuous Learning + Auto-Execute - Virtual trades will execute automatically and AI will learn from outcomes Resolves issue: AI analyzing without learning due to missing virtual trade execution
This commit is contained in:
@@ -11,17 +11,44 @@ export async function GET() {
|
||||
// Get total learning records
|
||||
const totalLearningRecords = await prisma.ai_learning_data.count()
|
||||
|
||||
// Get decisions and outcomes separately
|
||||
const decisions = await prisma.ai_learning_data.findMany({
|
||||
// Get total count of all decisions (separate from limited query)
|
||||
const totalDecisions = await prisma.ai_learning_data.count({
|
||||
where: {
|
||||
analysisData: {
|
||||
string_contains: 'STOP_LOSS_DECISION'
|
||||
}
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: 100 // Last 100 decisions for analysis
|
||||
OR: [
|
||||
{
|
||||
analysisData: {
|
||||
string_contains: 'STOP_LOSS_DECISION'
|
||||
}
|
||||
},
|
||||
{
|
||||
analysisData: {
|
||||
string_contains: 'ANALYSIS_DECISION'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
// Get decisions including both stop loss decisions and analysis decisions (limited for analysis)
|
||||
const decisions = await prisma.ai_learning_data.findMany({
|
||||
where: {
|
||||
OR: [
|
||||
{
|
||||
analysisData: {
|
||||
string_contains: 'STOP_LOSS_DECISION'
|
||||
}
|
||||
},
|
||||
{
|
||||
analysisData: {
|
||||
string_contains: 'ANALYSIS_DECISION'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: 200 // Last 200 decisions for analysis (increased for more data)
|
||||
})
|
||||
|
||||
const outcomes = await prisma.ai_learning_data.findMany({
|
||||
where: {
|
||||
analysisData: {
|
||||
@@ -33,10 +60,7 @@ export async function GET() {
|
||||
})
|
||||
|
||||
// Calculate real statistics
|
||||
const totalDecisions = decisions.length
|
||||
const totalOutcomes = outcomes.length
|
||||
|
||||
// Calculate success rate from outcomes
|
||||
const totalOutcomes = outcomes.length // Calculate success rate from outcomes
|
||||
let successfulOutcomes = 0
|
||||
outcomes.forEach(outcome => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user