"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(grounding): keep scalar contributions outside keyed instrument maps
Haozhe Wu29124ef7f784
diff --git a/agent/src/agent/grounding/evidence.py b/agent/src/agent/grounding/evidence.pyindex 2e6fd0c85..a5a509d65 100644--- a/agent/src/agent/grounding/evidence.py+++ b/agent/src/agent/grounding/evidence.py@@ -772,7 +772,7 @@ class _EvidenceMixin:parent_kind = _ANALYSIS_KIND_ALIASES.get(key_text.casefold())child_metric_map = (parent_kind- if parent_kind in {"contribution", "correlation"}+ if isinstance(child, dict) and parent_kind in {"contribution", "correlation"}else metric_map)child_symbol = keyed_symboldiff --git a/agent/tests/test_grounding_keyed_metric_paths.py b/agent/tests/test_grounding_keyed_metric_paths.pyindex f574530ed..66f9811f4 100644--- a/agent/tests/test_grounding_keyed_metric_paths.py+++ b/agent/tests/test_grounding_keyed_metric_paths.py@@ -55,6 +55,13 @@ def test_contribution_map_keeps_exact_instrument_identity(tmp_path, key, symbol)assert ledger._metric_pool("MSFT.US") == []+def test_scalar_contribution_is_not_reclassified_as_an_instrument_map(tmp_path):+ ledger = _ledger(tmp_path, {"contribution_pct": 0.125})+ (entry,) = ledger._analysis_metrics+ assert entry["instrument_scoped"] is False+ assert ledger._metric_pool("AAPL.US") == [0.125]++def test_correlation_matrix_cells_have_two_axes_and_no_single_symbol(tmp_path):ledger = _ledger(tmp_path,