def get_position_for(self, ticker): """ return Position for a given ticker symbol for this Account. returns a list of Position objects """ ticker = ticker.lower() position = Position.all_from_where_clause( "WHERE account_pk=? AND ticker=?", (self.pk, ticker)) if not Position: return Position(ticker=ticker, number_shares=0, account_pk=self.pk) return position
def get_positions(self): """ return all Positions where account_pk == self.pk. returns a list of Position objects """ return Position.all_from_where_clause("WHERE account_pk=?", (self.pk, ))