diff --git a/openbb_platform/openbb/assets/reference.json b/openbb_platform/openbb/assets/reference.json index f49139e9bf81..0347b95a4170 100644 --- a/openbb_platform/openbb/assets/reference.json +++ b/openbb_platform/openbb/assets/reference.json @@ -2415,203 +2415,203 @@ "default": null, "optional": true, "choices": [ - "brazil", - "isle_of_man", - "belgium", - "ukraine", - "liechtenstein", - "malawi", - "tunisia", - "jamaica", - "guinea", - "sri_lanka", - "united_states", - "mauritania", - "pakistan", + "spain", + "jordan", + "taiwan", + "romania", + "mozambique", + "mongolia", + "iraq", "new_zealand", - "mauritius", - "namibia", - "nepal", - "yemen", - "bhutan", - "benin", - "malta", + "italy", + "faroe_islands", + "hungary", + "ireland", + "republic_of_the_congo", + "ghana", + "el_salvador", + "gambia", + "tonga", + "malaysia", + "eritrea", + "honduras", + "barbados", + "euro_area", + "portugal", + "burundi", + "united_arab_emirates", "georgia", - "east_timor", - "switzerland", - "trinidad_and_tobago", - "south_sudan", - "austria", - "cyprus", + "ukraine", + "zimbabwe", + "paraguay", + "central_african_republic", + "angola", + "netherlands", "suriname", - "egypt", - "latvia", - "luxembourg", - "nicaragua", - "ghana", - "panama", - "north_macedonia", - "equatorial_guinea", - "cambodia", - "iraq", - "south_africa", + "somalia", + "albania", + "ecuador", + "belize", "serbia", - "zambia", - "republic_of_the_congo", - "sudan", - "guinea_bissau", - "sao_tome_and_principe", + "dominican_republic", + "rwanda", + "algeria", + "bahrain", "seychelles", - "singapore", - "greece", - "slovakia", - "maldives", - "australia", - "togo", - "czech_republic", - "guatemala", + "bosnia_and_herzegovina", + "bulgaria", + "yemen", "finland", + "iceland", + "chad", + "uzbekistan", + "canada", + "myanmar", + "bermuda", + "macao", + "east_timor", + "sweden", + "guinea", + "tanzania", + "luxembourg", + "malta", + "jamaica", + "tunisia", "mexico", - "iran", - "taiwan", - "north_korea", - "ireland", - "el_salvador", "brunei", - "bahrain", - "south_korea", - "hong_kong", + "iran", + "lithuania", + "cyprus", + "botswana", + "bahamas", + "colombia", + "philippines", + "cameroon", + "sao_tome_and_principe", + "kyrgyzstan", + "dominica", + "china", + "moldova", + "cape_verde", + "germany", + "aruba", + "cuba", + "benin", + "togo", + "lebanon", + "mauritania", + "ethiopia", + "morocco", + "maldives", + "guatemala", + "singapore", + "chile", + "uruguay", + "belarus", + "brazil", + "kosovo", "liberia", - "vanuatu", - "slovenia", + "monaco", + "venezuela", + "austria", + "congo", + "sudan", "qatar", - "united_arab_emirates", + "azerbaijan", + "indonesia", + "equatorial_guinea", + "andorra", + "papua_new_guinea", + "ivory_coast", + "armenia", + "oman", + "latvia", + "pakistan", + "uganda", + "north_macedonia", + "grenada", + "turkmenistan", + "nigeria", + "trinidad_and_tobago", + "samoa", + "nicaragua", + "malawi", + "liechtenstein", + "gabon", + "afghanistan", + "south_sudan", "antigua_and_barbuda", - "estonia", - "ecuador", - "kenya", - "kiribati", - "israel", - "kosovo", - "eritrea", + "namibia", + "bangladesh", + "libya", + "mali", + "panama", + "comoros", + "new_caledonia", "niger", - "sierra_leone", - "thailand", - "lesotho", "puerto_rico", - "croatia", - "andorra", - "denmark", - "congo", - "aruba", - "tonga", - "germany", - "france", - "norway", + "isle_of_man", + "mauritius", + "south_africa", + "swaziland", + "djibouti", "tajikistan", - "azerbaijan", - "chad", - "spain", + "peru", + "thailand", + "turkey", + "haiti", + "hong_kong", "madagascar", - "palestine", - "algeria", - "ivory_coast", - "somalia", - "bermuda", - "romania", - "belize", + "kenya", + "sierra_leone", + "north_korea", + "syria", "costa_rica", - "argentina", - "tanzania", - "dominican_republic", - "uruguay", - "belarus", - "botswana", - "peru", - "libya", - "bosnia_and_herzegovina", - "swaziland", - "jordan", "bolivia", + "lesotho", + "palestine", "kazakhstan", - "macao", - "chile", - "zimbabwe", - "moldova", - "burundi", - "honduras", - "grenada", - "gambia", - "indonesia", - "italy", - "burkina_faso", - "venezuela", - "myanmar", - "senegal", + "slovenia", + "united_states", + "australia", + "united_kingdom", + "norway", "guyana", - "turkey", + "switzerland", + "laos", + "czech_republic", + "saudi_arabia", "fiji", - "new_caledonia", - "netherlands", - "montenegro", - "angola", - "mongolia", - "central_african_republic", - "china", - "gabon", - "djibouti", + "belgium", + "egypt", + "bhutan", + "cambodia", + "israel", + "senegal", "vietnam", - "papua_new_guinea", - "saudi_arabia", - "mali", - "philippines", - "turkmenistan", - "nigeria", - "laos", - "euro_area", - "bangladesh", - "armenia", - "morocco", - "afghanistan", - "monaco", - "lithuania", - "lebanon", - "canada", - "russia", - "cuba", - "samoa", - "rwanda", - "hungary", + "sri_lanka", + "cayman_islands", "kuwait", - "sweden", - "mozambique", - "albania", + "slovakia", + "burkina_faso", + "russia", "solomon_islands", - "cameroon", - "malaysia", - "haiti", - "colombia", - "faroe_islands", - "iceland", - "comoros", - "kyrgyzstan", - "poland", - "bahamas", - "ethiopia", - "dominica", - "uganda", - "portugal", - "barbados", - "oman", - "bulgaria", + "argentina", + "estonia", "india", + "kiribati", + "croatia", + "guinea_bissau", + "south_korea", + "zambia", "japan", - "cayman_islands", - "paraguay", - "uzbekistan", - "cape_verde", - "united_kingdom", - "syria" + "france", + "montenegro", + "poland", + "denmark", + "nepal", + "vanuatu", + "greece" ] }, { @@ -28713,7 +28713,7 @@ "message": null }, "description": "Get yield curve data by country and date.", - "examples": "\nExamples\n--------\n\n```python\nfrom openbb import obb\nobb.fixedincome.government.yield_curve(provider='econdb')\nobb.fixedincome.government.yield_curve(date='2023-05-01', country='united_kingdom', provider='econdb')\n```\n\n", + "examples": "\nExamples\n--------\n\n```python\nfrom openbb import obb\nobb.fixedincome.government.yield_curve(provider='federal_reserve')\nobb.fixedincome.government.yield_curve(date='2023-05-01,2024-05-01', provider='fmp')\nobb.fixedincome.government.yield_curve(date='2023-05-01', country='united_kingdom', provider='econdb')\nobb.fixedincome.government.yield_curve(provider='fred', yield_curve_type=real, date='2023-05-01,2024-05-01')\n```\n\n", "parameters": { "standard": [ { @@ -28721,18 +28721,20 @@ "type": "str", "description": "The country to get data.", "default": null, - "optional": true + "optional": true, + "choices": null }, { "name": "date", "type": "Union[Union[str, str], List[Union[str, str]]]", - "description": "A specific date to get data for. By default is the current data. Multiple items allowed for provider(s): econdb, federal_reserve.", + "description": "A specific date to get data for. By default is the current data. Multiple items allowed for provider(s): econdb, federal_reserve, fmp, fred.", "default": null, - "optional": true + "optional": true, + "choices": null }, { "name": "provider", - "type": "Literal['econdb', 'federal_reserve']", + "type": "Literal['econdb', 'federal_reserve', 'fmp', 'fred']", "description": "The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'econdb' if there is no default.", "default": "econdb", "optional": true @@ -28741,20 +28743,33 @@ "econdb": [ { "name": "country", - "type": "Literal['australia,canada,china,hong_kong,india,japan,russia,saudi_arabia,south_africa,south_korea,taiwan,united_kingdom,united_states']", + "type": "Literal['australia', 'canada', 'china', 'hong_kong', 'india', 'japan', 'russia', 'saudi_arabia', 'south_africa', 'south_korea', 'taiwan', 'united_kingdom', 'united_states']", "description": "The country to get data.", "default": "united_states", - "optional": true + "optional": true, + "choices": null }, { "name": "use_cache", "type": "bool", "description": "If true, cache the request for four hours.", "default": true, - "optional": true + "optional": true, + "choices": null } ], - "federal_reserve": [] + "federal_reserve": [], + "fmp": [], + "fred": [ + { + "name": "yield_curve_type", + "type": "Literal['nominal', 'real', 'breakeven', 'corporate_spot', 'corporate_par']", + "description": "Yield curve type. Nominal and Real Rates are available daily, others are monthly. The closest date to the requested date will be returned.", + "default": "nominal", + "optional": true, + "choices": null + } + ] }, "returns": { "OBBject": [ @@ -28765,7 +28780,7 @@ }, { "name": "provider", - "type": "Optional[Literal['econdb', 'federal_reserve']]", + "type": "Optional[Literal['econdb', 'federal_reserve', 'fmp', 'fred']]", "description": "Provider name." }, { @@ -28792,32 +28807,37 @@ "type": "date", "description": "The date of the data.", "default": null, - "optional": true + "optional": true, + "choices": null }, { "name": "maturity", "type": "str", "description": "Maturity length of the security.", "default": "", - "optional": false + "optional": false, + "choices": null }, { "name": "rate", "type": "float", "description": "The yield as a normalized percent (0.05 is 5%)", "default": "", - "optional": false + "optional": false, + "choices": null } ], "econdb": [], - "federal_reserve": [] + "federal_reserve": [], + "fmp": [], + "fred": [] }, "model": "YieldCurve" }, "/fixedincome/government/us_yield_curve": { "deprecated": { - "flag": null, - "message": null + "flag": true, + "message": "This endpoint will be removed in a future version. Use, `/fixedincome/government/yield_curve`, instead. Deprecated in OpenBB Platform V4.1 to be removed in V4.3." }, "description": "US Yield Curve. Get United States yield curve.", "examples": "\nExamples\n--------\n\n```python\nfrom openbb import obb\nobb.fixedincome.government.us_yield_curve(provider='fred')\nobb.fixedincome.government.us_yield_curve(inflation_adjusted=True, provider='fred')\n```\n\n", diff --git a/openbb_platform/openbb/package/fixedincome_government.py b/openbb_platform/openbb/package/fixedincome_government.py index 480b82ffd2d8..3e72f5387acb 100644 --- a/openbb_platform/openbb/package/fixedincome_government.py +++ b/openbb_platform/openbb/package/fixedincome_government.py @@ -2,13 +2,15 @@ import datetime from typing import List, Literal, Optional, Union +from warnings import simplefilter, warn +from openbb_core.app.deprecation import OpenBBDeprecationWarning from openbb_core.app.model.field import OpenBBField from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container from openbb_core.app.static.utils.decorators import exception_handler, validate from openbb_core.app.static.utils.filters import filter_inputs -from typing_extensions import Annotated +from typing_extensions import Annotated, deprecated class ROUTER_fixedincome_government(Container): @@ -125,6 +127,10 @@ def treasury_rates( @exception_handler @validate + @deprecated( + "This endpoint will be removed in a future version. Use, `/fixedincome/government/yield_curve`, instead. Deprecated in OpenBB Platform V4.1 to be removed in V4.3.", + category=OpenBBDeprecationWarning, + ) def us_yield_curve( self, date: Annotated[ @@ -185,6 +191,13 @@ def us_yield_curve( >>> obb.fixedincome.government.us_yield_curve(inflation_adjusted=True, provider='fred') """ # noqa: E501 + simplefilter("always", DeprecationWarning) + warn( + "This endpoint will be removed in a future version. Use, `/fixedincome/government/yield_curve`, instead. Deprecated in OpenBB Platform V4.1 to be removed in V4.3.", + category=DeprecationWarning, + stacklevel=2, + ) + return self._run( "/fixedincome/government/us_yield_curve", **filter_inputs( @@ -213,11 +226,11 @@ def yield_curve( date: Annotated[ Union[str, None, List[Optional[str]]], OpenBBField( - description="A specific date to get data for. By default is the current data. Multiple comma separated items allowed for provider(s): econdb, federal_reserve." + description="A specific date to get data for. By default is the current data. Multiple comma separated items allowed for provider(s): econdb, federal_reserve, fmp, fred." ), ] = None, provider: Annotated[ - Optional[Literal["econdb", "federal_reserve"]], + Optional[Literal["econdb", "federal_reserve", "fmp", "fred"]], OpenBBField( description="The provider to use for the query, by default None.\n If None, the provider specified in defaults is selected or 'econdb' if there is\n no default." ), @@ -231,20 +244,22 @@ def yield_curve( country : Optional[str] The country to get data. date : Union[str, None, List[Optional[str]]] - A specific date to get data for. By default is the current data. Multiple comma separated items allowed for provider(s): econdb, federal_reserve. - provider : Optional[Literal['econdb', 'federal_reserve']] + A specific date to get data for. By default is the current data. Multiple comma separated items allowed for provider(s): econdb, federal_reserve, fmp, fred. + provider : Optional[Literal['econdb', 'federal_reserve', 'fmp', 'fred']] The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'econdb' if there is no default. use_cache : bool If true, cache the request for four hours. (provider: econdb) + yield_curve_type : Literal['nominal', 'real', 'breakeven', 'corporate_spot', 'corporate_par'] + Yield curve type. Nominal and Real Rates are available daily, others are monthly. The closest date to the requested date will be returned. (provider: fred) Returns ------- OBBject results : List[YieldCurve] Serializable results. - provider : Optional[Literal['econdb', 'federal_reserve']] + provider : Optional[Literal['econdb', 'federal_reserve', 'fmp', 'fred']] Provider name. warnings : Optional[List[Warning_]] List of warnings. @@ -265,8 +280,10 @@ def yield_curve( Examples -------- >>> from openbb import obb - >>> obb.fixedincome.government.yield_curve(provider='econdb') + >>> obb.fixedincome.government.yield_curve(provider='federal_reserve') + >>> obb.fixedincome.government.yield_curve(date='2023-05-01,2024-05-01', provider='fmp') >>> obb.fixedincome.government.yield_curve(date='2023-05-01', country='united_kingdom', provider='econdb') + >>> obb.fixedincome.government.yield_curve(provider='fred', yield_curve_type='real', date='2023-05-01,2024-05-01') """ # noqa: E501 return self._run( @@ -276,7 +293,7 @@ def yield_curve( "provider": self._get_provider( provider, "/fixedincome/government/yield_curve", - ("econdb", "federal_reserve"), + ("econdb", "federal_reserve", "fmp", "fred"), ) }, standard_params={ @@ -288,6 +305,8 @@ def yield_curve( "date": { "econdb": ["multiple_items_allowed"], "federal_reserve": {"multiple_items_allowed": True}, + "fmp": {"multiple_items_allowed": True}, + "fred": {"multiple_items_allowed": True}, } }, )