Skip to content

Commit

Permalink
fix for economy treasury / usdli
Browse files Browse the repository at this point in the history
  • Loading branch information
tehcoderer committed Jul 22, 2023
1 parent cd74832 commit 290c5bc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
10 changes: 6 additions & 4 deletions openbb_terminal/core/plots/plotly_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1300,9 +1300,10 @@ def get_dateindex(self) -> Optional[List[datetime]]:
"col": col,
"secondary_y": secondary_y,
}
self._subplot_xdates.setdefault(row, {}).setdefault(
col, []
).append(trace.x)
if trace.type != "scatter":
self._subplot_xdates.setdefault(row, {}).setdefault(
col, []
).append(trace.x)

# We convert the dateindex to a list of datetime objects if it's a numpy array
if output is not None and isinstance(output[0], np.datetime64):
Expand Down Expand Up @@ -1350,7 +1351,8 @@ def hide_date_gaps(
rangebreaks: List[Dict[str, Any]] = [dict(values=dt_missing_days)]

# We get the frequency of the data to hide intra-day gaps
if (freq := df_data.index[1] - df_data.index[0]).days == 0:
if df_data.index[-1].time() != df_data.index[-2].time():
freq = df_data.index[1] - df_data.index[0]
freq_mins = int(freq.seconds / 60)
break_values = (
df_data.resample(f"{freq_mins}T")
Expand Down
5 changes: 3 additions & 2 deletions openbb_terminal/economy/fedreserve_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ def show_treasuries(
)

for col in treasury_data.columns:
non_nan = treasury_data[col].notna()
fig.add_scatter(
x=treasury_data.index,
y=treasury_data[col],
x=treasury_data.index[non_nan],
y=treasury_data[col][non_nan],
mode="lines",
name=col.replace("m", " Month").replace("y", " Year"),
)
Expand Down
6 changes: 3 additions & 3 deletions openbb_terminal/economy/fred_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,9 @@ def get_usd_liquidity(overlay: str = "", show: bool = False) -> pd.DataFrame:
)

data = pd.DataFrame()
data["WALCL"] = get_series_data("WALCL").astype(int) * 1000000
data["WLRRAL"] = get_series_data("WLRRAL").astype(int) * 1000000
data["WDTGAL"] = get_series_data("WDTGAL").astype(int) * 1000000
data["WALCL"] = get_series_data("WALCL").astype("int64") * 1000000
data["WLRRAL"] = get_series_data("WLRRAL").astype("int64") * 1000000
data["WDTGAL"] = get_series_data("WDTGAL").astype("int64") * 1000000
data["USD Liquidity Index (Billions of USD)"] = round(
(data["WALCL"] - data["WLRRAL"] - data["WDTGAL"]) / 1000000000, 2
)
Expand Down

0 comments on commit 290c5bc

Please sign in to comment.