mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
Hotfix/4526 (#4682)
* Added fixes * Merged * Merged * Added some handling of errors * Adds some read dbs * Removed useless commands * Added fixes * Added fixes * Added fix * Added fix * Added fix * Added fix * Added fix * Added fix * Fixed tests * Handle lowercase * Added fxes * small ticker thing --------- Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
@@ -173,8 +173,6 @@ class StocksDiscovery(Category):
|
||||
self.arkord = lib.stocks_disc_ark_model.get_ark_orders
|
||||
self.asc = lib.stocks_disc_yahoofinance_model.get_asc
|
||||
self.dividends = lib.stocks_disc_nasdaq_model.get_dividend_cal
|
||||
self.filings = lib.stocks_fa_fmp_model.get_filings
|
||||
self.filings_chart = lib.stocks_disc_fmp_view.display_filings
|
||||
self.fipo = lib.stocks_disc_finnhub_model.get_future_ipo
|
||||
self.gainers = lib.stocks_disc_yahoofinance_model.get_gainers
|
||||
self.gtech = lib.stocks_disc_yahoofinance_model.get_gtech
|
||||
@@ -334,8 +332,6 @@ class StocksFundamentalAnalysis(Category):
|
||||
self.rot_chart = lib.stocks_fa_finnhub_view.rating_over_time
|
||||
self.score = lib.stocks_fa_fmp_model.get_score
|
||||
self.sec = lib.stocks_fa_marketwatch_model.get_sec_filings
|
||||
self.sec_fmp = lib.stocks_fa_fmp_model.get_filings
|
||||
self.sec_fmp_chart = lib.stocks_fa_fmp_view.display_filings
|
||||
self.shrs = lib.stocks_fa_yahoo_finance_model.get_shareholders
|
||||
self.similar_dfs = lib.stocks_fa_dcf_model.get_similar_dfs
|
||||
self.splits = lib.stocks_fa_yahoo_finance_model.get_splits
|
||||
|
||||
@@ -322,7 +322,6 @@ from openbb_terminal.stocks.dark_pool_shorts import (
|
||||
from openbb_terminal.stocks.discovery import (
|
||||
ark_model as stocks_disc_ark_model,
|
||||
finnhub_model as stocks_disc_finnhub_model,
|
||||
fmp_view as stocks_disc_fmp_view,
|
||||
nasdaq_model as stocks_disc_nasdaq_model,
|
||||
seeking_alpha_model as stocks_disc_seeking_alpha_model,
|
||||
shortinterest_model as stocks_disc_shortinterest_model,
|
||||
|
||||
2
openbb_terminal/core/sdk/trail_map.csv
vendored
2
openbb_terminal/core/sdk/trail_map.csv
vendored
@@ -411,7 +411,6 @@ stocks.disc.active,stocks_disc_yahoofinance_model.get_active,
|
||||
stocks.disc.arkord,stocks_disc_ark_model.get_ark_orders,
|
||||
stocks.disc.asc,stocks_disc_yahoofinance_model.get_asc,
|
||||
stocks.disc.dividends,stocks_disc_nasdaq_model.get_dividend_cal,
|
||||
stocks.disc.filings,stocks_fa_fmp_model.get_filings,stocks_disc_fmp_view.display_filings
|
||||
stocks.disc.fipo,stocks_disc_finnhub_model.get_future_ipo,
|
||||
stocks.disc.gainers,stocks_disc_yahoofinance_model.get_gainers,
|
||||
stocks.disc.gtech,stocks_disc_yahoofinance_model.get_gtech,
|
||||
@@ -473,7 +472,6 @@ stocks.fa.revfc,stocks_fa_seeking_alpha_model.get_estimates_rev,
|
||||
stocks.fa.rot,stocks_fa_finnhub_model.get_rating_over_time,stocks_fa_finnhub_view.rating_over_time
|
||||
stocks.fa.score,stocks_fa_fmp_model.get_score,
|
||||
stocks.fa.sec,stocks_fa_marketwatch_model.get_sec_filings,
|
||||
stocks.fa.sec_fmp,stocks_fa_fmp_model.get_filings,stocks_fa_fmp_view.display_filings
|
||||
stocks.fa.shrs,stocks_fa_yahoo_finance_model.get_shareholders,
|
||||
stocks.fa.similar_dfs,stocks_fa_dcf_model.get_similar_dfs,
|
||||
stocks.fa.splits,stocks_fa_yahoo_finance_model.get_splits,stocks_fa_yahoo_finance_view.display_splits
|
||||
|
||||
|
@@ -666,8 +666,7 @@
|
||||
"AlphaVantage"
|
||||
],
|
||||
"sec": [
|
||||
"MarketWatch",
|
||||
"FinancialModelingPrep"
|
||||
"Nasdaq"
|
||||
],
|
||||
"analysis": [
|
||||
"Elect"
|
||||
|
||||
@@ -25,7 +25,6 @@ from openbb_terminal.stocks.discovery import (
|
||||
ark_view,
|
||||
finnhub_view,
|
||||
finviz_view,
|
||||
fmp_view,
|
||||
nasdaq_view,
|
||||
seeking_alpha_view,
|
||||
shortinterest_view,
|
||||
@@ -60,7 +59,6 @@ class DiscoveryController(BaseController):
|
||||
"rtat",
|
||||
"divcal",
|
||||
"heatmap",
|
||||
"filings",
|
||||
]
|
||||
|
||||
arkord_sortby_choices = [
|
||||
@@ -127,7 +125,6 @@ class DiscoveryController(BaseController):
|
||||
def print_help(self):
|
||||
"""Print help"""
|
||||
mt = MenuText("stocks/disc/")
|
||||
mt.add_cmd("filings", "FinancialModelingPrep")
|
||||
mt.add_cmd("pipo", "Finnhub")
|
||||
mt.add_cmd("fipo", "Finnhub")
|
||||
mt.add_cmd("gainers", "Yahoo Finance")
|
||||
@@ -913,42 +910,3 @@ class DiscoveryController(BaseController):
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_filings(self, other_args: List[str]) -> None:
|
||||
"""Process Filings command"""
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
prog="filings",
|
||||
description="The most-recent filings submitted to the SEC",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-p",
|
||||
"--pages",
|
||||
dest="pages",
|
||||
metavar="pages",
|
||||
type=int,
|
||||
default=1,
|
||||
help="The number of pages to get data from (1000 entries/page; maximum 30 pages)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-t",
|
||||
"--today",
|
||||
dest="today",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Show all filings from today",
|
||||
)
|
||||
if other_args and "-" not in other_args[0][0]:
|
||||
other_args.insert(0, "-l")
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
other_args,
|
||||
EXPORT_ONLY_RAW_DATA_ALLOWED,
|
||||
limit=5,
|
||||
)
|
||||
if ns_parser:
|
||||
fmp_view.display_filings(
|
||||
ns_parser.pages, ns_parser.limit, ns_parser.today, ns_parser.export
|
||||
)
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
""" Financial Modeling Prep View """
|
||||
__docformat__ = "numpy"
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.helper_funcs import export_data
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.stocks.fundamental_analysis import fmp_model
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def display_filings(
|
||||
pages: int = 1,
|
||||
limit: int = 5,
|
||||
today: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: Optional[str] = None,
|
||||
) -> None:
|
||||
"""Display recent forms submitted to the SEC
|
||||
Parameters
|
||||
----------
|
||||
pages: int = 1
|
||||
The range of most-rececnt pages to get entries from (1000 per page, max 30 pages)
|
||||
limit: int = 5
|
||||
Limit the number of entries to display (default: 5)
|
||||
today: bool = False
|
||||
Show all from today
|
||||
export: str = ""
|
||||
Export data as csv, json, or xlsx
|
||||
Examples
|
||||
--------
|
||||
openbb.stocks.display_filings()
|
||||
openbb.stocks.display_filings(today = True, export = "csv")
|
||||
"""
|
||||
filings = fmp_model.get_filings(pages)
|
||||
if today is True:
|
||||
now: str = datetime.datetime.now().strftime("%Y-%m-%d")
|
||||
iso_today: int = datetime.datetime.today().isoweekday()
|
||||
if iso_today < 6 and not filings.empty:
|
||||
filings = filings.filter(like=now, axis=0)
|
||||
limit = 1000
|
||||
else:
|
||||
console.print(
|
||||
"[red]No filings today, displaying the most recent submissions instead[/red]"
|
||||
)
|
||||
|
||||
if not filings.empty:
|
||||
filings.reset_index(["Date"], inplace=True)
|
||||
for _, row in filings.head(limit).iterrows():
|
||||
console.print(
|
||||
"Timestamp: ",
|
||||
f"{row['Date']}",
|
||||
" US/Eastern",
|
||||
"\n",
|
||||
"Ticker: ",
|
||||
f"{row['Ticker']}",
|
||||
"\n",
|
||||
"CIK: " f"{row['CIK']}",
|
||||
"\n",
|
||||
"Form Type: ",
|
||||
f"{row['Form Type']}",
|
||||
"\n",
|
||||
f"{row['Title']}",
|
||||
"\n",
|
||||
f"{row['URL']}\n",
|
||||
sep="",
|
||||
)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"filings",
|
||||
filings,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
logger.error("Could not get data")
|
||||
console.print("[red]Could not get data[/red]\n")
|
||||
@@ -32,6 +32,7 @@ from openbb_terminal.stocks.fundamental_analysis import (
|
||||
finviz_view,
|
||||
fmp_view,
|
||||
market_watch_view,
|
||||
marketwatch_model,
|
||||
marketwatch_view,
|
||||
polygon_view,
|
||||
seeking_alpha_view,
|
||||
@@ -2019,14 +2020,23 @@ class FundamentalAnalysisController(StockBaseController):
|
||||
default=20,
|
||||
help="number of latest SEC filings.",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-p",
|
||||
"--pages",
|
||||
dest="pages",
|
||||
"-y",
|
||||
"--year",
|
||||
action="store",
|
||||
dest="year",
|
||||
type=check_positive,
|
||||
default=5,
|
||||
help="number of pages of SEC filings to search through, only relevant for FinancialModellingPrep.",
|
||||
default=None,
|
||||
help="year of SEC filings.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-f",
|
||||
"--form",
|
||||
action="store",
|
||||
dest="form",
|
||||
type=str,
|
||||
help="form group of SEC filings.",
|
||||
choices=marketwatch_model.FORM_GROUP.keys(),
|
||||
)
|
||||
|
||||
if other_args and "-" not in other_args[0][0]:
|
||||
@@ -2043,25 +2053,16 @@ class FundamentalAnalysisController(StockBaseController):
|
||||
console.print(no_ticker_message)
|
||||
return
|
||||
|
||||
if ns_parser.source == "MarketWatch":
|
||||
marketwatch_view.sec_filings(
|
||||
symbol=ns_parser.ticker,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
if ns_parser.source == "FinancialModelingPrep":
|
||||
fmp_view.display_filings(
|
||||
ns_parser.ticker,
|
||||
ns_parser.pages,
|
||||
ns_parser.limit,
|
||||
ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
marketwatch_view.sec_filings(
|
||||
symbol=ns_parser.ticker,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
year=ns_parser.year,
|
||||
form_group=ns_parser.form,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_supplier(self, other_args: List[str]):
|
||||
|
||||
@@ -675,72 +675,6 @@ def clean_metrics_df(data: pd.DataFrame, num: int, mask: bool = False) -> pd.Dat
|
||||
return data
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_filings(
|
||||
pages: int = 1,
|
||||
) -> pd.DataFrame:
|
||||
"""Get SEC Filings RSS feed, disseminated by FMP
|
||||
|
||||
Parameters
|
||||
----------
|
||||
pages: range = 1
|
||||
The range of most-rececnt pages to get entries from (1000 per page; maximum of 30 pages)
|
||||
|
||||
Returns
|
||||
-------
|
||||
df: pd.DataFrame
|
||||
Dataframe of results
|
||||
|
||||
Examples
|
||||
--------
|
||||
df = openbb.stocks.filings()
|
||||
|
||||
df = openbb.stocks.filings(pages=30)
|
||||
"""
|
||||
current_user = get_current_user()
|
||||
temp = []
|
||||
try:
|
||||
for i in range(pages):
|
||||
temp.append(
|
||||
pd.read_json(
|
||||
"https://financialmodelingprep.com/api/v3/rss_feed?&page="
|
||||
f"{i}"
|
||||
"&apikey="
|
||||
f"{current_user.credentials.API_KEY_FINANCIALMODELINGPREP}"
|
||||
)
|
||||
)
|
||||
df = pd.concat(temp)
|
||||
df = df.rename(
|
||||
columns={
|
||||
"title": "Title",
|
||||
"date": "Date",
|
||||
"link": "URL",
|
||||
"cik": "CIK",
|
||||
"form_type": "Form Type",
|
||||
"ticker": "Ticker",
|
||||
},
|
||||
)
|
||||
df_columns = ["Date", "Ticker", "CIK", "Form Type", "Title", "URL"]
|
||||
df = (
|
||||
pd.DataFrame(df, columns=df_columns)
|
||||
.set_index(keys=["Date"])
|
||||
.copy()
|
||||
.sort_index(ascending=False)
|
||||
)
|
||||
|
||||
# Invalid API Keys
|
||||
except ValueError as e:
|
||||
console.print(e)
|
||||
df = pd.DataFrame()
|
||||
# Premium feature, API plan is not authorized
|
||||
except HTTPError as e:
|
||||
console.print(e)
|
||||
df = pd.DataFrame()
|
||||
|
||||
return df
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_rating(symbol: str) -> pd.DataFrame:
|
||||
|
||||
@@ -705,69 +705,6 @@ def display_financial_statement_growth(
|
||||
console.print("[red]Could not get data[/red]\n")
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def display_filings(
|
||||
ticker: str = "",
|
||||
pages: int = 1,
|
||||
limit: int = 20,
|
||||
export: str = "",
|
||||
sheet_name: Optional[str] = None,
|
||||
) -> None:
|
||||
"""Display recent forms submitted to the SEC
|
||||
|
||||
Parameters
|
||||
----------
|
||||
pages: int = 1
|
||||
The range of most-rececnt pages to get entries from (1000 per page, max 30 pages)
|
||||
limit: int = 20
|
||||
Limit the number of entries to display (default: 20)
|
||||
export: str = ""
|
||||
Export data as csv, json, or xlsx
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
openbb.stocks.display_filings()
|
||||
|
||||
openbb.stocks.display_filings(today = True, export = "csv")
|
||||
"""
|
||||
filings = fmp_model.get_filings(pages)
|
||||
ticker_filings = filings[filings["Ticker"] == ticker.upper()]
|
||||
|
||||
if ticker_filings.empty:
|
||||
console.print(
|
||||
f"[red]No filings found for ticker {ticker}, consider increasing the value "
|
||||
"for --pages. Showing recent filings instead.[/red]\n"
|
||||
)
|
||||
print_rich_table(
|
||||
filings,
|
||||
title=f"Recent SEC Filings [Limit: {limit}]",
|
||||
show_index=True,
|
||||
export=bool(export),
|
||||
limit=limit,
|
||||
)
|
||||
elif not ticker_filings.empty:
|
||||
print_rich_table(
|
||||
ticker_filings,
|
||||
title=f"SEC Filings for {ticker} [Limit: {limit}]]",
|
||||
show_index=True,
|
||||
export=bool(export),
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"filings",
|
||||
ticker_filings,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
logger.error("Could not find any data.")
|
||||
console.print("[red]Could not find any data for {ticker}[/red]\n")
|
||||
|
||||
|
||||
def add_color(value: str) -> str:
|
||||
if "buy" in value.lower():
|
||||
value = f"[green]{value}[/green]"
|
||||
|
||||
@@ -2,70 +2,90 @@
|
||||
__docformat__ = "numpy"
|
||||
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
import pandas as pd
|
||||
from bs4 import BeautifulSoup
|
||||
from requests.exceptions import ReadTimeout
|
||||
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.helper_funcs import get_user_agent, request
|
||||
from openbb_terminal.helper_funcs import request
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
# pylint: disable=too-many-branches
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
FORM_GROUP = {
|
||||
"annual": "Annual%20Reports",
|
||||
"quarterly": "Quarterly%20Reports",
|
||||
"proxies": "Proxies%20and%20Info%20Statements",
|
||||
"insiders": "Insider%20Transactions",
|
||||
"8-K": "8-K%20Related",
|
||||
"registrations": "Registration%20Statements",
|
||||
"comments": "Comment%20Letters",
|
||||
}
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_sec_filings(symbol: str) -> pd.DataFrame:
|
||||
def get_sec_filings(
|
||||
symbol: str,
|
||||
limit: int = 20,
|
||||
year: Optional[int] = None,
|
||||
form_group: Optional[str] = None,
|
||||
) -> pd.DataFrame:
|
||||
"""Get SEC filings for a given stock ticker. [Source: Market Watch]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
symbol : str
|
||||
Stock ticker symbol
|
||||
limit : int
|
||||
The number of filings to return
|
||||
year: Optional[int]
|
||||
The year to grab from. The year will be ignored if form_group is not specified
|
||||
form_group: Optional[str]
|
||||
The form type to filter for:
|
||||
Choose from: annual, quarterly, proxies, insiders, 8-K, registrations, comments
|
||||
|
||||
Returns
|
||||
-------
|
||||
df_financials : pd.DataFrame
|
||||
SEC filings data
|
||||
"""
|
||||
|
||||
base_url = f"https://api.nasdaq.com/api/company/{symbol}/sec-filings"
|
||||
arguments = f"?limit={limit}&sortColumn=filed&sortOrder=desc&IsQuoteMedia=true"
|
||||
valid_form_group = False
|
||||
if form_group in FORM_GROUP:
|
||||
arguments = f"{arguments}&formGroup={FORM_GROUP[form_group]}"
|
||||
valid_form_group = True
|
||||
if year and valid_form_group:
|
||||
arguments = f"{arguments}&Year={year}"
|
||||
elif year:
|
||||
console.print("Year will be ignored if form_group is not specified")
|
||||
try:
|
||||
response = request(base_url + arguments)
|
||||
except ReadTimeout:
|
||||
return pd.DataFrame()
|
||||
try:
|
||||
data = response.json()["data"]["rows"]
|
||||
except KeyError:
|
||||
return pd.DataFrame()
|
||||
final_df = pd.DataFrame(data)
|
||||
pd.set_option("display.max_colwidth", None)
|
||||
|
||||
url_financials = (
|
||||
f"https://www.marketwatch.com/investing/stock/{symbol}/financials/secfilings"
|
||||
try:
|
||||
final_df["view"] = final_df["view"].apply(lambda x: x["htmlLink"])
|
||||
except KeyError:
|
||||
return pd.DataFrame()
|
||||
final_df = final_df.rename(
|
||||
columns={
|
||||
"companyName": "Company Name",
|
||||
"reportingOwner": "Reporting Owner",
|
||||
"formType": "Form Type",
|
||||
"filed": "Filed",
|
||||
"view": "View",
|
||||
"period": "Period",
|
||||
}
|
||||
)
|
||||
|
||||
text_soup_financials = BeautifulSoup(
|
||||
request(url_financials, headers={"User-Agent": get_user_agent()}).text,
|
||||
"lxml",
|
||||
)
|
||||
|
||||
# a_financials_header = list()
|
||||
df_financials = None
|
||||
b_ready_to_process_info = False
|
||||
soup_financials = text_soup_financials.findAll("tr", {"class": "table__row"})
|
||||
for financials_info in soup_financials:
|
||||
a_financials = financials_info.text.split("\n")
|
||||
|
||||
# If header has been processed and dataframe created ready to populate the SEC information
|
||||
if b_ready_to_process_info and len(a_financials) > 1:
|
||||
l_financials_info = [a_financials[2]]
|
||||
l_financials_info.extend(a_financials[5:-1])
|
||||
l_financials_info.append(financials_info.a["href"])
|
||||
# Append data values to financials
|
||||
df_financials.loc[len(df_financials.index)] = l_financials_info # type: ignore
|
||||
|
||||
if "Filing Date" in a_financials and len(a_financials) > 1:
|
||||
l_financials_header = [a_financials[2]]
|
||||
l_financials_header.extend(a_financials[5:-1])
|
||||
l_financials_header.append("Link")
|
||||
|
||||
df_financials = pd.DataFrame(columns=l_financials_header)
|
||||
df_financials.set_index("Filing Date")
|
||||
b_ready_to_process_info = True
|
||||
|
||||
# Set Filing Date as index
|
||||
df_financials = df_financials.set_index("Filing Date") # type: ignore
|
||||
|
||||
return df_financials
|
||||
final_df = final_df.set_index("Filed")
|
||||
return final_df
|
||||
|
||||
@@ -5,8 +5,11 @@ import logging
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.helper_funcs import export_data, print_rich_table
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.stocks.fundamental_analysis import marketwatch_model
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -14,7 +17,12 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def sec_filings(
|
||||
symbol: str, limit: int = 5, export: str = "", sheet_name: Optional[str] = None
|
||||
symbol: str,
|
||||
limit: int = 5,
|
||||
export: str = "",
|
||||
sheet_name: Optional[str] = None,
|
||||
year: Optional[int] = None,
|
||||
form_group: Optional[str] = None,
|
||||
):
|
||||
"""Display SEC filings for a given stock ticker. [Source: Market Watch]
|
||||
|
||||
@@ -24,12 +32,22 @@ def sec_filings(
|
||||
Stock ticker symbol
|
||||
limit: int
|
||||
Number of ratings to display
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Export dataframe data to csv,json,xlsx file
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
year: Optional[int]
|
||||
The year to grab from. The year will be ignored if form_group is not specified
|
||||
form_group: Optional[str]
|
||||
The form type to filter for:
|
||||
Choose from: annual, quarterly, proxies, insiders, 8-K, registrations, comments
|
||||
"""
|
||||
df_financials = marketwatch_model.get_sec_filings(symbol)
|
||||
df_financials = marketwatch_model.get_sec_filings(
|
||||
symbol.upper().replace("-", "."), limit, year, form_group
|
||||
)
|
||||
if not isinstance(df_financials, pd.DataFrame) or df_financials.empty:
|
||||
console.print(f"No data found for {symbol}")
|
||||
return
|
||||
print_rich_table(
|
||||
df_financials,
|
||||
headers=list(df_financials.columns),
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
# IMPORTATION STANDARD
|
||||
|
||||
# IMPORTATION THIRDPARTY
|
||||
import pytest
|
||||
|
||||
# IMPORTATION INTERNAL
|
||||
from openbb_terminal.stocks.discovery import fmp_view
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def vcr_config():
|
||||
return {
|
||||
"filter_headers": [("User-Agent", None)],
|
||||
"filter_query_parameters": [
|
||||
("apikey", "MOCK_API_KEY"),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.vcr
|
||||
@pytest.mark.record_stdout
|
||||
def test_display_filings():
|
||||
fmp_view.display_filings()
|
||||
@@ -1,4 +1,3 @@
|
||||
filings the most-recent form submissions to the SEC [FinancialModelingPrep]
|
||||
pipo past IPOs dates [Finnhub]
|
||||
fipo future IPOs dates [Finnhub]
|
||||
gainers show latest top gainers [YahooFinance]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,21 +1,2 @@
|
||||
Filing Date,Document Date,Type,Category,Amended,Link
|
||||
02/01/2023,N/A,SC 13G/A,Institutional Ownership,*,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16356194
|
||||
01/31/2023,12/31/2022,10-K,Annual Reports,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16349444
|
||||
01/25/2023,01/20/2023,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16335601
|
||||
01/03/2023,01/02/2023,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16290601
|
||||
10/24/2022,09/30/2022,10-Q,Quarterly Reports,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16146849
|
||||
10/19/2022,10/19/2022,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16142506
|
||||
10/03/2022,10/02/2022,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16112851
|
||||
09/28/2022,09/25/2022,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16105028
|
||||
08/05/2022,08/04/2022,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15996693
|
||||
07/25/2022,06/30/2022,10-Q,Quarterly Reports,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15962560
|
||||
07/20/2022,07/20/2022,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15957404
|
||||
07/05/2022,07/02/2022,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15929600
|
||||
06/23/2022,08/04/2022,DEF 14A,Proxy Statement,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15908062
|
||||
06/10/2022,08/04/2022,PRE 14A,Proxy Statement,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15885451
|
||||
05/03/2022,05/02/2022,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15780473
|
||||
05/02/2022,12/31/2021,10-K/A,Annual Reports,*,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15774524
|
||||
04/25/2022,03/31/2022,10-Q,Quarterly Reports,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15748453
|
||||
04/20/2022,04/20/2022,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15741161
|
||||
04/04/2022,04/02/2022,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15707913
|
||||
03/28/2022,03/28/2022,8-K,Special Events,,https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15686194
|
||||
Filed,Company Name,Reporting Owner,Form Type,Period,View
|
||||
02/13/2020,Tesla Inc.,,10-K,,https://app.quotemedia.com/data/downloadFiling?webmasterId=90423&ref=114788198&type=HTML&symbol=TSLA&companyName=Tesla+Inc.&formType=10-K&formDescription=Annual+report+pursuant+to+Section+13+or+15%28d%29&dateFiled=2020-02-13
|
||||
|
||||
|
@@ -615,6 +615,8 @@ def test_call_func_expect_queue(expected_queue, queue, func):
|
||||
"limit": 10,
|
||||
"export": "",
|
||||
"sheet_name": None,
|
||||
"year": None,
|
||||
"form_group": None,
|
||||
},
|
||||
),
|
||||
(
|
||||
|
||||
@@ -66,10 +66,6 @@ def test_get_score():
|
||||
"get_financial_growth",
|
||||
{"symbol": "PM", "limit": 5, "quarterly": False},
|
||||
),
|
||||
(
|
||||
"get_filings",
|
||||
{},
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.record_stdout
|
||||
|
||||
@@ -27,12 +27,6 @@ def test_valinvest_score():
|
||||
fmp_view.valinvest_score(symbol="PM", years=10)
|
||||
|
||||
|
||||
@pytest.mark.vcr
|
||||
@pytest.mark.record_stdout
|
||||
def test_display_filings():
|
||||
fmp_view.display_filings()
|
||||
|
||||
|
||||
@pytest.mark.vcr
|
||||
@pytest.mark.record_stdout
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -17,5 +17,7 @@ def vcr_config():
|
||||
|
||||
@pytest.mark.vcr
|
||||
def test_get_rating_over_time(recorder):
|
||||
result_df = marketwatch_model.get_sec_filings(symbol="TSLA")
|
||||
result_df = marketwatch_model.get_sec_filings(
|
||||
symbol="TSLA", year=2020, form_group="annual"
|
||||
)
|
||||
recorder.capture(result_df)
|
||||
|
||||
@@ -10,4 +10,6 @@ from openbb_terminal.stocks.fundamental_analysis import marketwatch_view
|
||||
@pytest.mark.vcr
|
||||
@pytest.mark.record_stdout
|
||||
def test_analyst():
|
||||
marketwatch_view.sec_filings(symbol="TSLA", limit=5, export=None)
|
||||
marketwatch_view.sec_filings(
|
||||
symbol="TSLA", limit=5, export=None, year=2020, form_group="annual"
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ Financial Statements:
|
||||
ratios extensive set of ratios over time [FinancialModelingPrep]
|
||||
dupont detailed breakdown for Return on Equity (RoE) [AlphaVantage]
|
||||
fraud key fraud ratios including M-score, Z-score and McKee [AlphaVantage]
|
||||
sec obtain recent SEC filings of the company [MarketWatch, FinancialModelingPrep]
|
||||
sec obtain recent SEC filings of the company [Nasdaq]
|
||||
analysis analyse SEC filings with the help of machine learning [Elect]
|
||||
|
||||
Future Expectations:
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
Document Date Type Category Amended Link
|
||||
Filing Date
|
||||
02/01/2023 N/A SC 13G/A Institutional Ownership * https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16356194
|
||||
01/31/2023 12/31/2022 10-K Annual Reports https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16349444
|
||||
01/25/2023 01/20/2023 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16335601
|
||||
01/03/2023 01/02/2023 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16290601
|
||||
10/24/2022 09/30/2022 10-Q Quarterly Reports https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16146849
|
||||
10/19/2022 10/19/2022 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16142506
|
||||
10/03/2022 10/02/2022 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16112851
|
||||
09/28/2022 09/25/2022 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=16105028
|
||||
08/05/2022 08/04/2022 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15996693
|
||||
07/25/2022 06/30/2022 10-Q Quarterly Reports https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15962560
|
||||
07/20/2022 07/20/2022 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15957404
|
||||
07/05/2022 07/02/2022 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15929600
|
||||
06/23/2022 08/04/2022 DEF 14A Proxy Statement https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15908062
|
||||
06/10/2022 08/04/2022 PRE 14A Proxy Statement https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15885451
|
||||
05/03/2022 05/02/2022 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15780473
|
||||
05/02/2022 12/31/2021 10-K/A Annual Reports * https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15774524
|
||||
04/25/2022 03/31/2022 10-Q Quarterly Reports https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15748453
|
||||
04/20/2022 04/20/2022 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15741161
|
||||
04/04/2022 04/02/2022 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15707913
|
||||
03/28/2022 03/28/2022 8-K Special Events https://www.marketwatch.com/investing/stock/tsla/financials/secfilings?docid=15686194
|
||||
Company Name Reporting Owner Form Type Period View
|
||||
Filed
|
||||
02/13/2020 Tesla Inc. 10-K https://app.quotemedia.com/data/downloadFiling?webmasterId=90423&ref=114788198&type=HTML&symbol=TSLA&companyName=Tesla+Inc.&formType=10-K&formDescription=Annual+report+pursuant+to+Section+13+or+15%28d%29&dateFiled=2020-02-13
|
||||
|
||||
Reference in New Issue
Block a user