diff --git a/build/pyinstaller/.env b/build/pyinstaller/.env index 04015487b5e..58e3640f467 100644 --- a/build/pyinstaller/.env +++ b/build/pyinstaller/.env @@ -24,4 +24,3 @@ OPENBB_USE_DATETIME=true OPENBB_OPEN_REPORT_AS_HTML=true OPENBB_ENABLE_QUICK_EXIT=false OPENBB_ENABLE_EXIT_AUTO_HELP=false -PYWRY_EXECUTABLE=OpenBBPlotsBackend diff --git a/build/pyinstaller/setup_icons_post.applescript b/build/pyinstaller/setup_icons_post.applescript index 0b244233ab3..73587aca012 100644 --- a/build/pyinstaller/setup_icons_post.applescript +++ b/build/pyinstaller/setup_icons_post.applescript @@ -13,8 +13,8 @@ set destPath to current_path & "../../DMG/OpenBB Terminal/.OpenBB/OpenBBTerminal set imageData to (current application's NSImage's alloc()'s initWithContentsOfFile:sourcePath) (current application's NSWorkspace's sharedWorkspace()'s setIcon:imageData forFile:destPath options:2) --- Set OpenBB OpenBBPlotsBackend icon relative to script location +-- Set OpenBB pywry icon relative to script location set sourcePath to current_path & "../../images/openbb.icns" -set destPath to current_path & "../../DMG/OpenBB Terminal/.OpenBB/OpenBBPlotsBackend" +set destPath to current_path & "../../DMG/OpenBB Terminal/.OpenBB/pywry" set imageData to (current application's NSImage's alloc()'s initWithContentsOfFile:sourcePath) (current application's NSWorkspace's sharedWorkspace()'s setIcon:imageData forFile:destPath options:2) diff --git a/build/pyinstaller/terminal.spec b/build/pyinstaller/terminal.spec index 7c01351ff9e..2728339ece7 100644 --- a/build/pyinstaller/terminal.spec +++ b/build/pyinstaller/terminal.spec @@ -1,5 +1,6 @@ # -*- mode: python ; coding: utf-8 -*- # noqa import os +from shutil import which import subprocess import sys from pathlib import Path @@ -27,11 +28,10 @@ venv_path = Path(sys.executable).parent.parent.resolve() # Check if we are running in a conda environment if is_darwin: pathex = os.path.join(os.path.dirname(os.__file__), "site-packages") +elif "site-packages" in list(venv_path.iterdir()): + pathex = str(venv_path / "site-packages") else: - if "site-packages" in list(venv_path.iterdir()): - pathex = str(venv_path / "site-packages") - else: - pathex = str(venv_path / "lib" / "site-packages") + pathex = str(venv_path / "lib" / "site-packages") pathex = Path(pathex).resolve() @@ -76,6 +76,7 @@ added_files = [ (str(pathex / "llama_index/VERSION"), "llama_index"), (str(pathex / "tiktoken"), "tiktoken"), (str(pathex / "tiktoken_ext"), "tiktoken_ext"), + (which("pywry"), "."), ] if is_win: @@ -112,7 +113,7 @@ hidden_imports = [ "_sysconfigdata__darwin_darwin", "prophet", "debugpy", - "pywry.pywry", + "pywry", "scipy.sparse.linalg._isolve._iterative", "whisper", "transformers", @@ -154,45 +155,6 @@ if is_win: if is_darwin: exe_icon = (str(repo_path / "images/openbb.icns"),) -block_cipher = None -# PyWry -pywry_a = Analysis( - [str(pathex / "pywry/backend.py")], - pathex=[], - binaries=[], - datas=[], - hiddenimports=[], - hookspath=[], - hooksconfig={}, - runtime_hooks=[], - excludes=[], - win_no_prefer_redirects=False, - win_private_assemblies=False, - cipher=block_cipher, - noarchive=False, -) -pywry_pyz = PYZ(pywry_a.pure, pywry_a.zipped_data, cipher=block_cipher) - - -# PyWry EXE -pywry_exe = EXE( - pywry_pyz, - pywry_a.scripts, - [], - exclude_binaries=True, - name="OpenBBPlotsBackend", - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - upx_exclude=[], - console=True, - disable_windowed_traceback=False, - target_arch="x86_64", - codesign_identity=None, - entitlements_file=None, - icon=exe_icon, -) exe_args = [ pyz, @@ -252,14 +214,9 @@ if is_darwin: exe_kwargs["argv_emulation"] = True exe = EXE(*exe_args, **exe_kwargs) -pywry_collect_args = [ - pywry_a.binaries, - pywry_a.zipfiles, - pywry_a.datas, -] if build_type == "folder": coll = COLLECT( - *([exe] + collect_args + [pywry_exe] + pywry_collect_args), + *([exe] + collect_args), **collect_kwargs, ) diff --git a/openbb_terminal/common/technical_analysis/overlap_model.py b/openbb_terminal/common/technical_analysis/overlap_model.py index 781bc682e96..5413602009c 100644 --- a/openbb_terminal/common/technical_analysis/overlap_model.py +++ b/openbb_terminal/common/technical_analysis/overlap_model.py @@ -55,7 +55,7 @@ def sma(data: pd.Series, length: int = 50, offset: int = 0) -> pd.DataFrame: Returns ------- pd.DataFrame - Dataframe containing prices and SMA + Dataframe containing prices and SMA """ if isinstance(data, pd.DataFrame): console.print("[red]Please send a series and not a DataFrame.[/red]\n") diff --git a/openbb_terminal/core/plots/plotly_helper.py b/openbb_terminal/core/plots/plotly_helper.py index 19ca0c730ac..c16b15eb2de 100644 --- a/openbb_terminal/core/plots/plotly_helper.py +++ b/openbb_terminal/core/plots/plotly_helper.py @@ -926,6 +926,10 @@ class OpenBBFigure(go.Figure): """ df_volume = df_volume.apply(lambda x: f"{x:.1f}") df_volume = pd.to_numeric(df_volume.astype(float)) + + if isinstance(df_volume, pd.Series): + df_volume = df_volume.to_frame() + volume_ticks = int(df_volume.max().max()) round_digits = -3 first_val = round(volume_ticks * 0.20, round_digits) diff --git a/openbb_terminal/core/plots/plotly_ta/ta_class.py b/openbb_terminal/core/plots/plotly_ta/ta_class.py index 79309af7eba..98dba3a8046 100644 --- a/openbb_terminal/core/plots/plotly_ta/ta_class.py +++ b/openbb_terminal/core/plots/plotly_ta/ta_class.py @@ -264,7 +264,7 @@ class PlotlyTA(PltTA): def calculate_indicators(self): """Return dataframe with all indicators""" - return self.indicators.to_dataframe(self.df_stock.copy(), self.ma_mode) + return self.indicators.to_dataframe(self.df_stock, self.ma_mode) def get_subplot(self, subplot: str) -> bool: """Return True if subplots will be able to be plotted with current data""" diff --git a/openbb_terminal/dashboards/stream/pages/Indicators.py b/openbb_terminal/dashboards/stream/pages/Indicators.py index 99c3992eeb4..862654a8b75 100644 --- a/openbb_terminal/dashboards/stream/pages/Indicators.py +++ b/openbb_terminal/dashboards/stream/pages/Indicators.py @@ -159,7 +159,12 @@ async def plot_indicators( ): annotation.xshift += -5 - y_min, y_max = data["Low"].min().min(), data["High"].max().max() + min_max = {"min": data["Low"].min(), "max": data["High"].max()} + for attr in min_max: + if hasattr(min_max[attr], attr): + min_max[attr] = getattr(min_max[attr], attr)() + + y_min, y_max = min_max["min"], min_max["max"] y_range = y_max - y_min y_min -= y_range * 0.05 y_max += y_range * 0.05 diff --git a/openbb_terminal/portfolio/portfolio_view.py b/openbb_terminal/portfolio/portfolio_view.py index c8b5f49e1da..25de72c6af1 100644 --- a/openbb_terminal/portfolio/portfolio_view.py +++ b/openbb_terminal/portfolio/portfolio_view.py @@ -579,6 +579,11 @@ def display_monthly_returns( texttemplate = "%{z:.2f}%" if show_vals else "" hovertemplate = "%{x} %{y:.0f}:
%{z:.2f}%" + if isinstance(portfolio_returns, pd.Series): + portfolio_returns = portfolio_returns.to_frame() + if isinstance(benchmark_returns, pd.Series): + benchmark_returns = benchmark_returns.to_frame() + pb_mins = (portfolio_returns.min().min(), benchmark_returns.min().min()) pb_maxs = (portfolio_returns.max().max(), benchmark_returns.max().max()) diff --git a/openbb_terminal/stocks/stocks_helper.py b/openbb_terminal/stocks/stocks_helper.py index 5fc9425b0bc..4d9d76540bc 100644 --- a/openbb_terminal/stocks/stocks_helper.py +++ b/openbb_terminal/stocks/stocks_helper.py @@ -679,9 +679,6 @@ def process_candle(data: pd.DataFrame) -> pd.DataFrame: df_data["OC_High"] = df_data[["Open", "Close"]].max(axis=1) df_data["OC_Low"] = df_data[["Open", "Close"]].min(axis=1) - df_data["ma20"] = df_data["Close"].rolling(20).mean().fillna(method="bfill") - df_data["ma50"] = df_data["Close"].rolling(50).mean().fillna(method="bfill") - return df_data diff --git a/poetry.lock b/poetry.lock index e7fca534320..1a0c1b46581 100644 --- a/poetry.lock +++ b/poetry.lock @@ -7226,24 +7226,15 @@ files = [ [[package]] name = "pywry" -version = "0.5.14" +version = "0.6.1" description = "" optional = false python-versions = ">=3.8" files = [ - {file = "pywry-0.5.14-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:bf30e8e6e59863614fe06144e90c3c95c43256f944222d070be07e71c0303ad6"}, - {file = "pywry-0.5.14-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:46fc00c02dfbbd3d81aa0f43cb9c5111c06e748a850cc795dfcd800a3b78958f"}, - {file = "pywry-0.5.14-cp310-none-win_amd64.whl", hash = "sha256:ecd8e4c4d95f5fb114d0baa6572d2392ae0cc866f200c5fccd6c4bfa3b1a29cc"}, - {file = "pywry-0.5.14-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:db5a298d57b80cc33c6a03f572b80f14d0018b2c4204e2137072ee9dfb23b1c1"}, - {file = "pywry-0.5.14-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:335e97b0f242bfa6037ec7fdc90b3625611be0ad40496a8cf152dae0c6ae6605"}, - {file = "pywry-0.5.14-cp311-none-win_amd64.whl", hash = "sha256:66cba8d3144bcd118808d09c33044e27544561f5c9a7b397edb9c3b3fcf6d3d9"}, - {file = "pywry-0.5.14-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:713fe32afa2b61595057344b6c0b47772080dc05ee9b2f210448ba8cb2b8ac76"}, - {file = "pywry-0.5.14-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:d0479f3a52f27658eedb37128e230c3ea620eb113d1371326ae235006a29f3e0"}, - {file = "pywry-0.5.14-cp38-none-win_amd64.whl", hash = "sha256:3f42fd9e1fe6ae40be6f13195719e648fbbebda29fe9ba846c59797f71839add"}, - {file = "pywry-0.5.14-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:b2690978499d63dfac3fe712ed3e3752866d7eb40ed7dcb21590b0ff109cecb7"}, - {file = "pywry-0.5.14-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:2bcba7d64b9cdf2f1d65f4d468f87b00629157d233de251805b0816a43ba738b"}, - {file = "pywry-0.5.14-cp39-none-win_amd64.whl", hash = "sha256:c5b949f5d16a43aa2cc703159caa6de45b91e6008a4fa608d99909b7c89f45c3"}, - {file = "pywry-0.5.14.tar.gz", hash = "sha256:a2a03b18f0847366a4347d30429afd8a50c95cc35713371a3d6bbed077db9983"}, + {file = "pywry-0.6.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:ce0250bf88bd795bc2751daae162f03e9c3f64a2c0275edf4b376c180090154b"}, + {file = "pywry-0.6.1-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:8f7dba93babc10eb49682dc8811afe5a9f108772e6a09457173b9c2b30f00e41"}, + {file = "pywry-0.6.1-py3-none-win_amd64.whl", hash = "sha256:537381db5ec246a99e583260613f20a1a2b92829e53e2faa393537f1edc71476"}, + {file = "pywry-0.6.1.tar.gz", hash = "sha256:0ef6a303d1c90db15e9ac62c337fa0b050dd73d3ece5005a96a97576fdc524ed"}, ] [package.dependencies] @@ -10511,4 +10502,4 @@ optimization = ["Riskfolio-Lib"] [metadata] lock-version = "2.0" python-versions = "^3.8.1,<3.11, !=3.9.7" -content-hash = "8347de5903ddbda7e77ce2bcfe4349702d41233891c9ea65a407611c96b57d87" +content-hash = "39eeb5c1f43224d772062e1dbc5ee224d2461724e79c131e379d90d0fa14c01e" diff --git a/pyproject.toml b/pyproject.toml index fd992a6a0d9..fe1add899ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -101,7 +101,7 @@ jupyterlab-widgets = "^3.0.3" mstarpy = "^0.0.4" packaging = ">=22.0" streamlit = "^1.24.1" -pywry = "^0.5.14" +pywry = "^0.6.1" svglib = "^1.5.0" sparqlwrapper = "^2.0.0" y-py = "!=0.5.5" # Untraceable third level dependency that requires cargo to be built diff --git a/requirements-full.txt b/requirements-full.txt index 9296a620c1f..3252620a799 100644 --- a/requirements-full.txt +++ b/requirements-full.txt @@ -315,7 +315,7 @@ pytz==2023.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" pywin32-ctypes==0.2.2 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7" and sys_platform == "win32" pywin32==306 ; sys_platform == "win32" and platform_python_implementation != "PyPy" and python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" pywinpty==2.0.11 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" and os_name == "nt" -pywry==0.5.14 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" +pywry==0.6.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" pyyaml==6.0.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" pyzmq==25.1.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" qdldl==0.1.7.post0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" diff --git a/requirements.txt b/requirements.txt index 93c70ad0a27..aa0dcfdbf9a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -217,7 +217,7 @@ pytz-deprecation-shim==0.1.0.post0 ; python_full_version >= "3.8.1" and python_f pytz==2023.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" pywin32==306 ; sys_platform == "win32" and platform_python_implementation != "PyPy" and python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" pywinpty==2.0.11 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" and os_name == "nt" -pywry==0.5.14 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" +pywry==0.6.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" pyyaml==6.0.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" pyzmq==25.1.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" quandl==3.7.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"