vn6295337 Claude Opus 4.5 commited on
Commit
7b2e271
·
1 Parent(s): fb7f46b

Add output format documentation to metrics schema

Browse files

Documents the JSON output structure for:
- Aggregated response from fetch_all_research_data
- Individual MCP outputs (fundamentals, valuation, volatility, macro, news, sentiment)
- Streamed partial_metrics format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

.obsidian/workspace.json CHANGED
@@ -13,12 +13,12 @@
13
  "state": {
14
  "type": "markdown",
15
  "state": {
16
- "file": "docs/mcp_raw_visa.md",
17
  "mode": "source",
18
  "source": false
19
  },
20
  "icon": "lucide-file",
21
- "title": "mcp_raw_visa"
22
  }
23
  }
24
  ]
@@ -185,11 +185,12 @@
185
  },
186
  "active": "369b0d31e1527f56",
187
  "lastOpenFiles": [
 
 
 
188
  "app.py.tmp.1610.1768146282892",
189
  "mcp-servers/volatility-basket/server.py.tmp.1610.1768144883587",
190
  "__pycache__/mcp_client.cpython-311.pyc.140529827342128",
191
- "docs/mcp_test_report_KO.md",
192
- "docs/metrics_schema_human_readable.md",
193
  "docs/metrics_schema_emitted.md",
194
  "docs/schema_normalization.md",
195
  "mcp_client.py.tmp.1610.1768140230378",
@@ -199,8 +200,6 @@
199
  "mcp_client.py.tmp.1610.1768140165633",
200
  "mcp_client.py.tmp.1610.1768140149514",
201
  "mcp_client.py.tmp.1610.1768140127411",
202
- "mcp_client.py.tmp.1610.1768140120176",
203
- "docs/mcp_raw_visa.md",
204
  "docs/alphavantage_data_schema.md",
205
  "docs/mcp_data_sources.md",
206
  "docs/mcp_normalized_schemas.md",
 
13
  "state": {
14
  "type": "markdown",
15
  "state": {
16
+ "file": "docs/metrics_schema_human_readable.md",
17
  "mode": "source",
18
  "source": false
19
  },
20
  "icon": "lucide-file",
21
+ "title": "metrics_schema_human_readable"
22
  }
23
  }
24
  ]
 
185
  },
186
  "active": "369b0d31e1527f56",
187
  "lastOpenFiles": [
188
+ "docs/mcp_test_report_KO.md",
189
+ "docs/metrics_schema_human_readable.md",
190
+ "docs/mcp_raw_visa.md",
191
  "app.py.tmp.1610.1768146282892",
192
  "mcp-servers/volatility-basket/server.py.tmp.1610.1768144883587",
193
  "__pycache__/mcp_client.cpython-311.pyc.140529827342128",
 
 
194
  "docs/metrics_schema_emitted.md",
195
  "docs/schema_normalization.md",
196
  "mcp_client.py.tmp.1610.1768140230378",
 
200
  "mcp_client.py.tmp.1610.1768140165633",
201
  "mcp_client.py.tmp.1610.1768140149514",
202
  "mcp_client.py.tmp.1610.1768140127411",
 
 
203
  "docs/alphavantage_data_schema.md",
204
  "docs/mcp_data_sources.md",
205
  "docs/mcp_normalized_schemas.md",
docs/metrics_schema_human_readable.md CHANGED
@@ -178,3 +178,227 @@ Standardized output schema for financial data across ALL industries (banks, cons
178
  | `mcp-servers/volatility-basket/server.py` | Both | get_all_sources_volatility() |
179
  | `mcp-servers/macro-basket/server.py` | Both | get_all_sources_macro() |
180
  | `tests/test_mcp_e2e.py` | Test | E2E validation with expected counts |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  | `mcp-servers/volatility-basket/server.py` | Both | get_all_sources_volatility() |
179
  | `mcp-servers/macro-basket/server.py` | Both | get_all_sources_macro() |
180
  | `tests/test_mcp_e2e.py` | Test | E2E validation with expected counts |
181
+
182
+ ---
183
+
184
+ ## Output Format
185
+
186
+ ### Aggregated Response (from `fetch_all_research_data`)
187
+
188
+ ```json
189
+ {
190
+ "ticker": "AAPL",
191
+ "company_name": "Apple Inc.",
192
+ "sources_available": ["fundamentals", "valuation", "volatility", "macro", "news", "sentiment"],
193
+ "sources_failed": [],
194
+ "metrics": {
195
+ "fundamentals": { ... },
196
+ "valuation": { ... },
197
+ "volatility": { ... },
198
+ "macro": { ... },
199
+ "news": { ... },
200
+ "sentiment": { ... }
201
+ },
202
+ "multi_source": {
203
+ "fundamentals_all": { ... },
204
+ "valuation_all": { ... },
205
+ "macro_all": { ... },
206
+ "volatility_all": { ... }
207
+ },
208
+ "conflict_resolution": { ... },
209
+ "aggregated_swot": { ... },
210
+ "completeness": {
211
+ "completeness_pct": 85.0,
212
+ "metrics_found": 17,
213
+ "metrics_total": 20,
214
+ "missing": { ... }
215
+ },
216
+ "generated_at": "2025-01-11T21:00:00"
217
+ }
218
+ ```
219
+
220
+ ---
221
+
222
+ ### Fundamentals Output
223
+
224
+ ```json
225
+ {
226
+ "sec_edgar": {
227
+ "source": "SEC EDGAR XBRL",
228
+ "data": {
229
+ "revenue": {"value": 383285000000, "end_date": "2024-09-28", "fiscal_year": 2024, "form": "10-K"},
230
+ "net_income": {"value": 93736000000, "end_date": "2024-09-28", "fiscal_year": 2024, "form": "10-K"},
231
+ "net_margin_pct": {"value": 24.45, "end_date": "2024-09-28", "fiscal_year": 2024, "form": "10-K"},
232
+ "total_assets": {"value": 364980000000},
233
+ "total_liabilities": {"value": 308030000000},
234
+ "stockholders_equity": {"value": 56950000000}
235
+ }
236
+ },
237
+ "yahoo_finance": {
238
+ "source": "Yahoo Finance",
239
+ "data": {
240
+ "operating_margin_pct": 30.74,
241
+ "total_debt": 106629000000,
242
+ "operating_cash_flow": 118254000000,
243
+ "free_cash_flow": 111443000000
244
+ }
245
+ }
246
+ }
247
+ ```
248
+
249
+ ---
250
+
251
+ ### Valuation Output
252
+
253
+ ```json
254
+ {
255
+ "yahoo_finance": {
256
+ "source": "Yahoo Finance",
257
+ "data": {
258
+ "current_price": 229.87,
259
+ "market_cap": 3480000000000,
260
+ "enterprise_value": 3580000000000,
261
+ "trailing_pe": 37.12,
262
+ "forward_pe": 31.45,
263
+ "ps_ratio": 9.08,
264
+ "pb_ratio": 61.11,
265
+ "trailing_peg": 2.89,
266
+ "forward_peg": 2.15,
267
+ "earnings_growth": 0.1047,
268
+ "revenue_growth": 0.0204
269
+ }
270
+ },
271
+ "alpha_vantage": {
272
+ "source": "Alpha Vantage",
273
+ "data": { ... }
274
+ }
275
+ }
276
+ ```
277
+
278
+ ---
279
+
280
+ ### Volatility Output
281
+
282
+ ```json
283
+ {
284
+ "yahoo_finance": {
285
+ "source": "Yahoo Finance",
286
+ "data": {
287
+ "beta": {"value": 1.24},
288
+ "historical_volatility": {"value": 22.5},
289
+ "implied_volatility": {"value": null}
290
+ }
291
+ },
292
+ "market_volatility_context": {
293
+ "vix": {"value": 15.45, "date": "2025-01-10"},
294
+ "vxn": {"value": 18.32, "date": "2025-01-10"}
295
+ }
296
+ }
297
+ ```
298
+
299
+ ---
300
+
301
+ ### Macro Output
302
+
303
+ ```json
304
+ {
305
+ "bea_bls": {
306
+ "source": "BEA/BLS",
307
+ "data": {
308
+ "gdp_growth": {"value": 4.30, "date": "2024-09-01"},
309
+ "cpi_inflation": {"value": 2.74, "date": "2024-12-01"},
310
+ "unemployment": {"value": 4.40, "date": "2024-12-01"}
311
+ }
312
+ },
313
+ "fred": {
314
+ "source": "FRED",
315
+ "data": {
316
+ "interest_rate": {"value": 3.72, "date": "2025-01-09"}
317
+ }
318
+ }
319
+ }
320
+ ```
321
+
322
+ ---
323
+
324
+ ### News Output
325
+
326
+ ```json
327
+ {
328
+ "group": "content_analysis",
329
+ "ticker": "AAPL",
330
+ "items": [
331
+ {
332
+ "title": "Apple Reports Record Q4 Earnings",
333
+ "content": "Apple Inc. reported...",
334
+ "url": "https://...",
335
+ "datetime": "2025-01-10",
336
+ "source": "Tavily"
337
+ }
338
+ ],
339
+ "item_count": 10,
340
+ "sources_used": ["Tavily", "NYT", "NewsAPI"],
341
+ "source": "news-basket",
342
+ "as_of": "2025-01-11"
343
+ }
344
+ ```
345
+
346
+ ---
347
+
348
+ ### Sentiment Output
349
+
350
+ ```json
351
+ {
352
+ "group": "content_analysis",
353
+ "ticker": "AAPL",
354
+ "items": [
355
+ {
356
+ "title": "AAPL to the moon!",
357
+ "content": "Just loaded up on more shares...",
358
+ "url": "https://reddit.com/r/wallstreetbets/...",
359
+ "datetime": "2025-01-10",
360
+ "source": "Reddit",
361
+ "subreddit": "r/wallstreetbets"
362
+ },
363
+ {
364
+ "title": "Apple Announces New Product Line",
365
+ "content": "Apple Inc. unveiled...",
366
+ "url": "https://finnhub.io/...",
367
+ "datetime": "2025-01-09",
368
+ "source": "Finnhub",
369
+ "subreddit": null
370
+ }
371
+ ],
372
+ "item_count": 15,
373
+ "sources_used": ["Finnhub", "Reddit"],
374
+ "source": "sentiment-basket",
375
+ "as_of": "2025-01-11"
376
+ }
377
+ ```
378
+
379
+ ---
380
+
381
+ ### Streamed Metrics (partial_metrics)
382
+
383
+ During task execution, metrics are streamed as:
384
+
385
+ ```json
386
+ {
387
+ "source": "fundamentals",
388
+ "metric": "revenue",
389
+ "value": 383285000000,
390
+ "timestamp": "2025-01-11T21:00:01",
391
+ "end_date": "2024-09-28",
392
+ "fiscal_year": 2024,
393
+ "form": "10-K"
394
+ }
395
+ ```
396
+
397
+ | Source | Metrics Streamed |
398
+ |--------|------------------|
399
+ | fundamentals | `revenue`, `net_margin` |
400
+ | valuation | `P/E`, `P/B`, `P/S`, `EV/EBITDA` |
401
+ | volatility | `VIX`, `beta`, `hist_vol` |
402
+ | macro | `GDP_growth`, `interest_rate`, `inflation`, `unemployment` |
403
+ | news | `items_found` (count) |
404
+ | sentiment | `items_found` (count) |