mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
added verification for windows. if start is prior to 1970, convert it to 1970-01-02 (1 day buffer in case of timezone adjustments) (#2056)
reference_1 : https://stackoverflow.com/questions/2518706/python-mktime-overflow-error reference_2 : https://discuss.python.org/t/please-help-getting-try-except-working-for-yfinance-download/11682/6 Co-authored-by: Chavithra <chavithra@gmail.com>
This commit is contained in:
@@ -356,6 +356,12 @@ def load(
|
||||
int_ = "1mo"
|
||||
int_string = "Monthly"
|
||||
|
||||
# Win10 version of mktime cannot cope with dates before 1970
|
||||
if os.name == "nt" and start < datetime(1970, 1, 1):
|
||||
start = datetime(
|
||||
1970, 1, 2
|
||||
) # 1 day buffer in case of timezone adjustments
|
||||
|
||||
# Adding a dropna for weekly and monthly because these include weird NaN columns.
|
||||
df_stock_candidate = yf.download(
|
||||
ticker, start=start, end=end, progress=False, interval=int_
|
||||
|
||||
Reference in New Issue
Block a user