def __call__(self, *args, **kwargs): sid = self.stock.type.alias + self.stock.sid print "[fetch] %s" % sid logger.info("[fetch] %s" % sid) try: #hexun foucs stock info hexunFocus = HexunFocus(self.stock.sid) hexunFocus.perform() logger.info("[%s] %d %d" % (self.stock.sid, hexunFocus.current_focus, hexunFocus.monthly_focus)) except Exception, e: print "%s - Unexpected error. %s" % (sid, e.message) logger.critical(e.message) return None
def __call__(self, *args, **kwargs): sid = self.stock.type.alias + self.stock.sid print "[fetch] %s" % sid logger.info("[fetch] %s" % sid) try: vote = SinaVote(sid) vote.perform() month_summary_data = vote.monthly daily_summary_data = vote.daily logger.info("[%s] %s" % (sid, daily_summary_data.__str__())) rate = self.__get_rate(month_summary_data) #fetch stock info stockInfo = StockInfo(sid) stockInfo.perform() #fetch hexun focus hexunFocus = HexunFocus(self.stock.sid) hexunFocus.perform() except Exception, e: print "%s - Unexpected error. %s" % (sid, e.message) logger.critical(e.message) return None