mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-02 23:41:27 +00:00
sia cleanup (#3134)
* sia cleanup * Website * Change load-> select to address #2609 * Change the list of tickers in vis * change back to show if nothing
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
"divcal": ["Nasdaq"]
|
||||
},
|
||||
"sia": {
|
||||
"load": ["YahooFinance", "IEXCloud", "AlphaVantage", "Polygon", "EODHD"],
|
||||
"select": ["YahooFinance"],
|
||||
"clear": [],
|
||||
"industry": ["FinanceDatabase"],
|
||||
"sector": ["FinanceDatabase"],
|
||||
@@ -86,9 +86,7 @@
|
||||
"cpis": ["FinanceDatabase"],
|
||||
"cpcs": ["FinanceDatabase"],
|
||||
"cpci": ["FinanceDatabase"],
|
||||
"sama": ["YahooFinance"],
|
||||
"metric": ["YahooFinance"],
|
||||
"satma": ["StockAnalysis"],
|
||||
"vis": ["StockAnalysis"]
|
||||
},
|
||||
"dps": {
|
||||
|
||||
4
openbb_terminal/miscellaneous/i18n/en.yml
vendored
4
openbb_terminal/miscellaneous/i18n/en.yml
vendored
@@ -182,7 +182,7 @@ en:
|
||||
stocks/disc/rtat: top 10 retail traded stocks per day
|
||||
stocks/disc/divcal: dividend calendar for selected date
|
||||
stocks/disc/heatmap: heatmap of SP500 tickers
|
||||
stocks/sia/load: load a specific ticker and all it's corresponding parameters
|
||||
stocks/sia/select: select a specific ticker and all it's corresponding parameters
|
||||
stocks/sia/clear: clear all or one of industry, sector, country and market cap parameters
|
||||
stocks/sia/industry: see existing industries, or set industry if arg specified
|
||||
stocks/sia/sector: see existing sectors, or set sector if arg specified
|
||||
@@ -204,9 +204,7 @@ en:
|
||||
stocks/sia/cpci: companies per Country based on Industry (and Market Cap)
|
||||
stocks/sia/_financials_: Financials
|
||||
stocks/sia/_financials_loaded_: Financials - loaded data (fast mode)
|
||||
stocks/sia/sama: see all metrics available
|
||||
stocks/sia/metric: visualize financial metric across filters selected
|
||||
stocks/sia/satma: see all metrics available over time
|
||||
stocks/sia/vis: visualize financial metric across filters selected
|
||||
stocks/sia/_returned_tickers: Returned tickers
|
||||
stocks/sia/ca: take these to comparison analysis menu
|
||||
|
||||
3105
openbb_terminal/reports/templates/crypto.ipynb
vendored
3105
openbb_terminal/reports/templates/crypto.ipynb
vendored
File diff suppressed because one or more lines are too long
@@ -668,8 +668,13 @@
|
||||
"source": [
|
||||
"body = \"\"\n",
|
||||
"\n",
|
||||
"img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
"floppy_disk_img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
"img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY)\n",
|
||||
" + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
")\n",
|
||||
"floppy_disk_img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
")\n",
|
||||
"body += widgets.header(\n",
|
||||
" img,\n",
|
||||
" floppy_disk_img,\n",
|
||||
|
||||
@@ -1203,8 +1203,13 @@
|
||||
"source": [
|
||||
"body = \"\"\n",
|
||||
"\n",
|
||||
"img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
"floppy_disk_img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
"img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY)\n",
|
||||
" + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
")\n",
|
||||
"floppy_disk_img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
")\n",
|
||||
"body += widgets.header(\n",
|
||||
" img,\n",
|
||||
" floppy_disk_img,\n",
|
||||
|
||||
9
openbb_terminal/reports/templates/etf.ipynb
vendored
9
openbb_terminal/reports/templates/etf.ipynb
vendored
@@ -236,8 +236,13 @@
|
||||
"source": [
|
||||
"body = \"\"\n",
|
||||
"\n",
|
||||
"img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
"floppy_disk_img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
"img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY)\n",
|
||||
" + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
")\n",
|
||||
"floppy_disk_img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
")\n",
|
||||
"body += widgets.header(\n",
|
||||
" img,\n",
|
||||
" floppy_disk_img,\n",
|
||||
|
||||
@@ -226,8 +226,13 @@
|
||||
"source": [
|
||||
"body = \"\"\n",
|
||||
"\n",
|
||||
"img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
"floppy_disk_img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
"img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY)\n",
|
||||
" + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
")\n",
|
||||
"floppy_disk_img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
")\n",
|
||||
"body += widgets.header(\n",
|
||||
" img,\n",
|
||||
" floppy_disk_img,\n",
|
||||
|
||||
@@ -626,8 +626,13 @@
|
||||
"source": [
|
||||
"body = \"\"\n",
|
||||
"\n",
|
||||
"img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
"floppy_disk_img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
"img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY)\n",
|
||||
" + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
")\n",
|
||||
"floppy_disk_img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
")\n",
|
||||
"body += widgets.header(\n",
|
||||
" img,\n",
|
||||
" floppy_disk_img,\n",
|
||||
|
||||
@@ -101,7 +101,10 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"holdings = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/miscellaneous/portfolio_examples/holdings/\"\n",
|
||||
"holdings = (\n",
|
||||
" str(REPOSITORY_DIRECTORY)\n",
|
||||
" + \"/openbb_terminal/miscellaneous/portfolio_examples/holdings/\"\n",
|
||||
")\n",
|
||||
"orderbook_path = holdings + orderbook\n",
|
||||
"_, orderbook_file = os.path.split(orderbook_path)\n",
|
||||
"report_title = f\"Portfolio report for {orderbook_file}\"\n",
|
||||
@@ -339,8 +342,13 @@
|
||||
"source": [
|
||||
"body = \"\"\n",
|
||||
"\n",
|
||||
"img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
"floppy_disk_img = str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
"img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY)\n",
|
||||
" + \"/openbb_terminal/reports/templates/OpenBB_reports_logo.png\"\n",
|
||||
")\n",
|
||||
"floppy_disk_img = (\n",
|
||||
" str(REPOSITORY_DIRECTORY) + \"/openbb_terminal/reports/templates/floppy-disc.png\"\n",
|
||||
")\n",
|
||||
"body += widgets.header(\n",
|
||||
" img,\n",
|
||||
" floppy_disk_img,\n",
|
||||
|
||||
@@ -6,7 +6,6 @@ import difflib
|
||||
import logging
|
||||
from typing import List
|
||||
|
||||
import numpy as np
|
||||
import yfinance as yf
|
||||
|
||||
from openbb_terminal.custom_prompt_toolkit import NestedCompleter
|
||||
@@ -20,8 +19,7 @@ from openbb_terminal.helper_funcs import (
|
||||
)
|
||||
from openbb_terminal.menu import session
|
||||
from openbb_terminal.parent_classes import BaseController
|
||||
from openbb_terminal.rich_config import console, MenuText, get_ordered_list_sources
|
||||
from openbb_terminal.stocks import stocks_helper
|
||||
from openbb_terminal.rich_config import console, MenuText
|
||||
from openbb_terminal.stocks.comparison_analysis import ca_controller
|
||||
from openbb_terminal.stocks.sector_industry_analysis import (
|
||||
financedatabase_model,
|
||||
@@ -40,7 +38,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
"""Sector Industry Analysis Controller class"""
|
||||
|
||||
CHOICES_COMMANDS = [
|
||||
"load",
|
||||
"select",
|
||||
"clear",
|
||||
"industry",
|
||||
"sector",
|
||||
@@ -53,9 +51,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
"cpis",
|
||||
"cpcs",
|
||||
"cpci",
|
||||
"sama",
|
||||
"metric",
|
||||
"satma",
|
||||
"vis",
|
||||
]
|
||||
CHOICES_MENUS = [
|
||||
@@ -96,7 +92,6 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
"ev",
|
||||
"fpe",
|
||||
]
|
||||
satma_choices = ["BS", "bs", "IS", "is", "CF", "cf", ""]
|
||||
metric_yf_keys = {
|
||||
"roa": ("financialData", "returnOnAssets"),
|
||||
"roe": ("financialData", "returnOnEquity"),
|
||||
@@ -187,26 +182,14 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
|
||||
if session and obbff.USE_PROMPT_TOOLKIT:
|
||||
choices: dict = {c: {} for c in self.controller_choices}
|
||||
|
||||
one_to_hundred: dict = {str(c): {} for c in range(1, 100)}
|
||||
zero_to_one_detailed: dict = {
|
||||
str(c): {} for c in np.arange(0.0, 1.0, 0.005)
|
||||
}
|
||||
choices["load"] = {
|
||||
choices["select"] = {
|
||||
"--ticker": None,
|
||||
"-t": "--ticker",
|
||||
"--source": {
|
||||
c: {} for c in get_ordered_list_sources(f"{self.PATH}load")
|
||||
},
|
||||
}
|
||||
choices["mktcap"] = {c: {} for c in self.mktcap_choices}
|
||||
choices["period"] = {c: {} for c in self.period_choices}
|
||||
choices["clear"] = {c: {} for c in self.clear_choices}
|
||||
standard_cp = {
|
||||
"--max": one_to_hundred,
|
||||
"-M": "--max",
|
||||
"--min": zero_to_one_detailed,
|
||||
"-m": "--min",
|
||||
"--raw": {},
|
||||
"-r": "--raw",
|
||||
}
|
||||
@@ -220,20 +203,15 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
"-m": "--metric",
|
||||
"--raw": {},
|
||||
"-r": "--raw",
|
||||
"--limit": one_to_hundred,
|
||||
"-l": "--limit",
|
||||
"--show-all": {},
|
||||
}
|
||||
choices["satma"] = {c: {} for c in self.satma_choices}
|
||||
choices["vis"] = {
|
||||
"--metric": {c: {} for c in self.metric_choices},
|
||||
"--metric": {c: {} for c in self.vis_choices},
|
||||
"-m": "--metric",
|
||||
"--period": one_to_hundred,
|
||||
"-p": "--period",
|
||||
"--currency": None,
|
||||
"-c": "--currency",
|
||||
"--raw": {},
|
||||
"--limit": one_to_hundred,
|
||||
"-l": "--limit",
|
||||
"--show-all": {},
|
||||
}
|
||||
|
||||
choices["support"] = self.SUPPORT_CHOICES
|
||||
@@ -271,7 +249,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
def print_help(self):
|
||||
"""Print help"""
|
||||
mt = MenuText("stocks/sia/")
|
||||
mt.add_cmd("load")
|
||||
mt.add_cmd("select")
|
||||
mt.add_raw("\n")
|
||||
mt.add_cmd("clear")
|
||||
mt.add_cmd("industry")
|
||||
@@ -299,9 +277,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
mt.add_info("_financials_")
|
||||
else:
|
||||
mt.add_info("_financials_loaded_")
|
||||
mt.add_cmd("sama")
|
||||
mt.add_cmd("metric")
|
||||
mt.add_cmd("satma")
|
||||
mt.add_cmd("vis")
|
||||
mt.add_raw("\n")
|
||||
mt.add_param("_returned_tickers", ", ".join(self.tickers))
|
||||
@@ -315,13 +291,13 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
return []
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_load(self, other_args: List[str]):
|
||||
"""Process load command"""
|
||||
def call_select(self, other_args: List[str]):
|
||||
"""Process select command"""
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
prog="load",
|
||||
description="Load stock ticker and alter the industry, sector, country and market cap "
|
||||
prog="select",
|
||||
description="Select stock ticker and alter the industry, sector, country and market cap "
|
||||
"accordingly for this ticker.",
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -336,8 +312,9 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
other_args.insert(0, "-t")
|
||||
ns_parser = self.parse_known_args_and_warn(parser, other_args)
|
||||
if ns_parser:
|
||||
df_stock_candidate = stocks_helper.load(
|
||||
ns_parser.ticker,
|
||||
# The historical data is not used, so this is a quick way to check if the ticker is valid
|
||||
df_stock_candidate = yf.download(
|
||||
ns_parser.ticker, period="1mo", progress=False
|
||||
)
|
||||
if not df_stock_candidate.empty:
|
||||
if "." in ns_parser.ticker:
|
||||
@@ -439,7 +416,9 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
)
|
||||
if other_args and "-" not in other_args[0][0]:
|
||||
other_args.insert(0, "-n")
|
||||
|
||||
ns_parser = self.parse_known_args_and_warn(parser, other_args)
|
||||
|
||||
if ns_parser:
|
||||
possible_industries = financedatabase_model.get_industries(
|
||||
country=self.country,
|
||||
@@ -485,7 +464,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
console.print(industry)
|
||||
|
||||
self.stocks_data = {}
|
||||
console.print("")
|
||||
console.print()
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_sector(self, other_args: List[str]):
|
||||
@@ -546,7 +525,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
console.print(sector)
|
||||
|
||||
self.stocks_data = {}
|
||||
console.print("")
|
||||
console.print()
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_country(self, other_args: List[str]):
|
||||
@@ -604,7 +583,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
console.print(country)
|
||||
|
||||
self.stocks_data = {}
|
||||
console.print("")
|
||||
console.print()
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_mktcap(self, other_args: List[str]):
|
||||
@@ -635,7 +614,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
)
|
||||
|
||||
self.stocks_data = {}
|
||||
console.print("")
|
||||
console.print()
|
||||
|
||||
# pylint:disable=attribute-defined-outside-init
|
||||
@log_start_end(log=logger)
|
||||
@@ -656,7 +635,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
)
|
||||
|
||||
self.stocks_data = {}
|
||||
console.print("")
|
||||
console.print()
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_clear(self, other_args: List[str]):
|
||||
@@ -697,7 +676,6 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
self.ticker = ""
|
||||
self.update_runtime_choices()
|
||||
self.stocks_data = {}
|
||||
console.print("")
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_period(self, other_args: List[str]):
|
||||
@@ -726,55 +704,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
console.print("Select between period: Annual, Quarterly and Trailing")
|
||||
|
||||
self.stocks_data = {}
|
||||
console.print("")
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_sama(self, other_args: List[str]):
|
||||
"""Process sama command"""
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
prog="sama",
|
||||
description="See all metrics available",
|
||||
)
|
||||
ns_parser = self.parse_known_args_and_warn(parser, other_args)
|
||||
if ns_parser:
|
||||
help_text = """
|
||||
roa return on assets
|
||||
roe return on equity
|
||||
cr current ratio
|
||||
qr quick ratio
|
||||
de debt to equity
|
||||
tc total cash
|
||||
tcs total cash per share
|
||||
tr total revenue
|
||||
rps revenue per share
|
||||
rg revenue growth
|
||||
eg earnings growth
|
||||
pm profit margins
|
||||
gp gross profits
|
||||
gm gross margins
|
||||
ocf operating cash flow
|
||||
om operating margins
|
||||
fcf free cash flow
|
||||
td total debt
|
||||
ebitda earnings before interest, taxes, depreciation and amortization
|
||||
ebitdam ebitda margins
|
||||
rec recommendation mean
|
||||
mc market cap
|
||||
fte full time employees
|
||||
er enterprise to revenue
|
||||
bv book value
|
||||
ss shares short
|
||||
pb price to book
|
||||
beta beta
|
||||
fs float shares
|
||||
sr short ratio
|
||||
peg peg ratio
|
||||
ev enterprise value
|
||||
fpe forward P/E
|
||||
"""
|
||||
console.print(help_text)
|
||||
console.print()
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_metric(self, other_args: List[str]):
|
||||
@@ -789,7 +719,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
"-m",
|
||||
"--metric",
|
||||
dest="metric",
|
||||
required="-h" not in other_args,
|
||||
required="-h" not in other_args and "--show-all" not in other_args,
|
||||
help="Metric to visualize",
|
||||
choices=self.metric_choices,
|
||||
)
|
||||
@@ -809,13 +739,53 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
default=False,
|
||||
help="Output all raw data",
|
||||
)
|
||||
|
||||
if other_args and "-" not in other_args[0][0]:
|
||||
other_args.insert(0, "-m")
|
||||
|
||||
if not other_args:
|
||||
help_text = """Available Metrics:
|
||||
roa return on assets
|
||||
roe return on equity
|
||||
cr current ratio
|
||||
qr quick ratio
|
||||
de debt to equity
|
||||
tc total cash
|
||||
tcs total cash per share
|
||||
tr total revenue
|
||||
rps revenue per share
|
||||
rg revenue growth
|
||||
eg earnings growth
|
||||
pm profit margins
|
||||
gp gross profits
|
||||
gm gross margins
|
||||
ocf operating cash flow
|
||||
om operating margins
|
||||
fcf free cash flow
|
||||
td total debt
|
||||
ebitda earnings before interest, taxes, depreciation and amortization
|
||||
ebitdam ebitda margins
|
||||
rec recommendation mean
|
||||
mc market cap
|
||||
fte full time employees
|
||||
er enterprise to revenue
|
||||
bv book value
|
||||
ss shares short
|
||||
pb price to book
|
||||
beta beta
|
||||
fs float shares
|
||||
sr short ratio
|
||||
peg peg ratio
|
||||
ev enterprise value
|
||||
fpe forward P/E
|
||||
"""
|
||||
console.print(help_text)
|
||||
return
|
||||
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES
|
||||
)
|
||||
if ns_parser:
|
||||
|
||||
if not self.country and not self.sector and not self.industry:
|
||||
console.print(
|
||||
"[red]Select at least one filter from sector, country or industry.[/red]\n"
|
||||
@@ -847,53 +817,6 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
"from sector, country or industry.\n[/param]"
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_satma(self, other_args: List[str]):
|
||||
"""Process satma command"""
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
prog="satma",
|
||||
description="See all metrics available",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--statement",
|
||||
dest="statement",
|
||||
help="See all metrics available for the given choice",
|
||||
choices=self.satma_choices,
|
||||
)
|
||||
|
||||
if other_args and "-" not in other_args[0][0]:
|
||||
other_args.insert(0, "-s")
|
||||
ns_parser = self.parse_known_args_and_warn(parser, other_args)
|
||||
|
||||
help_text = ""
|
||||
statement_string = {
|
||||
"BS": "Balance Sheet Statement",
|
||||
"IS": "Income Statement",
|
||||
"CF": "Cash Flow Statement",
|
||||
}
|
||||
|
||||
if ns_parser.statement:
|
||||
ns_parser.statement = str(ns_parser.statement).upper()
|
||||
|
||||
if ns_parser.statement not in ("IS", "BS", "CF"):
|
||||
console.print(f"{ns_parser.statement} is not a valid option.")
|
||||
|
||||
help_text += f"\n{statement_string[ns_parser.statement]}\n"
|
||||
for k, v in stockanalysis_model.SA_KEYS[ns_parser.statement].items():
|
||||
help_text += f" {k} {(10 - len(k)) * ' '} {v} \n"
|
||||
|
||||
else:
|
||||
for statement, statement_value in stockanalysis_model.SA_KEYS.items():
|
||||
help_text += f"\n{statement_string[statement]}\n"
|
||||
for k, v in statement_value.items():
|
||||
help_text += f" {k} {(10 - len(k)) * ' '} {v} \n"
|
||||
|
||||
console.print(help_text)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_vis(self, other_args: List[str]):
|
||||
"""Process vis command"""
|
||||
@@ -907,7 +830,7 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
"-m",
|
||||
"--metric",
|
||||
dest="metric",
|
||||
required="-h" not in other_args,
|
||||
required="-h" not in other_args and "--show-all" not in other_args,
|
||||
help="Metric to visualize",
|
||||
choices=self.vis_choices,
|
||||
)
|
||||
@@ -927,12 +850,31 @@ class SectorIndustryAnalysisController(BaseController):
|
||||
"to USD (US Dollars).",
|
||||
default="USD",
|
||||
)
|
||||
|
||||
if other_args and "-" not in other_args[0][0]:
|
||||
other_args.insert(0, "-m")
|
||||
|
||||
if not other_args:
|
||||
statement_string = {
|
||||
"BS": "Balance Sheet Statement",
|
||||
"IS": "Income Statement",
|
||||
"CF": "Cash Flow Statement",
|
||||
}
|
||||
help_text = ""
|
||||
|
||||
for statement, statement_value in stockanalysis_model.SA_KEYS.items():
|
||||
help_text += f"\n{statement_string[statement]}\n"
|
||||
for k, v in statement_value.items():
|
||||
help_text += f" {k} {(10 - len(k)) * ' '} {v} \n"
|
||||
|
||||
console.print(help_text)
|
||||
return
|
||||
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES, limit=10, raw=True
|
||||
)
|
||||
if ns_parser:
|
||||
|
||||
if not self.country and not self.sector and not self.industry:
|
||||
console.print(
|
||||
"[red]Select at least one filter from sector, country or industry.[/red]\n"
|
||||
|
||||
@@ -129,9 +129,8 @@ def get_stocks_data(
|
||||
symbol_statement, rounding, currency_dcf = create_dataframe(
|
||||
top_item, item, period.lower()
|
||||
)
|
||||
|
||||
if symbol_statement.empty:
|
||||
no_data.append(symbol)
|
||||
no_data.append(top_item)
|
||||
continue
|
||||
|
||||
symbol_statement_rounded = (
|
||||
|
||||
@@ -200,5 +200,4 @@ def display_plots_financials(
|
||||
item_name,
|
||||
df,
|
||||
)
|
||||
|
||||
return stocks_data, company_tickers
|
||||
|
||||
@@ -349,13 +349,6 @@ def test_call_func_expect_queue(expected_queue, func, queue):
|
||||
[],
|
||||
dict(),
|
||||
),
|
||||
(
|
||||
"call_sama",
|
||||
[],
|
||||
"",
|
||||
[],
|
||||
dict(),
|
||||
),
|
||||
(
|
||||
"call_cps",
|
||||
[
|
||||
@@ -520,8 +513,6 @@ def test_call_func(
|
||||
"call_cpis",
|
||||
"call_cpcs",
|
||||
"call_cpci",
|
||||
"call_sama",
|
||||
"call_metric",
|
||||
],
|
||||
)
|
||||
def test_call_func_no_parser(func, mocker):
|
||||
@@ -771,11 +762,11 @@ def test_custom_reset(expected, ticker):
|
||||
MOCK_TUPLE + MOCK_SUMMARY_PROFILE_MISSING_SECTOR,
|
||||
],
|
||||
)
|
||||
def test_call_load(countries, industries, mocker, sectors, summaryProfile):
|
||||
def test_call_select(countries, industries, mocker, sectors, summaryProfile):
|
||||
path_controller = "openbb_terminal.stocks.sector_industry_analysis.sia_controller"
|
||||
|
||||
# MOCK LOAD
|
||||
target = f"{path_controller}.stocks_helper.load"
|
||||
target = f"{path_controller}.yf.download"
|
||||
mocker.patch(target=target, return_value=DF_STOCK)
|
||||
|
||||
# MOCK GET_JSON
|
||||
@@ -817,9 +808,9 @@ def test_call_load(countries, industries, mocker, sectors, summaryProfile):
|
||||
or not summaryProfile["industry"]
|
||||
):
|
||||
with pytest.raises(Exception):
|
||||
controller.call_load(other_args=other_args)
|
||||
controller.call_select(other_args=other_args)
|
||||
else:
|
||||
controller.call_load(other_args=other_args)
|
||||
controller.call_select(other_args=other_args)
|
||||
|
||||
|
||||
@pytest.mark.vcr(record_mode="none")
|
||||
@@ -835,7 +826,7 @@ def test_call_load_market_cap(market_cap, mocker):
|
||||
path_controller = "openbb_terminal.stocks.sector_industry_analysis.sia_controller"
|
||||
|
||||
# MOCK LOAD
|
||||
target = f"{path_controller}.stocks_helper.load"
|
||||
target = f"{path_controller}.yf.download"
|
||||
mocker.patch(target=target, return_value=DF_STOCK)
|
||||
|
||||
# MOCK GET_JSON
|
||||
@@ -869,10 +860,8 @@ def test_call_load_market_cap(market_cap, mocker):
|
||||
|
||||
other_args = [
|
||||
"TSLA",
|
||||
"--start=2021-12-17",
|
||||
"--end=2021-12-18",
|
||||
]
|
||||
controller.call_load(other_args=other_args)
|
||||
controller.call_select(other_args=other_args)
|
||||
|
||||
|
||||
@pytest.mark.vcr(record_mode="none")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
load load a specific ticker and all it's corresponding parameters [YahooFinance, IEXCloud, AlphaVantage, Polygon, EODHD]
|
||||
select select a specific ticker and all it's corresponding parameters [YahooFinance]
|
||||
|
||||
clear clear all or one of industry, sector, country and market cap parameters
|
||||
industry see existing industries, or set industry if arg specified [FinanceDatabase]
|
||||
@@ -23,9 +23,7 @@ Statistics:
|
||||
[unvl] cpci companies per Country based on Industry (and Market Cap)[/unvl] [FinanceDatabase]
|
||||
|
||||
Financials - loaded data (fast mode):
|
||||
sama see all metrics available [YahooFinance]
|
||||
metric visualize financial metric across filters selected [YahooFinance]
|
||||
satma see all metrics available over time [StockAnalysis]
|
||||
vis visualize financial metric across filters selected [StockAnalysis]
|
||||
|
||||
Returned tickers:
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
```text
|
||||
usage: metric [-m {roa,roe,cr,qr,de,tc,tcs,tr,rps,rg,eg,pm,gp,gm,ocf,om,fcf,td,ebitda,ebitdam,rec,mc,fte,er,bv,ss,pb,beta,fs,peg,ev,fpe}] [-l LIMIT] [-r] [-h] [--export EXPORT]
|
||||
```
|
||||
|
||||
Visualise a particular metric with the filters selected [source: Yahoo Finance]
|
||||
Visualize a particular metric with the filters selected
|
||||
|
||||
```
|
||||
optional arguments:
|
||||
@@ -13,8 +12,7 @@ optional arguments:
|
||||
-r, --raw Output all raw data (default: False)
|
||||
-h, --help show this help message (default: False)
|
||||
--export EXPORT Export raw data into csv, json, xlsx and figure into png, jpg, pdf, svg (default: )
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
Return on Equity example:
|
||||
```
|
||||
@@ -23,7 +21,7 @@ Return on Equity example:
|
||||
│ Country : United States │
|
||||
│ Market Cap : Large │
|
||||
│ Exclude Exchanges : True │
|
||||
│ Period : Annual
|
||||
│ Period : Annual
|
||||
|
||||
|
||||
2022 Mar 21, 09:51 (✨) /stocks/sia/ $ metric roe
|
||||
@@ -38,9 +36,8 @@ Full Time Employees example:
|
||||
│ Country : United States │
|
||||
│ Market Cap : Large │
|
||||
│ Exclude Exchanges : True │
|
||||
│ Period : Annual
|
||||
│ Period : Annual
|
||||
|
||||
2022 Mar 21, 09:55 (✨) /stocks/sia/ $ metric fte
|
||||
```
|
||||

|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
```text
|
||||
usage: sama [-h]
|
||||
```
|
||||
|
||||
See all metrics available
|
||||
|
||||
```
|
||||
optional arguments:
|
||||
-h, --help show this help message (default: False)
|
||||
```
|
||||
|
||||
Available metrics
|
||||
|
||||
```
|
||||
roa return on assets
|
||||
roe return on equity
|
||||
cr current ratio
|
||||
qr quick ratio
|
||||
de debt to equity
|
||||
tc total cash
|
||||
tcs total cash per share
|
||||
tr total revenue
|
||||
rps revenue per share
|
||||
rg revenue growth
|
||||
eg earnings growth
|
||||
pm profit margins
|
||||
gp gross profits
|
||||
gm gross margins
|
||||
ocf operating cash flow
|
||||
om operating margins
|
||||
fcf free cash flow
|
||||
td total debt
|
||||
ebitda earnings before interest, taxes, depreciation and amortization
|
||||
ebitdam ebitda margins
|
||||
rec recommendation mean
|
||||
mc market cap
|
||||
fte full time employees
|
||||
er enterprise to revenue
|
||||
bv book value
|
||||
ss shares short
|
||||
pb price to book
|
||||
beta beta
|
||||
fs float shares
|
||||
sr short ratio
|
||||
peg peg ratio
|
||||
ev enterprise value
|
||||
fpe forward P/E
|
||||
```
|
||||
@@ -1,74 +0,0 @@
|
||||
```text
|
||||
usage: satma [-s {BS,bs,IS,is,CF,cf,}] [-h]
|
||||
```
|
||||
See all balance sheet, income and cash flow statement metrics available [source: StockAnalysis]
|
||||
|
||||
```
|
||||
optional arguments:
|
||||
-s {BS,bs,IS,is,CF,cf,}, --statement {BS,bs,IS,is,CF,cf,}
|
||||
See all metrics available for the given choice (default: None)
|
||||
-h, --help show this help message (default: False)
|
||||
```
|
||||
The current list of available options is:
|
||||
|
||||
````
|
||||
Balance Sheet Statement
|
||||
ce Cash & Equivalents
|
||||
sti Short-Term Investments
|
||||
cce Cash & Cash Equivalents
|
||||
rec Receivables
|
||||
inv Inventory
|
||||
oca Other Current Assets
|
||||
tca Total Current Assets
|
||||
ppe Property, Plant & Equipment
|
||||
lti Long-Term Investments
|
||||
gai Goodwill and Intangibles
|
||||
olta Other Long-Term Assets
|
||||
tlta Total Long-Term Assets
|
||||
ta Total Assets
|
||||
ap Accounts Payable
|
||||
dr Deferred Revenue
|
||||
cd Current Debt
|
||||
ocl Other Current Liabilities
|
||||
tcl Total Current Liabilities
|
||||
ltd Long-Term Debt
|
||||
oltl Other Long-Term Liabilities
|
||||
tltl Total Long-Term Liabilities
|
||||
tl Total Liabilities
|
||||
ret Retained Earnings
|
||||
ci Comprehensive Income
|
||||
se Shareholders' Equity
|
||||
tle Total Liabilities and Equity
|
||||
|
||||
Income Statement
|
||||
re Revenue
|
||||
cr Cost of Revenue
|
||||
gp Gross Profit
|
||||
sga Selling, Genera & Admin
|
||||
rd Research & Development
|
||||
ooe Other Operating Expenses
|
||||
oi Operating Income
|
||||
ie Interest Expense / Income
|
||||
oe Other Expense / Income
|
||||
it Income Tax
|
||||
ni Net Income
|
||||
pd Preferred Dividends
|
||||
|
||||
Cash Flow Statement
|
||||
ninc Net Income
|
||||
da Depreciation & Amortization
|
||||
sbc Share-Based Compensation
|
||||
ooa Other Operating Activities
|
||||
ocf Operating Cash Flow
|
||||
cex Capital Expenditures
|
||||
acq Acquisitions
|
||||
cii Change in Investments
|
||||
oia Other Investing Activities
|
||||
icf Investing Cash Flow
|
||||
dp Dividends Paid
|
||||
si Share Insurance / Repurchase
|
||||
di Debt Issued / Paid
|
||||
ofa Other Financing Activities
|
||||
fcf Financing Cash Flow
|
||||
ncf Net Cash Flow
|
||||
````
|
||||
@@ -1,9 +1,9 @@
|
||||
```text
|
||||
usage: vis [-m {ce,sti,cce,rec,inv,oca,tca,ppe,lti,gai,olta,tlta,ta,ap,dr,cd,ocl,tcl,ltd,oltl,tltl,tl,ret,ci,se,tle,ninc,da,sbc,ooa,ocf,cex,acq,cii,oia,icf,dp,si,di,ofa,fcf,ncf,re,cr,gp,sga,rd,ooe,oi,ie,oe,it,ni,pd}] [-p PERIOD]
|
||||
[-cc CONVERT_CURRENCY] [-h] [--export {csv,json,xlsx,png,jpg,pdf,svg}] [--raw] [-l LIMIT]
|
||||
usage: vis
|
||||
[-m {ce,sti,cce,rec,inv,oca,tca,ppe,lti,gai,olta,tlta,ta,ap,dr,cd,ocl,tcl,ltd,oltl,tltl,tl,ret,ci,se,tle,ninc,da,sbc,ooa,ocf,cex,acq,cii,oia,icf,dp,si,di,ofa,fcf,ncf,re,cr,gp,sga,rd,ooe,oi,ie,oe,it,ni,pd}]
|
||||
[-p PERIOD] [-c CURRENCY] [-h] [--export EXPORT] [--raw] [-l LIMIT]
|
||||
```
|
||||
|
||||
Visualize a particular metric with the filters selected [source: StockAnalysis]
|
||||
Visualize a particular metric with the filters selected
|
||||
|
||||
```
|
||||
optional arguments:
|
||||
@@ -11,15 +11,13 @@ optional arguments:
|
||||
Metric to visualize (default: None)
|
||||
-p PERIOD, --period PERIOD
|
||||
Limit number of periods to display (default: 12)
|
||||
-cc CONVERT_CURRENCY, --convert_currency CONVERT_CURRENCY
|
||||
-c CURRENCY, --currency CURRENCY
|
||||
Convert the currency of the chosen country to a specified currency. By default, this is set to USD (US Dollars). (default: USD)
|
||||
-h, --help show this help message (default: False)
|
||||
--export {csv,json,xlsx,png,jpg,pdf,svg}
|
||||
Export raw data into csv, json, xlsx and figure into png, jpg, pdf, svg (default: )
|
||||
--export EXPORT Export raw data into csv, json, xlsx and figure into png, jpg, pdf, svg (default: )
|
||||
--raw Flag to display raw data (default: False)
|
||||
-l LIMIT, --limit LIMIT
|
||||
Number of entries to show in data. (default: 10)
|
||||
|
||||
```
|
||||
|
||||

|
||||
|
||||
Reference in New Issue
Block a user