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>
This commit is contained in:
Henrique Joaquim
2023-12-11 18:44:51 +00:00
committed by GitHub
parent fce63afa6c
commit e7a06085b3
2 changed files with 13 additions and 6 deletions

View File

@@ -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).
</details>

View File

@@ -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