Files
OpenBB/gamestonk_terminal/common/behavioural_analysis/finnhub_model.py
jmaslek 876d1aab3e Refactor BA Menu (#768)
* Finnhub and finbrain fns

* Twitter menu (forex/ba  adjusted)

* Google menu

* Reddit menu pt1

* Reddit commands

* Stocktwits commands

* Sentimentinvestor commands

* Update crypto-dd

* Review pt 1

* Hugo server

* Review comments - get rid of all prints/errors in model...
2021-10-01 12:01:00 -04:00

29 lines
601 B
Python

"""Finnhub Model"""
__docformat__ = "numpy"
from typing import Dict
import requests
from gamestonk_terminal import config_terminal as cfg
def get_sentiment_stats(ticker: str) -> Dict:
"""Get sentiment stats [Source: finnhub]
Parameters
----------
ticker : str
Ticker to get sentiment stats
Returns
-------
Dict
Get sentiment stats
"""
response = requests.get(
f"https://finnhub.io/api/v1/news-sentiment?symbol={ticker}&token={cfg.API_FINNHUB_KEY}"
)
if response.status_code == 200:
return response.json()
return {}