mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-13 04:41:24 +00:00
Hotfix/pywry 0.6.1 (#5446)
* poetry, req files * installer spec pywry 0.6.0 changes * fix `df_volume` being sent as `pd.Series` on Macs * more `pd.Series` fixes * bump pywry to 0.6.1 -fixes linux install
This commit is contained in:
1
build/pyinstaller/.env
vendored
1
build/pyinstaller/.env
vendored
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
57
build/pyinstaller/terminal.spec
vendored
57
build/pyinstaller/terminal.spec
vendored
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"""
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -579,6 +579,11 @@ def display_monthly_returns(
|
||||
texttemplate = "%{z:.2f}%" if show_vals else ""
|
||||
hovertemplate = "%{x} %{y:.0f}:<br>%{z:.2f}%<extra></extra>"
|
||||
|
||||
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())
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
21
poetry.lock
generated
vendored
21
poetry.lock
generated
vendored
@@ -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"
|
||||
|
||||
2
pyproject.toml
vendored
2
pyproject.toml
vendored
@@ -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
|
||||
|
||||
2
requirements-full.txt
vendored
2
requirements-full.txt
vendored
@@ -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"
|
||||
|
||||
2
requirements.txt
vendored
2
requirements.txt
vendored
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user