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:
92
test-ai-learning-recording.js
Normal file
92
test-ai-learning-recording.js
Normal file
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Test script to verify AI learning decision recording
|
||||
*/
|
||||
|
||||
const { getDB } = require('./lib/db.js')
|
||||
|
||||
async function testLearningRecording() {
|
||||
try {
|
||||
console.log('🧪 Testing AI learning decision recording...')
|
||||
|
||||
const prisma = getDB()
|
||||
|
||||
// Get current count
|
||||
const currentCount = await prisma.ai_learning_data.count({
|
||||
where: {
|
||||
OR: [
|
||||
{
|
||||
analysisData: {
|
||||
string_contains: 'STOP_LOSS_DECISION'
|
||||
}
|
||||
},
|
||||
{
|
||||
analysisData: {
|
||||
string_contains: 'ANALYSIS_DECISION'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
console.log(`📊 Current total decisions: ${currentCount}`)
|
||||
|
||||
// Record a new test decision
|
||||
const decisionData = {
|
||||
type: 'ANALYSIS_DECISION',
|
||||
symbol: 'SOLUSD',
|
||||
timeframe: '60',
|
||||
recommendation: 'BUY',
|
||||
confidence: 85,
|
||||
reasoning: 'Test analysis decision for continuous learning',
|
||||
marketSentiment: 'BULLISH',
|
||||
timestamp: new Date().toISOString()
|
||||
}
|
||||
|
||||
const record = await prisma.ai_learning_data.create({
|
||||
data: {
|
||||
id: `test_analysis_decision_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
||||
userId: 'continuous-learning-test',
|
||||
symbol: 'SOLUSD',
|
||||
timeframe: '60',
|
||||
analysisData: JSON.stringify(decisionData),
|
||||
marketConditions: JSON.stringify({
|
||||
sentiment: 'BULLISH',
|
||||
confidence: 85,
|
||||
recommendation: 'BUY'
|
||||
}),
|
||||
confidenceScore: 85
|
||||
}
|
||||
})
|
||||
|
||||
console.log(`✅ Test decision recorded: ${record.id}`)
|
||||
|
||||
// Check new count
|
||||
const newCount = await prisma.ai_learning_data.count({
|
||||
where: {
|
||||
OR: [
|
||||
{
|
||||
analysisData: {
|
||||
string_contains: 'STOP_LOSS_DECISION'
|
||||
}
|
||||
},
|
||||
{
|
||||
analysisData: {
|
||||
string_contains: 'ANALYSIS_DECISION'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
console.log(`📊 New total decisions: ${newCount}`)
|
||||
console.log(`📈 Increase: ${newCount - currentCount}`)
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Error testing AI learning recording:', error.message)
|
||||
console.error('❌ Stack trace:', error.stack)
|
||||
}
|
||||
}
|
||||
|
||||
testLearningRecording()
|
||||
Reference in New Issue
Block a user