JECSand / yahoofinancials

A powerful financial data module used for pulling data from Yahoo Finance. This module can pull fundamental and technical data for stocks, indexes, currencies, cryptos, ETFs, Mutual Funds, U.S. Treasuries, and commodity futures.
https://pypi.python.org/pypi/yahoofinancials
MIT License
910 stars 215 forks source link

get_historical_price_data returns None for a single close value #25

Open andrewkdinh opened 5 years ago

andrewkdinh commented 5 years ago

For some tickers, get_historical_data returns None for a single close value.

Some tickers this occurs for: SGHIX, FSHCX

Example:

from yahoofinancials import YahooFinancials
import datetime

ticker = 'SGHIX'
yahoo_financials = YahooFinancials(ticker)
r = yahoo_financials.get_historical_price_data('1900-01-01', str(datetime.date.today()), 'daily')

s = r[ticker]['prices']
listOfDates = []
listOfCloseValues = []
for i in range(0, len(s), 1):
    listOfDates.append(s[i]['formatted_date'])
    listOfCloseValues.append(s[i]['close'])
listYahoo = [listOfDates, listOfCloseValues]

print(len(listYahoo[0]), 'dates and', len(listYahoo[1]), "close values")

k = 0
for i in listYahoo[1]:
    if i == None:
        print(listYahoo[0][k])
        print(k)
        print('None value found')
    k += 1
JECSand commented 5 years ago

@andrewkdinh

I will look into this and report back. I have been very busy these past few months, but my goal is to have a new version out addressing the current outstanding issues by the middle of September.

bohm66 commented 4 years ago

Hi, I have the same problem since one week back. Before it worked perfectly.