def test_get_quote_string(self): _yahoo_codes.update({'MarketCap': 'j1'}) df = web.get_quote_yahoo('GOOG') self.assertFalse(pd.isnull(df['MarketCap'][0]))
quote = web.get_data_yahoo(symbol,thirty_days.strftime("%m/%d/%Y"), time.strftime("%m/%d/%Y")) #quote = web.get_data_yahoo(symbol,thirty_days.strftime("%m/%d/%Y"), twenty_days.strftime("%m/%d/%Y")) return quote #from talib import MA_Type from talib import MA_Type upper, middle, lower = ta.BBANDS(close, matype=MA_Type.T3) # Own test end import pandas_datareader.data as web from pandas.io.data import _yahoo_codes a=web.get_quote_yahoo("MSFT") b=_yahoo_codes.update({'MarketCap' : 'j1'}) print(a) print(b) a=web.get_quote_yahoo("GEN.CO") b=_yahoo_codes.update({'52WeekLow' : 'j'}) print(a) print(b) print("stop") aapl = web.get_data_yahoo("GEN.CO",'1/1/2016', '5/20/2016') #appl = web.get_data_google("GEN",'1/1/2016', '5/20/2016') #print(aapl.Close) # get all close price #closeprice = ta.SMA(numpy.array(aapl.Close)) # Avoid Argument 'real' has incorrect type (expected numpy.ndarray, got Series) error.
from pandas.io.data import _yahoo_codes from pandas.io.common import urlopen import pandas.compat as compat from collections import defaultdict sym_list = 'APT' _yahoo_codes.update({'MarketCap' : 'j1'}) request = ''.join(compat.itervalues(_yahoo_codes)) # code request string header = list(_yahoo_codes.keys()) print header data = defaultdict(list) url_str = 'http://finance.yahoo.com/d/quotes.csv?s=%s&f=%s' % (sym_list, request) with urlopen(url_str) as url: lines = url.readlines() print lines