示例#1
0
文件: stock.py 项目: beachmg/raychen
 def setPrice(self, price):
     if isinstance(price, tuple):
         self.price = _s(price)
     else:
         self.price = DEFAULT_PRICE
示例#2
0
文件: stock.py 项目: beachmg/raychen
    def setGoalPrice(self, price):

        if isinstance(price, tuple):
            self.goal_price = _s(price)
        else:
            self.goal_price = ("0", "10000000")
示例#3
0
 def setPrice(self, price):
     if isinstance(price, tuple):
         self.price = _s(price)
     else:
         self.price = DEFAULT_PRICE
示例#4
0
                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")
示例#5
0
    def setGoalPrice(self, price):

        if isinstance(price, tuple):
            self.goal_price = _s(price)
        else:
            self.goal_price = ("0", "10000000")