Beispiel #1
0
 def downloadHistData(self, startDate=(2010,1,1),endDate=date.today().timetuple()[:3],\
                 source = 'yahoo'):
     ''' 
     get historical OHLC data from a data source (yahoo is default)
     startDate and endDate are tuples in form (d,m,y)
     '''
     self.log.debug('Getting OHLC data')
     self.ohlc = getHistoricData(self.name, startDate, endDate)
Beispiel #2
0
    def _getYahooData(self, startDate=(2007, 1, 1)):
        """ fetch historic data """
        data = {}
        for symbol in self.symbols:
            print 'Downloading %s' % symbol
            data[symbol] = (getHistoricData(symbol, startDate)['adj_close'])

        self.histClose = DataFrame(data).dropna()
Beispiel #3
0
 def _getYahooData(self, startDate=(2007,1,1)):
     """ fetch historic data """
     data = {}        
     for symbol in self.symbols:
         print 'Downloading %s' % symbol
         data[symbol]=(yahoo.getHistoricData(symbol,startDate)['adj_close'] )
        
     self.price = pd.DataFrame(data).dropna()
Beispiel #4
0
 def downloadHistData(self, startDate=(2010,1,1),endDate=date.today().timetuple()[:3],\
                 source = 'yahoo'):
     ''' 
     get historical OHLC data from a data source (yahoo is default)
     startDate and endDate are tuples in form (d,m,y)
     '''
     self.log.debug('Getting OHLC data')
     self.ohlc = yahoo.getHistoricData(self.name,startDate,endDate)
Beispiel #5
0
    def _missingDates(self):
        ''' check for missing dates based on spy data'''
        print 'Getting yahoo data to determine business dates... ',
        spy = yf.getHistoricData('SPY',sDate = (2010,1,1))
        busDates = [d.date() for d in spy.index ]

        print 'Date range: ', busDates[0] ,'-', busDates[-1]
        missing = []
        for d in busDates:
            if d not in self.dates:
                missing.append(d)

        return missing