Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(grounding): add Argentina listing identity

Lanre Shittuac8cb2e88342
diff --git a/agent/src/agent/grounding/identity.py b/agent/src/agent/grounding/identity.py
index 6e3e1eae1..30f70bbf5 100644
--- a/agent/src/agent/grounding/identity.py
+++ b/agent/src/agent/grounding/identity.py
@@ -122,7 +122,7 @@ _CANONICAL_SYMBOL_RE = re.compile(
# match turns any "…/us.reuters/…" host inside a source URL into the
# symbol REUTERS.US and fails the answer for an unsourced figure.
r"(?-i:US\.[A-Z][A-Z0-9&-]{0,19})|"
- r"[A-Z][A-Z0-9&.-]{0,19}\.(?:US|NS|BO|FX|TO|V)|"
+ r"[A-Z][A-Z0-9&.-]{0,19}\.(?:US|NS|BO|FX|TO|V|BA)|"
r"[A-Z0-9]{2,15}(?:-|/)(?:USDT|USDC|USD|BTC|ETH)|"
r"[A-Z]{2,15}(?:" + "|".join(_JOINED_CRYPTO_QUOTE_SUFFIXES) + r")|"
r"\^[A-Z0-9&.\-]{1,20}|"
@@ -251,6 +251,7 @@ def _infer_venue(symbol: str) -> str | None:
".FX": "forex",
".TO": "toronto",
".V": "tsx_venture",
+ ".BA": "buenos_aires",
}
for suffix, venue in suffixes.items():
if upper.endswith(suffix):
@@ -307,6 +308,7 @@ def _infer_currency(symbol: str) -> str | None:
".BO": "INR",
".TO": "CAD",
".V": "CAD",
+ ".BA": "ARS",
}
for suffix, currency in suffixes.items():
if upper.endswith(suffix):
diff --git a/agent/src/agent/resolution_context.py b/agent/src/agent/resolution_context.py
index b8b0c2fa4..bed57861a 100644
--- a/agent/src/agent/resolution_context.py
+++ b/agent/src/agent/resolution_context.py
@@ -154,6 +154,8 @@ def candidate_market(candidate: Mapping[str, Any]) -> str | None:
return "hk"
if suffix == "US":
return "us"
+ if suffix == "BA":
+ return "ar"
raw = (
str(candidate.get("market") or candidate.get("exchange") or "")
.strip()
@@ -168,6 +170,10 @@ def candidate_market(candidate: Mapping[str, Any]) -> str | None:
"hong kong": "hk",
"us": "us",
"usa": "us",
+ "ar": "ar",
+ "argentina": "ar",
+ "buenos aires": "ar",
+ "bue": "ar",
}.get(raw)
diff --git a/agent/src/tools/symbol_search_tool.py b/agent/src/tools/symbol_search_tool.py
index e409f24dd..61f7089ff 100644
--- a/agent/src/tools/symbol_search_tool.py
+++ b/agent/src/tools/symbol_search_tool.py
@@ -790,6 +790,8 @@ def _from_yahoo_symbol(raw_symbol: str, quote: Dict[str, Any]) -> tuple[str, str
return f"{base.zfill(5)}.HK", "hk"
if upper.endswith((".TO", ".V")):
return upper, "ca"
+ if upper.endswith(".BA"):
+ return upper, "ar"
# Yahoo quotes Shanghai as ``.SS`` where this project (and Eastmoney) use
# ``.SH``. Emitting both spellings published one listing as two rival
# candidates, which the identity gate could not choose between, so every
diff --git a/agent/tests/test_agent_grounding.py b/agent/tests/test_agent_grounding.py
index d90864fb5..e9c17c185 100644
--- a/agent/tests/test_agent_grounding.py
+++ b/agent/tests/test_agent_grounding.py
@@ -305,6 +305,19 @@ def test_market_sensitive_skill_waits_for_prior_identity_batch(
assert skill.calls == 1
+def test_argentina_symbols_have_grounding_identity() -> None:
+ """Buenos Aires symbols retain venue and ARS identity."""
+ assert _scan_symbols("Check GOOGL.BA price") == {"GOOGL.BA"}
+ assert _infer_venue("GGAL.BA") == "buenos_aires"
+ assert _infer_currency("GGAL.BA") == "ARS"
+
+
+def test_argentina_symbol_is_seeded_with_market_identity(tmp_path: Path) -> None:
+ ledger = GroundingLedger(run_dir=tmp_path, user_message="Check GOOGL.BA price")
+
+ assert ledger.authorized_symbols == {"GOOGL.BA"}
+
+
@pytest.mark.parametrize(
("tool_name", "arguments"),
[
diff --git a/agent/tests/test_symbol_search_tool.py b/agent/tests/test_symbol_search_tool.py
index 5e802e140..56203f39f 100644
--- a/agent/tests/test_symbol_search_tool.py
+++ b/agent/tests/test_symbol_search_tool.py
@@ -143,6 +143,18 @@ class TestSymbolSearchSuccess:
assert "BK0001" not in by_symbol
assert data["count"] == len(data["candidates"])
+ def test_argentina_candidate_keeps_market_identity(self):
+ quote = {
+ "symbol": "GGAL.BA",
+ "shortname": "Grupo Financiero Galicia",
+ "exchange": "BUE",
+ "quoteType": "EQUITY",
+ }
+ candidate = ss._yahoo_candidate(quote)
+ assert candidate is not None
+ assert candidate["symbol"] == "GGAL.BA"
+ assert candidate["market"] == "ar"
+
def test_limit_clamped_and_applied(self):
with patch.object(
ss.eastmoney_client, "get_json", return_value=_eastmoney_payload()