summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanglewood <85772166+deeleeramone@users.noreply.github.com>2024-06-10 21:45:34 -0700
committerDanglewood <85772166+deeleeramone@users.noreply.github.com>2024-06-10 21:45:34 -0700
commitaab066bf88849f8b514f68a7b3b1c32358b4e172 (patch)
treef5c3c10223bd2e17c46836158f7afd41a6848715
parentda0547641e65a0f0cb4891091fcb956575776bf1 (diff)
move moody's bond indices to the bond_indices endpoint
-rw-r--r--openbb_platform/extensions/fixedincome/openbb_fixedincome/corporate/corporate_router.py7
-rw-r--r--openbb_platform/openbb/assets/reference.json30
-rw-r--r--openbb_platform/openbb/package/economy.py26
-rw-r--r--openbb_platform/openbb/package/fixedincome_corporate.py11
-rw-r--r--openbb_platform/providers/fred/openbb_fred/models/bond_indices.py15
5 files changed, 61 insertions, 28 deletions
diff --git a/openbb_platform/extensions/fixedincome/openbb_fixedincome/corporate/corporate_router.py b/openbb_platform/extensions/fixedincome/openbb_fixedincome/corporate/corporate_router.py
index d38bbcf6b60..f8a6775d057 100644
--- a/openbb_platform/extensions/fixedincome/openbb_fixedincome/corporate/corporate_router.py
+++ b/openbb_platform/extensions/fixedincome/openbb_fixedincome/corporate/corporate_router.py
@@ -48,6 +48,13 @@ async def ice_bofa(
@router.command(
+ deprecated=True,
+ deprecation=OpenBBDeprecationWarning(
+ message="This endpoint is deprecated; use `/fixedincome/bond_indices` instead."
+ + " Set `category` to `us` and `index` to `seasoned_corporate`.",
+ since=(4, 2),
+ expected_removal=(4, 5),
+ ),
model="MoodyCorporateBondIndex",
examples=[
APIEx(parameters={"provider": "fred"}),
diff --git a/openbb_platform/openbb/assets/reference.json b/openbb_platform/openbb/assets/reference.json
index 1d954de432f..065f70967c7 100644
--- a/openbb_platform/openbb/assets/reference.json
+++ b/openbb_platform/openbb/assets/reference.json
@@ -5595,7 +5595,7 @@
{
"name": "face_value",
"type": "float",
- "description": "Current face value of the security (Thousands). Current face value of the securities, which is the remaining principal balance of the securities.",
+ "description": "Current face value of the security (Thousands of $USD). Current face value of the securities, which is the remaining principal balance of the securities.",
"default": null,
"optional": true,
"choices": null
@@ -5603,7 +5603,7 @@
{
"name": "par_value",
"type": "float",
- "description": "Par value of the security (Thousands). Changes in par may reflect primary and secondary market transactions and/or custodial account activity.",
+ "description": "Par value of the security (Thousands of $USD). Changes in par may reflect primary and secondary market transactions and/or custodial account activity.",
"default": null,
"optional": true,
"choices": null
@@ -5635,7 +5635,7 @@
{
"name": "bills",
"type": "float",
- "description": "Treasury bills amount (Thousands). Only returned when 'summary' is True.",
+ "description": "Treasury bills amount (Thousands of $USD). Only returned when 'summary' is True.",
"default": null,
"optional": true,
"choices": null
@@ -5643,7 +5643,7 @@
{
"name": "frn",
"type": "float",
- "description": "Floating rate Treasury notes amount (Thousands). Only returned when 'summary' is True.",
+ "description": "Floating rate Treasury notes amount (Thousands of $USD). Only returned when 'summary' is True.",
"default": null,
"optional": true,
"choices": null
@@ -5651,7 +5651,7 @@
{
"name": "notes_and_bonds",
"type": "float",
- "description": "Treasuy Notes and bonds amount (Thousands). Only returned when 'summary' is True.",
+ "description": "Treasuy Notes and bonds amount (Thousands of $USD). Only returned when 'summary' is True.",
"default": null,
"optional": true,
"choices": null
@@ -5659,7 +5659,7 @@
{
"name": "tips",
"type": "float",
- "description": "Treasury inflation-protected securities amount (Thousands). Only returned when 'summary' is True.",
+ "description": "Treasury inflation-protected securities amount (Thousands of $USD). Only returned when 'summary' is True.",
"default": null,
"optional": true,
"choices": null
@@ -5667,7 +5667,7 @@
{
"name": "mbs",
"type": "float",
- "description": "Mortgage-backed securities amount (Thousands). Only returned when 'summary' is True.",
+ "description": "Mortgage-backed securities amount (Thousands of $USD). Only returned when 'summary' is True.",
"default": null,
"optional": true,
"choices": null
@@ -5675,7 +5675,7 @@
{
"name": "cmbs",
"type": "float",
- "description": "Commercial mortgage-backed securities amount (Thousands). Only returned when 'summary' is True.",
+ "description": "Commercial mortgage-backed securities amount (Thousands of $USD). Only returned when 'summary' is True.",
"default": null,
"optional": true,
"choices": null
@@ -5683,7 +5683,7 @@
{
"name": "agencies",
"type": "float",
- "description": "Agency securities amount (Thousands). Only returned when 'summary' is True.",
+ "description": "Agency securities amount (Thousands of $USD). Only returned when 'summary' is True.",
"default": null,
"optional": true,
"choices": null
@@ -5691,7 +5691,7 @@
{
"name": "total",
"type": "float",
- "description": "Total SOMA holdings amount (Thousands). Only returned when 'summary' is True.",
+ "description": "Total SOMA holdings amount (Thousands of $USD). Only returned when 'summary' is True.",
"default": null,
"optional": true,
"choices": null
@@ -5699,7 +5699,7 @@
{
"name": "tips_inflation_compensation",
"type": "float",
- "description": "Treasury inflation-protected securities inflation compensation amount (Thousands). Only returned when 'summary' is True.",
+ "description": "Treasury inflation-protected securities inflation compensation amount (Thousands of $USD). Only returned when 'summary' is True.",
"default": null,
"optional": true,
"choices": null
@@ -5707,7 +5707,7 @@
{
"name": "change_prior_week",
"type": "float",
- "description": "Change in SOMA holdings from the prior week (Thousands).",
+ "description": "Change in SOMA holdings from the prior week (Thousands of $USD).",
"default": null,
"optional": true,
"choices": null
@@ -5715,7 +5715,7 @@
{
"name": "change_prior_year",
"type": "float",
- "description": "Change in SOMA holdings from the prior year (Thousands).",
+ "description": "Change in SOMA holdings from the prior year (Thousands of $USD).",
"default": null,
"optional": true,
"choices": null
@@ -32115,8 +32115,8 @@
},
"/fixedincome/corporate/moody": {
"deprecated": {
- "flag": null,
- "message": null
+ "flag": true,
+ "message": "This endpoint is deprecated; use `/fixedincome/bond_indices` instead. Set `category` to `us` and `index` to `seasoned_corporate`. Deprecated in OpenBB Platform V4.2 to be removed in V4.5."
},
"description": "Moody Corporate Bond Index.\n\nMoody's Aaa and Baa are investment bonds that acts as an index of\nthe performance of all bonds given an Aaa or Baa rating by Moody's Investors Service respectively.\nThese corporate bonds often are used in macroeconomics as an alternative to the federal ten-year\nTreasury Bill as an indicator of the interest rate.",
"examples": "\nExamples\n--------\n\n```python\nfrom openbb import obb\nobb.fixedincome.corporate.moody(provider='fred')\nobb.fixedincome.corporate.moody(index_type='baa', provider='fred')\n```\n\n",
diff --git a/openbb_platform/openbb/package/economy.py b/openbb_platform/openbb/package/economy.py
index 1601627f307..c980bc1fc49 100644
--- a/openbb_platform/openbb/package/economy.py
+++ b/openbb_platform/openbb/package/economy.py
@@ -439,9 +439,9 @@ class ROUTER_economy(Container):
term : Optional[str]
Term of the security. Only returned for Agency securities. (provider: federal_reserve)
face_value : Optional[float]
- Current face value of the security (Thousands). Current face value of the securities, which is the remaining principal balance of the securities. (provider: federal_reserve)
+ Current face value of the security (Thousands of $USD). Current face value of the securities, which is the remaining principal balance of the securities. (provider: federal_reserve)
par_value : Optional[float]
- Par value of the security (Thousands). Changes in par may reflect primary and secondary market transactions and/or custodial account activity. (provider: federal_reserve)
+ Par value of the security (Thousands of $USD). Changes in par may reflect primary and secondary market transactions and/or custodial account activity. (provider: federal_reserve)
coupon : Optional[float]
Coupon rate of the security. (provider: federal_reserve)
spread : Optional[float]
@@ -449,27 +449,27 @@ class ROUTER_economy(Container):
percent_outstanding : Optional[float]
Total percent of the outstanding CUSIP issuance. (provider: federal_reserve)
bills : Optional[float]
- Treasury bills amount (Thousands). Only returned when 'summary' is True. (provider: federal_reserve)
+ Treasury bills amount (Thousands of $USD). Only returned when 'summary' is True. (provider: federal_reserve)
frn : Optional[float]
- Floating rate Treasury notes amount (Thousands). Only returned when 'summary' is True. (provider: federal_reserve)
+ Floating rate Treasury notes amount (Thousands of $USD). Only returned when 'summary' is True. (provider: federal_reserve)
notes_and_bonds : Optional[float]
- Treasuy Notes and bonds amount (Thousands). Only returned when 'summary' is True. (provider: federal_reserve)
+ Treasuy Notes and bonds amount (Thousands of $USD). Only returned when 'summary' is True. (provider: federal_reserve)
tips : Optional[float]
- Treasury inflation-protected securities amount (Thousands). Only returned when 'summary' is True. (provider: federal_reserve)
+ Treasury inflation-protected securities amount (Thousands of $USD). Only returned when 'summary' is True. (provider: federal_reserve)
mbs : Optional[float]
- Mortgage-backed securities amount (Thousands). Only returned when 'summary' is True. (provider: federal_reserve)
+ Mortgage-backed securities amount (Thousands of $USD). Only returned when 'summary' is True. (provider: federal_reserve)
cmbs : Optional[float]
- Commercial mortgage-backed securities amount (Thousands). Only returned when 'summary' is True. (provider: federal_reserve)
+ Commercial mortgage-backed securities amount (Thousands of $USD). Only returned when 'summary' is True. (provider: federal_reserve)
agencies : Optional[float]
- Agency securities amount (Thousands). Only returned when 'summary' is True. (provider: federal_reserve)
+ Agency securities amount (Thousands of $USD). Only returned when 'summary' is True. (provider: federal_reserve)
total : Optional[float]
- Total SOMA holdings amount (Thousands). Only returned when 'summary' is True. (provider: federal_reserve)
+ Total SOMA holdings amount (Thousands of $USD). Only returned when 'summary' is True. (provider: federal_reserve)
tips_inflation_compensation : Optional[float]
- Treasury inflation-protected securities inflation compensation amount (Thousands). Only returned when 'summary' is True. (provider: federal_reserve)
+ Treasury inflation-protected securities inflation compensation amount (Thousands of $USD). Only returned when 'summary' is True. (provider: federal_reserve)
change_prior_week : Optional[float]
- Change in SOMA holdings from the prior week (Thousands). (provider: federal_reserve)
+ Change in SOMA holdings from the prior week (Thousands of $USD). (provider: federal_reserve)
change_prior_year : Optional[float]
- Change in SOMA holdings from the prior year (Thousands). (provider: federal_reserve)
+ Change in SOMA holdings from the prior year (Thousands of $USD). (provider: federal_reserve)
Examples
--------
diff --git a/openbb_platform/openbb/package/fixedincome_corporate.py b/openbb_platform/openbb/package/fixedincome_corporate.py
index 8b4fa08a841..97dd8953989 100644
--- a/openbb_platform/openbb/package/fixedincome_corporate.py
+++ b/openbb_platform/openbb/package/fixedincome_corporate.py
@@ -361,6 +361,10 @@ class ROUTER_fixedincome_corporate(Container):
@exception_handler
@validate
+ @deprecated(
+ "This endpoint is deprecated; use `/fixedincome/bond_indices` instead. Set `category` to `us` and `index` to `seasoned_corporate`. Deprecated in OpenBB Platform V4.2 to be removed in V4.5.",
+ category=OpenBBDeprecationWarning,
+ )
def moody(
self,
start_date: Annotated[
@@ -431,6 +435,13 @@ class ROUTER_fixedincome_corporate(Container):
>>> obb.fixedincome.corporate.moody(index_type='baa', provider='fred')
""" # noqa: E501
+ simplefilter("always", DeprecationWarning)
+ warn(
+ "This endpoint is deprecated; use `/fixedincome/bond_indices` instead. Set `category` to `us` and `index` to `seasoned_corporate`. Deprecated in OpenBB Platform V4.2 to be removed in V4.5.",
+ category=DeprecationWarning,
+ stacklevel=2,
+ )
+
return self._run(
"/fixedincome/corporate/moody",
**filter_inputs(
diff --git a/openbb_platform/providers/fred/openbb_fred/models/bond_indices.py b/openbb_platform/providers/fred/openbb_fred/models/bond_indices.py
index 345004e7ff3..c5606878ffd 100644
--- a/openbb_platform/providers/fred/openbb_fred/models/bond_indices.py
+++ b/openbb_platform/providers/fred/openbb_fred/models/bond_indices.py
@@ -45,6 +45,12 @@ BAML_CATEGORIES = {
"oas": "BAMLC0A0CM",
"yield_to_worst": "BAMLC0A0CMSYTW",
},
+ "seasoned_corporate": {
+ "total_return": "",
+ "yield": "DAAA,AAA10Y,AAAFF,DBAA,BAA10Y,BAAFF",
+ "oas": "",
+ "yield_to_worst": "",
+ },
"high_yield": {
"total_return": "BAMLHYH0A0HYM2TRIV",
"yield": "BAMLH0A0HYM2EY",
@@ -449,6 +455,15 @@ class FredBondIndicesFetcher(
+ f" Must be one of {','.join(BAML_CATEGORIES.get('us'))}."
)
messages.append(message)
+ elif (
+ index == "seasoned_corporate"
+ and values["index_type"] != "yield"
+ ):
+ message = (
+ "Invalid index_type for index: 'seasoned_corporate'."
+ + " Must be 'yield'."
+ )
+ messages.append(message)
else:
new_index.append(index)
if values["category"] == "high_yield":