perf: parallelize Twelve Data historical fetch with ThreadPoolExecutor#20
Open
chenlinxi890-spec wants to merge 1 commit into
Open
Conversation
…readPoolExecutor - Added cache_refresh_parallel.py with concurrent fetcher using ThreadPoolExecutor for symbol×range combinations - Modified refresh_token_historical() to use parallel fetcher with graceful fallback to original serial implementation - Rate limit respected: delays scaled by number of symbols - Estimated improvement: 4x+ faster for 4 symbols x 5 ranges (20 requests) while maintaining Twelve Data free tier compliance Refs Dragoon4002#2
|
Someone is attempting to deploy a commit to the dragoon4002's projects Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
CI Note: Vercel deployment is failing with a repository authorization failure (https://vercel.com/git/authorize). This is expected for fork PRs — Vercel requires the repo owner to authorize the fork's branch for deployment previews. This is not a code issue. The change is a pure Python optimization to �pp/market/cache_refresh.py and �pp/market/cache_refresh_parallel.py with zero frontend/Vercel impact. Please authorize the fork branch in Vercel dashboard or skip the Vercel check for this PR. The code changes are standalone and don't touch any Vercel config. |
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.
Performance Optimization: Parallel Cache Refresh
Problem
efresh_token_historical() in cache_refresh.py made 20 sequential HTTP calls to Twelve Data API (4 symbols × 5 ranges) with ime.sleep(8) between each call = ~160 seconds per refresh cycle.
Solution
Added cache_refresh_parallel.py with a ThreadPoolExecutor-based parallel fetcher that:
Changes
efresh_token_historical() now uses parallel fetcher with serial fallback
Expected Impact
Refs
Bounty issue #2 — Performance Enhancer