feat: integrate real AI learning system with dashboard

- Updated AI learning status API to use real database data
- Fixed Prisma JSON search queries for decisions and outcomes
- Updated frontend component to display real learning metrics
- Added AI learning influence to trading decision logic
- Learning system now actively modifies confidence thresholds
- Dashboard shows: 9,413 analyses, pattern recognition phase, 50% confidence

The AI learning system is now fully integrated and actively improving trading decisions based on 4,197 historical decisions.
This commit is contained in:
mindesbunister
2025-07-28 14:12:22 +02:00
parent 1b9881a706
commit 0033ce1b13
6 changed files with 262 additions and 135 deletions

View File

@@ -158,7 +158,7 @@ class SimplifiedStopLossLearner {
where: {
symbol: symbol,
analysisData: {
string_contains: '"type":"STOP_LOSS_DECISION"'
string_contains: 'STOP_LOSS_DECISION'
}
},
orderBy: { createdAt: 'desc' },
@@ -286,7 +286,7 @@ class SimplifiedStopLossLearner {
const outcomes = await prisma.ai_learning_data.findMany({
where: {
analysisData: {
string_contains: '"type":"STOP_LOSS_OUTCOME"'
string_contains: 'STOP_LOSS_OUTCOME'
}
}
});
@@ -326,7 +326,7 @@ class SimplifiedStopLossLearner {
const decisions = await prisma.ai_learning_data.findMany({
where: {
analysisData: {
string_contains: '"type":"STOP_LOSS_DECISION"'
string_contains: 'STOP_LOSS_DECISION'
},
createdAt: {
gte: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) // Last 7 days
@@ -338,7 +338,7 @@ class SimplifiedStopLossLearner {
const outcomes = await prisma.ai_learning_data.findMany({
where: {
analysisData: {
string_contains: '"type":"STOP_LOSS_OUTCOME"'
string_contains: 'STOP_LOSS_OUTCOME'
},
createdAt: {
gte: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) // Last 7 days
@@ -377,7 +377,7 @@ class SimplifiedStopLossLearner {
const totalDecisions = await prisma.ai_learning_data.count({
where: {
analysisData: {
string_contains: '"type":"STOP_LOSS_DECISION"'
string_contains: 'STOP_LOSS_DECISION'
}
}
});
@@ -385,7 +385,7 @@ class SimplifiedStopLossLearner {
const recentDecisions = await prisma.ai_learning_data.count({
where: {
analysisData: {
string_contains: '"type":"STOP_LOSS_DECISION"'
string_contains: 'STOP_LOSS_DECISION'
},
createdAt: {
gte: new Date(Date.now() - 24 * 60 * 60 * 1000) // Last 24 hours