openbb-charting 2.1.1__tar.gz → 2.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/PKG-INFO +2 -2
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/__init__.py +16 -2
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/backend.py +3 -75
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/openbb_figure.py +2 -20
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/pyproject.toml +2 -2
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/README.md +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/builder.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/charting_router.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/__init__.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/assets/Terminal_icon.png +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/assets/plotly-2.32.0.min.js +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/chart_style.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/config/__init__.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/config/openbb_styles.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/dummy_backend.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly.html +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/__init__.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/base.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/data_classes.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/plugins/__init__.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/plugins/custom_indicators_plugin.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/plugins/momentum_plugin.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/plugins/overlap_plugin.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/plugins/trend_indicators_plugin.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/plugins/volatility_plugin.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/plugins/volume_plugin.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/ta_class.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/ta_helpers.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/table.html +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/to_chart.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/query_params.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/styles/__init__.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/styles/colors.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/styles/default/dark.pltstyle.json +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/styles/default/light.pltstyle.json +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/styles/default/tables.pltstyle.json +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/utils/__init__.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/utils/generic_charts.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/utils/helpers.py +0 -0
- {openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/utils/relative_rotation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: openbb-charting
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.2
|
|
4
4
|
Summary: Charting extension for OpenBB
|
|
5
5
|
License: AGPL-3.0-only
|
|
6
6
|
Author: OpenBB Team
|
|
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Requires-Dist: nbformat (>=5.9.2,<6.0.0)
|
|
16
|
-
Requires-Dist: openbb-core (>=1.2.
|
|
16
|
+
Requires-Dist: openbb-core (>=1.2.4,<2.0.0)
|
|
17
17
|
Requires-Dist: pandas-ta (>=0.3.14b,<0.4.0)
|
|
18
18
|
Requires-Dist: plotly (>=5.17.0,<6.0.0)
|
|
19
19
|
Requires-Dist: pywry (>=0.6.1,<0.7.0)
|
|
@@ -459,8 +459,9 @@ class Charting:
|
|
|
459
459
|
)
|
|
460
460
|
kwargs["provider"] = self._obbject.provider # pylint: disable=protected-access
|
|
461
461
|
kwargs["extra"] = self._obbject.extra # pylint: disable=protected-access
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
metadata = kwargs["extra"].get("metadata")
|
|
463
|
+
kwargs["extra_params"] = (
|
|
464
|
+
metadata.arguments.get("extra_params") if metadata else None
|
|
464
465
|
)
|
|
465
466
|
if "kwargs" in kwargs:
|
|
466
467
|
_kwargs = kwargs.pop("kwargs")
|
|
@@ -554,3 +555,16 @@ class Charting:
|
|
|
554
555
|
ipython_display.display(ipython_display.HTML(data_as_df.to_html()))
|
|
555
556
|
else:
|
|
556
557
|
warn("IPython.display is not available.")
|
|
558
|
+
|
|
559
|
+
def url(
|
|
560
|
+
self,
|
|
561
|
+
url: str,
|
|
562
|
+
title: str = "",
|
|
563
|
+
width: Optional[int] = None,
|
|
564
|
+
height: Optional[int] = None,
|
|
565
|
+
):
|
|
566
|
+
"""Return the URL of the chart."""
|
|
567
|
+
try:
|
|
568
|
+
self._backend.send_url(url=url, title=title, width=width, height=height)
|
|
569
|
+
except Exception as e: # pylint: disable=W0718
|
|
570
|
+
warn(f"Failed to show figure with backend. {e}")
|
|
@@ -201,21 +201,18 @@ class Backend(PyWry):
|
|
|
201
201
|
if self.charting_settings.chart_style == "dark"
|
|
202
202
|
else "rgba(255,255,255,0)"
|
|
203
203
|
)
|
|
204
|
-
|
|
205
204
|
title = "Interactive Chart"
|
|
206
|
-
|
|
207
205
|
fig.layout.title.text = re.sub(
|
|
208
206
|
r"<[^>]*>", "", fig.layout.title.text if fig.layout.title.text else title
|
|
209
207
|
)
|
|
210
|
-
|
|
211
208
|
fig.layout.height += 69
|
|
212
209
|
|
|
213
|
-
|
|
214
|
-
export_image = Path(export_image).resolve()
|
|
210
|
+
export_image = Path(export_image).resolve() if export_image else None
|
|
215
211
|
|
|
216
212
|
json_data = json.loads(fig.to_json())
|
|
217
213
|
json_data.update(self.get_json_update(command_location))
|
|
218
214
|
json_data["layout"]["paper_bgcolor"] = paper_bg
|
|
215
|
+
|
|
219
216
|
outgoing = dict(
|
|
220
217
|
html=self.get_plotly_html(),
|
|
221
218
|
json_data=json_data,
|
|
@@ -224,7 +221,7 @@ class Backend(PyWry):
|
|
|
224
221
|
)
|
|
225
222
|
self.send_outgoing(outgoing)
|
|
226
223
|
|
|
227
|
-
if export_image
|
|
224
|
+
if export_image:
|
|
228
225
|
if self.loop.is_closed(): # type: ignore[has-type]
|
|
229
226
|
# Create a new event loop
|
|
230
227
|
self.loop = asyncio.new_event_loop()
|
|
@@ -404,75 +401,6 @@ class Backend(PyWry):
|
|
|
404
401
|
|
|
405
402
|
super().close()
|
|
406
403
|
|
|
407
|
-
async def get_results(self, description: str) -> dict:
|
|
408
|
-
"""Wait for completion of interactive task and return the data.
|
|
409
|
-
|
|
410
|
-
Parameters
|
|
411
|
-
----------
|
|
412
|
-
description : str
|
|
413
|
-
Description of the task to console print while waiting.
|
|
414
|
-
|
|
415
|
-
Returns
|
|
416
|
-
-------
|
|
417
|
-
dict
|
|
418
|
-
The data returned from pywry backend.
|
|
419
|
-
"""
|
|
420
|
-
warnings.warn(
|
|
421
|
-
f"[green]{description}[/]\n\n"
|
|
422
|
-
"[yellow]If the window is closed you can continue by pressing Ctrl+C.[/]"
|
|
423
|
-
)
|
|
424
|
-
while True:
|
|
425
|
-
try:
|
|
426
|
-
data: dict = self.recv.get(block=False) or {}
|
|
427
|
-
if data.get("result", False):
|
|
428
|
-
return json.loads(data["result"])
|
|
429
|
-
except Exception: # pylint: disable=W0703
|
|
430
|
-
await asyncio.sleep(0.1)
|
|
431
|
-
|
|
432
|
-
await asyncio.sleep(1)
|
|
433
|
-
|
|
434
|
-
def call_hub(self, login: bool = True) -> Optional[dict]:
|
|
435
|
-
"""Call the hub to login or logout.
|
|
436
|
-
|
|
437
|
-
Parameters
|
|
438
|
-
----------
|
|
439
|
-
login : bool, optional
|
|
440
|
-
Whether to login or logout, by default True
|
|
441
|
-
|
|
442
|
-
Returns
|
|
443
|
-
-------
|
|
444
|
-
Optional[dict]
|
|
445
|
-
The user data if login was successful, None otherwise.
|
|
446
|
-
"""
|
|
447
|
-
self.check_backend()
|
|
448
|
-
endpoint = {True: "login", False: "logout"}[login]
|
|
449
|
-
|
|
450
|
-
outgoing = dict(
|
|
451
|
-
json_data=dict(url=f"https://my.openbb.co/{endpoint}?pywry=true"),
|
|
452
|
-
**self.get_kwargs(endpoint.title()),
|
|
453
|
-
width=900,
|
|
454
|
-
height=800,
|
|
455
|
-
)
|
|
456
|
-
self.send_outgoing(outgoing)
|
|
457
|
-
|
|
458
|
-
messages_dict = dict(
|
|
459
|
-
login=dict(
|
|
460
|
-
message="Welcome to OpenBB Terminal! Please login to continue.",
|
|
461
|
-
interrupt="Window closed without authentication. Please proceed below.",
|
|
462
|
-
),
|
|
463
|
-
logout=dict(
|
|
464
|
-
message="Sending logout request", interrupt="Please login to continue."
|
|
465
|
-
),
|
|
466
|
-
)
|
|
467
|
-
|
|
468
|
-
try:
|
|
469
|
-
return self.loop.run_until_complete(
|
|
470
|
-
self.get_results(messages_dict[endpoint]["message"])
|
|
471
|
-
)
|
|
472
|
-
except KeyboardInterrupt:
|
|
473
|
-
warnings.warn(f"\n[red]{messages_dict[endpoint]['interrupt']}[/red]")
|
|
474
|
-
return None
|
|
475
|
-
|
|
476
404
|
|
|
477
405
|
async def download_plotly_js():
|
|
478
406
|
"""Download or updates plotly.js to the assets folder."""
|
|
@@ -91,7 +91,7 @@ class OpenBBFigure(go.Figure):
|
|
|
91
91
|
if fig:
|
|
92
92
|
self.__dict__ = fig.__dict__
|
|
93
93
|
|
|
94
|
-
self._charting_settings: Optional[
|
|
94
|
+
self._charting_settings: Optional[ChartingSettings] = kwargs.pop(
|
|
95
95
|
"charting_settings", None
|
|
96
96
|
)
|
|
97
97
|
self._has_secondary_y = kwargs.pop("has_secondary_y", False)
|
|
@@ -464,24 +464,6 @@ class OpenBBFigure(go.Figure):
|
|
|
464
464
|
|
|
465
465
|
self.update_layout(barmode="overlay", bargap=0.01, bargroupgap=0)
|
|
466
466
|
|
|
467
|
-
def is_image_export(self, export: Optional[str] = "") -> bool:
|
|
468
|
-
"""Check if the export format is an image format.
|
|
469
|
-
|
|
470
|
-
Parameters
|
|
471
|
-
----------
|
|
472
|
-
export : `str`
|
|
473
|
-
Export format
|
|
474
|
-
|
|
475
|
-
Returns
|
|
476
|
-
-------
|
|
477
|
-
`bool`
|
|
478
|
-
True if the export format is an image format, False otherwise
|
|
479
|
-
"""
|
|
480
|
-
if not export:
|
|
481
|
-
return False
|
|
482
|
-
|
|
483
|
-
return any(ext in export for ext in ["jpg", "png", "svg"])
|
|
484
|
-
|
|
485
467
|
def set_title(
|
|
486
468
|
self, title: str, wrap: bool = False, wrap_width: int = 80, **kwargs
|
|
487
469
|
) -> "OpenBBFigure":
|
|
@@ -917,7 +899,7 @@ class OpenBBFigure(go.Figure):
|
|
|
917
899
|
self._exported = True
|
|
918
900
|
|
|
919
901
|
# We send the figure to the backend to be displayed
|
|
920
|
-
return self._backend.send_figure(self, export_image)
|
|
902
|
+
return self._backend.send_figure(fig=self, export_image=export_image)
|
|
921
903
|
except Exception as e:
|
|
922
904
|
# If the backend fails, we just show the figure normally
|
|
923
905
|
# This is a very rare case, but it's better to have a fallback
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "openbb-charting"
|
|
3
|
-
version = "2.1.
|
|
3
|
+
version = "2.1.2"
|
|
4
4
|
description = "Charting extension for OpenBB"
|
|
5
5
|
authors = ["OpenBB Team <hello@openbb.co>"]
|
|
6
6
|
license = "AGPL-3.0-only"
|
|
@@ -15,7 +15,7 @@ statsmodels = "^0.14.0"
|
|
|
15
15
|
pywry = "^0.6.1"
|
|
16
16
|
nbformat = "^5.9.2"
|
|
17
17
|
pandas-ta = "^0.3.14b"
|
|
18
|
-
openbb-core = "^1.2.
|
|
18
|
+
openbb-core = "^1.2.4"
|
|
19
19
|
|
|
20
20
|
[build-system]
|
|
21
21
|
requires = ["poetry-core"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/assets/Terminal_icon.png
RENAMED
|
File without changes
|
{openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/assets/plotly-2.32.0.min.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/config/openbb_styles.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/data_classes.py
RENAMED
|
File without changes
|
{openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/plugins/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/core/plotly_ta/ta_helpers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/styles/default/dark.pltstyle.json
RENAMED
|
File without changes
|
{openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/styles/default/light.pltstyle.json
RENAMED
|
File without changes
|
{openbb_charting-2.1.1 → openbb_charting-2.1.2}/openbb_charting/styles/default/tables.pltstyle.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|