fix for economy treasury / usdli

This commit is contained in:
tehcoderer
2023-07-21 20:17:33 -04:00
parent cd74832ded
commit 290c5bc8d7
3 changed files with 12 additions and 9 deletions

View File

@@ -1300,9 +1300,10 @@ class OpenBBFigure(go.Figure):
"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):
@@ -1350,7 +1351,8 @@ class OpenBBFigure(go.Figure):
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")

View File

@@ -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"),
)

View File

@@ -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
)