mirror of
https://github.com/ranaroussi/yfinance.git
synced 2024-01-29 09:38:56 +03:00
fix: start year on history
timestamp of 1900 is older than 100 years, so yahoo responds with error: GDEVW: 1d data not available for startTime=-2208994789 and endTime=1687780922. Only 100 years worth of day granularity data are allowed to be fetched per request. this should fix it, something similar was proposed here: https://github.com/ranaroussi/yfinance/pull/648 # Please enter the commit message for your changes. Lines starting
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@ dist
|
||||
yfinance.egg-info
|
||||
*.pyc
|
||||
.coverage
|
||||
.idea/
|
||||
.vscode/
|
||||
build/
|
||||
*.html
|
||||
|
||||
@@ -170,8 +170,8 @@ class TickerBase:
|
||||
if interval == "1m":
|
||||
start = end - 604800 # Subtract 7 days
|
||||
else:
|
||||
_UNIX_TIMESTAMP_1900 = -2208994789
|
||||
start = _UNIX_TIMESTAMP_1900
|
||||
max_start_datetime = pd.Timestamp.utcnow().floor("D") - _datetime.timedelta(days=99 * 365)
|
||||
start = int(max_start_datetime.timestamp())
|
||||
else:
|
||||
start = utils._parse_user_dt(start, tz)
|
||||
params = {"period1": start, "period2": end}
|
||||
|
||||
Reference in New Issue
Block a user