def statistics_activity_comments(): """ Display comment activity statistics """ statistics = db_client.find_all('top-stats-global', {})[0]['comments_activity'] return jsonify(statistics)
def statistics(): """ Display statistics """ statistics = db_client.find_all('top-stats-global', {})[0] statistics[ 'last_update'] = f'{statistics["last_update"].strftime("%Y-%m-%d %H:%M:%S")} UTC' return jsonify(statistics)
def stock_frequency_historic(stock_name): """ Display current stock frequency from database (historic) """ stock_frequency = db_client.find_all('top-stocks-historic', {'stock_name': stock_name.upper()}) if stock_frequency: stock_frequency = stock_frequency[0]['historic_data'] stock_frequency.reverse() return jsonify(stock_frequency)
def emoji_top(): """ Display top emojis """ top_emoji = db_client.find_all('top-emojis-global', {}) return jsonify(top_emoji[:10])
def keyword_top(): """ Display top keywords """ top_keywords = db_client.find_all('top-keywords', {}) return jsonify(top_keywords[:10])
def stock_list(): """ Display all stocks """ stocks = db_client.find_all('stock-list', {}) return jsonify(stocks)
def stock_frequency_top(): """ Display current stock frequency from database (top) """ stock_frequency = db_client.find_all('top-stocks-global', {}) return jsonify(stock_frequency[:10])
def market_data(): """ Display latest price 10 and a percentage diff from daily open for top 10 stocks mentioned. """ intraday_market_data = db_client.find_all('top-intraday-data', {}) return jsonify(intraday_market_data)