Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blackary/yf-fix
Fixing yfinance > 0.2.28 on Streamlit Community Cloud
https://github.com/blackary/yf-fix
Last synced: 13 days ago
JSON representation
Fixing yfinance > 0.2.28 on Streamlit Community Cloud
- Host: GitHub
- URL: https://github.com/blackary/yf-fix
- Owner: blackary
- Created: 2023-09-25T14:12:33.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-02T16:17:49.000Z (about 1 year ago)
- Last Synced: 2024-10-11T09:32:56.422Z (about 1 month ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# YFinance > 0.2.28 support in Community Cloud
# UPDATE 2023-10-01 This has been fixed with yfinance>=0.2.31b2
## OLD:
yfinance changed the default behavior in version 0.2.29 to cache timezone info to
improve performance. However, the default place it tries to save the cache
(`/home/appuser/.cache/`) doesn't exist on Streamlit Community Cloud.You can get around this issue and still use the latest versions of yfinance by setting
a different cache directory than the default one, like this:```python
from pathlib import Pathimport appdirs as ad
CACHE_DIR = ".cache"
# Force appdirs to say that the cache dir is .cache
ad.user_cache_dir = lambda *args: CACHE_DIR# Create the cache dir if it doesn't exist
Path(CACHE_DIR).mkdir(exist_ok=True)
```This puts the timezone cache in a new folder inside the current folder, called .cache
```
streamlit_app.py
.cache/
py-yfinance/
tkr-tz.db
````.cache` isn't really special, but it's a writable location -- you can name the folder
whatever you want.This bug has been reported here https://github.com/ranaroussi/yfinance/issues/1700
This app can be previewed at: https://yf-fix.streamlit.app/
Alternatively, you can set `yfinance==0.2.28` in your requirements.txt to avoid this
issue.