def sell(self, stock_set_id, num_of_units): if not self.acct: raise NoAccountSelectedError("No account selected") try: stock = Stock_Owned.get(id=stock_set_id) except Stock_Owned.DoesNotExist as e: raise e # Try to Sell Stock try: self.acct.sell_stock(stock, num_of_units) except StockNotOwnedError as e: raise e
def __get_sell_value(self, stock_set_id): # current price * number of shares stk = Stock_Owned.get_stock(stock_set_id) return stk.get_value()
def __get_buying_value(self, stock_set_id): # price paid * number of shares stk = Stock_Owned.get_stock(stock_set_id) return stk.get_buying_value()
def __get_buying_price(self, stock_set_id): ''' Returns the price the that the stock was bought bought-at ''' stk = Stock_Owned.get_stock(stock_set_id) return stk.purchase_price
def __get_buying_price(self, stock_set_id): """ Returns the price the that the stock was bought bought-at """ stk = Stock_Owned.get_stock(stock_set_id) return stk.purchase_price