Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/strategy_switch_worker_validation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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",
}),
}),
{
Expand Down
6 changes: 3 additions & 3 deletions web/strategy-switch-console/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
Loading