Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync main -> dev #2108

Merged
merged 14 commits into from
Nov 2, 2024
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.2.46
------
Fix regression in 0.2.45 #2094

0.2.45
------
Features:
- Screener #2066 @ericpien
Fixes
- Tickers keyerror #2068 @antoniouaa
- IndexError in some history() debug messages #2087
- improve dividend repair #2090
Maintenance
- fix unit tests contextual imports #2067
- fix typos #2072 @algonell
- add Pyright type checking #2059 @marco-carvalho

0.2.44
------
Features:
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Yahoo! finance API is intended for personal use only.**
<a target="new" href="https://pypi.python.org/pypi/yfinance"><img border=0 src="https://img.shields.io/pypi/v/yfinance.svg?maxAge=60%" alt="PyPi version"></a>
<a target="new" href="https://pypi.python.org/pypi/yfinance"><img border=0 src="https://img.shields.io/pypi/status/yfinance.svg?maxAge=60" alt="PyPi status"></a>
<a target="new" href="https://pypi.python.org/pypi/yfinance"><img border=0 src="https://img.shields.io/pypi/dm/yfinance.svg?maxAge=2592000&label=installs&color=%2327B1FF" alt="PyPi downloads"></a>
<a target="new" href="https://travis-ci.com/github/ranaroussi/yfinance"><img border=0 src="https://img.shields.io/travis/ranaroussi/yfinance/main.svg?maxAge=1" alt="Travis-CI build status"></a>
<a target="new" href="https://www.codefactor.io/repository/github/ranaroussi/yfinance"><img border=0 src="https://www.codefactor.io/repository/github/ranaroussi/yfinance/badge" alt="CodeFactor"></a>
<a target="new" href="https://github.com/ranaroussi/yfinance"><img border=0 src="https://img.shields.io/github/stars/ranaroussi/yfinance.svg?style=social&label=Star&maxAge=60" alt="Star this repo"></a>
<a target="new" href="https://twitter.com/aroussi"><img border=0 src="https://img.shields.io/twitter/follow/aroussi.svg?style=social&label=Follow&maxAge=60" alt="Follow me on twitter"></a>
Expand Down Expand Up @@ -376,6 +375,6 @@ details on your rights to use the actual data downloaded.

### P.S.

Please drop me an note with any feedback you have.
Please drop me a note with any feedback you have.

**Ran Aroussi**
2 changes: 1 addition & 1 deletion meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "yfinance" %}
{% set version = "0.2.44" %}
{% set version = "0.2.46" %}

package:
name: "{{ name|lower }}"
Expand Down
14 changes: 10 additions & 4 deletions yfinance/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@


@utils.log_indent_decorator
def download(tickers, start=None, end=None, actions=False, threads=True, ignore_tz=None,
group_by='column', auto_adjust=False, back_adjust=False, repair=False, keepna=False,
progress=True, period="max", interval="1d", prepost=False,
proxy=None, rounding=False, timeout=10, session=None):
def download(tickers, start=None, end=None, actions=False, threads=True,
ignore_tz=None, group_by='column', auto_adjust=False, back_adjust=False,
repair=False, keepna=False, progress=True, period="max", interval="1d",
prepost=False, proxy=None, rounding=False, timeout=10, session=None,
multi_level_index=True):
"""Download yahoo tickers
:Parameters:
tickers : str, list
Expand Down Expand Up @@ -85,6 +86,8 @@ def download(tickers, start=None, end=None, actions=False, threads=True, ignore_
seconds. (Can also be a fraction of a second e.g. 0.01)
session: None or Session
Optional. Pass your own session object to be used for all requests
multi_level_index: bool
Optional. Always return a MultiIndex DataFrame? Default is False
"""
logger = utils.get_yf_logger()

Expand Down Expand Up @@ -215,6 +218,9 @@ def download(tickers, start=None, end=None, actions=False, threads=True, ignore_
data.columns = data.columns.swaplevel(0, 1)
data.sort_index(level=0, axis=1, inplace=True)

if not multi_level_index and len(tickers) == 1:
data = data.droplevel(0 if group_by == 'ticker' else 1, axis=1).rename_axis(None, axis=1)

return data


Expand Down
4 changes: 2 additions & 2 deletions yfinance/screener/screener.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def _fetch_and_parse(self) -> None:
self._response = response['finance']['result'][0]
except Exception as e:
logger = utils.get_yf_logger()
logger.error(f"Failed to get screener data for '{self._body.get('query', "query not set")}' reason: {e}")
logger.error(f"Failed to get screener data for '{self._body.get('query', 'query not set')}' reason: {e}")
logger.debug("Got response: ")
logger.debug("-------------")
logger.debug(f" {response}")
logger.debug("-------------")
logger.debug("-------------")
2 changes: 1 addition & 1 deletion yfinance/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.2.44"
version = "0.2.48"
Loading