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.
Description by Korbit AI
What change is being made?
Integrate a DuckDB caching mechanism to optimize Polygon data retrieval for faster and more efficient polygon backtesting.
Why are these changes being made?
The previous implementation did not cache data on a local database, making retrievals from Polygon inefficient during backtesting due to repeated fetches for the same data. By using DuckDB caching, data retrieval is now optimized by storing previously fetched data locally, thus reducing the need for repeated external API calls and improving performance during backtesting operations. Additionally, code improvements were made for enhanced clarity, concurrency handling, and accuracy in the data-fetching logic.