Fix: PSI-10 mirrored twice when multi-fund mode is enabled - #12
Open
mpont91 wants to merge 1 commit into
Open
Conversation
FundConfiguration builds a full single-fund pipeline for hft.fund.index-type and MultiFundConfiguration builds another for every fund in the roster. Both are enabled in the develop and production profiles, and both cover PSI-10, so it was mirrored twice and the registry held the wrong capital for it. The registry bean stays unconditional since multi-fund depends on it; its single-fund registration and the two legacy schedulers stand down when multi-fund mode owns the roster.
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.
With
hft.multi-fund.enabled: true(the default in bothapplication-develop.yamlandapplication-production.yaml), startup logs:FundConfigurationis active onhft.fund.enabled=trueand registershft.fund.index-type(PSI-10) withhft.fund.capital-usd.MultiFundConfigurationthen registers the same id with its allocation, andFundRegistry.registerFundrejects the duplicate.Why it matters beyond the log line
MultiFundConfigurationcatches onlyIllegalArgumentExceptionaround that call, so theIllegalStateExceptionescapes to the outer handler and PSI-10 logs as failed —Successfully initialized PSI mirror fund: PSI-10never prints.But
FundConfigurationdoes not just register: it also builds aFundPositionMirror, aFundTradeListener, aFundTradePolleron a 1s schedule and aFundSignalProcessoron a 100ms schedule, all for the same index. Those keep running. So PSI-10 is mirrored by two independent pipelines at once, and the registry reportshft.fund.capital-usd($10,000 by default) rather than the multi-fund allocation ($15,000 at 15% of 100k) that the mirror actually sizes with.Fix
The
FundRegistrybean stays unconditional — multi-fund depends on it. Its single-fund registration returns early when multi-fund mode is on, and the two legacy schedulers are gated with@ConditionalOnProperty(prefix = "hft.multi-fund", name = "enabled", havingValue = "false", matchIfMissing = true), so single-fund deployments are unchanged.After