예제 #1
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 {}
예제 #2
0
 def testGetTicks(self):
     googleFinance = GoogleFinance()
     ret = googleFinance.getTicks('EBAY', start = '20110101', end = '20110110')
     print(ret)
예제 #3
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)
예제 #4
0
 def testGetQuotes_badSymbol(self):
     googleFinance = GoogleFinance()
     self.assertRaises(UfException, googleFinance.getQuotes, *['AFSDFASDFASDFS', '20110101', '20110110'])
예제 #5
0
 def testGetAll_badSymbol(self):
     googleFinance = GoogleFinance()
     self.assertRaises(UfException, googleFinance.getAll, 'fasfdsdfasf')
예제 #6
0
 def testGetAll(self):
     googleFinance = GoogleFinance()
     data = googleFinance.getAll('EBAY')
     print(data)
     self.assertNotEqual(0, len(data))
예제 #7
0
 def testGetQuotes(self):
     googleFinance = GoogleFinance()
     data = googleFinance.getQuotes('NASDAQ:EBAY', '20110101', '20110110')
     assert len(data)
 def __init__(self):
     ''' constructor '''
     super(GoogleDAM, self).__init__()
     self.__gf = GoogleFinance()
 def testGetQuotes(self):
     googleFinance = GoogleFinance()
     data = googleFinance.getQuotes('NASDAQ:EBAY', '20131101', None)
     print[str(q) for q in data]
     assert len(data)