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

Adding method to extract company officers or executives. #2085

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions yfinance/multi.py
Original file line number Diff line number Diff line change
@@ -200,10 +200,6 @@ def download(tickers, start=None, end=None, actions=False, threads=True, ignore_
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[ticker]

try:
data = _pd.concat(shared._DFS.values(), axis=1, sort=True,
keys=shared._DFS.keys(), names=['Ticker', 'Price'])
15 changes: 15 additions & 0 deletions yfinance/scrapers/quote.py
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@ def __init__(self, tickerBaseObject, proxy=None):

self._10d_avg_vol = None
self._3mo_avg_vol = None
self._company_officers = None

# attrs = utils.attributes(self)
# self.keys = attrs.keys()
@@ -72,6 +73,7 @@ def __init__(self, tickerBaseObject, proxy=None):
_properties += ["last_volume"]
_properties += ["fifty_day_average", "two_hundred_day_average", "ten_day_average_volume", "three_month_average_volume"]
_properties += ["year_high", "year_low", "year_change"]
_properties += ["company_officers"]

# Because released before fixing key case, need to officially support
# camel-case but also secretly support snake-case
@@ -455,6 +457,19 @@ def year_change(self):
self._year_change = float(self._year_change)
return self._year_change


def _fetch_company_officers(self):
if self._company_officers is None:
try:
self._company_officers = self._tkr.info['companyOfficers']
except Exception:
self._company_officers = []
return self._company_officers

@property
def company_officers(self):
return self._fetch_company_officers()

@property
def market_cap(self):
if self._mcap is not None: