Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ValueRaider authored Oct 25, 2022
2 parents edb911b + c49cf62 commit f5973b2
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 8 deletions.
5 changes: 4 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ Before posting an issue - please upgrade to the latest version and confirm the i
Upgrade using:
`$ pip install yfinance --upgrade --no-cache-dir`

Bug still there? Delete this content and submit your bug report here...
Bug still there? Delete this content and submit your bug report here and provide the following, as best you can:

- Simple code that reproduces your problem
- The error message
17 changes: 17 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
Change Log
===========

0.1.81
------
- Fix unhandled tz-cache exception #1107

0.1.80
------
- Fix `download(ignore_tz=True)` for single ticker #1097
- Fix rare case of error "Cannot infer DST time" #1100

0.1.79
------
- Fix when Yahoo returns price=NaNs on dividend day

0.1.78
------
- Fix download() when different timezones #1085

0.1.77
------
- Fix user experience bug #1078
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ Yahoo! finance API is intended for personal use only.**

The `Ticker` module, which allows you to access ticker data in a more Pythonic way:

Note: yahoo finance datetimes are received as UTC.

```python
import yfinance as yf

Expand Down Expand Up @@ -217,6 +215,18 @@ data = yf.download( # or pdr.get_data_yahoo(...
)
```

### Timezone cache store

When fetching price data, all dates are localized to stock exchange timezone.
But timezone retrieval is relatively slow, so yfinance attemps to cache them
in your users cache folder.
You can direct cache to use a different location with `set_tz_cache_location()`:
```python
import yfinance as yf
yf.set_tz_cache_location("custom/cache/location")
...
```

### Managing Multi-Level Columns

The following answer on Stack Overflow is for [How to deal with
Expand Down
1 change: 1 addition & 0 deletions yfinance/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ def _get_ticker_tz(self, debug_mode, proxy, timeout):
self._tz = tz
return tz


def _fetch_ticker_tz(self, debug_mode, proxy, timeout):
# Query Yahoo for basic price data just to get returned timezone

Expand Down
8 changes: 4 additions & 4 deletions yfinance/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ def download(tickers, start=None, end=None, actions=False, threads=True, ignore_
print("\n".join(['- %s: %s' %
v for v in list(shared._ERRORS.items())]))

if len(tickers) == 1:
ticker = tickers[0]
return shared._DFS[shared._ISINS.get(ticker, ticker)]

if ignore_tz:
for tkr in shared._DFS.keys():
if (shared._DFS[tkr] is not None) and (shared._DFS[tkr].shape[0]>0):
shared._DFS[tkr].index = shared._DFS[tkr].index.tz_localize(None)

if len(tickers) == 1:
ticker = tickers[0]
return shared._DFS[shared._ISINS.get(ticker, ticker)]

try:
data = _pd.concat(shared._DFS.values(), axis=1, sort=True,
keys=shared._DFS.keys())
Expand Down
2 changes: 1 addition & 1 deletion yfinance/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.1.77"
version = "0.1.81"

0 comments on commit f5973b2

Please sign in to comment.