fix(strategy-center): enable live trading mode for crypto portfolios (#225) - #9
Open
mwaleedta wants to merge 3 commits into
Open
fix(strategy-center): enable live trading mode for crypto portfolios (#225)#9mwaleedta wants to merge 3 commits into
mwaleedta wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes OpenByteInc/QuantDinger#225.
The web deployment editor was blocking
executionMode=livefor any Strategy API V2 portfolio unless the asset class was USStock, even though the backend explicitly supports same-market live deployments (seebackend_api_python/app/services/strategy_v2/deployment.py::_validate_execution_account— Crypto + USStock both pass; only mixed-market is rejected).For a multi-instrument crypto portfolio (e.g.
BTC/USDT@swap+ETH/USDT@swap), users could only choosesignalmode in the deployment wizard. Single-instrument CTA crypto strategies worked fine.Root cause
In
src/views/strategy-center/components/LiveStrategyEditor.vue:supportsLive(line 370) hard-codedisPortfolioStrategy → marketCategory === 'USStock', disabling the radio for crypto portfolios.compatibleCredentials(line 420) hard-codedisPortfolioStrategy → exchange === 'alpaca', hiding binance/okx/etc. credentials.Fix
Two surgical changes:
supportsLivenow delegates tosupportsLiveExecutionMode(manifest)— permits any same-marketCryptoorUSStockmanifest, regardless of strategy type.compatibleCredentialsnow delegates tocredentialMatchesLiveStrategy(manifest, exchange_id)— accepts crypto exchanges for Crypto manifests, alpaca/ibkr for USStock manifests, rejects everything else.Both helpers live in a new
src/utils/liveTradingEligibility.jsmodule so they can be unit-tested without mounting the Vue SFC.Tests
tests/unit/liveTradingEligibility.test.mjscovering CTA vs. portfolio × Crypto/USStock/mixed and credential matching across the supported exchanges.tests/unit/liveStrategyCurrentContract.test.mjswith a source-scan regression test that asserts the old hard-blocks are gone and the new helpers are wired in.pnpm test:unitpasses (55/55), plus the new files run 13/13 green.Verification
Per the issue's repro, a strategy like:
...now shows "Live Automated Trading" as an available option in the deploy wizard and accepts a crypto exchange credential.
Out of scope
strategyV2.mixedMarketLiveUnsupported.