mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-06 17:31:53 +00:00
Merge branch 'feature/login' of github.com:OpenBB-finance/OpenBBTerminal into feature/login
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"stocks": {
|
||||
"filings": ["FinancialModelingPrep"],
|
||||
"search": ["FinanceDatabase"],
|
||||
"quote": ["YahooFinance"],
|
||||
"tob": ["CBOE"],
|
||||
|
||||
1
openbb_terminal/miscellaneous/i18n/en.yml
vendored
1
openbb_terminal/miscellaneous/i18n/en.yml
vendored
@@ -88,6 +88,7 @@ en:
|
||||
forecast: timeseries forecasting with machine learning
|
||||
portfolio: perform portfolio optimization and look at portfolio performance and attribution
|
||||
dashboards: interactive dashboards using voila and jupyter notebooks
|
||||
stocks/filings: the most-recent form submissions to the SEC
|
||||
stocks/search: search a specific stock ticker for analysis
|
||||
stocks/load: load a specific stock ticker and additional info for analysis
|
||||
stocks/_ticker: Stock
|
||||
|
||||
@@ -548,3 +548,5 @@ futures.search,openbb_terminal.futures.yfinance_model.get_search_futures,
|
||||
futures.historical,openbb_terminal.futures.yfinance_model.get_historical_futures,openbb_terminal.futures.yfinance_view.display_historical
|
||||
futures.curve,openbb_terminal.futures.yfinance_model.get_curve_futures,openbb_terminal.futures.yfinance_view.display_curve
|
||||
economy.get_groups,openbb_terminal.economy.finviz_model.get_groups,
|
||||
stocks.filings,openbb_terminal.stocks.fundamental_analysis.fmp_model.get_filings,openbb_terminal.stocks.fundamental_analysis.fmp_view.display_filings
|
||||
|
||||
|
||||
|
9
openbb_terminal/miscellaneous/scripts/stocks/test_stocks_filings.openbb
vendored
Normal file
9
openbb_terminal/miscellaneous/scripts/stocks/test_stocks_filings.openbb
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
script: test_stocks_filings.openbb
|
||||
- - - - - - - - - -
|
||||
|
||||
stocks
|
||||
filings
|
||||
filings --limit 200
|
||||
filings --today
|
||||
filings --pages 30 --limit 30000
|
||||
exit
|
||||
@@ -585,3 +585,69 @@ def clean_metrics_df(data: pd.DataFrame, num: int, mask: bool = True) -> pd.Data
|
||||
)
|
||||
|
||||
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)
|
||||
"""
|
||||
|
||||
temp = []
|
||||
try:
|
||||
for i in range(pages):
|
||||
temp.append(
|
||||
pd.read_json(
|
||||
"https://financialmodelingprep.com/api/v3/rss_feed?&page="
|
||||
f"{i}"
|
||||
"&apikey="
|
||||
f"{cfg.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
|
||||
|
||||
@@ -4,6 +4,7 @@ __docformat__ = "numpy"
|
||||
import logging
|
||||
import os
|
||||
|
||||
import datetime
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
|
||||
@@ -525,3 +526,76 @@ def display_financial_statement_growth(
|
||||
else:
|
||||
logger.error("Could not get data")
|
||||
console.print("[red]Could not get data[/red]\n")
|
||||
|
||||
|
||||
@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 = "",
|
||||
) -> 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,
|
||||
)
|
||||
else:
|
||||
logger.error("Could not get data")
|
||||
console.print("[red]Could not get data[/red]\n")
|
||||
|
||||
@@ -16,6 +16,7 @@ from openbb_terminal.common.quantitative_analysis import qa_view
|
||||
from openbb_terminal.custom_prompt_toolkit import NestedCompleter
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.stocks import cboe_view
|
||||
from openbb_terminal.stocks.fundamental_analysis import fmp_view
|
||||
|
||||
from openbb_terminal.helper_funcs import (
|
||||
EXPORT_ONLY_RAW_DATA_ALLOWED,
|
||||
@@ -50,6 +51,7 @@ class StocksController(StockBaseController):
|
||||
"news",
|
||||
"resources",
|
||||
"codes",
|
||||
"filings",
|
||||
]
|
||||
CHOICES_MENUS = [
|
||||
"ta",
|
||||
@@ -109,6 +111,7 @@ class StocksController(StockBaseController):
|
||||
stock_text += f" (from {self.start.strftime('%Y-%m-%d')})"
|
||||
|
||||
mt = MenuText("stocks/", 100)
|
||||
mt.add_cmd("filings")
|
||||
mt.add_cmd("search")
|
||||
mt.add_cmd("load")
|
||||
mt.add_raw("\n")
|
||||
@@ -151,6 +154,45 @@ class StocksController(StockBaseController):
|
||||
]
|
||||
return []
|
||||
|
||||
@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
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_search(self, other_args: List[str]):
|
||||
"""Process search command."""
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
3051
tests/openbb_terminal/stocks/fundamental_analysis/cassettes/test_fmp_view/test_display_filings.yaml
vendored
Normal file
3051
tests/openbb_terminal/stocks/fundamental_analysis/cassettes/test_fmp_view/test_display_filings.yaml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -71,6 +71,10 @@ def test_get_score():
|
||||
"get_financial_growth",
|
||||
{"symbol": "PM", "limit": 5, "quarterly": False},
|
||||
),
|
||||
(
|
||||
"get_filings",
|
||||
{},
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.record_stdout
|
||||
|
||||
@@ -24,6 +24,12 @@ def test_valinvest_score():
|
||||
fmp_view.valinvest_score(symbol="PM")
|
||||
|
||||
|
||||
@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(
|
||||
|
||||
35
tests/openbb_terminal/stocks/fundamental_analysis/txt/test_fmp_view/test_display_filings.txt
vendored
Normal file
35
tests/openbb_terminal/stocks/fundamental_analysis/txt/test_fmp_view/test_display_filings.txt
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
Timestamp: 2023-01-13 13:32:45 US/Eastern
|
||||
Ticker: GAME
|
||||
CIK: 1714562
|
||||
Form Type: 6-K
|
||||
6-K - Engine Gaming & Media, Inc. (0001714562) (Filer)
|
||||
https://www.sec.gov/Archives/edgar/data/1714562/000149315223001382/0001493152-23-001382-index.htm
|
||||
|
||||
Timestamp: 2023-01-13 13:25:12 US/Eastern
|
||||
Ticker: TEGY
|
||||
CIK: 1383394
|
||||
Form Type: 10-K
|
||||
10-K - TRANSACT ENERGY CORP (0001383394) (Filer)
|
||||
https://www.sec.gov/Archives/edgar/data/1383394/000139390523000016/0001393905-23-000016-index.htm
|
||||
|
||||
Timestamp: 2023-01-13 13:21:18 US/Eastern
|
||||
Ticker: MOR
|
||||
CIK: 1340243
|
||||
Form Type: 6-K
|
||||
6-K - MorphoSys AG (0001340243) (Filer)
|
||||
https://www.sec.gov/Archives/edgar/data/1340243/000162828023001015/0001628280-23-001015-index.htm
|
||||
|
||||
Timestamp: 2023-01-13 13:21:18 US/Eastern
|
||||
Ticker: MPSYF
|
||||
CIK: 1340243
|
||||
Form Type: 6-K
|
||||
6-K - MorphoSys AG (0001340243) (Filer)
|
||||
https://www.sec.gov/Archives/edgar/data/1340243/000162828023001015/0001628280-23-001015-index.htm
|
||||
|
||||
Timestamp: 2023-01-13 13:19:16 US/Eastern
|
||||
Ticker: DWAY
|
||||
CIK: 1394638
|
||||
Form Type: 10-K
|
||||
10-K - Driveitaway Holdings, Inc. (0001394638) (Filer)
|
||||
https://www.sec.gov/Archives/edgar/data/1394638/000173112223000046/0001731122-23-000046-index.htm
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
|
||||
filings the most-recent form submissions to the SEC [FinancialModelingPrep]
|
||||
search search a specific stock ticker for analysis [FinanceDatabase]
|
||||
load load a specific stock ticker and additional info for analysis [YahooFinance, IEXCloud, AlphaVantage, Polygon, EODHD]
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ The list below are the SDK functions within the Stocks module and a short descri
|
||||
| openbb.stocks.disc | Sub-Module | Stock Discovery |
|
||||
| openbb.stocks.dps | Sub-Module | Dark Pools & Shorts |
|
||||
| openbb.stocks.fa | Sub-Module | Fundamental Analysis |
|
||||
| openbb.stocks.filings | Function | Feed of new filings to the SEC |
|
||||
| openbb.stocks.gov | Sub-Module | US Government, Lobbying & Representative Activity |
|
||||
| openbb.stocks.ins | Sub-Module | Corporate Insider Activity (SEC Form 4) |
|
||||
| openbb.stocks.load | Function | Load Data |
|
||||
@@ -197,6 +198,21 @@ quote_tob
|
||||
| 3 | 100 | 394.68 | 200 | 395.25 |
|
||||
| 4 | 100 | 394.65 | 100 | 395.29 |
|
||||
|
||||
### Filings
|
||||
|
||||
Get the most-recent form submissions to the SEC.
|
||||
|
||||
```python
|
||||
filings = openbb.stocks.filings()
|
||||
filings.head(3)
|
||||
```
|
||||
|
||||
| Date | Ticker | CIK | Form Type | Title | URL |
|
||||
|:--------------------|:---------|--------:|:------------|:------------------------------------------------|:--------------------------------------------------------------------------------------------------|
|
||||
| 2023-01-12 14:09:25 | CYBN | 1833141 | 6-K | 6-K - CYBIN INC. (0001833141) (Filer) | https://www.sec.gov/Archives/edgar/data/1833141/000162828023000949/0001628280-23-000949-index.htm |
|
||||
| 2023-01-12 13:39:25 | RYAOF | 1038683 | 6-K | 6-K - RYANAIR HOLDINGS PLC (0001038683) (Filer) | https://www.sec.gov/Archives/edgar/data/1038683/000165495423000350/0001654954-23-000350-index.htm |
|
||||
| 2023-01-12 13:39:25 | RYAAY | 1038683 | 6-K | 6-K - RYANAIR HOLDINGS PLC (0001038683) (Filer) | https://www.sec.gov/Archives/edgar/data/1038683/000165495423000350/0001654954-23-000350-index.htm |
|
||||
|
||||
### Upcoming Earnings
|
||||
|
||||
The upcoming earnings calendar is part of the `Discovery` sub-module. The results can be easily filtered to use as inputs for another function.
|
||||
|
||||
@@ -70,7 +70,7 @@ The first step in many workflows will be to load a stock symbol with historical
|
||||
|
||||
The data source for each function is located on the right-side of the menu. In the image below, this is depicted by the text in [blue].
|
||||
|
||||

|
||||

|
||||
|
||||
Attaching the source argument to a command enables users to select their preferred source. The default sources can be changed from the [`/sources` menu](https://docs.openbb.co/terminal/guides/advanced/changing-sources). To select the `source` as `NewsApi`, use the block below.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user