Skip to content

"Vibe-Trading: Your Personal Trading Agent"

feat(journal-shadow): infer UK market for .L/.IL and map to uk_equity

cgycorey243e3afe5144
diff --git a/agent/src/shadow_account/extractor.py b/agent/src/shadow_account/extractor.py
index 34900099d..16215aa1e 100644
--- a/agent/src/shadow_account/extractor.py
+++ b/agent/src/shadow_account/extractor.py
@@ -55,6 +55,7 @@ _MARKET_KEY_MAP = {
"china_a": "a_share",
"us": "us_equity",
"hk": "hk_equity",
+ "uk": "uk_equity",
"crypto": "crypto",
}
@@ -552,6 +553,7 @@ _MARKET_LABELS = {
"china_a": "China A-share",
"us": "US equity",
"hk": "HK equity",
+ "uk": "UK equity",
"crypto": "Crypto",
"other": "Other",
}
diff --git a/agent/src/tools/trade_journal_parsers.py b/agent/src/tools/trade_journal_parsers.py
index f58cb4a10..140bef687 100644
--- a/agent/src/tools/trade_journal_parsers.py
+++ b/agent/src/tools/trade_journal_parsers.py
@@ -527,6 +527,10 @@ def _infer_market_from_symbol(symbol: str) -> str:
s = symbol.upper()
if s.endswith(".HK"):
return "hk"
+ if s.endswith(".L") or s.endswith(".IL"):
+ # LSE/ISE UK/Irish names (#1206); without this they landed in "other"
+ # and shadow analysis silently degraded to NaN.
+ return "uk"
if s.endswith(".SH") or s.endswith(".SZ") or s.endswith(".BJ"):
return "china_a"
if ("-" in s or "/" in s) and any(quote in s for quote in ("USDT", "USDC", "BTC", "USD")):
diff --git a/agent/tests/test_shadow_account.py b/agent/tests/test_shadow_account.py
index 4382e8f9e..57c54e8bc 100644
--- a/agent/tests/test_shadow_account.py
+++ b/agent/tests/test_shadow_account.py
@@ -1259,7 +1259,8 @@ def test_promoted_features_threshold() -> None:
promoted = _promoted_numeric_features(df, min_support=3)
assert "prior_5d_return" in promoted # 4 >= 3
assert "entry_rsi14" not in promoted # 2 < 3
- assert set(_MARKET_KEY_MAP) == {"china_a", "us", "hk", "crypto"}
+ assert set(_MARKET_KEY_MAP) == {"china_a", "us", "hk", "uk", "crypto"}
+ assert _MARKET_KEY_MAP["uk"] == "uk_equity"
@pytest.mark.unit
diff --git a/agent/tests/test_trade_journal.py b/agent/tests/test_trade_journal.py
index 860fb33f9..469e72a4a 100644
--- a/agent/tests/test_trade_journal.py
+++ b/agent/tests/test_trade_journal.py
@@ -119,6 +119,10 @@ def test_normalize_side_rejects_missing_or_unknown(raw: object) -> None:
("00700.HK", "hk"),
("600519.SH", "china_a"),
("000001.SZ", "china_a"),
+ ("VOD.L", "uk"),
+ ("HSBA.L", "uk"),
+ ("DCC.IL", "uk"),
+ ("vod.l", "uk"),
("AAPL", "us"),
("BTC-USDT", "crypto"),
("ETH-USD", "crypto"),