diff --git a/openbb_terminal/common/behavioural_analysis/reddit_model.py b/openbb_terminal/common/behavioural_analysis/reddit_model.py index ef983301047..8ab713e7f3e 100644 --- a/openbb_terminal/common/behavioural_analysis/reddit_model.py +++ b/openbb_terminal/common/behavioural_analysis/reddit_model.py @@ -10,8 +10,8 @@ from typing import List, Tuple import finviz import pandas as pd import praw -from pmaw import PushshiftAPI from prawcore.exceptions import ResponseException +from psaw import PushshiftAPI from requests import HTTPError from sklearn.feature_extraction import _stop_words from tqdm import tqdm diff --git a/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py b/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py index a7e6aa1917a..1ed75dd29e4 100644 --- a/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py +++ b/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py @@ -20,6 +20,7 @@ class Custom(PltTA): @indicator() def plot_srlines(self, fig: OpenBBFigure, df_ta: pd.DataFrame): """Adds support and resistance lines to plotly figure""" + window = self.params["srlines"].get_argument_values("window") or 200 def is_far_from_level(value, levels, df_stock): ave = np.mean(df_stock["High"] - df_stock["Low"]) @@ -40,7 +41,7 @@ class Custom(PltTA): return cond1 and cond2 and cond3 and cond4 df_ta2 = df_ta.copy().loc[ - (df_ta.index >= datetime.now() - timedelta(days=200)) + (df_ta.index >= datetime.now() - timedelta(days=window)) & (df_ta.index < datetime.now()) ] if df_ta2.index[-2].date() != df_ta2.index[-1].date(): diff --git a/openbb_terminal/dashboards/dashboards_controller.py b/openbb_terminal/dashboards/dashboards_controller.py index 050c33ce782..04f5dd2abe5 100644 --- a/openbb_terminal/dashboards/dashboards_controller.py +++ b/openbb_terminal/dashboards/dashboards_controller.py @@ -321,7 +321,9 @@ class DashboardsController(BaseController): ns_parser = self.parse_simple_args(parser, other_args) if ns_parser: - cmd = "streamlit run" + cmd = ["streamlit", "run", "--server.headless", "true"] + if not hasattr(sys, "frozen"): + cmd = [sys.executable, "-m"] + cmd filepath = Path(__file__).parent / "stream" / "Forecasting.py" file = filepath.relative_to(self.parent_path).as_posix() @@ -333,7 +335,7 @@ class DashboardsController(BaseController): response = "" if not ns_parser.input and not self.streamlit_url: response = console.input( - f"\nWarning: opens a port on your computer to run a {cmd} server.\n" + "\nWarning: opens a port on your computer to run a streamlit server.\n" "[green]Would you like us to run the server for you Y/n? [/]" ) @@ -341,9 +343,10 @@ class DashboardsController(BaseController): port = self.get_free_port() self.streamlit_url = f"http://localhost:{port}" os.environ["PYTHONPATH"] = str(self.parent_path) + cmd += ["--server.port", f"{port}", file] self.processes.append( psutil.Popen( - f"{cmd} --server.headless true --server.port {port} {file}", + cmd, stdout=PIPE, stderr=STDOUT, stdin=PIPE, @@ -376,7 +379,9 @@ class DashboardsController(BaseController): url = f"{self.streamlit_url}/{name}" plots_backend().send_url(url=url, title=f"{filename.title()} Dashboard") else: - console.print(f"\n\nType: {cmd} '{file}'\ninto a terminal to run.") + console.print( + f"\n\nType: streamlit run '{file}'\ninto a terminal to run." + ) def is_streamlit_activated() -> bool: