Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
deeleeramone committed May 15, 2024
1 parent 12b6125 commit 2d078f0
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
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},
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,21 @@
examples=[
APIEx(parameters={"provider": "federal_reserve"}),
APIEx(parameters={"date": "2023-05-01,2024-05-01", "provider": "fmp"}),
APIEx(parameters={"date": "2023-05-01", "country": "united_kingdom", "provider": "econdb"}),
APIEx(
parameters={
"date": "2023-05-01",
"country": "united_kingdom",
"provider": "econdb",
}
),
APIEx(parameters={"provider": "ecb", "yield_curve_type": "par_yield"}),
APIEx(parameters={"provider": "fred", "yield_curve_type": "real", "date": "2023-05-01,2024-05-01"})
APIEx(
parameters={
"provider": "fred",
"yield_curve_type": "real",
"date": "2023-05-01,2024-05-01",
}
),
],
)
async def yield_curve(
Expand Down

0 comments on commit 2d078f0

Please sign in to comment.