summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Maslek <jmaslek11@gmail.com>2023-08-25 11:14:40 -0400
committerJames Maslek <jmaslek11@gmail.com>2023-08-25 11:14:40 -0400
commit81322503f79dadd7f7399a78fbe1d6e339074a7f (patch)
tree958d514c1649cecde6b49e9b5580a086d319a1a5
parent9fdf0d2c76e9ac4439492cc682da26d37365e0e3 (diff)
parent141dd68e68b6cb76abdd1a9ef5c16bf545d020a8 (diff)
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTerminal into develop
-rw-r--r--custom_pre_commit/check_doc.py4
-rw-r--r--custom_pre_commit/check_reserved_args.py2
-rw-r--r--openbb_terminal/account/account_view.py4
-rw-r--r--openbb_terminal/common/behavioural_analysis/finnhub_view.py1
-rw-r--r--openbb_terminal/common/technical_analysis/volatility_model.py31
-rw-r--r--openbb_terminal/core/models/sources_model.py2
-rw-r--r--openbb_terminal/core/plots/backend.py6
-rw-r--r--openbb_terminal/core/plots/plotly_helper.py6
-rw-r--r--openbb_terminal/core/scripts/sdk_audit.py25
-rw-r--r--openbb_terminal/core/session/sources_handler.py6
-rw-r--r--openbb_terminal/core/session/utils.py8
-rw-r--r--openbb_terminal/cryptocurrency/cryptocurrency_helpers.py2
-rw-r--r--openbb_terminal/cryptocurrency/defi/coindix_view.py3
-rw-r--r--openbb_terminal/cryptocurrency/defi/llama_view.py3
-rw-r--r--openbb_terminal/cryptocurrency/due_diligence/dd_controller.py2
-rw-r--r--openbb_terminal/cryptocurrency/pyth_view.py2
-rw-r--r--openbb_terminal/econometrics/econometrics_view.py4
-rw-r--r--openbb_terminal/economy/finviz_model.py1
-rw-r--r--openbb_terminal/economy/fred_model.py2
-rw-r--r--openbb_terminal/economy/fred_view.py2
-rw-r--r--openbb_terminal/forecast/helpers.py2
-rw-r--r--openbb_terminal/forecast/whisper_model.py8
-rw-r--r--openbb_terminal/futures/sdk_helper.py5
-rw-r--r--openbb_terminal/loggers.py5
-rw-r--r--openbb_terminal/menu.py3
-rw-r--r--openbb_terminal/portfolio/portfolio_controller.py2
-rw-r--r--openbb_terminal/portfolio/portfolio_helper.py2
-rw-r--r--openbb_terminal/portfolio/portfolio_optimization/optimizer_view.py12
-rw-r--r--openbb_terminal/portfolio/portfolio_optimization/yahoo_finance_model.py3
-rw-r--r--openbb_terminal/reports/widget_helpers.py3
-rw-r--r--openbb_terminal/rich_config.py8
-rw-r--r--openbb_terminal/stocks/fundamental_analysis/sdk_helpers.py7
-rw-r--r--openbb_terminal/stocks/options/cboe_model.py17
-rw-r--r--openbb_terminal/stocks/options/intrinio_model.py10
-rw-r--r--openbb_terminal/stocks/options/intrinio_view.py2
-rw-r--r--openbb_terminal/stocks/options/nasdaq_model.py8
-rw-r--r--openbb_terminal/stocks/options/options_chains_model.py55
-rw-r--r--openbb_terminal/stocks/options/options_chains_view.py11
-rw-r--r--openbb_terminal/stocks/options/options_sdk_helper.py2
-rw-r--r--openbb_terminal/stocks/options/tmx_model.py15
-rw-r--r--openbb_terminal/stocks/options/tradier_model.py4
-rw-r--r--openbb_terminal/stocks/options/yfinance_model.py2
-rw-r--r--openbb_terminal/terminal_controller.py4
-rw-r--r--pyproject.toml3
-rw-r--r--tests/conftest.py2
-rw-r--r--tests/openbb_terminal/cryptocurrency/due_diligence/test_pycoingecko_view.py2
-rw-r--r--tests/openbb_terminal/etf/technical_analysis/test_ta_controller.py6
-rw-r--r--tests/openbb_terminal/forecast/test_forecast_controller.py1
48 files changed, 170 insertions, 150 deletions
diff --git a/custom_pre_commit/check_doc.py b/custom_pre_commit/check_doc.py
index c690785e6ff..0f20540810d 100644
--- a/custom_pre_commit/check_doc.py
+++ b/custom_pre_commit/check_doc.py
@@ -67,12 +67,12 @@ def main(ignore_files: Optional[str], ignore_commands: Optional[str]):
if not undocumented:
sys.exit(0)
else:
- print("The following commands do not have documentation:")
+ print("The following commands do not have documentation:") # noqa: T201
undocumented = list(undocumented)
undocumented.sort()
for item in undocumented:
- print(item)
+ print(item) # noqa: T201
sys.exit(1)
diff --git a/custom_pre_commit/check_reserved_args.py b/custom_pre_commit/check_reserved_args.py
index 9e9354ddb98..84f388d0eec 100644
--- a/custom_pre_commit/check_reserved_args.py
+++ b/custom_pre_commit/check_reserved_args.py
@@ -35,7 +35,7 @@ def process_file(file_path: str, exp: str):
if long_arg is not None:
long_arg = long_arg.group()
if long_arg not in ("HistoryManager.hist_file", RESERVED_ARGS[short_arg]):
- print(
+ print( # noqa: T201
f"{file_path}: "
f"'-{short_arg}' argument expected '{RESERVED_ARGS[short_arg]}'"
f" but assigned to '{long_arg}'"
diff --git a/openbb_terminal/account/account_view.py b/openbb_terminal/account/account_view.py
index 5dcbff376bf..fb40d32fbef 100644
--- a/openbb_terminal/account/account_view.py
+++ b/openbb_terminal/account/account_view.py
@@ -57,8 +57,7 @@ def display_personal_routines(df: pd.DataFrame, page: int, pages: int):
show_index=True,
index_name="#",
)
- except Exception as exc:
- print(exc)
+ except Exception:
console.print("Failed to display personal routines.")
@@ -72,7 +71,6 @@ def display_default_routines(df: pd.DataFrame):
"""
try:
df = df.rename(columns={"date_updated": "updated_date"})
- print(df)
df = clean_df(df)
print_rich_table(
df=df,
diff --git a/openbb_terminal/common/behavioural_analysis/finnhub_view.py b/openbb_terminal/common/behavioural_analysis/finnhub_view.py
index fbf69c2765b..b2a40729157 100644
--- a/openbb_terminal/common/behavioural_analysis/finnhub_view.py
+++ b/openbb_terminal/common/behavioural_analysis/finnhub_view.py
@@ -32,7 +32,6 @@ def display_sentiment_stats(
Format to export data
"""
d_stats = finnhub_model.get_sentiment_stats(ticker)
- print(d_stats)
if d_stats.empty:
return
diff --git a/openbb_terminal/common/technical_analysis/volatility_model.py b/openbb_terminal/common/technical_analysis/volatility_model.py
index b786799727a..39e6ea9017c 100644
--- a/openbb_terminal/common/technical_analysis/volatility_model.py
+++ b/openbb_terminal/common/technical_analysis/volatility_model.py
@@ -10,6 +10,7 @@ import pandas_ta as ta
from openbb_terminal.common.technical_analysis import ta_helpers
from openbb_terminal.decorators import log_start_end
+from openbb_terminal.rich_config import console
logger = logging.getLogger(__name__)
@@ -216,11 +217,11 @@ def standard_deviation(
"""
if window < 2:
- print("Error: Window must be at least 2, defaulting to 30.")
+ console.print("Error: Window must be at least 2, defaulting to 30.")
window = 30
if trading_periods and is_crypto:
- print("is_crypto is overridden by trading_periods.")
+ console.print("is_crypto is overridden by trading_periods.")
if not trading_periods:
trading_periods = 365 if is_crypto else 252
@@ -273,11 +274,11 @@ def parkinson(
"""
if window < 1:
- print("Error: Window must be at least 1, defaulting to 30.")
+ console.print("Error: Window must be at least 1, defaulting to 30.")
window = 30
if trading_periods and is_crypto:
- print("is_crypto is overridden by trading_periods.")
+ console.print("is_crypto is overridden by trading_periods.")
if not trading_periods:
trading_periods = 365 if is_crypto else 252
@@ -334,11 +335,11 @@ def garman_klass(
"""
if window < 1:
- print("Error: Window must be at least 1, defaulting to 30.")
+ console.print("Error: Window must be at least 1, defaulting to 30.")
window = 30
if trading_periods and is_crypto:
- print("is_crypto is overridden by trading_periods.")
+ console.print("is_crypto is overridden by trading_periods.")
if not trading_periods:
trading_periods = 365 if is_crypto else 252
@@ -395,11 +396,11 @@ def hodges_tompkins(
"""
if window < 2:
- print("Error: Window must be at least 2, defaulting to 30.")
+ console.print("Error: Window must be at least 2, defaulting to 30.")
window = 30
if trading_periods and is_crypto:
- print("is_crypto is overridden by trading_periods.")
+ console.print("is_crypto is overridden by trading_periods.")
if not trading_periods:
trading_periods = 365 if is_crypto else 252
@@ -460,11 +461,11 @@ def rogers_satchell(
"""
if window < 1:
- print("Error: Window must be at least 1, defaulting to 30.")
+ console.print("Error: Window must be at least 1, defaulting to 30.")
window = 30
if trading_periods and is_crypto:
- print("is_crypto is overridden by trading_periods.")
+ console.print("is_crypto is overridden by trading_periods.")
if not trading_periods:
trading_periods = 365 if is_crypto else 252
@@ -521,11 +522,11 @@ def yang_zhang(
"""
if window < 2:
- print("Error: Window must be at least 2, defaulting to 30.")
+ console.print("Error: Window must be at least 2, defaulting to 30.")
window = 30
if trading_periods and is_crypto:
- print("is_crypto is overridden by trading_periods.")
+ console.print("is_crypto is overridden by trading_periods.")
if not trading_periods:
trading_periods = 365 if is_crypto else 252
@@ -624,7 +625,7 @@ def cones(
lower_q, upper_q = upper_q, lower_q
if (lower_q >= 1) or (upper_q >= 1):
- print("Error: lower_q and upper_q must be between 0 and 1")
+ console.print("Error: lower_q and upper_q must be between 0 and 1")
cones_df = pd.DataFrame()
return cones_df
@@ -644,7 +645,9 @@ def cones(
for window in windows:
# Looping to build a dataframe with realized volatility over each window.
if model not in VOLATILITY_MODELS:
- print("Model not available. Available models: ", VOLATILITY_MODELS)
+ console.print(
+ "Model not available. Available models: ", VOLATILITY_MODELS
+ )
elif model == "STD":
estimator = standard_deviation(
window=window, data=data, is_crypto=is_crypto
diff --git a/openbb_terminal/core/models/sources_model.py b/openbb_terminal/core/models/sources_model.py
index ad8d885bff7..384aaf4a765 100644
--- a/openbb_terminal/core/models/sources_model.py
+++ b/openbb_terminal/core/models/sources_model.py
@@ -22,7 +22,7 @@ def read_default_sources() -> Dict:
with open(DATA_SOURCES_DEFAULT_FILE) as file:
return flatten(json.load(file))
except Exception as e:
- print(
+ print( # noqa: T201
f"\nFailed to read data sources file: "
f"{DATA_SOURCES_DEFAULT_FILE}\n{e}\n"
)
diff --git a/openbb_terminal/core/plots/backend.py b/openbb_terminal/core/plots/backend.py
index 2a8e02c5b4d..235af4d651f 100644
--- a/openbb_terminal/core/plots/backend.py
+++ b/openbb_terminal/core/plots/backend.py
@@ -23,7 +23,7 @@ from openbb_terminal.core.session.constants import BackendEnvironment
try:
from pywry import PyWry
except ImportError as e:
- print(f"\033[91m{e}\033[0m")
+ print(f"\033[91m{e}\033[0m") # noqa: T201
# pylint: disable=C0412
from openbb_terminal.core.plots.no_import import DummyBackend
@@ -54,7 +54,7 @@ else:
JUPYTER_NOTEBOOK = True
PLOTS_CORE_PATH = Path(__file__).parent.resolve()
-PLOTLYJS_PATH = PLOTS_CORE_PATH / "assets" / "plotly-2.24.2.min.js"
+PLOTLYJS_PATH: Path = PLOTS_CORE_PATH / "assets" / "plotly-2.24.2.min.js"
BACKEND = None
@@ -496,7 +496,7 @@ async def download_plotly_js():
file.unlink(missing_ok=True)
except Exception as err: # pylint: disable=W0703
- print(f"Error downloading plotly.js: {err}")
+ console.print(f"Error downloading plotly.js: {err}")
def plots_backend() -> Backend:
diff --git a/openbb_terminal/core/plots/plotly_helper.py b/openbb_terminal/core/plots/plotly_helper.py
index 2546a75f6b3..19ca0c730ac 100644
--- a/openbb_terminal/core/plots/plotly_helper.py
+++ b/openbb_terminal/core/plots/plotly_helper.py
@@ -29,9 +29,7 @@ from scipy import stats
from openbb_terminal import config_terminal
from openbb_terminal.base_helpers import console, strtobool
-from openbb_terminal.core.config.paths import (
- STYLES_DIRECTORY_REPO,
-)
+from openbb_terminal.core.config.paths import STYLES_DIRECTORY_REPO
from openbb_terminal.core.plots.backend import PLOTLYJS_PATH, plots_backend
from openbb_terminal.core.plots.config.openbb_styles import (
PLT_COLORWAY,
@@ -59,7 +57,7 @@ class TerminalStyle:
"""
STYLES_REPO = STYLES_DIRECTORY_REPO
- USER_STYLES_DIRECTORY = get_current_user().preferences.USER_STYLES_DIRECTORY
+ USER_STYLES_DIRECTORY: Path = get_current_user().preferences.USER_STYLES_DIRECTORY
plt_styles_available: Dict[str, Path] = {}
plt_style: str = "dark"
diff --git a/openbb_terminal/core/scripts/sdk_audit.py b/openbb_terminal/core/scripts/sdk_audit.py
index ee65cbb6185..b67f427a487 100644
--- a/openbb_terminal/core/scripts/sdk_audit.py
+++ b/openbb_terminal/core/scripts/sdk_audit.py
@@ -8,6 +8,7 @@ from typing import Callable, List, Tuple
import pandas as pd
from openbb_terminal.core.config.paths import MAP_PATH
+from openbb_terminal.rich_config import console
try:
import darts # pylint: disable=W0611 # noqa: F401
@@ -84,8 +85,10 @@ def get_sdk(file_path: Path = MAP_PATH) -> pd.DataFrame:
df = pd.read_csv(base_path / file_path)
df_dups = len(df["trail"]) - len(df["trail"].drop_duplicates())
if df_dups > 0:
- print(f"Number of duplicate sdk paths: {df_dups}")
- print("This indicates that the same SDK trail is being used multiple times\n")
+ console.print(f"Number of duplicate sdk paths: {df_dups}")
+ console.print(
+ "This indicates that the same SDK trail is being used multiple times\n"
+ )
views = list(df[["view", "trail"]].itertuples(index=False, name=None))
models = list(df[["model", "trail"]].itertuples(index=False, name=None))
# Add in whether it is a view or a model in pandas
@@ -146,8 +149,8 @@ def functions_df() -> pd.DataFrame:
func_df["docstring"] = [x[1] for x in all_formatted]
func_dups = len(func_df["name"]) - len(func_df["name"].drop_duplicates())
if func_dups > 0:
- print(f"Number of duplicate functions found: {func_dups}")
- print(
+ console.print(f"Number of duplicate functions found: {func_dups}")
+ console.print(
"This may indicate that functions are defined several times in the terminal.\n"
)
func_df = func_df.set_index("name")
@@ -159,7 +162,7 @@ def save_df(data: pd.DataFrame) -> None:
time_str = (str(timestamp)).replace(".", "")
output_path = f"{time_str}_sdk_audit.csv"
data.to_csv(output_path)
- print(f"File saved to {output_path}")
+ console.print(f"File saved to {output_path}")
def get_nonconforming_functions(data: pd.DataFrame) -> pd.DataFrame:
@@ -192,7 +195,7 @@ def get_nonconforming_functions(data: pd.DataFrame) -> pd.DataFrame:
def main():
- print(
+ console.print(
"This tool checks all functions in a file with a name including 'view' or 'model'against\n"
"all functions in the sdk, which is gathered from 'trail_map.csv'. If the generated csv\n"
"has an entry for 'trail' that means it is in the SDK, and if it has an entry for\n"
@@ -209,15 +212,17 @@ def main():
# Get further stats on bad data
no_doc_count = len(final_df[final_df["docstring"].isnull()].index)
if no_doc_count > 0:
- print(f"The number of rows with blank docstrings is: {no_doc_count}")
- print(
+ console.print(f"The number of rows with blank docstrings is: {no_doc_count}")
+ console.print(
"This indicates a matching function does not exist, is not in a 'model' or 'view'\n"
"file, or that the trailmap does not import it from the place it is defined.\n"
)
dup_name_count = len(final_df[final_df.duplicated(keep=False)].index)
if dup_name_count > 0:
- print(f"The number of duplicate functions after merge is: {dup_name_count}")
- print(
+ console.print(
+ f"The number of duplicate functions after merge is: {dup_name_count}"
+ )
+ console.print(
"This most likely indicates that the same function is being used at "
"different SDK endpoints.\n"
)
diff --git a/openbb_terminal/core/session/sources_handler.py b/openbb_terminal/core/session/sources_handler.py
index 83901db44c2..ac1dd91b4f1 100644
--- a/openbb_terminal/core/session/sources_handler.py
+++ b/openbb_terminal/core/session/sources_handler.py
@@ -26,8 +26,8 @@ def read_sources(path: Path) -> Dict:
return flatten(json.load(file))
return {}
except Exception as e:
- print(f"\nFailed to read data sources file: {path}\n{e}\n")
- print("Falling back to OpenBB default sources.")
+ print(f"\nFailed to read data sources file: {path}\n{e}\n") # noqa: T201
+ print("Falling back to OpenBB default sources.") # noqa: T201
return {}
@@ -45,7 +45,7 @@ def write_sources(sources: Dict, path: Path):
with open(path, "w") as f:
json.dump(extend(sources), f, indent=4)
except Exception as e:
- print(f"\nFailed to write data sources file: {path}\n{e}\n")
+ print(f"\nFailed to write data sources file: {path}\n{e}\n") # noqa: T201
def merge_sources(incoming: Dict, allowed: Dict):
diff --git a/openbb_terminal/core/session/utils.py b/openbb_terminal/core/session/utils.py
index 45ab3e509ee..5d20941c541 100644
--- a/openbb_terminal/core/session/utils.py
+++ b/