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>
22 lines
983 B
TypeScript
22 lines
983 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { normalizeSymbol } from "../src/agent/symbols";
|
|
|
|
describe("normalizeSymbol", () => {
|
|
it.each([
|
|
["600519", { symbol: "600519", market: "CN", display: "600519.SS" }],
|
|
["000001.SZ", { symbol: "000001", market: "CN", display: "000001.SZ" }],
|
|
["512480", { symbol: "512480", market: "CN", display: "512480.SS" }],
|
|
["512480.SZ", { symbol: "512480", market: "CN", display: "512480.SS" }],
|
|
["00700.hk", { symbol: "00700", market: "HK", display: "00700.HK" }],
|
|
["AAPL", { symbol: "AAPL", market: "US", display: "AAPL" }],
|
|
["msft.us", { symbol: "MSFT", market: "US", display: "MSFT" }]
|
|
])("normalizes %s", (input, expected) => {
|
|
expect(normalizeSymbol(input)).toEqual(expected);
|
|
});
|
|
|
|
it("rejects empty and unsupported symbols", () => {
|
|
expect(() => normalizeSymbol("")).toThrow("Stock symbol is required");
|
|
expect(() => normalizeSymbol("!!!")).toThrow("Unsupported stock symbol");
|
|
});
|
|
});
|