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

Fix to enable fetching all (including last) rows of intraday data #1608

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions yfinance/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ def history(self, period="1mo", interval="1d",
#if the ticker is MUTUALFUND or ETF, then get capitalGains events
params["events"] = "div,splits,capitalGains"

# Fetch all data
params["useYfid"] = True

params_pretty = dict(params)
tz = self._get_ticker_tz(proxy, timeout)
for k in ["period1", "period2"]:
Expand Down
2 changes: 1 addition & 1 deletion yfinance/scrapers/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,14 +585,14 @@ def calendar(self) -> pd.DataFrame:
def _fetch(self, proxy):
if self._already_fetched:
return
self._already_fetched = True
modules = ['financialData', 'quoteType', 'defaultKeyStatistics', 'assetProfile', 'summaryDetail']
params_dict = {}
params_dict["modules"] = modules
params_dict["ssl"] = "true"
result = self._data.get_raw_json(
_BASIC_URL_ + f"/{self._data.ticker}", params=params_dict, proxy=proxy
)
self._already_fetched = True
result["quoteSummary"]["result"][0]["symbol"] = self._data.ticker
query1_info = next(
(info for info in result.get("quoteSummary", {}).get("result", []) if info["symbol"] == self._data.ticker),
Expand Down
2 changes: 1 addition & 1 deletion yfinance/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def fix_Yahoo_returning_prepost_unrequested(quotes, interval, tradingPeriods):
quotes = quotes.merge(tps_df, how="left")
quotes.index = idx
# "end" = end of regular trading hours (including any auction)
f_drop = quotes.index >= quotes["end"]
f_drop = quotes.index > quotes["end"]
f_drop = f_drop | (quotes.index < quotes["start"])
if f_drop.any():
# When printing report, ignore rows that were already NaNs:
Expand Down