Skip to content

Commit

Permalink
hotfix/economy-charts (#4387)
Browse files Browse the repository at this point in the history
* fixes

* missing dropna on economy models, bump pywry version to override download path

* Update backend.py

* tests

* fix rare instance CHART_DIV is undefined if pywry window loads too fast

* add warning of pywry version due to json keys change

* pylint

* Update fred_view.py

* Update fred_view.py

* Update plotly_helper.py
  • Loading branch information
tehcoderer authored and jmaslek committed Apr 12, 2023
1 parent 82a8819 commit 9e0be38
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
10 changes: 9 additions & 1 deletion openbb_terminal/core/plots/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
BACKEND = None


class Backend(PyWry):
class Backend(pywry.PyWry):
"""Custom backend for Plotly."""

def __new__(cls, *args, **kwargs): # pylint: disable=W0613
Expand Down Expand Up @@ -230,6 +230,14 @@ def send_table(self, df_table: pd.DataFrame, title: str = "", source: str = ""):
Source of the data, by default ""
"""
self.loop.run_until_complete(self.check_backend())
columnwidth = [
max(len(str(df_table[col].name)), df_table[col].astype(str).str.len().max())
for col in df_table.columns
]
# we add a percentage of max to the min column width
columnwidth = [
int(x + (max(columnwidth) - min(columnwidth)) * 0.2) for x in columnwidth
]

if title:
# We remove any html tags and markdown from the title
Expand Down
13 changes: 4 additions & 9 deletions openbb_terminal/economy/fred_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,18 +349,13 @@ def plot_cpi(
"growth_previous": "Growth Previous Period (%)",
}

country = [
country.replace("_", " ").title()
for country in countries
if df.columns.str.contains(country)
]

country = str(countries[0]).replace("_", " ").title()
title = f"{'Harmonized ' if harmonized else ''} Consumer Price"
title += (
f" Index for {', '.join(country)}"
if country
else " Indices"
" Indices"
if len(df.columns) > 1
else f" Index for {country}"
if country
else ""
)

Expand Down
Binary file removed openbb_terminal/fixedincome/commercial_paper.xlsx
Binary file not shown.
Binary file not shown.
Binary file removed openbb_terminal/fixedincome/ice_bofa_indices.xlsx
Binary file not shown.

0 comments on commit 9e0be38

Please sign in to comment.