From 2275e592c4a3b1955a1098aaf683286d184104c8 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Sat, 4 Jul 2026 08:43:20 +0800 Subject: [PATCH] fix strategy switch account sync validation Co-Authored-By: Codex --- tests/strategy_switch_worker_validation.mjs | 4 ++++ web/strategy-switch-console/worker.js | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/strategy_switch_worker_validation.mjs b/tests/strategy_switch_worker_validation.mjs index 905573f..3f3741d 100644 --- a/tests/strategy_switch_worker_validation.mjs +++ b/tests/strategy_switch_worker_validation.mjs @@ -408,6 +408,8 @@ assert.deepEqual(accountOptions.longbridge[0].supported_domains, ["us_equity", " assert.deepEqual(accountOptions.longbridge[1].supported_domains, ["us_equity", "hk_equity"]); assert.deepEqual(accountOptions.ibkr[0].supported_domains, ["us_equity", "hk_equity"]); assert.equal(accountOptions.longbridge[0].cash_currency, "HKD"); +const defaultAccountOptions = __test.normalizeAccountOptionsPayload(DEFAULT_ACCOUNT_OPTIONS, "default_account_options"); +assert.equal(defaultAccountOptions.qmt[0].cash_currency, "CNY"); for (const platformOptions of Object.values(DEFAULT_ACCOUNT_OPTIONS)) { for (const option of platformOptions) { assert.equal("reserved_cash_ratio" in option, false); @@ -463,6 +465,8 @@ const kvUnboundSyncResponse = await worker.fetch( execution_mode: "live", variable_scope: "default", plugin_mode: "auto", + option_overlay_mode: "current", + cash_only_execution_mode: "current", }), }), { diff --git a/web/strategy-switch-console/worker.js b/web/strategy-switch-console/worker.js index a20e35f..a5cf661 100644 --- a/web/strategy-switch-console/worker.js +++ b/web/strategy-switch-console/worker.js @@ -59,7 +59,7 @@ const PLATFORM_CASH_ONLY_EXECUTION_VARIABLES = { firstrade: "FIRSTRADE_CASH_ONLY_EXECUTION", }; const LEGACY_CASH_ONLY_EXECUTION_VARIABLE = "CASH_ONLY_EXECUTION"; -const CASH_ONLY_EXECUTION_MODES = ["enabled", "disabled"]; +const CASH_ONLY_EXECUTION_MODES = ["current", "enabled", "disabled"]; const INCOME_LAYER_ENABLED_VARIABLE = "INCOME_LAYER_ENABLED"; const INCOME_LAYER_START_USD_VARIABLE = "INCOME_LAYER_START_USD"; const INCOME_LAYER_MAX_RATIO_VARIABLE = "INCOME_LAYER_MAX_RATIO"; @@ -99,7 +99,7 @@ const OPTION_OVERLAY_PROFILE_FIELDS = [ "option_overlay_live_gate", "option_overlay_live_status", ]; -const OPTION_OVERLAY_MODES = ["enabled", "disabled"]; +const OPTION_OVERLAY_MODES = ["current", "enabled", "disabled"]; const DCA_PROFILE_CONFIG = Object.fromEntries( Object.entries(DCA_PROFILE_DEFAULTS).map(([profile, defaults]) => [ profile, @@ -1739,7 +1739,7 @@ function cleanStrategyDomain(value, fieldName) { } function cleanCashCurrency(value, fieldName) { - return cleanChoice(String(value || "").trim().toUpperCase(), ["USD", "HKD"], fieldName); + return cleanChoice(String(value || "").trim().toUpperCase(), ["USD", "HKD", "CNY"], fieldName); } function addConfigOptional(target, key, value, cleaner) {