Add JoinQuant env browser login helper

This commit is contained in:
Yuxuan Yan
2026-07-04 18:37:34 +08:00
parent d05931f41a
commit 5fada75d23
3 changed files with 157 additions and 1 deletions
+15
View File
@@ -14,6 +14,7 @@ from cli import cli
from pipeline.common.schema import FILL_COLUMNS, PNL_COLUMNS, POSITION_COLUMNS
from plugins.joinquant.browser import (
default_browser_config,
load_env_file,
resolve_template,
write_browser_config_template,
)
@@ -559,6 +560,20 @@ def test_browser_config_template_and_placeholder_resolution(tmp_path):
assert resolve_template("save:{expected_joinquant_csvs.fills}", context) == "save:/tmp/jq_fills.csv"
def test_load_env_file_handles_quotes_without_shell_sourcing(tmp_path):
env_path = tmp_path / "joinquant.env"
env_path.write_text(
"JOINQUANT_USERNAME=alice\n"
"JOINQUANT_PASSWORD=\"secret\"\n"
"JOINQUANT_STRATEGY_URL='https://example.test/path?x=1&y=2'\n"
)
env = load_env_file(env_path)
assert env["JOINQUANT_USERNAME"] == "alice"
assert env["JOINQUANT_PASSWORD"] == "secret"
assert env["JOINQUANT_STRATEGY_URL"] == "https://example.test/path?x=1&y=2"
def test_sim_trade_browser_config_template(tmp_path):
config_path = write_browser_config_template(
tmp_path / "sim_config.json",