Closed pratik-choudhari closed 2 years ago
Facing the same issue.
# yfinance returns the same date twice if the period is 1d
if(period == "1d" and interval == "1d"):
price_action = price_action.head(1)
Will do.
Should I make a pull request? @ranaroussi
I dont think maintainers are active in this repo
yeah . . . . . df = df[:-1] from here: https://stackoverflow.com/questions/26921651/how-to-delete-the-last-row-of-data-of-a-pandas-dataframe
i would strongly encourage Mr. Aroussi to better support his creations . . . . .
Facing the same issue.
# yfinance returns the same date twice if the period is 1d if(period == "1d" and interval == "1d"): price_action = price_action.head(1)
Will do.
Should I make a pull request? @ranaroussi
Can you point out where is the bug in the code?
this is a problem whether period = '1d' or start_date = "YYYY-MM-DD", end_date = "YYYY-MM-DD"
the code result returns duplicate record of last trading day.
Facing the same issue.
# yfinance returns the same date twice if the period is 1d if(period == "1d" and interval == "1d"): price_action = price_action.head(1)
Will do. Should I make a pull request? @ranaroussi
Can you point out where is the bug in the code?
@beglitis It's an issue from Yahoo! Finance side.
Check this, e.g., https://query1.finance.yahoo.com/v8/finance/chart/TSLA?symbol=TSLA&interval=1d&range=1d
It returns two rows of data.
I thought so that is why I asked where is the bug in the code. :)
Yea but adding the if statement above fixes the problem.
On Wed, Feb 17, 2021, 1:02 PM beglitis notifications@github.com wrote:
I thought so that is why I asked where is the bug in the code. :)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ranaroussi/yfinance/issues/573#issuecomment-780426228, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK7FVIVD4BKERHXIGRYVQLDS7OELLANCNFSM4W2NAQFA .
Having the same problem for one ticker specifically. All others I've worked quite well. Been using the library everyday for a couple of weeks and just noticed this, so it might or might not have just started acting like this. Still not sure. Sure would be nice to have an official fix.
The same issue here! Could the maintainer help solve this? It seems that whenever you try to download using period '1d' or '5d' (I also tested other intervals, and they all passed my tests) during the weekend set the start to be the Friday that just passed, it will duplicate. A related bug is that if you set the start to be Saturday, it will still include the data of Friday (but a single data). I guess that's the reason it duplicates: one indeed for Friday and the other for Saturday. The latter is definitely a bug!
It seems that this only occurs when you download the data during the weekend and your start is the closest Friday or Saturday. For example, now it is 6/13/2021 (Sunday), if I write
data = yf.download('AMC', start = '2021-06-11', end = '2021-06-13' , interval = '1d')
It will show
But if I write (also start from a Friday end on a Sunday)
data = yf.download('AMC', start = '2021-06-04', end = '2021-06-06' , interval = '1d')
It shows correctly:
A very simple way to solve this bug is as follows.
if data.shape[0] >= 2 and data.index[-1] == data.index[-2]:
data = data[:-1]
Just to chime in that I'm having the same issue.
Is this still happening?
On running
history(period='1d')
for any stock, duplicate data is returned. Here is the screenshot of output. Everything is same except volume. Is this being done deliberately?