Skip to content

Commit 8932849

Browse files
Pigbibiclaude
andcommitted
fix(strategy-switch): add default_strategy_profile fallback in resolveCurrentStrategyForAccount
When no GitHub variables are readable (token lacks repo access), fall back to the default_strategy_profile from account options KV. This ensures platforms like firstrade, binance, and qmt always show a default strategy. Also updates KV account_options to include: - IBKR 4th account u18308207 (global_etf_rotation) - firstrade with explicit matching fields (service_name, account_scope, etc.) - binance and qmt default account options Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4b40515 commit 8932849

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

web/strategy-switch-console/worker.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,25 @@ async function resolveCurrentStrategyForAccount({ platform, option, optionsCount
858858
};
859859
}
860860

861+
// Fallback: use default_strategy_profile from account options when
862+
// no GitHub variables can be read (e.g. token lacks repo access).
863+
const defaultProfile = cleanCurrentStrategy(option?.default_strategy_profile);
864+
if (defaultProfile) {
865+
return {
866+
strategy_profile: defaultProfile,
867+
...reservedCashPayload,
868+
...incomeLayerPayload,
869+
...optionOverlayPayload,
870+
...runtimeTargetEnabledPayload,
871+
...dcaPayloadForProfile(defaultProfile, dcaPayload),
872+
...ibitZscoreExitPayloadForProfile(defaultProfile, ibitZscorePayload),
873+
...cashOnlyPayload,
874+
source: "ACCOUNT_OPTIONS_DEFAULT",
875+
variable_scope: variableScope,
876+
github_environment: githubEnvironment || "",
877+
};
878+
}
879+
861880
return null;
862881
}
863882

0 commit comments

Comments
 (0)