Skip to content

Commit

Permalink
Merge pull request #4349 from OpenBB-finance/hotfix/treasury-rates
Browse files Browse the repository at this point in the history
Fix long/short issue and fix transform issue
  • Loading branch information
JerBouma authored Feb 28, 2023
2 parents 3f9db71 + b02457d commit 3a961ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions openbb_terminal/economy/econdb_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,13 @@ def get_macro_data(

df = pd.DataFrame(data["dataarray"])

if code not in df.columns:
console.print(
f"No data available for {parameter} of {country} "
f"{f'with transform method {transform}' if transform else ''}"
)
return pd.DataFrame(), "NA/NA"

df = df.set_index(pd.to_datetime(df["date"]))[code] * SCALES[scale]
df = df.sort_index().dropna()

Expand Down
3 changes: 3 additions & 0 deletions openbb_terminal/fixedincome/oecd_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ def get_treasury(
end_date: str
End date of data, in YYYY-MM-DD format
"""
df_short, df_long = pd.DataFrame(), pd.DataFrame()

if short_term:
df_short = get_interest_rate_data(
f"short{'_forecast' if forecast else ''}",
Expand All @@ -239,4 +241,5 @@ def get_treasury(
)

df = pd.concat([df_short, df_long], axis=1)

return df

0 comments on commit 3a961ea

Please sign in to comment.