def get_distinct_traded_stocks(self, user): result = self.db.query("select distinct stock from history where user=('%s')"%(user) + ";") if result: l=[] for i in range(len(result)): c = Company() c.set_name(result[i]['stock']) l.append(c) return l
def get_distinct_traded_stocks(self, user): result = self.db.query( "select distinct stock from history where user=('%s')" % (user) + ";") if result: l = [] for i in range(len(result)): c = Company() c.set_name(result[i]['stock']) l.append(c) return l
def get_company_model(self, symbol): result = self.db.query( "select Ask, Name, Volume from company_info where symbol = ('%s')" % (symbol) + ";") if result: c = Company() c.set_ask(result[0]['Ask']) c.set_name(result[0]['Name']) #c.set_percent_change(result[0]['PercentChange']) c.set_symbol(symbol) #c.set_avg_daily_volume(result[0]['AverageDailyVolume']) c.set_volume(result[0]['Volume']) return c
def get_company_model(self, symbol): result = self.db.query("select Ask, Name, Volume from company_info where symbol = ('%s')"%(symbol)+";") if result: c = Company() c.set_ask(result[0]['Ask']) c.set_name(result[0]['Name']) #c.set_percent_change(result[0]['PercentChange']) c.set_symbol(symbol) #c.set_avg_daily_volume(result[0]['AverageDailyVolume']) c.set_volume(result[0]['Volume']) return c
def get_list_of_company_models(self, symbols_list): if symbols_list: symbols_string = "" for i in range(len(symbols_list)): symbols_string = symbols_string + "'" + symbols_list[i] + "'" if i != len(symbols_list) - 1: symbols_string = symbols_string + "," result = self.db.query( "select ask, name, symbol from company_info where symbol in (" + symbols_string + ");") if result: l = [] for i in range(len(result)): c = Company() c.set_ask(result[i]['ask']) c.set_name(result[i]['name']) c.set_symbol(result[i]['symbol']) l.append(c) return l else: return False
def get_list_of_company_models(self, symbols_list): if symbols_list: symbols_string="" for i in range(len(symbols_list)): symbols_string = symbols_string + "'" + symbols_list[i] + "'" if i != len(symbols_list)-1: symbols_string = symbols_string + "," result = self.db.query("select ask, name, symbol from company_info where symbol in ("+symbols_string+");") if result: l=[] for i in range(len(result)): c = Company() c.set_ask(result[i]['ask']) c.set_name(result[i]['name']) c.set_symbol(result[i]['symbol']) l.append(c) return l else: return False