https://github.com/dharmatech/yfinance_download.py
https://github.com/dharmatech/yfinance_download.py
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dharmatech/yfinance_download.py
- Owner: dharmatech
- Created: 2023-12-24T09:27:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-24T09:16:01.000Z (over 1 year ago)
- Last Synced: 2025-12-19T18:08:20.356Z (6 months ago)
- Language: Python
- Size: 6.84 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
With `yfinance`, if you do the following:
```
import yfinance as yf
df = yf.download(tickers='^GSPC')
```
you'll download all the data for the S&P 500.
Later on, if you repeat the same steps to get new data, it will download all data again.
With `yfinance_download`, all the data is only downloaded the first time. The data is serialized into a pkl file. Subsequent calls to download the data only request recent data (data since 2nd most recent date).
After running the following:
```
import yfinance_download
df = yfinance_download.update_records('^GSPC')
```
you should have a file `pkl/^GSPC-1d.pkl` which stores the serialized data.
To select a `1mo` interval:
```
df = yfinance_download.update_records('^GSPC', interval='1mo')
```
You should then see a file `pkl/^GSPC-1mo.pkl`