-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] ICE BofAML Bond Indices (FRED) (#6486)
* fred bond indices * maturity dict * review items
- Loading branch information
1 parent
a52b24c
commit d7a9e66
Showing
12 changed files
with
1,303 additions
and
3 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
openbb_platform/core/openbb_core/provider/standard_models/bond_indices.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Bond Indices Standard Model.""" | ||
|
||
from datetime import ( | ||
date as dateType, | ||
) | ||
from typing import Literal, Optional | ||
|
||
from pydantic import Field, field_validator | ||
|
||
from openbb_core.provider.abstract.data import Data | ||
from openbb_core.provider.abstract.query_params import QueryParams | ||
from openbb_core.provider.utils.descriptions import ( | ||
DATA_DESCRIPTIONS, | ||
QUERY_DESCRIPTIONS, | ||
) | ||
|
||
|
||
class BondIndicesQueryParams(QueryParams): | ||
"""Bond Indices Query.""" | ||
|
||
start_date: Optional[dateType] = Field( | ||
default=None, | ||
description=QUERY_DESCRIPTIONS.get("start_date", ""), | ||
) | ||
end_date: Optional[dateType] = Field( | ||
default=None, | ||
description=QUERY_DESCRIPTIONS.get("end_date", ""), | ||
) | ||
index_type: Literal["yield", "yield_to_worst", "total_return", "oas"] = Field( | ||
default="yield", | ||
description="The type of series. OAS is the option-adjusted spread. Default is yield.", | ||
json_schema_extra={ | ||
"choices": ["yield", "yield_to_worst", "total_return", "oas"] | ||
}, | ||
) | ||
|
||
@field_validator("index_type", mode="before", check_fields=False) | ||
@classmethod | ||
def to_lower(cls, v: Optional[str]) -> Optional[str]: | ||
"""Convert field to lowercase.""" | ||
return v.lower() if v else v | ||
|
||
|
||
class BondIndicesData(Data): | ||
"""Bond Indices Data.""" | ||
|
||
date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) | ||
symbol: Optional[str] = Field( | ||
default=None, | ||
description=DATA_DESCRIPTIONS.get("symbol", ""), | ||
) | ||
value: float = Field(description="Index values.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.