-
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.
- Loading branch information
1 parent
12b6125
commit 2d078f0
Showing
2 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
openbb_platform/core/openbb_core/provider/standard_models/yield_curve.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,40 @@ | ||
"""Yield Curve Standard Model.""" | ||
|
||
from datetime import date as dateType | ||
from typing import Optional | ||
|
||
from pydantic import Field | ||
|
||
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 YieldCurveQueryParams(QueryParams): | ||
"""Yield Curve Query.""" | ||
|
||
country: Optional[str] = Field( | ||
default=None, description=QUERY_DESCRIPTIONS.get("country", "") | ||
) | ||
date: Optional[str] = Field( | ||
default=None, | ||
description=QUERY_DESCRIPTIONS.get("date", "") | ||
+ " By default is the current data.", | ||
) | ||
|
||
|
||
class YieldCurveData(Data): | ||
"""Yield Curve Data.""" | ||
|
||
date: Optional[dateType] = Field( | ||
default=None, | ||
description=DATA_DESCRIPTIONS.get("date", ""), | ||
) | ||
maturity: str = Field(description="Maturity length of the security.") | ||
rate: float = Field( | ||
description="The yield as a normalized percent (0.05 is 5%)", | ||
json_schema_extra={"x-unit_measurement": "percent", "x-frontend_multiply": 100}, | ||
) |
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