mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-29 04:32:43 +00:00
Fix stocks (#1035)
* Fix Stocks > FA > Eclect US * Fix Stocks > FA > Market Watch * Fix Stocks > FA > Eclect US : black * Fixing linting
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Eclect.us model"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
from collections import OrderedDict
|
||||
import requests
|
||||
from colorama import Style
|
||||
|
||||
@@ -20,29 +21,33 @@ def get_filings_analysis(ticker: str) -> str:
|
||||
str
|
||||
Analysis of filings text
|
||||
"""
|
||||
result = requests.get(f"https://api.eclect.us/symbol/{ticker.lower()}?page=1")
|
||||
|
||||
if result.status_code == 200:
|
||||
if result.json():
|
||||
rf_highlights = f"{Style.BRIGHT}\n\tRISK FACTORS:{Style.RESET_ALL}\n"
|
||||
rf_highlights_txt = "\n\n".join(
|
||||
{sentence["sentence"] for sentence in result.json()[0]["rf_highlights"]}
|
||||
)
|
||||
response = requests.get(f"https://api.eclect.us/symbol/{ticker.lower()}?page=1")
|
||||
|
||||
daa_highlights = (
|
||||
f"{Style.BRIGHT}\n\tDISCUSSION AND ANALYSIS:{Style.RESET_ALL}\n"
|
||||
)
|
||||
daa_highlights += "\n\n".join(
|
||||
{
|
||||
sentence["sentence"]
|
||||
for sentence in result.json()[0]["daa_highlights"]
|
||||
}
|
||||
)
|
||||
if response.status_code != 200:
|
||||
filings_analysis = ""
|
||||
else:
|
||||
response_dict = response.json()
|
||||
|
||||
return (
|
||||
rf_highlights + rf_highlights_txt + "\n" + daa_highlights
|
||||
if rf_highlights_txt
|
||||
else daa_highlights
|
||||
)
|
||||
rf_highlights = f"{Style.BRIGHT}\n\tRISK FACTORS:{Style.RESET_ALL}\n"
|
||||
rf_highlights_list = [
|
||||
sentence["sentence"] for sentence in response_dict[0]["rf_highlights"]
|
||||
]
|
||||
rf_highlights_list = list(OrderedDict.fromkeys(rf_highlights_list))
|
||||
rf_highlights_txt = "\n\n".join(rf_highlights_list)
|
||||
|
||||
return ""
|
||||
daa_highlights = (
|
||||
f"{Style.BRIGHT}\n\tDISCUSSION AND ANALYSIS:{Style.RESET_ALL}\n"
|
||||
)
|
||||
daa_highlights_list = [
|
||||
sentence["sentence"] for sentence in response_dict[0]["daa_highlights"]
|
||||
]
|
||||
daa_highlights_list = list(OrderedDict.fromkeys(daa_highlights_list))
|
||||
daa_highlights += "\n\n".join(daa_highlights_list)
|
||||
|
||||
if rf_highlights_txt:
|
||||
filings_analysis = rf_highlights + rf_highlights_txt + "\n" + daa_highlights
|
||||
else:
|
||||
filings_analysis = daa_highlights
|
||||
|
||||
return filings_analysis
|
||||
|
||||
@@ -265,7 +265,7 @@ def display_sean_seah_warnings(ticker: str, debug: bool = False):
|
||||
)
|
||||
)
|
||||
else:
|
||||
print(financials.to_string(()))
|
||||
print(financials.to_string())
|
||||
|
||||
if not warnings:
|
||||
print("No warnings found. Good stonk")
|
||||
|
||||
Reference in New Issue
Block a user