From e7a06085b3657b7eae12538039d149c7aaa08ff7 Mon Sep 17 00:00:00 2001 From: Henrique Joaquim Date: Mon, 11 Dec 2023 18:44:51 +0000 Subject: [PATCH] Changes to the `obb.fixedincome.corporate.hqm()` output (#5876) * changes to the hqm output * typo --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> --- .github/pull_request_template.md | 2 +- .../providers/fred/openbb_fred/models/hqm.py | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 1c5145873d6..3df72068a85 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -74,7 +74,7 @@ - [ ] I have performed a self-review of my own code. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have adhered to the GitFlow naming convention and my branch name is in the format of `feature/feature-name` or `hotfix/hotfix-name`. -- [ ] I ensure that I am following th [CONTRIBUTING guidelines](https://github.com/OpenBB-finance/OpenBBTerminal/blob/main/CONTRIBUTING.md). +- [ ] I ensure that I am following the [CONTRIBUTING guidelines](https://github.com/OpenBB-finance/OpenBBTerminal/blob/main/CONTRIBUTING.md). - [ ] (If applicable) I have updated tests following [these guidelines](/openbb_platform/CONTRIBUTING.md#qa-your-extension). diff --git a/openbb_platform/providers/fred/openbb_fred/models/hqm.py b/openbb_platform/providers/fred/openbb_fred/models/hqm.py index b7c98ea836e..c410b6d0080 100644 --- a/openbb_platform/providers/fred/openbb_fred/models/hqm.py +++ b/openbb_platform/providers/fred/openbb_fred/models/hqm.py @@ -14,7 +14,7 @@ from openbb_fred.utils.fred_helpers import ( YIELD_CURVE_SERIES_CORPORATE_PAR, YIELD_CURVE_SERIES_CORPORATE_SPOT, ) -from pydantic import field_validator +from pydantic import Field, field_validator class FREDHighQualityMarketCorporateBondQueryParams( @@ -28,6 +28,8 @@ class FREDHighQualityMarketCorporateBondData(HighQualityMarketCorporateBondData) __alias_dict__ = {"rate": "value"} + series_id: str = Field(description="FRED series id.") + @field_validator("rate", mode="before", check_fields=False) @classmethod def value_validate(cls, v): @@ -88,10 +90,15 @@ class FREDHighQualityMarketCorporateBondFetcher( start_date=start_date, **kwargs, ) - for item in d: - item["maturity"] = maturity - item["yield_curve"] = query.yield_curve - data.extend(d) + for observation in d: + series_data = { + "series_id": id_, + "maturity": maturity, + "yield_curve": query.yield_curve, + "date": observation["date"], + "value": observation["value"], + } + data.append(series_data) return data