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 startingpull/1576/head
parent
1cb0b215c4
commit
0789b690a4
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue