From 35cbff8bbd519c1eb49dc3616a55085a57211268 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Mon, 26 Aug 2024 01:20:50 +0200 Subject: [PATCH] update --- app/cron_bull_bear_say.py | 12 ++++++++---- fastify/app.js | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/cron_bull_bear_say.py b/app/cron_bull_bear_say.py index 36cd455..19cde8d 100755 --- a/app/cron_bull_bear_say.py +++ b/app/cron_bull_bear_say.py @@ -5,11 +5,13 @@ import asyncio import os from dotenv import load_dotenv from datetime import datetime - +import re load_dotenv() api_key = os.getenv('BENZINGA_API_KEY') + + async def get_endpoint(session, symbol): url = "https://api.benzinga.com/api/v1/bulls_bears_say" querystring = {"token": api_key, "symbols": symbol} @@ -21,8 +23,10 @@ async def get_endpoint(session, symbol): for item in res['bulls_say_bears_say']: date = datetime.fromtimestamp(item['updated']) date = date.strftime("%B %d, %Y") - formatted_data = {'date': date, 'bearSays': item['bear_case'], 'bullSays': item['bull_case']} - except: + bull_case = item['bull_case'] + bear_case = item['bear_case'] + formatted_data = {'date': date, 'bullSays': bull_case, 'bearSays': bear_case} + except Exception as e: formatted_data = {} except Exception as e: formatted_data = {} @@ -35,7 +39,7 @@ async def run(): cursor = con.cursor() cursor.execute("PRAGMA journal_mode = wal") - cursor.execute("SELECT DISTINCT symbol FROM stocks WHERE symbol != ?", ('%5EGSPC',)) + cursor.execute("SELECT DISTINCT symbol FROM stocks") stocks_symbols = [row[0] for row in cursor.fetchall()] #stocks_symbols = ['NVDA'] con.close() diff --git a/fastify/app.js b/fastify/app.js index 8f4ad10..4fbac00 100755 --- a/fastify/app.js +++ b/fastify/app.js @@ -12,7 +12,7 @@ const twitchAPIKey = process.env.TWITCH_API_KEY; const twitchSecretKey = process.env.TWITCH_SECRET_KEY; //const Mixpanel = require('mixpanel'); -const UAParser = require('ua-parser-js'); +//const UAParser = require('ua-parser-js'); const got = require('got'); //Only version npm i got@11.8.3 works with ESM const cheerio = require('cheerio');