"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(tiger): accept project-style 1H/4H period tokens
santhreal78650f74aae6
diff --git a/agent/src/trading/connectors/tiger/sdk.py b/agent/src/trading/connectors/tiger/sdk.pyindex 9d6e250d7..998d36b88 100644--- a/agent/src/trading/connectors/tiger/sdk.py+++ b/agent/src/trading/connectors/tiger/sdk.py@@ -287,9 +287,11 @@ def get_quote(symbol: str, *, config: TigerConfig | None = None, **_: Any) -> di#: Canonical period token → Tiger ``get_bars`` period string.+# ``1H``/``1D``/``1W`` alias the lowercase tokens; ``1m`` vs ``1M`` stays case-sensitive._PERIOD_MAP = {"1m": "1min", "5m": "5min", "15m": "15min", "30m": "30min",- "1h": "60min", "4h": "60min", "1d": "day", "1w": "week", "1M": "month",+ "1h": "60min", "1H": "60min", "4h": "60min", "4H": "60min",+ "1d": "day", "1D": "day", "1w": "week", "1W": "week", "1M": "month",}diff --git a/agent/tests/test_tiger_period_hour_case.py b/agent/tests/test_tiger_period_hour_case.pynew file mode 100644index 000000000..58dc2f01f--- /dev/null+++ b/agent/tests/test_tiger_period_hour_case.py@@ -0,0 +1,36 @@+"""Tiger period map must treat project-style 1H/4H as hour bars, not day."""++from __future__ import annotations++from src.trading.connectors.tiger import sdk as tg+++class _FakeTigerQuote:+ def __init__(self) -> None:+ self.calls: list[dict] = []++ def get_bars(self, symbols, period=None, limit=None):+ self.calls.append({"period": period, "limit": limit})+ return []+++def test_tiger_period_map_accepts_project_hour_tokens() -> None:+ assert tg._PERIOD_MAP["1H"] == "60min"+ assert tg._PERIOD_MAP["4H"] == "60min"+ assert tg._PERIOD_MAP["1h"] == "60min"+ assert tg._PERIOD_MAP["1m"] == "1min"+ assert tg._PERIOD_MAP["1M"] == "month"+++def test_tiger_history_1H_does_not_collapse_to_day(monkeypatch) -> None:+ fake = _FakeTigerQuote()+ monkeypatch.setattr(tg, "_quote_client", lambda cfg: fake)+ monkeypatch.setattr(tg, "_assert_profile", lambda cfg: None)+ cfg = tg.TigerConfig(+ tiger_id="x",+ private_key_path="x",+ account="20191106192858300",+ profile="paper",+ )+ tg.get_historical_bars("AAPL", config=cfg, period="1H", limit=24)+ assert fake.calls[-1]["period"] == "60min"