mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-29 05:21:48 +00:00
* 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...
29 lines
601 B
Python
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 {}
|