Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Charting Modularity #6477

Merged
merged 36 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
46f857f
add accessors to the charting extension
hjoaquim Jun 4, 2024
6c64036
equity views
hjoaquim Jun 4, 2024
c92f9f2
get charting functions from the extensions/accessors
hjoaquim Jun 4, 2024
1f21189
Merge branch 'develop' into feature/charting-modularity
hjoaquim Jun 4, 2024
30b2923
use the private variable instead
hjoaquim Jun 4, 2024
e5537c2
Merge branch 'feature/charting-modularity' of github.com:OpenBB-finan…
hjoaquim Jun 4, 2024
d6ba616
etf views
hjoaquim Jun 4, 2024
da6a718
index views
hjoaquim Jun 4, 2024
450454f
crypto and currency views
hjoaquim Jun 4, 2024
af2bf63
technical views
hjoaquim Jun 4, 2024
1169079
economy views
hjoaquim Jun 4, 2024
d8e09c2
fixedincome views
hjoaquim Jun 4, 2024
bee7f77
right description for price historical
hjoaquim Jun 4, 2024
867b57e
unused
hjoaquim Jun 4, 2024
caa3a71
adjust test and deprecate the charting router
hjoaquim Jun 4, 2024
d65533a
import views only with charting installed
hjoaquim Jun 4, 2024
fcd9cb7
Merge branch 'develop' into feature/charting-modularity
hjoaquim Jun 4, 2024
d889b68
Merge branch 'develop' into feature/charting-modularity
deeleeramone Jun 5, 2024
fa21f04
Merge remote-tracking branch 'OpenBB-finance/develop' into feature/ch…
hjoaquim Jun 6, 2024
c53356c
Merge branch 'develop' into feature/charting-modularity
deeleeramone Jun 10, 2024
6a78c2f
Merge branch 'develop' into feature/charting-modularity
hjoaquim Jun 12, 2024
e71ffce
Merge branch 'develop' into feature/charting-modularity
deeleeramone Jun 14, 2024
e4c4bbf
Merge branch 'develop' into feature/charting-modularity
deeleeramone Jun 15, 2024
eadddf2
Merge branch 'develop' into feature/charting-modularity
IgorWounds Jun 16, 2024
236d224
Merge branch 'develop' into feature/charting-modularity
hjoaquim Jun 17, 2024
be65de0
adding views throught dependencies instead
hjoaquim Jun 17, 2024
bdd1ed3
removing unnecessary infra and adding entry point to charting extension
hjoaquim Jun 17, 2024
acca93c
fixed income toml
hjoaquim Jun 17, 2024
6e3a189
removing accessor
hjoaquim Jun 17, 2024
2e7c82d
typo
hjoaquim Jun 17, 2024
69b145a
typo
hjoaquim Jun 17, 2024
14dd8d0
adding extra params to obbject
hjoaquim Jun 17, 2024
414d4df
remove things from init
hjoaquim Jun 17, 2024
c59e980
rename utils to charts instead
hjoaquim Jun 17, 2024
103fab2
Merge remote-tracking branch 'OpenBB-finance/develop' into feature/ch…
hjoaquim Jun 18, 2024
7d447e6
updated readme
hjoaquim Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions openbb_platform/core/openbb_core/app/model/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ def obbject_accessor(self) -> Callable:

return self.register_accessor(self.name, OBBject)

@property
def charting_accessor(self) -> Callable:
"""Extend a Charting, inspired by pandas."""
# pylint: disable=import-outside-toplevel
# Avoid circular imports

from openbb_charting import Charting

return self.register_accessor(self.name, Charting)

@staticmethod
def register_accessor(name, cls) -> Callable:
"""Register a custom accessor."""
Expand Down
7 changes: 7 additions & 0 deletions openbb_platform/extensions/crypto/openbb_crypto/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
"""OpenBB Crypto Extension."""

try:
from openbb_charting import Charting # type: ignore

from openbb_crypto import crypto_views
except ImportError:
pass
29 changes: 29 additions & 0 deletions openbb_platform/extensions/crypto/openbb_crypto/crypto_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Views for the crypto Extension."""

from typing import Any, Dict, Tuple

from openbb_charting import Charting
from openbb_charting.core.openbb_figure import OpenBBFigure
from openbb_charting.utils.price_historical import price_historical
from openbb_core.app.model.extension import Extension

ext = Extension(
name="crypto_views",
description="Create custom charts from OBBject data for the crypto extension.",
)


@ext.charting_accessor
class CryptoViews:
"""Crypto Views."""

def __init__(self, charting: Charting) -> None:
"""Initialize the crypto Views."""
self._charting = charting

@staticmethod
def crypto_price_historical( # noqa: PLR0912
**kwargs,
deeleeramone marked this conversation as resolved.
Show resolved Hide resolved
) -> Tuple[OpenBBFigure, Dict[str, Any]]:
"""Crypto Price Historical Chart."""
return price_historical(**kwargs)
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
"""The Currency router init."""

try:
from openbb_charting import Charting # type: ignore

from openbb_currency import currency_views
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Views for the currency Extension."""

from typing import Any, Dict, Tuple

from openbb_charting import Charting
from openbb_charting.core.openbb_figure import OpenBBFigure
from openbb_charting.utils.price_historical import price_historical
from openbb_core.app.model.extension import Extension

ext = Extension(
name="currency_views",
description="Create custom charts from OBBject data for the currency extension.",
)


@ext.charting_accessor
class CurrencyViews:
"""Currency Views."""

def __init__(self, charting: Charting) -> None:
"""Initialize the Currency Views."""
self._charting = charting

@staticmethod
def currency_price_historical( # noqa: PLR0912
**kwargs,
) -> Tuple[OpenBBFigure, Dict[str, Any]]:
"""Currency Price Historical Chart."""
return price_historical(**kwargs)
7 changes: 7 additions & 0 deletions openbb_platform/extensions/economy/openbb_economy/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
"""OpenBB Economy Extension."""

try:
from openbb_charting import Charting # type: ignore

from openbb_economy import economy_views
except ImportError:
pass
Loading
Loading