def setPrice(self, price): if isinstance(price, tuple): self.price = _s(price) else: self.price = DEFAULT_PRICE
def setGoalPrice(self, price): if isinstance(price, tuple): self.goal_price = _s(price) else: self.goal_price = ("0", "10000000")
line = line.strip() if line.startswith("#") or line == "": continue # handle line = line.replace('\"', "") pieces = line.split(",") s= stock.FavorStock(code=pieces[0], name=pieces[1]) s.setPrice(tuple(pieces[2:7])) s.setGoalPrice(tuple(pieces[-2:])) self.stock_pool.append(s) return self.stock_pool def get_pool(self): return self.stock_pool def output(self): return "\n".join(map(lambda p: p.output(), self.stock_pool)) if __name__ == "__main__": fu = FileUtil() print fu.output() s = stock.FavorStock("sh600112") s.setPrice(_s((1,2,3,4,5))) s.setGoalPrice(price=_s((30, 60))) fu.add(s) fu.remove("sh600112")