mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
Add fa/analysis command to analyse filings using NLP (#761)
* Add alpaca keys to cfg_terminal * Add fa/analysis command for sec filings * no need for alpaca keys on config_terminal * fix eclect naming
This commit is contained in:
@@ -91,6 +91,8 @@ API_COINBASE_KEY = os.getenv("GT_API_COINBASE_KEY") or "REPLACE_ME"
|
||||
API_COINBASE_SECRET = os.getenv("GT_API_COINBASE_SECRET") or "REPLACE_ME"
|
||||
API_COINBASE_PASS_PHRASE = os.getenv("GT_API_COINBASE_PASS_PHRASE") or "REPLACE_ME"
|
||||
|
||||
# https://alpaca.markets/docs/api-documentation/api-v2/
|
||||
# GT_APCA_API_BASE_URL, GT_APCA_API_KEY_ID and GT_APCA_API_SECRET_KEY need to be set as env variable
|
||||
|
||||
# https://docs.whale-alert.io/
|
||||
API_WHALE_ALERT_KEY = os.getenv("GT_API_WHALE_ALERT_KEY") or "REPLACE_ME"
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
"""Eclect.us model"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
import requests
|
||||
|
||||
# pylint: disable=R1718
|
||||
|
||||
|
||||
def get_filings_analysis(ticker: str) -> str:
|
||||
"""Save time reading SEC filings with the help of machine learning. [Source: https://eclect.us]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
ticker: str
|
||||
Ticker to see analysis of filings
|
||||
|
||||
Returns
|
||||
-------
|
||||
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():
|
||||
return "\n\n".join(
|
||||
{
|
||||
sentence["sentence"]
|
||||
for sentence in result.json()[0]["daa_highlights"]
|
||||
}
|
||||
)
|
||||
|
||||
return ""
|
||||
@@ -0,0 +1,24 @@
|
||||
"""Eclect.us view"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
from gamestonk_terminal.stocks.fundamental_analysis import eclect_us_model
|
||||
|
||||
|
||||
def display_analysis(
|
||||
ticker: str,
|
||||
) -> None:
|
||||
"""Display analysis of SEC filings based on NLP model. [Source: https://eclect.us]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
ticker: str
|
||||
Ticker to do SEC filings analysis from
|
||||
"""
|
||||
|
||||
analysis = eclect_us_model.get_filings_analysis(ticker)
|
||||
|
||||
if analysis:
|
||||
print(analysis)
|
||||
else:
|
||||
print("No SEC filings analysis found for this ticker")
|
||||
print("")
|
||||
@@ -11,6 +11,7 @@ from gamestonk_terminal.stocks.fundamental_analysis.financial_modeling_prep impo
|
||||
fmp_view,
|
||||
)
|
||||
from gamestonk_terminal.stocks.fundamental_analysis import (
|
||||
eclect_us_view,
|
||||
finviz_view,
|
||||
yahoo_finance_view,
|
||||
av_view,
|
||||
@@ -37,6 +38,7 @@ class FundamentalAnalysisController:
|
||||
]
|
||||
|
||||
CHOICES_COMMANDS = [
|
||||
"analysis",
|
||||
"score",
|
||||
"dcf",
|
||||
"screener",
|
||||
@@ -108,6 +110,7 @@ Fundamental Analysis:
|
||||
|
||||
screener screen info about the company [Finviz]
|
||||
mgmt management team of the company [Business Insider]
|
||||
analysis analyse SEC filings with the help of machine learning [Elect.us]
|
||||
score investing score from Warren Buffett, Joseph Piotroski and Benjamin Graham [FMP]
|
||||
warnings company warnings according to Sean Seah book [Market Watch]
|
||||
dcf a customizable discounted cash flow created in excel [stockanalysis]
|
||||
@@ -181,6 +184,24 @@ Other Sources:
|
||||
"""Process Quit command - quit the program"""
|
||||
return True
|
||||
|
||||
def call_analysis(self, other_args: List[str]):
|
||||
"""Process analysis command"""
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
prog="analysis",
|
||||
description="""Display analysis of SEC filings based on NLP model. [Source: https://eclect.us]""",
|
||||
)
|
||||
try:
|
||||
ns_parser = parse_known_args_and_warn(parser, other_args)
|
||||
if not ns_parser:
|
||||
return
|
||||
|
||||
eclect_us_view.display_analysis(self.ticker)
|
||||
|
||||
except Exception as e:
|
||||
print(e, "\n")
|
||||
|
||||
def call_mgmt(self, other_args: List[str]):
|
||||
"""Process mgmt command"""
|
||||
business_insider_view.management(other_args, self.ticker)
|
||||
|
||||
10
website/content/stocks/fundamental_analysis/analysis/_index.md
vendored
Executable file
10
website/content/stocks/fundamental_analysis/analysis/_index.md
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
```text
|
||||
usage: analysis [-h]
|
||||
```
|
||||
|
||||
Display analysis of SEC filings based on NLP model. [Source: https://eclect.us]
|
||||
|
||||
```
|
||||
optional arguments:
|
||||
-h, --help show this help message (default: False)
|
||||
```
|
||||
2
website/data/menu/main.yml
vendored
2
website/data/menu/main.yml
vendored
@@ -197,6 +197,8 @@ main:
|
||||
ref: "/stocks/fundamental_analysis/screener"
|
||||
- name: mgmt
|
||||
ref: "/stocks/fundamental_analysis/mgmt"
|
||||
- name: analysis
|
||||
ref: "/stocks/fundamental_analysis/analysis"
|
||||
- name: score
|
||||
ref: "/stocks/fundamental_analysis/score"
|
||||
- name: warnings
|
||||
|
||||
Reference in New Issue
Block a user