Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(connectors): accept project 1H/4H periods on OKX bars

santhreal65e624ab8de3
diff --git a/agent/src/trading/connectors/okx/sdk.py b/agent/src/trading/connectors/okx/sdk.py
index 89350b52b..8cd9981a1 100644
--- a/agent/src/trading/connectors/okx/sdk.py
+++ b/agent/src/trading/connectors/okx/sdk.py
@@ -318,7 +318,8 @@ def get_quote(symbol: str, *, config: OKXConfig | None = None, **_: Any) -> dict
#: Canonical period token → OKX ``bar`` parameter.
_BAR_MAP = {
"1m": "1m", "5m": "5m", "15m": "15m", "30m": "30m",
- "1h": "1H", "4h": "4H", "1d": "1D", "1w": "1W", "1M": "1M",
+ "1h": "1H", "1H": "1H", "4h": "4H", "4H": "4H",
+ "1d": "1D", "1D": "1D", "1w": "1W", "1W": "1W", "1M": "1M",
}
diff --git a/agent/tests/test_okx_bar_map.py b/agent/tests/test_okx_bar_map.py
new file mode 100644
index 000000000..7a67856ec
--- /dev/null
+++ b/agent/tests/test_okx_bar_map.py
@@ -0,0 +1,17 @@
+"""Tests for OKX period → bar mapping."""
+
+from __future__ import annotations
+
+from src.trading.connectors.okx.sdk import _BAR_MAP
+
+
+def test_project_hour_tokens_map_to_hour_not_daily() -> None:
+ assert _BAR_MAP.get("1H") == "1H"
+ assert _BAR_MAP.get("4H") == "4H"
+ assert _BAR_MAP.get("1h") == "1H"
+ assert _BAR_MAP.get("4h") == "4H"
+
+
+def test_minute_month_case_still_distinct() -> None:
+ assert _BAR_MAP["1m"] == "1m"
+ assert _BAR_MAP["1M"] == "1M"