示例#1
0
    def addToWatchlist(self, ticker):

        s = Stock(ticker)
        if (s.exists()):
            self.watchlist.append(s)
        else:
            print("This stock does not exist")
示例#2
0
 def buyStock(self, ticker, quanity):
     s = Stock(ticker)
     if (s.exists()):
         if self.cash - quanity * float(s.getPrice()) >= 0:
             self.cash -= quanity * float(s.getPrice())
             if ticker in self.stocks:
                 self.stocks[ticker] += quanity
             else:
                 self.stocks[ticker] = quanity
         else:
             print("You have insufficent funds for this trade")