def getLastTableDate(mysql_conn,ticker): query = "SELECT max(date) as date from investing.stats where ticker = '{}';".format(ticker) max_date = MySQL_func.execute_select_query(mysql_conn,query=query)['date'].iloc[0] return max_date
def getTickerData(mysql_conn, ticker): max_date = getLastTableDate(mysql_conn,ticker) query = "select * from investing.stats where date = '{}' AND ticker = '{}';".format(max_date,ticker) stats_data = MySQL_func.execute_select_query(mysql_conn,query=query) return stats_data
def getAllTickers(): host_name = 'localhost' user = '******' passwd = 'root' db_name = 'investing' mysql_conn = MySQL_func.connect_to_mysql_db(host_name,db_name,user,passwd) query = "SELECT ticker from investing.stats group by ticker;" tickers = MySQL_func.execute_select_query(mysql_conn,query=query)['ticker'].to_list() return tickers