diff --git a/openbb_sdk/extensions/charting/openbb_charting/core/backend.py b/openbb_sdk/extensions/charting/openbb_charting/core/backend.py index 8bd13c07244..0b29cb3d532 100644 --- a/openbb_sdk/extensions/charting/openbb_charting/core/backend.py +++ b/openbb_sdk/extensions/charting/openbb_charting/core/backend.py @@ -142,7 +142,7 @@ class Backend(PyWry): def get_json_update( self, - cmd_loc: str, + cmd_loc: Optional[str] = None, theme: Optional[str] = None, ) -> dict: """Get the json update for the backend.""" diff --git a/openbb_sdk/extensions/charting/openbb_charting/core/plotly_ta/plugins/custom_indicators_plugin.py b/openbb_sdk/extensions/charting/openbb_charting/core/plotly_ta/plugins/custom_indicators_plugin.py index 0570fe4ff73..c08d9b5831b 100644 --- a/openbb_sdk/extensions/charting/openbb_charting/core/plotly_ta/plugins/custom_indicators_plugin.py +++ b/openbb_sdk/extensions/charting/openbb_charting/core/plotly_ta/plugins/custom_indicators_plugin.py @@ -5,10 +5,7 @@ import numpy as np import pandas as pd from openbb_charting.core.config.openbb_styles import PLT_FIB_COLORWAY from openbb_charting.core.openbb_figure import OpenBBFigure -from openbb_charting.core.plotly_ta.base import ( - PltTA, - indicator, -) +from openbb_charting.core.plotly_ta.base import PltTA, indicator class Custom(PltTA): @@ -122,7 +119,6 @@ class Custom(PltTA): @indicator() def plot_fib(self, fig: OpenBBFigure, df_ta: pd.DataFrame): """Add fibonacci to plotly figure.""" - try: from openbb_ta.ta_helpers import calculate_fib_levels except ImportError: @@ -135,6 +131,7 @@ class Custom(PltTA): limit = self.params["fib"].get_argument_values("limit") or 120 start_date = self.params["fib"].get_argument_values("start_date") or None end_date = self.params["fib"].get_argument_values("end_date") or None + close = self.params["fib"].get_argument_values("close") or "close" ( df_fib, min_date, @@ -142,7 +139,7 @@ class Custom(PltTA): min_pr, max_pr, lvl_text, - ) = calculate_fib_levels(df_ta, limit, start_date, end_date) + ) = calculate_fib_levels(df_ta, close, limit, start_date, end_date) levels = df_fib.Price fibs = [ "0", diff --git a/openbb_sdk/extensions/charting/openbb_charting/core/plotly_ta/ta_class.py b/openbb_sdk/extensions/charting/openbb_charting/core/plotly_ta/ta_class.py index b4bcd0c8777..8f4d7e43798 100644 --- a/openbb_sdk/extensions/charting/openbb_charting/core/plotly_ta/ta_class.py +++ b/openbb_sdk/extensions/charting/openbb_charting/core/plotly_ta/ta_class.py @@ -81,7 +81,7 @@ class PlotlyTA(PltTA): >>> fig2.show() """ - inchart_colors: Optional[List[str]] = None + inchart_colors: List[str] = [] plugins: List[Type[PltTA]] = [] df_ta: pd.DataFrame = None close_column: Optional[str] = "close" @@ -404,7 +404,8 @@ class PlotlyTA(PltTA): secondary_y=False, ) fig.update_layout(yaxis=dict(nticks=15)) - self.inchart_colors = self.theme.get_colors()[1:] + if self.theme: + self.inchart_colors = self.theme.get_colors()[1:] fig.set_title(symbol, x=0.5, y=0.98, xanchor="center", yanchor="top") return fig diff --git a/openbb_sdk/extensions/ta/openbb_ta/ta_router.py b/openbb_sdk/extensions/ta/openbb_ta/ta_router.py index 775580f6ee8..ec072bf1318 100644 --- a/openbb_sdk/extensions/ta/openbb_ta/ta_router.py +++ b/openbb_sdk/extensions/ta/openbb_ta/ta_router.py @@ -83,8 +83,7 @@ def fib( start_date: Optional[str] = None, end_date: Optional[str] = None, ) -> OBBject[List[Data]]: - """ - Fibonacci Retracement Levels. + """Create Fibonacci Retracement Levels. Parameters ---------- diff --git a/openbb_sdk/sdk/core/openbb_core/app/charting_manager.py b/openbb_sdk/sdk/core/openbb_core/app/charting_manager.py index 5c101219dd9..1b327bad88e 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/charting_manager.py +++ b/openbb_sdk/sdk/core/openbb_core/app/charting_manager.py @@ -1,5 +1,5 @@ from importlib import import_module -from typing import Callable, Generic, Optional, Tuple, TypeVar +from typing import Callable, Optional, Tuple, TypeVar from importlib_metadata import entry_points @@ -194,7 +194,7 @@ class ChartingManager(metaclass=SingletonMeta): user_settings: UserSettings, system_settings: SystemSettings, route: str, - obbject_item: Generic[T], + obbject_item: T, **kwargs, ): """ diff --git a/openbb_sdk/sdk/core/openbb_core/app/model/charts/charting_settings.py b/openbb_sdk/sdk/core/openbb_core/app/model/charts/charting_settings.py index 45f423acab1..f43d20787b1 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/model/charts/charting_settings.py +++ b/openbb_sdk/sdk/core/openbb_core/app/model/charts/charting_settings.py @@ -16,8 +16,6 @@ class ChartingSettings: user_settings = user_settings or UserSettings() system_settings = system_settings or SystemSettings() - has_hub = user_settings.profile.hub_session is not None - user_data_directory = ( str(Path.home() / "OpenBBUserData") if not user_settings.preferences @@ -37,11 +35,11 @@ class ChartingSettings: self.plot_pywry_width: int = user_settings.preferences.plot_pywry_width self.plot_pywry_height: int = user_settings.preferences.plot_pywry_height self.plot_open_export: bool = user_settings.preferences.plot_open_export - self.user_email: Optional[str] = ( - user_settings.profile.hub_session.email if has_hub else None + self.user_email: Optional[str] = getattr( + user_settings.profile.hub_session, "email", None ) - self.user_uuid: Optional[str] = ( - user_settings.profile.hub_session.user_uuid if has_hub else None + self.user_uuid: Optional[str] = getattr( + user_settings.profile.hub_session, "uuid", None ) self.user_exports_directory = user_settings.preferences.export_directory self.user_styles_directory = user_settings.preferences.user_styles_directory