mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 05:52:23 +00:00
hotfix/yfinance-download: Fix Intraday Helper (#5785)
* fix yfinance_download intraday helper * fix today getting cutoff --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
This commit is contained in:
@@ -151,12 +151,9 @@ class YFinanceEquityHistoricalFetcher(
|
||||
data.set_index("date", inplace=True)
|
||||
data.index = to_datetime(data.index)
|
||||
|
||||
start_date_dt = datetime.combine(query.start_date, datetime.min.time())
|
||||
end_date_dt = datetime.combine(query.end_date, datetime.min.time())
|
||||
|
||||
data = data[
|
||||
(data.index >= start_date_dt + timedelta(days=days))
|
||||
& (data.index <= end_date_dt)
|
||||
(data.index >= to_datetime(query.start_date))
|
||||
& (data.index <= to_datetime(query.end_date + timedelta(days=days)))
|
||||
]
|
||||
|
||||
data.reset_index(inplace=True)
|
||||
|
||||
@@ -10,8 +10,7 @@ from typing import Any, Literal, Optional, Union
|
||||
import pandas as pd
|
||||
import yfinance as yf
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from .references import MONTHS
|
||||
from openbb_yfinance.utils.references import MONTHS
|
||||
|
||||
|
||||
def get_futures_data() -> pd.DataFrame:
|
||||
@@ -107,7 +106,7 @@ def yf_download(
|
||||
_start_date = None
|
||||
|
||||
if interval in ["2m", "5m", "15m", "30m", "90m"]:
|
||||
_start_date = (datetime.now().date() - relativedelta(days=59)).strftime(
|
||||
_start_date = (datetime.now().date() - relativedelta(days=58)).strftime(
|
||||
"%Y-%m-%d"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user