ValueRaider / yfinance-cache

Caching wrapper for yfinance module. Intelligent caching, not dumb caching of web requests.
MIT License
28 stars 10 forks source link

Some Feedback #20

Closed asafravid closed 1 year ago

asafravid commented 2 years ago

How do you know when your cache is out-of-date? For instance - yfinance-cache was run on day n and the data wasn't in cache so the cache was filled-in.

Scenario 1:

Now it is day n+2 and during day n+1 yahoo finance updated its records such that a quarterly element was updated. you must cache that in as your cache is out of date.

Scenario 2:

Now it is day n+2 and during day n+1 yahoo finance did not update its records such that you can use your cache - but how do you know that without checking - rendering the cache obsolete (unless same operations per day or unless you allow some time to not be updated). I use caching in my stock scanner and screener (https://github.com/asafravid/sss) using json, but thats just for crash and continue or reruns - is that your intention with this caching tool?

Scenario 3:

As we saw in a few issues (and as I saw as well) - sometimes two different calls to yfinance can yield different data as yahoo picks the data randomly from several websites which may or may not be updated, yielding different (sometimes less updated by one quarter) results

Bare that in mind while you develop your tool, maybe add usecases in the Readme, etc.

ValueRaider commented 2 years ago

Data isn't cached in one homogenous block that is rendered 100% obsolete and refetched. Instead think like a database.

Price data is easy. Tool records when data fetched, and market trading hours are public knowledge, so can calculate what and when to fetch.

Financials update not implemented yet, but should be simple (I already do this in prototype code). Balance sheet etc tables give me earnings release interval. earnings_dates gives me release dates (for most tickers). So can predict when next earning release is, and usually by then Yahoo has a concrete date so know exactly when to fetch new financials.

But before financials update is implemented, first it needs to be fixed in yfinance - many issues of yfinance retuning different data than website, and a proposed PR fixes this. Maybe after then the "different yields" issues disappears.