feat(data): extend market data provider with charts, fundamentals, and quant analysis

Adds a stock data cache layer and indicator helpers (MA/RSI/MACD), expands
the MarketDataProvider interface with candles, fundamentals, related-data,
and quant analysis, and threads tags + source attribution through the
shared types. Updates affected agent tests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 23:20:42 +08:00
parent 30f6cd84a8
commit a4a2cb2ccf
12 changed files with 2187 additions and 32 deletions

View File

@@ -9,6 +9,7 @@ const watchlist: WatchStock[] = [
display: "AAPL",
market: "US",
name: "Apple",
tags: ["core"],
addedAt: "2026-05-11T00:00:00.000Z"
},
{
@@ -17,6 +18,7 @@ const watchlist: WatchStock[] = [
display: "00700.HK",
market: "HK",
name: "Tencent",
tags: ["internet"],
addedAt: "2026-05-11T00:00:00.000Z"
}
];
@@ -51,6 +53,44 @@ const provider: MarketDataProvider = {
peers: [{ display: "9988.HK", pe: 18 }],
news: []
};
},
async candles() {
return [];
},
async fundamentals() {
return [];
},
async relatedData() {
return {
sector: "Technology",
avgVolume20: 1_000_000,
volumeRatio: 1,
volatility20: 0.02,
drawdownFromHigh: 0.1,
relativeStrength60: 0.04,
support: 90,
resistance: 120,
capitalFlow: 0.1,
sentimentScore: 0.6,
newsHeat: 0.5,
riskFlags: [],
sources: []
};
},
async quantAnalysis() {
return {
action: "hold",
score: 55,
confidence: 0.5,
horizon: "1-3 months",
summary: "Hold",
factors: [
{ name: "trend", score: 55, weight: 1, evidence: "neutral" },
{ name: "valuation", score: 55, weight: 0, evidence: "neutral" },
{ name: "risk", score: 55, weight: 0, evidence: "neutral" }
],
riskNotes: []
};
}
};