mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-08 10:22:09 +00:00
* First wave of refactoring. yfinance and marketwatch menus * Finbrain commands refactored * Refactor finviz commands * Add custom ML model for running get * Bug fixes + dim ca commands when no similar selected * Add pylint disable * move ml command into yfinance stuff. fix typos * Change historical/corr to have interested ticker first * Pylint error * Comment out fa test
23 lines
559 B
Python
23 lines
559 B
Python
"""Finnhub model"""
|
|
__docformat__ = "numpy"
|
|
|
|
from typing import List, Tuple
|
|
import requests
|
|
from gamestonk_terminal import config_terminal as cfg
|
|
|
|
|
|
def get_similar_companies(ticker: str) -> Tuple[List[str], str]:
|
|
result = requests.get(
|
|
f"https://finnhub.io/api/v1/stock/peers?symbol={ticker}&token={cfg.API_FINNHUB_KEY}"
|
|
)
|
|
|
|
if result.status_code == 200:
|
|
similar = result.json()
|
|
user = "Finnhub"
|
|
|
|
else:
|
|
print("Similar companies not found.")
|
|
similar = [""]
|
|
user = "Error"
|
|
return similar, user
|