def get_position_for(self,symbol): where="WHERE account_pk=? and ticker=?" values=(self.pk,symbol) result=Position.select_one(where,values) if result: return result position=Position() position.account_pk=self.pk position.ticker=symbol position.shares=0 return position
def get_position_for(self, ticker): where = "WHERE account_pk = ? AND ticker = ?" values = (self.pk, ticker) result = Position.select_one(where, values) if result: return result position = Position() position.account_pk = self.pk position.ticker = ticker position.shares = 0 return position