class GoogleDAM(BaseDAM):
    ''' Google DAO '''
    def __init__(self):
        ''' constructor '''
        super(GoogleDAM, self).__init__()
        self.__gf = GoogleFinance()

    def readQuotes(self, start, end):
        ''' read quotes from google Financial'''
        if self.symbol is None:
            LOG.debug('Symbol is None')
            return []

        return self.__gf.getQuotes(self.symbol, start, end)

    def readTicks(self, start, end):
        ''' read ticks from google Financial'''
        if self.symbol is None:
            LOG.debug('Symbol is None')
            return []

        return self.__gf.getTicks(self.symbol, start, end)

    def readFundamental(self):
        ''' read fundamental '''
        if self.symbol is None:
            LOG.debug('Symbol is None')
            return {}

        return self.__gf.getFinancials(self.symbol)
Exemplo n.º 2
0
class GoogleDAM(BaseDAM):
    ''' Google DAO '''

    def __init__(self):
        ''' constructor '''
        super(GoogleDAM, self).__init__()
        self.__gf = GoogleFinance()

    def readQuotes(self, start, end):
        ''' read quotes from google Financial'''
        if self.symbol is None:
            LOG.debug('Symbol is None')
            return []

        return self.__gf.getQuotes(self.symbol, start, end)

    def readTicks(self, start, end):
        ''' read ticks from google Financial'''
        if self.symbol is None:
            LOG.debug('Symbol is None')
            return []

        return self.__gf.getTicks(self.symbol, start, end)

    def readFundamental(self):
        ''' read fundamental '''
        if self.symbol is None:
            LOG.debug('Symbol is None')
            return {}

        return self.__gf.getFinancials(self.symbol)
Exemplo n.º 3
0
    def getStockFinancials(self, writeOutput=False):
        ''' get stock financials '''
        with open(self.__stockList) as inFile:
            stockFinancials = {}

            for stockName in inFile.readlines():
                try:
                    stockName = stockName.strip()
                    googleFinance = GoogleFinance()
                    financials = googleFinance.getFinancials(stockName)
                    print "Processed %s" % stockName
                    stockFinancials[stockName] = financials
                except StandardError as excp:
                    print '%s' % excp

            if writeOutput:
                with open(self.__outputFile, 'w') as outFile:
                    outFile.write(json.dumps(stockFinancials))

            return stockFinancials

        return {}
Exemplo n.º 4
0
    def getStockFinancials(self, writeOutput=False):
        ''' get stock financials '''
        with open(self.__stockList) as inFile:
            stockFinancials = {}

            for stockName in inFile.readlines():
                try:
                    stockName = stockName.strip()
                    googleFinance = GoogleFinance()
                    financials = googleFinance.getFinancials(stockName)
                    print "Processed %s" % stockName
                    stockFinancials[stockName] = financials
                except StandardError as excp:
                    print '%s' % excp

            if writeOutput:
                with open(self.__outputFile, 'w') as outFile:
                    outFile.write(json.dumps(stockFinancials))

            return stockFinancials

        return {}
Exemplo n.º 5
0
 def testGetFinancials(self):
     googleFinance = GoogleFinance()
     #ret = googleFinance.getFinancials('NASDAQ:EBAY', ['Net Income', 'Total Revenue', 'Diluted Normalized EPS', 'Total Common Shares Outstanding'], False)
     ret = googleFinance.getFinancials('NASDAQ:EBAY')
     print(ret)
 def testGetFinancials(self):
     googleFinance = GoogleFinance()
     #ret = googleFinance.getFinancials('NASDAQ:EBAY', ['Net Income', 'Total Revenue', 'Diluted Normalized EPS', 'Total Common Shares Outstanding'], False)
     ret = googleFinance.getFinancials('NASDAQ:EBAY')
     print(ret)