Open Olshansk opened 3 years ago
Initial thoughts. Going to take a more in-depth look early this week.
Looks good!
What are your thoughts about allowing the user to pass the cache as an argument to get_historical_data
rather than using global variables?
e.g.
cache = prepare_cache(CacheMetadata(cache_path="store.h5", cache_type=CacheType.HDF_STORE))
get_historical_data("AAPL", start=start, end=end, cache=cache)
and then some logic in get_historical_data
:
if cache is not None:
return HistoricalReaderCache(
symbols, start=start, end=end, close_only=close_only, cache=cache **kwargs
).fetch()
else:
return HistoricalReader(
symbols, start=start, end=end, close_only=close_only, **kwargs
).fetch()
iexfinance.stocks.cache
--> iexfinance.caching
(in the unlikely case we implement caching for an endpoint which does not fall under stocks
)Trivial:
unittest
in the tests. Everything can be collected by pytest
Current Usage:
Current limitations:
I looked at how the
requests-cache
module handles a global variables/sessions, but it can not apply in the case of iexfinance (without refactoring) becauserequests-cache
makes use ofrequests
's global session, so a global variable is used here instead.TODOs:
Extra changes:
Added typing to get_historical_data. This was only done because it was the original point of entry in my work and I can reverse this.
[ ] closes #xxxx
[ ] tests added / passed
[ ] passes
black iexfinance
[ ] passes
git diff upstream/master -u -- "*.py" | flake8 --diff
[ ] added entry to docs/source/whatsnew/vLATEST.txt