"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(profile): label UK/Irish tickers as 'uk' in get_stock_profile
cgycorey179b5a112c80
diff --git a/agent/src/tools/stock_profile_tool.py b/agent/src/tools/stock_profile_tool.pyindex 6240102ae..7b94d3f88 100644--- a/agent/src/tools/stock_profile_tool.py+++ b/agent/src/tools/stock_profile_tool.py@@ -227,7 +227,12 @@ def _resolve_sections(sections: Optional[List[str]]) -> List[str]:def _market_for(ticker: str) -> str:"""Classify a ticker into a coarse market label for the envelope."""- return "hk" if ticker.strip().upper().endswith(".HK") else "us"+ upper = ticker.strip().upper()+ if upper.endswith(".HK"):+ return "hk"+ if upper.endswith((".L", ".IL")):+ return "uk"+ return "us"class StockProfileTool(BaseTool):@@ -235,12 +240,12 @@ class StockProfileTool(BaseTool):name = "get_stock_profile"description = (- "Fetch a read-only company profile for a US or Hong Kong listing from "- "Yahoo Finance: valuation key statistics, analyst price targets and "- "earnings/revenue estimates, institutional and insider ownership, and "- "the analyst recommendation trend. Use this for fundamentals and "- "consensus context, not for OHLCV price bars (use get_market_data). "- 'Example: get_stock_profile(ticker="AAPL.US", '+ "Fetch a read-only company profile for a US, Hong Kong, or UK/Irish "+ "listing from Yahoo Finance: valuation key statistics, analyst price "+ "targets and earnings/revenue estimates, institutional and insider "+ "ownership, and the analyst recommendation trend. Use this for "+ "fundamentals and consensus context, not for OHLCV price bars (use "+ "get_market_data). Example: get_stock_profile(ticker=\"AAPL.US\", "'sections=["key_stats", "financials"]).')parameters = {@@ -249,8 +254,9 @@ class StockProfileTool(BaseTool):"ticker": {"type": "string","description": (- "US or HK symbol. US uses a bare or .US suffix (AAPL or "- "AAPL.US); HK uses a zero-padded .HK code (00700.HK)."+ "US, HK, or UK/Irish symbol. US uses a bare or .US suffix "+ "(AAPL or AAPL.US); HK uses a zero-padded .HK code "+ "(00700.HK); UK/Irish uses .L or .IL (VOD.L)."),},"sections": {diff --git a/agent/tests/test_stock_profile_tool.py b/agent/tests/test_stock_profile_tool.pyindex ea30cb832..f3d478994 100644--- a/agent/tests/test_stock_profile_tool.py+++ b/agent/tests/test_stock_profile_tool.py@@ -177,3 +177,14 @@ class TestStockProfileErrors:assert payload["ok"] is Falseassert "yahoo quoteSummary request failed" in payload["error"]assert "429" in payload["error"]+++def test_uk_ticker_market_label() -> None:+ """VOD.L is served by Yahoo but must not be labeled 'us' (#1206)."""+ from src.tools.stock_profile_tool import _market_for++ assert _market_for("VOD.L") == "uk"+ assert _market_for("DCC.IL") == "uk"+ assert _market_for("AAPL.US") == "us"+ assert _market_for("AAPL") == "us"+ assert _market_for("00700.HK") == "hk"