Files
OpenBB/openbb_terminal/stocks/technical_analysis/finbrain_model.py
Pratyush Shukla 13283fbfce CI listing quick fix (#6002)
* BIGGGG LINTING

* fixing lints

* fixing lints

* black

* very ruff

* no export

* fix hedge_view again

* lints

* platform lints

* lints

* black

* black it @hjoaquim

* fix some more linting

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
2024-01-26 17:08:42 +00:00

39 lines
1005 B
Python

"""Finbrain model"""
__docformat__ = "numpy"
import logging
from openbb_terminal.decorators import log_start_end
from openbb_terminal.helper_funcs import request
from openbb_terminal.rich_config import console
logger = logging.getLogger(__name__)
@log_start_end(log=logger)
def get_technical_summary_report(symbol: str) -> str:
"""Get technical summary report provided by FinBrain's API
Parameters
----------
symbol : str
Ticker symbol to get the technical summary
Returns
-------
report: str
technical summary report
"""
result = request(f"https://api.finbrain.tech/v0/technicalSummary/{symbol}")
report = ""
if result.status_code == 200:
if "technicalSummary" in result.json():
report = result.json()["technicalSummary"]
else:
console.print("Unexpected data format from FinBrain API")
else:
console.print("Request error in retrieving sentiment from FinBrain API")
return report