update
This commit is contained in:
parent
ae3e47cb2d
commit
35cbff8bbd
@ -5,11 +5,13 @@ import asyncio
|
|||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import re
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
api_key = os.getenv('BENZINGA_API_KEY')
|
api_key = os.getenv('BENZINGA_API_KEY')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def get_endpoint(session, symbol):
|
async def get_endpoint(session, symbol):
|
||||||
url = "https://api.benzinga.com/api/v1/bulls_bears_say"
|
url = "https://api.benzinga.com/api/v1/bulls_bears_say"
|
||||||
querystring = {"token": api_key, "symbols": symbol}
|
querystring = {"token": api_key, "symbols": symbol}
|
||||||
@ -21,8 +23,10 @@ async def get_endpoint(session, symbol):
|
|||||||
for item in res['bulls_say_bears_say']:
|
for item in res['bulls_say_bears_say']:
|
||||||
date = datetime.fromtimestamp(item['updated'])
|
date = datetime.fromtimestamp(item['updated'])
|
||||||
date = date.strftime("%B %d, %Y")
|
date = date.strftime("%B %d, %Y")
|
||||||
formatted_data = {'date': date, 'bearSays': item['bear_case'], 'bullSays': item['bull_case']}
|
bull_case = item['bull_case']
|
||||||
except:
|
bear_case = item['bear_case']
|
||||||
|
formatted_data = {'date': date, 'bullSays': bull_case, 'bearSays': bear_case}
|
||||||
|
except Exception as e:
|
||||||
formatted_data = {}
|
formatted_data = {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
formatted_data = {}
|
formatted_data = {}
|
||||||
@ -35,7 +39,7 @@ async def run():
|
|||||||
|
|
||||||
cursor = con.cursor()
|
cursor = con.cursor()
|
||||||
cursor.execute("PRAGMA journal_mode = wal")
|
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 = [row[0] for row in cursor.fetchall()]
|
||||||
#stocks_symbols = ['NVDA']
|
#stocks_symbols = ['NVDA']
|
||||||
con.close()
|
con.close()
|
||||||
|
|||||||
@ -12,7 +12,7 @@ const twitchAPIKey = process.env.TWITCH_API_KEY;
|
|||||||
const twitchSecretKey = process.env.TWITCH_SECRET_KEY;
|
const twitchSecretKey = process.env.TWITCH_SECRET_KEY;
|
||||||
|
|
||||||
//const Mixpanel = require('mixpanel');
|
//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 got = require('got'); //Only version npm i got@11.8.3 works with ESM
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user