Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing smaller issues and moving a few things around #4155

Merged
merged 16 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openbb_terminal/economy/econdb_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def show_treasuries(
export,
os.path.dirname(os.path.abspath(__file__)),
"treasuries_data",
treasury_data,
treasury_data / 100,
sheet_name,
)

Expand Down
1 change: 1 addition & 0 deletions openbb_terminal/economy/yfinance_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ def get_index(
interval=interval,
progress=False,
show_errors=False,
ignore_tz=True,
)

if column not in index_data.columns:
Expand Down
7 changes: 4 additions & 3 deletions openbb_terminal/miscellaneous/data_sources_default.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
}
},
"disc": {
"filings": ["FinancialModelingPrep"],
"pipo": ["Finnhub"],
"fipo": ["Finnhub"],
"gainers": ["YahooFinance"],
Expand Down Expand Up @@ -112,7 +113,8 @@
"financial": ["Finviz"],
"ownership": ["Finviz"],
"performance": ["Finviz"],
"technical": ["Finviz"]
"technical": ["Finviz"],
"arktrades": ["Cathiesark"]
},
"ins": {
"load": ["YahooFinance", "IEXCloud", "AlphaVantage", "Polygon", "EODHD"],
Expand Down Expand Up @@ -257,8 +259,7 @@
"est": ["BusinessInsider"],
"sec": ["MarketWatch", "FinancialModelingPrep"],
"supplier": ["CSIMarket"],
"customer": ["CSIMarket"],
"arktrades": ["Cathiesark"]
"customer": ["CSIMarket"]
},
"bt": {
"load": ["YahooFinance", "IEXCloud", "AlphaVantage", "Polygon", "EODHD"],
Expand Down
3 changes: 2 additions & 1 deletion openbb_terminal/miscellaneous/i18n/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ en:
stocks/th/all: show all markets
stocks/th/exchange: show one exchange
stocks/th/holidays: show all dates on which there is a market holiday
stocks/disc/filings: the most-recent form submissions to the SEC
stocks/disc/pipo: past IPOs dates
stocks/disc/fipo: future IPOs dates
stocks/disc/gainers: show latest top gainers
Expand Down Expand Up @@ -232,6 +233,7 @@ en:
stocks/scr/ownership: ownership (e.g. Float, Insider Own, Short Ratio)
stocks/scr/performance: performance (e.g. Perf Week, Perf YTD, Volatility M)
stocks/scr/technical: technical (e.g. Beta, SMA50, 52W Low, RSI, Change)
stocks/scr/arktrades: get ARK trades for a chosen ticker
stocks/scr/_screened_tickers: Last screened tickers
stocks/scr/ca: take these to comparison analysis menu
stocks/ins/view: view available presets
Expand Down Expand Up @@ -337,7 +339,6 @@ en:
stocks/fa/score: value investing scores for any time period
stocks/fa/warnings: company warnings according to Sean Seah book
stocks/fa/sust: sustainability values (environment, social and governance)
stocks/fa/arktrades: get ARK trades for ticker
stocks/fa/_management_shareholders: Management and Ownership
stocks/fa/mgmt: management team of the company
stocks/fa/shrs: shareholders (insiders, institutions and mutual funds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ disc
help
h
?
filings
pipo
fipo
gainers
Expand Down

This file was deleted.

9 changes: 5 additions & 4 deletions openbb_terminal/miscellaneous/library/trail_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ stocks.disc.gtech,openbb_terminal.stocks.discovery.yahoofinance_model.get_gtech,
stocks.disc.losers,openbb_terminal.stocks.discovery.yahoofinance_model.get_losers,
stocks.disc.ugs,openbb_terminal.stocks.discovery.yahoofinance_model.get_ugs,
stocks.disc.ulc,openbb_terminal.stocks.discovery.yahoofinance_model.get_ulc,
stocks.fa.arktrades,openbb_terminal.stocks.fundamental_analysis.ark_model.get_ark_trades_by_ticker,
stocks.screener.arktrades,openbb_terminal.stocks.screener.ark_model.get_ark_trades_by_ticker,
stocks.fa.est,openbb_terminal.stocks.fundamental_analysis.business_insider_model.get_estimates,
stocks.fa.pt,openbb_terminal.stocks.fundamental_analysis.business_insider_model.get_price_target_from_analysts,openbb_terminal.stocks.fundamental_analysis.business_insider_view.price_target_from_analysts
stocks.fa.customer,openbb_terminal.stocks.fundamental_analysis.csimarket_model.get_customers,
Expand Down Expand Up @@ -403,7 +403,7 @@ stocks.fa.growth,openbb_terminal.stocks.fundamental_analysis.fmp_model.get_finan
stocks.fa.metrics,openbb_terminal.stocks.fundamental_analysis.fmp_model.get_key_metrics,
stocks.fa.ratios,openbb_terminal.stocks.fundamental_analysis.fmp_model.get_key_ratios,
stocks.fa.profile,openbb_terminal.stocks.fundamental_analysis.fmp_model.get_profile,
stocks.quote_fmp,openbb_terminal.stocks.fundamental_analysis.fmp_model.get_quote,
stocks.quote_fmp,openbb_terminal.stocks.stocks_model.get_quote_fmp,
stocks.fa.score,openbb_terminal.stocks.fundamental_analysis.fmp_model.get_score,
stocks.fa.data,openbb_terminal.stocks.fundamental_analysis.finviz_model.get_data,
stocks.fa.cal,openbb_terminal.stocks.fundamental_analysis.yahoo_finance_model.get_calendar_earnings,
Expand Down Expand Up @@ -491,7 +491,7 @@ stocks.load,openbb_terminal.stocks.stocks_helper.load,
etf.load,openbb_terminal.stocks.stocks_helper.load,
stocks.process_candle,openbb_terminal.stocks.stocks_helper.process_candle,
stocks.search,openbb_terminal.stocks.stocks_helper.search,
stocks.quote_yf,openbb_terminal.stocks.stocks_model.load_quote,
stocks.quote_yf,openbb_terminal.stocks.stocks_model.get_quote_yf,
stocks.tob,openbb_terminal.stocks.cboe_model.get_top_of_book,
stocks.candle,openbb_terminal.stocks.stocks_helper.display_candle,
crypto.load,openbb_terminal.cryptocurrency.cryptocurrency_helpers.load,
Expand Down Expand Up @@ -541,4 +541,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
stocks.disc.filings,openbb_terminal.stocks.discovery.fmp_model.get_filings,openbb_terminal.stocks.discovery.fmp_view.display_filings
stocks.fa.sec_fmp,openbb_terminal.stocks.fundamental_analysis.fmp_model.get_filings,openbb_terminal.stocks.fundamental_analysis.fmp_view.get_filings
53 changes: 31 additions & 22 deletions openbb_terminal/reports/templates/equity.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
" df_year_estimates,\n",
" df_quarter_earnings,\n",
" df_quarter_revenues,\n",
") = openbb.stocks.dd.est(symbol=symbol)\n",
") = openbb.stocks.fa.est(symbol=symbol)\n",
"df_quarter_revenues"
]
},
Expand Down Expand Up @@ -195,7 +195,7 @@
"metadata": {},
"outputs": [],
"source": [
"quote_data = openbb.stocks.quote(symbol)\n",
"quote_data = openbb.stocks.quote_fmp(symbol)\n",
"quote_data"
]
},
Expand Down Expand Up @@ -240,7 +240,7 @@
"metadata": {},
"outputs": [],
"source": [
"df_sec_filings = openbb.stocks.dd.sec(symbol=symbol)[[\"Type\", \"Category\", \"Link\"]].head(\n",
"df_sec_filings = openbb.stocks.fa.sec(symbol=symbol)[[\"Type\", \"Category\", \"Link\"]].head(\n",
" 5\n",
")\n",
"df_sec_filings[\"Link\"] = df_sec_filings[\"Link\"].apply(\n",
Expand All @@ -256,7 +256,7 @@
"metadata": {},
"outputs": [],
"source": [
"df_analyst = openbb.stocks.dd.analyst(symbol=symbol)\n",
"df_analyst = openbb.stocks.fa.analyst(symbol=symbol)\n",
"\n",
"if not df_analyst.empty:\n",
" if \"target\" in df_analyst.columns:\n",
Expand Down Expand Up @@ -284,7 +284,7 @@
"metadata": {},
"outputs": [],
"source": [
"df_rating = openbb.stocks.dd.rating(symbol)\n",
"df_rating = openbb.stocks.fa.rating(symbol)\n",
"df_rating"
]
},
Expand Down Expand Up @@ -319,7 +319,18 @@
"expiry_dates = openbb.stocks.options.expirations(symbol)\n",
"exp = expiry_dates[0]\n",
"option_chain = openbb.stocks.options.chains(symbol, expiration=exp)\n",
"current_price = float(info[\"Previous close\"][0])"
"current_price = float(ticker_data['Adj Close'][-1])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3fdc1595",
"metadata": {},
"outputs": [],
"source": [
"call_option_chain = option_chain[option_chain['optionType'] == \"call\"]\n",
"put_option_chain = option_chain[option_chain['optionType'] == \"put\"]"
]
},
{
Expand All @@ -331,10 +342,10 @@
"source": [
"fig, ax = plt.subplots(figsize=(11, 3), dpi=150)\n",
"ax.plot(\n",
" option_chain[\"strike\"], option_chain[\"c_Openinterest\"], label=\"Call Open Interest\"\n",
" call_option_chain[\"strike\"], call_option_chain[\"openInterest\"], label=\"Call Open Interest\"\n",
")\n",
"ax.plot(\n",
" option_chain[\"strike\"], option_chain[\"p_Openinterest\"], label=\"Put Open Interest\"\n",
" put_option_chain[\"strike\"], put_option_chain[\"openInterest\"], label=\"Put Open Interest\"\n",
")\n",
"ax.legend()\n",
"fig.tight_layout()\n",
Expand All @@ -351,8 +362,8 @@
"outputs": [],
"source": [
"fig, ax = plt.subplots(figsize=(11, 8), dpi=150)\n",
"ax.plot(option_chain[\"strike\"], option_chain[\"c_Volume\"], label=\"Call Volume\")\n",
"ax.plot(option_chain[\"strike\"], option_chain[\"p_Volume\"], label=\"Put Volume\")\n",
"ax.plot(call_option_chain[\"strike\"], call_option_chain[\"volume\"], label=\"Call Volume\")\n",
"ax.plot(put_option_chain[\"strike\"], put_option_chain[\"volume\"], label=\"Put Volume\")\n",
"ax.legend()\n",
"fig.tight_layout()\n",
"f = io.BytesIO()\n",
Expand Down Expand Up @@ -506,7 +517,7 @@
" external_axes=[\n",
" ax,\n",
" ],\n",
" normalize=False,\n",
" normalize=True,\n",
")\n",
"fig.tight_layout()\n",
"f = io.BytesIO()\n",
Expand Down Expand Up @@ -696,7 +707,7 @@
"outputs": [],
"source": [
"fig, ax = plt.subplots(figsize=(11, 3), dpi=150)\n",
"openbb.stocks.dd.pt_chart(\n",
"openbb.stocks.fa.pt_chart(\n",
" symbol=symbol,\n",
" start_date=\"2022-01-01\",\n",
" data=ticker_data,\n",
Expand All @@ -717,7 +728,7 @@
"metadata": {},
"outputs": [],
"source": [
"df = openbb.stocks.dd.pt(symbol=symbol)\n",
"df = openbb.stocks.fa.pt(symbol=symbol)\n",
"avg_ratings_last_30_days = 0\n",
"days = 0\n",
"if not df.empty:\n",
Expand Down Expand Up @@ -745,7 +756,7 @@
"outputs": [],
"source": [
"fig, ax = plt.subplots(figsize=(11, 3), dpi=150)\n",
"openbb.stocks.dd.rot_chart(\n",
"openbb.stocks.fa.rot_chart(\n",
" symbol=symbol,\n",
" limit=10,\n",
" raw=False,\n",
Expand Down Expand Up @@ -951,7 +962,7 @@
"metadata": {},
"outputs": [],
"source": [
"income_df = openbb.stocks.fa.income(symbol, source=\"YahooFinance\")\n",
"income_df = openbb.stocks.fa.income(symbol, source=\"FinancialModelingPrep\")\n",
"data_df = openbb.stocks.fa.data(symbol)\n",
"mgmt_df = openbb.stocks.fa.mgmt(symbol)\n",
"if not mgmt_df.empty:\n",
Expand All @@ -964,9 +975,7 @@
"except:\n",
" pass\n",
"enterprise_df = openbb.stocks.fa.enterprise(symbol)\n",
"score = openbb.stocks.fa.score(symbol)\n",
"if score:\n",
" score = round(float(score), 2)"
"score = openbb.stocks.fa.score(symbol, years=10)"
]
},
{
Expand Down Expand Up @@ -1174,15 +1183,15 @@
" ],\n",
" finbrain_sentiment_val,\n",
")\n",
"if score:\n",
"if score[\"Total Score\"]:\n",
" htmlcode += widgets.kpi(\n",
" [25, 75],\n",
" [\n",
" \"Buffet Score is not favourable\",\n",
" \"Buffet Score is neutral\",\n",
" \"Buffet Score is favourable\",\n",
" ],\n",
" score,\n",
" float(score[\"Total Score\"], 2),\n",
" )\n",
"if predictions:\n",
" htmlcode += widgets.kpi(\n",
Expand Down Expand Up @@ -1467,11 +1476,11 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6 | packaged by conda-forge | (default, Jul 11 2021, 03:36:15) \n[Clang 11.1.0 ]"
"version": "3.9.6"
},
"vscode": {
"interpreter": {
"hash": "cb66ba39c97f15743fbb79e204a841ea03600987d49579cfb0ffc8e8dd934c69"
"hash": "100174a9203096c0c10fb537684ff280825ee9e252451beb8786068677204f06"
}
}
},
Expand Down
42 changes: 42 additions & 0 deletions openbb_terminal/stocks/discovery/disc_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
ark_view,
finnhub_view,
finviz_view,
fmp_view,
nasdaq_view,
seeking_alpha_view,
shortinterest_view,
Expand Down Expand Up @@ -59,6 +60,7 @@ class DiscoveryController(BaseController):
"rtat",
"divcal",
"heatmap",
"filings",
]

arkord_sortby_choices = [
Expand Down Expand Up @@ -125,6 +127,7 @@ def __init__(self, queue: List[str] = None):
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")
Expand Down Expand Up @@ -911,3 +914,42 @@ def call_heatmap(self, other_args: List[str]):
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
)
Loading