perf: reduce stochastic signal window scans#5
Open
Godel-Smith wants to merge 1 commit into
Open
Conversation
|
@Godel-Smith is attempting to deploy a commit to the dragoon4002's projects Team on Vercel. A member of the Team first needs to authorize it. |
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
Reduces extra rolling-window scans in
stochastic_signal. The function only uses the trailingd_period%K values to compute%D, so this PR computes those trailing windows directly instead of scanningk_periodwindows and discarding most of them.If this ranks for payout, I can provide payment details privately after acceptance.
Type
Related Issue
Refs #2
Changes
%Kwindows insidestochastic_signal.%K/%Doutput for the defaultd_period <= k_periodpath.d_period > k_period.Benchmark
Synthetic 1000-candle input, best of 5 repeats, run with direct file import to avoid pulling app dependencies:
k_period=14,d_period=3: old0.508540s, new0.150167sfor 10,000 calls:3.39xspeedupk_period=120,d_period=3: old4.531116s, new0.154038sfor 2,000 calls:29.42xspeedupTesting
pytest tests/passes locallygit diff --cached --checkNot run:
pytest tests/because this repo ignorestests/as private/internal and the local environment does not have the full app dependency stack installed.Checklist
docs/connections/service-map.mdupdated (if adding a new call path)docs/architecture/data-model.mdupdated (if changing DB schema)app/strategies/signals.py(if adding a strategy)app/onchain_logger.py(if adding a strategy)Screenshots (if UI change)
N/A