def getTopPerformers(self, category = 'all', top = True):
     db = dbAccessor()
     companiesReturn = []
     companyList = db.companiesOfType()
     for row in companyList:
         companiesReturn.append( (row[1],self.companyPredic.getMonthlyReturns(row[2])) )
     return sorted(companiesReturn, reverse=top, key= lambda x: x[1])
Exemple #2
0
 def getTopPerformers(self, category='all', top=True):
     db = dbAccessor()
     companiesReturn = []
     companyList = db.companiesOfType(category)
     for row in companyList:
         companiesReturn.append(
             (row[1], self.companyPredic.getMonthlyReturns(row[2])))
     return sorted(companiesReturn, reverse=top, key=lambda x: x[1])
Exemple #3
0
 def limitAnalysis(self, closeData):
     from dbAccess import dbAccessor
     db = dbAccessor()
     userHoldings = db.getCompanyInvestement(self.symbol)
     buyPrice = userHoldings[3]
     buyToCurrentRation = buyPrice / float(closeData['Close'])
     if buyToCurrentRation > predictor.profitMax:
         self.returnStatus = "SELL"
         self.message = 'It would be best to book profits and sell.'
         return self.returnStatus
     elif buyToCurrentRation < predictor.lossMax:
         self.returnStatus = "SELL"
         self.message = 'Cut your losses and sell the stock'
         return self.returnStatus
 def limitAnalysis(self, closeData):
     from dbAccess import dbAccessor
     db = dbAccessor()
     userHoldings = db.getCompanyInvestement(self.symbol)
     buyPrice = userHoldings[3]
     buyToCurrentRation = buyPrice/float(closeData['Close'])
     if buyToCurrentRation > predictor.profitMax:
         self.returnStatus = "SELL"
         self.message = 'It would be best to book profits and sell.'
         return self.returnStatus
     elif buyToCurrentRation < predictor.lossMax:
         self.returnStatus = "SELL"
         self.message = 'Cut your losses and sell the stock'
         return self.returnStatus
 def __init__(self, userId):
     self.db = dbAccessor()
     self.userId = userId
     self.purchases = self.db.getUserPurchases(self.userId)
Exemple #6
0
 def getPortfolioAnalysis(self, userId):
     self.userId = userId
     db = dbAccessor()
     self.allStocks = db.getInvestments(self.userId)
     return self.categorizePortfolio(self.allStocks)
 def getPortfolioAnalysis(self,userId):
     self.userId = userId
     db = dbAccessor()
     self.allStocks = db.getInvestments(self.userId)
     t1 = self.categorizePortfolio(self.allStocks)
     return sorted(t1.items(), reverse=True, key= operator.itemgetter(1))
Exemple #8
0
 def __init__(self, userId):
     self.db = dbAccessor()
     self.userId = userId
     self.purchases = self.db.getUserPurchases(self.userId)