Skip to content

Commit 109d4f2

Browse files
committed
Update IBKR tests for runtime target JSON
1 parent 7487415 commit 109d4f2

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

tests/conftest.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import importlib
2+
import json
23
import sys
34
import types
45
from pathlib import Path
@@ -31,6 +32,23 @@ def load_strategy_module(**env_overrides):
3132
"GLOBAL_TELEGRAM_CHAT_ID": None,
3233
}
3334
defaults.update(env_overrides)
35+
if "RUNTIME_TARGET_JSON" not in defaults:
36+
dry_run_only = str(defaults.get("IBKR_DRY_RUN_ONLY") or "").strip().lower() in {
37+
"1",
38+
"true",
39+
"yes",
40+
"y",
41+
"on",
42+
}
43+
defaults["RUNTIME_TARGET_JSON"] = json.dumps(
44+
{
45+
"platform_id": "ibkr",
46+
"strategy_profile": str(defaults.get("STRATEGY_PROFILE") or "global_etf_rotation"),
47+
"dry_run_only": dry_run_only,
48+
"execution_mode": "paper" if dry_run_only else "live",
49+
},
50+
separators=(",", ":"),
51+
)
3452

3553
for key, value in defaults.items():
3654
if value is None:

tests/test_account_group_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ def test_default_account_group_example_is_valid():
88
Path(__file__).resolve().parents[1]
99
/ "docs"
1010
/ "examples"
11-
/ "ibkr-account-groups.default.json"
11+
/ "ibkr-account-groups.paper.json"
1212
)
1313

1414
configs = parse_account_group_configs(example_path.read_text(encoding="utf-8"))
15-
default_group = configs["default"]
15+
default_group = configs["paper"]
1616

1717
assert default_group.ib_gateway_instance_name == "interactive-brokers-quant-instance"
1818
assert default_group.ib_gateway_zone == "us-central1-c"

0 commit comments

Comments
 (0)