def testDownloadAndParseDaily(self): instrument = "orcl" common.init_temp_path() path = os.path.join(common.get_temp_path(), "orcl-2010.csv") googlefinance.download_daily_bars(instrument, 2010, path) bf = googlefeed.Feed() bf.addBarsFromCSV(instrument, path) bf.loadAll() self.assertEqual(bf[instrument][-1].getOpen(), 31.22) self.assertEqual(bf[instrument][-1].getClose(), 31.30)
def testDownloadAndParseDaily(self): instrument = "orcl" common.init_temp_path() path = os.path.join(common.get_temp_path(), "orcl-2010.csv") googlefinance.download_daily_bars(instrument, 2010, path) bf = googlefeed.Feed() bf.addBarsFromCSV(instrument, path) bf.loadAll() self.assertEqual(bf[instrument][-1].getOpen(), 31.22) self.assertEqual(bf[instrument][-1].getClose(), 31.30)
from pyalgotrade.tools import googlefinance googlefinance.download_daily_bars('aapl', 2011, 'aapl-2011.csv')
from pyalgotrade.tools import googlefinance googlefinance.download_daily_bars('orcl', 2000, 'orcl-2000.csv')