Skip to content

Commit

Permalink
Merge pull request #6618 from OpenBB-finance/release/4.3.1
Browse files Browse the repository at this point in the history
[Release] Merge Release/4.3.1 Into Main
  • Loading branch information
deeleeramone authored Aug 9, 2024
2 parents fe649ac + 0eeff8b commit a9aec9f
Show file tree
Hide file tree
Showing 347 changed files with 79,448 additions and 36,497 deletions.
13 changes: 0 additions & 13 deletions .devcontainer/devcontainer.json

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/general-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
# Run linters for openbb_platform | cli
if [ -n "${{ env.diff_files }}" ]; then
black --diff --check ${{ env.diff_files }}
mypy ${{ env.diff_files }} --ignore-missing-imports --scripts-are-modules --check-untyped-defs
pydocstyle ${{ env.diff_files }}
pylint ${{ env.diff_files }}
ruff check ${{ env.diff_files }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-branch-name-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
if: steps.check-comment.outputs.commentExists == 'false'
run: |
reason="${{ steps.check-develop-branch.outputs.reason }}${{ steps.check-main-branch.outputs.reason }}"
gh pr comment ${{ github.event.pull_request.number }} --body "$reason Please review our [branch naming guidelines](https://github.com/OpenBB-finance/OpenBB/blob/develop/CONTRIBUTING.md#branch-naming-conventions)."
gh pr comment ${{ github.event.pull_request.number }} --body "$reason Please review our [branch naming guidelines](https://docs.openbb.co/platform/developer_guide/github#branch-naming-conventions)."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ Offers access to equity, options, crypto, forex, macro economy, fixed income, an

Sign up to the [OpenBB Hub](https://my.openbb.co/login) to get the most out of the OpenBB ecosystem.

We have also open source an AI financial analyst agent that can access all the data within OpenBB, and that repo can be found [here](https://github.com/OpenBB-finance/openbb-agents).

---

If you are looking for the first AI financial terminal for professionals, the OpenBB Terminal Pro can be found at [pro.openbb.co](https://pro.openbb.co)

<a href="https://pro.openbb.co">
Expand Down
7 changes: 7 additions & 0 deletions assets/extensions/provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@
"website": "https://intrinio.com",
"instructions": "Go to: https://intrinio.com/starter-plan\n\n![Intrinio](https://user-images.githubusercontent.com/85772166/219207556-fcfee614-59f1-46ae-bff4-c63dd2f6991d.png)\n\nAn API key will be issued with a subscription. Find the token value within the account dashboard."
},
{
"packageName": "openbb-multpl",
"optional": true,
"description": "Public broad-market data published to https://multpl.com.",
"credentials": [],
"website": "https://www.multpl.com/"
},
{
"packageName": "openbb-nasdaq",
"optional": true,
Expand Down
12 changes: 7 additions & 5 deletions cli/openbb_cli/argparse_translator/argparse_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,22 +400,23 @@ def execute_func(
"""
kwargs = self._unflatten_args(vars(parsed_args))
kwargs = self._update_with_custom_types(kwargs)

provider = kwargs.get("provider")
provider_args = []
provider_args: List = []
if provider and provider in self.provider_parameters:
provider_args = self.provider_parameters[provider]
else:
for args in self.provider_parameters.values():
provider_args.extend(args)

# remove kwargs that doesn't match the signature or provider parameters
# remove kwargs not matching the signature, provider parameters, or are empty.
kwargs = {
key: value
for key, value in kwargs.items()
if key in self.signature.parameters or key in provider_args
if (
(key in self.signature.parameters or key in provider_args)
and (value or value is False)
)
}

return self.func(**kwargs)

def parse_args_and_execute(self) -> Any:
Expand All @@ -426,6 +427,7 @@ def parse_args_and_execute(self) -> Any:
Any: The return value of the original function.
"""
parsed_args = self._parser.parse_args()

return self.execute_func(parsed_args)

def translate(self) -> Callable:
Expand Down
2 changes: 2 additions & 0 deletions cli/openbb_cli/controllers/base_platform_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ def method(self, other_args: List[str], translator=translator):
fig = obbject.chart.fig if obbject.chart else None
if not export:
obbject.show()
elif session.settings.USE_INTERACTIVE_DF and not export:
obbject.charting.table()
else:
if isinstance(df.columns, pd.RangeIndex):
df.columns = [str(i) for i in df.columns]
Expand Down
32 changes: 7 additions & 25 deletions cli/openbb_cli/controllers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
import numpy as np
import pandas as pd
import requests
from openbb import obb
from openbb_charting.core.backend import create_backend, get_backend
from openbb_cli.config.constants import AVAILABLE_FLAIRS, ENV_FILE_SETTINGS
from openbb_cli.session import Session
from openbb_core.app.model.charts.charting_settings import ChartingSettings
from openbb_core.app.model.obbject import OBBject
from pytz import all_timezones, timezone
from rich.table import Table
Expand Down Expand Up @@ -303,20 +300,6 @@ def return_colored_value(value: str):
return f"{value}"


def _get_backend():
"""Get the Platform charting backend."""
try:
return get_backend()
except ValueError:
# backend might not be created yet
charting_settings = ChartingSettings(
system_settings=obb.system, user_settings=obb.user # type: ignore
)
create_backend(charting_settings)
get_backend().start(debug=charting_settings.debug_mode)
return get_backend()


# pylint: disable=too-many-arguments
def print_rich_table( # noqa: PLR0912
df: pd.DataFrame,
Expand Down Expand Up @@ -385,7 +368,7 @@ def print_rich_table( # noqa: PLR0912
isinstance(df[col].iloc[x], pd.Timestamp)
for x in range(min(10, len(df)))
):
df[col] = pd.to_numeric(df[col], errors="ignore")
df[col] = df[col].apply(pd.to_numeric)
except (ValueError, TypeError):
df[col] = df[col].astype(str)

Expand All @@ -396,7 +379,7 @@ def _get_headers(_headers: Union[List[str], pd.Index]) -> List[str]:
output = list(_headers)
if len(output) != len(df.columns):
raise ValueError("Length of headers does not match length of DataFrame.")
return output
return output # type: ignore

if session.settings.USE_INTERACTIVE_DF:
df_outgoing = df.copy()
Expand All @@ -414,10 +397,7 @@ def _get_headers(_headers: Union[List[str], pd.Index]) -> List[str]:
if col == "":
df_outgoing = df_outgoing.rename(columns={col: " "})

# ensure everything on the dataframe is a string
df_outgoing = df_outgoing.applymap(str)

_get_backend().send_table(
session._backend.send_table( # type: ignore # pylint: disable=protected-access
df_table=df_outgoing,
title=title,
theme=session.user.preferences.table_style,
Expand Down Expand Up @@ -1014,12 +994,14 @@ def handle_obbject_display(
if obbject.chart:
obbject.show(**kwargs)
else:
obbject.charting.to_chart(**kwargs)
obbject.charting.to_chart(**kwargs) # type: ignore
if export:
fig = obbject.chart.fig
fig = obbject.chart.fig # type: ignore
df = obbject.to_dataframe()
except Exception as e:
session.console.print(f"Failed to display chart: {e}")
elif session.settings.USE_INTERACTIVE_DF:
obbject.charting.table() # type: ignore
else:
df = obbject.to_dataframe()
print_rich_table(
Expand Down
19 changes: 19 additions & 0 deletions cli/openbb_cli/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from typing import Optional

from openbb import obb
from openbb_charting.core.backend import create_backend, get_backend
from openbb_core.app.model.abstract.singleton import SingletonMeta
from openbb_core.app.model.charts.charting_settings import ChartingSettings
from openbb_core.app.model.user_settings import UserSettings as User
from prompt_toolkit import PromptSession

Expand All @@ -17,11 +19,26 @@
from openbb_cli.models.settings import Settings


def _get_backend():
"""Get the Platform charting backend."""
try:
return get_backend()
except ValueError:
# backend might not be created yet
charting_settings = ChartingSettings(
system_settings=obb.system, user_settings=obb.user # type: ignore
)
create_backend(charting_settings)
get_backend().start(debug=charting_settings.debug_mode) # type: ignore
return get_backend()


class Session(metaclass=SingletonMeta):
"""Session class."""

def __init__(self):
"""Initialize session."""

self._obb = obb
self._settings = Settings()
self._style = Style(
Expand All @@ -34,6 +51,8 @@ def __init__(self):
self._prompt_session = self._get_prompt_session()
self._obbject_registry = Registry()

self._backend = _get_backend()

@property
def user(self) -> User:
"""Get platform user."""
Expand Down
Loading

0 comments on commit a9aec9f

Please sign in to comment.