Merge pull request #231 from multica-ai/fix/remove-broken-finance-actions

fix(data): remove broken finance actions
This commit is contained in:
LinYushen 2026-02-27 13:15:19 +08:00 committed by GitHub
commit 3f589d8326
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 20 additions and 68 deletions

View file

@ -29,8 +29,8 @@ describe("inferRunLogToolIsError", () => {
expect(
inferRunLogToolIsError(
false,
"{\"domain\":\"finance\",\"action\":\"get_price_snapshot\"}",
{ domain: "finance", action: "get_price_snapshot" },
"{\"domain\":\"finance\",\"action\":\"get_financial_metrics\"}",
{ domain: "finance", action: "get_financial_metrics" },
),
).toBe(false);
});

View file

@ -27,7 +27,7 @@
* - `tool_end` Tool execution completes.
* Fields: tool (name), duration_ms, is_error, result_chars, result_summary?, error_type?
* result_chars: total character count of result content (survives session compaction)
* result_summary: short tool-specific summary (e.g. "10 results", "12.5KB", "finance/get_price_snapshot")
* result_summary: short tool-specific summary (e.g. "10 results", "12.5KB", "finance/get_financial_metrics")
* error_type: error category when tool returned an error (e.g. "fetch_failed", "ssrf_blocked")
*
* ### Context Management Preflight (before LLM call)

View file

@ -21,8 +21,6 @@ const DataToolSchema = Type.Object({
"Action to perform within the domain.\n\n" +
"FINANCE DOMAIN ACTIONS:\n" +
"Prices:\n" +
" get_price_snapshot — params: { ticker }\n" +
" get_prices — params: { ticker, start_date, end_date, interval?, interval_multiplier? }\n" +
" get_crypto_price_snapshot — params: { ticker } (e.g. BTC-USD)\n" +
" get_crypto_prices — params: { ticker, start_date, end_date, interval?, interval_multiplier? }\n" +
" get_available_crypto_tickers — params: {}\n" +
@ -32,7 +30,6 @@ const DataToolSchema = Type.Object({
" get_cash_flow_statements — same params\n" +
" get_all_financial_statements — same params (returns all three)\n" +
"Metrics:\n" +
" get_financial_metrics_snapshot — params: { ticker }\n" +
" get_financial_metrics — params: { ticker, period?, limit?, report_period*? }\n" +
" get_analyst_estimates — params: { ticker, period? }\n" +
"Company:\n" +

View file

@ -66,30 +66,6 @@ type ActionHandler = (params: Params, signal?: AbortSignal) => Promise<FinanceAc
const handlers: Record<FinanceAction, ActionHandler> = {
// ── Prices ──────────────────────────────────────────────────────────────
get_price_snapshot: async (params, signal) => {
const ticker = requireParam(params, "ticker");
const { data, url } = await financeFetch("/prices/snapshot", { ticker }, signal);
return { data: (data as Record<string, unknown>).snapshot ?? data, sourceUrl: url };
},
get_prices: async (params, signal) => {
const ticker = requireParam(params, "ticker");
const start_date = requireParam(params, "start_date");
const end_date = requireParam(params, "end_date");
const { data, url } = await financeFetch(
"/prices",
{
ticker,
start_date,
end_date,
interval: optionalString(params, "interval") ?? "day",
interval_multiplier: optionalNumber(params, "interval_multiplier"),
},
signal,
);
return { data: (data as Record<string, unknown>).prices ?? data, sourceUrl: url };
},
get_crypto_price_snapshot: async (params, signal) => {
const ticker = requireParam(params, "ticker");
const { data, url } = await financeFetch("/crypto/prices/snapshot", { ticker }, signal);
@ -147,12 +123,6 @@ const handlers: Record<FinanceAction, ActionHandler> = {
// ── Metrics & estimates ─────────────────────────────────────────────────
get_financial_metrics_snapshot: async (params, signal) => {
const ticker = requireParam(params, "ticker");
const { data, url } = await financeFetch("/financial-metrics/snapshot", { ticker }, signal);
return { data: (data as Record<string, unknown>).snapshot ?? data, sourceUrl: url };
},
get_financial_metrics: async (params, signal) => {
const ticker = requireParam(params, "ticker");
const { data, url } = await financeFetch(

View file

@ -5,8 +5,6 @@
/** All supported finance actions */
export const FINANCE_ACTIONS = [
// Price data
"get_price_snapshot",
"get_prices",
"get_crypto_price_snapshot",
"get_crypto_prices",
"get_available_crypto_tickers",
@ -16,7 +14,6 @@ export const FINANCE_ACTIONS = [
"get_cash_flow_statements",
"get_all_financial_statements",
// Metrics & estimates
"get_financial_metrics_snapshot",
"get_financial_metrics",
"get_analyst_estimates",
// Company info

View file

@ -58,8 +58,8 @@ Use `data` tool with `domain="finance"` for all calls:
4. **Financial Metrics** (current):
```
action: "get_financial_metrics_snapshot"
params: { ticker: "[TICKER]" }
action: "get_financial_metrics"
params: { ticker: "[TICKER]", period: "quarterly", limit: 1 }
```
Extract: `market_cap`, `enterprise_value`, `return_on_invested_capital`, `debt_to_equity`, `free_cash_flow_per_share`
@ -70,19 +70,18 @@ Use `data` tool with `domain="finance"` for all calls:
```
Extract: Forward EPS estimates for growth validation
6. **Current Price**:
```
action: "get_price_snapshot"
params: { ticker: "[TICKER]" }
```
7. **Company Facts**:
6. **Company Facts**:
```
action: "get_company_facts"
params: { ticker: "[TICKER]" }
```
Extract: `sector` — use to determine WACC range from [sector-wacc.md](references/sector-wacc.md)
7. **Current Price** (use web search):
```
web_search("[TICKER] stock price today")
```
8. **Recent Event Context**:
- Pull company-specific headlines with:
```

View file

@ -64,8 +64,8 @@ Use `data` tool with `domain="finance"` for all structured data calls.
3. **Current financial metrics**:
```
action: "get_financial_metrics_snapshot"
params: { ticker: "[TICKER]" }
action: "get_financial_metrics"
params: { ticker: "[TICKER]", period: "quarterly", limit: 1 }
```
4. **Company facts**:
@ -75,13 +75,7 @@ Use `data` tool with `domain="finance"` for all structured data calls.
```
Extract: `sector`, `industry` — needed for benchmark comparisons in later steps.
5. **Current stock price**:
```
action: "get_price_snapshot"
params: { ticker: "[TICKER]" }
```
6. **Recent news**:
5. **Recent news**:
```
action: "get_news"
params: { ticker: "[TICKER]", limit: 10 }
@ -349,8 +343,8 @@ Pull and analyze the most recent annual or quarterly filing:
2. **Pull peer data** (for each peer):
```
action: "get_financial_metrics_snapshot"
params: { ticker: "[PEER_TICKER]" }
action: "get_financial_metrics"
params: { ticker: "[PEER_TICKER]", period: "quarterly", limit: 1 }
```
```
action: "get_income_statements"

View file

@ -22,11 +22,8 @@ You are conducting financial research with an analyst-grade standard. Tool usage
### Available Data Actions
#### Price Data
- `get_price_snapshot` — Current stock price. Params: `{ ticker }`
- `get_prices` — Historical OHLCV prices. Params: `{ ticker, start_date, end_date, interval?, interval_multiplier? }`
- interval: "day" (default), "week", "month", "year"
- `get_crypto_price_snapshot` — Current crypto price. Params: `{ ticker }` (e.g. "BTC-USD")
- `get_crypto_prices` — Historical crypto prices. Same params as get_prices.
- `get_crypto_prices` — Historical crypto prices. Params: `{ ticker, start_date, end_date, interval?, interval_multiplier? }`
- `get_available_crypto_tickers` — List available crypto tickers. Params: `{}`
#### Financial Statements
@ -41,7 +38,6 @@ Actions:
- `get_all_financial_statements` — All three at once (more efficient when you need multiple)
#### Metrics & Estimates
- `get_financial_metrics_snapshot` — Current key ratios (P/E, market cap, margins, etc.). Params: `{ ticker }`
- `get_financial_metrics` — Historical metrics. Params: `{ ticker, period?, limit?, report_period*? }`
- `get_analyst_estimates` — EPS and revenue estimates. Params: `{ ticker, period? }`
@ -75,7 +71,7 @@ Decision policy:
- State region and analysis horizon (event-driven, 3-6 months, 1-3 years).
2. **Core Company Data (Structured)**
- Start with: `get_price_snapshot`, `get_company_facts`, `get_financial_metrics_snapshot`.
- Start with: `get_company_facts`, `get_financial_metrics`.
- Pull statements (`get_all_financial_statements`) and estimates as needed.
3. **Macro & Policy Context (Conditional)**
@ -121,7 +117,7 @@ Primary-market capability boundary:
When asked about listed equities:
1. **Trend & Positioning**
- Pull 1y price history (`get_prices`) and identify regime (uptrend/range/downtrend) with volatility context.
- Pull 1y price history (`get_crypto_prices` for crypto, or use `web_search` for stock prices) and identify regime (uptrend/range/downtrend) with volatility context.
2. **Fundamentals**
- Analyze growth quality (revenue vs FCF), margin durability, leverage, and capital allocation.
@ -159,8 +155,7 @@ Always include:
For "Analyze Apple's investment outlook":
1. `data(domain="finance", action="get_price_snapshot", params={ticker: "AAPL"})`
2. `data(domain="finance", action="get_company_facts", params={ticker: "AAPL"})`
1. `data(domain="finance", action="get_company_facts", params={ticker: "AAPL"})`
3. `data(domain="finance", action="get_all_financial_statements", params={ticker: "AAPL", period: "annual", limit: 3})`
4. `data(domain="finance", action="get_financial_metrics", params={ticker: "AAPL", period: "quarterly", limit: 8})`
5. `data(domain="finance", action="get_analyst_estimates", params={ticker: "AAPL", period: "annual"})`