def test_yahoo_reader_class(self): r = YahooDailyReader('GOOG') df = r.read() self.assertEqual(df.Volume.loc['JAN-02-2015'], 1447600) session = requests.Session() r = YahooDailyReader('GOOG', session=session) self.assertTrue(r.session is session)
def test_yahoo_reader_class(self): r = YahooDailyReader("GOOG", start="JAN-01-2015") df = r.read() assert df.Volume.loc["JAN-02-2015"] == 1447500 session = requests.Session() r = YahooDailyReader("GOOG", session=session) assert r.session is session
def test_yahoo_reader_class(self): r = YahooDailyReader('GOOG') df = r.read() assert df.Volume.loc['JAN-02-2015'] == 1447500 session = requests.Session() r = YahooDailyReader('GOOG', session=session) assert r.session is session
def download_stock_daily_csv(tickers, out_dir, start_date, end_date): print 'len(tickers)', len(tickers) if not os.path.exists(out_dir): os.makedirs(out_dir) for ticker in tickers: file_name = os.path.join(out_dir, ticker + '.csv') if os.path.isfile(file_name): continue try: print "Downloading " + ticker df = YahooDailyReader(ticker, start_date, end_date).read() df.to_csv(file_name) except IOError as error: print error