OpenBB
OpenBB copied to clipboard
[FR] Adding an optional caching layer
What's the problem of not having this feature? Right now, if I'm requesting the same dataset a few different times, there's two problems:
- I outrun my API key limits
- I have slower requests
- I can't run analysis when internet is unavailable. In theory, this would allow users to load data they'd want to analyse, and continue to operate with that data in a situation without WiFi (ie: flight).
Describe the solution you would like I'd like to submit a PR that allows the user to turn a configuration ON that let's them to run a local Redis cache on their machine to cache requests. This would be configured to identify the time range, so people looking for higher frequency data would get cache misses on intraday data if they're on a small time window.
Would there be traction to get this merged?
Additional information I'll write this myself, I have an idea about how to go about it.
The Terminal application does require internet access; however, the SDK layer can run offline by using locally stored data. One solution would be to simply export the data you want to keep and maintain your own private database to work offline. That said, I am also curious what your solution might look like.
Im very interested in what a solution would look like for this.
Ideally it could be abstracted to one of the base classes so that we could cache any request throughout the terminal (behind a feature flag).
I briefly played around with just using the requests_cache library, but their recommended way would require changing every requests.get() to a session, which was more than I was interested in doing.