Date range not fully pulled by get_data_yahoo
focussedmonk opened this issue · 2 comments
THE BELOW CODE IS RUNNING
- BUT WHEN YOU RUN THE TICKER TABLE SEPERATELY, THE LAST FEW DATES ARE ONLY GETTING PULLED AND NOT ALL 10 DAYS - SO THE RESULT EVENTUALLY IS FALSE.
THE DATE RANGE IS BETWEEN 9/13 - 9/24....but only the last 4 days data is getting pulled ??
`import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import datetime as dt
import statistics
import yfinance as yf
import pandas_datareader.data as web
stock_data = {
'Eicher': 'eichermot.ns',
'Nestle': 'nestleind.ns'}
yf.pdr_override()
start = dt.datetime(2021,9,13)
end = dt.datetime.now()
#end = datetime.datetime.now()
for name, ticker in stock_data.items():
ticker = web.get_data_yahoo(ticker, start, end)
for day in ticker:
ticker['True_Range'] = (ticker['Adj Close'].shift(1) - ticker['Low'])
ticker.dropna(inplace=True)
weekly_dynamic_sigma = 1.5 * statistics.pstdev(ticker['True_Range'])
mean_tr = statistics.mean(ticker['True_Range'])
gap = mean_tr + weekly_dynamic_sigma
prev_close = ticker['Adj Close'][-1]
current_price = ticker['Adj Close']
Buy_Zone = ticker['Adj Close'][-1] - gap
print(f'\t~~~~~~~~~~\n\tBUY zone: {Buy_Zone.round(2)}\n\t~~~~~~~~~~\n')`
I think you've got the wrong github project with this issue submission. It looks like you your issue is against the YFINANCE python module, based on your code snippet (import yfinance as yf). My app (ticker_data) is works with finance.yahoo.com as one of its data sources (but not exclusively). The yfinance module (by https://pypi.org/user/ranaroussi) singularly focuses on Yahoo Finance only.
I think you should re-submit your GitHub issue to the yfinaince project team here: https://github.com/ranaroussi/yfinance
Thank you for the detailed feedback and reference.