improve docstring (#6986)

This commit is contained in:
Danglewood
2024-12-11 10:40:06 -08:00
committed by GitHub
parent d704de554e
commit f1b4d36e35
3 changed files with 43 additions and 9 deletions

View File

@@ -39188,7 +39188,7 @@
{
"name": "index",
"type": "Union[str, List[str]]",
"description": "The specific index to query. Used in conjunction with 'category' and 'index_type', default is 'yield_curve'. Multiple items allowed for provider(s): fred.",
"description": "The specific index to query. Used in conjunction with 'category' and 'index_type', default is 'yield_curve'.\n Possible values are:\n corporate\n seasoned_corporate\n liquid_corporate\n yield_curve\n crossover\n public_sector\n private_sector\n non_financial\n high_grade\n high_yield\n liquid_emea\n emea\n liquid_asia\n asia\n liquid_latam\n latam\n liquid_aaa\n liquid_bbb\n aaa\n aa\n a\n bbb\n bb\n b\n ccc Multiple items allowed for provider(s): fred.",
"default": "yield_curve",
"optional": true,
"choices": [

View File

@@ -68,7 +68,35 @@ class ROUTER_fixedincome(Container):
category : Literal['high_yield', 'us', 'emerging_markets']
The type of index category. Used in conjunction with 'index', default is 'us'. (provider: fred)
index : str
The specific index to query. Used in conjunction with 'category' and 'index_type', default is 'yield_curve'. Multiple comma separated items allowed. (provider: fred)
The specific index to query. Used in conjunction with 'category' and 'index_type', default is 'yield_curve'.
Possible values are:
corporate
seasoned_corporate
liquid_corporate
yield_curve
crossover
public_sector
private_sector
non_financial
high_grade
high_yield
liquid_emea
emea
liquid_asia
asia
liquid_latam
latam
liquid_aaa
liquid_bbb
aaa
aa
a
bbb
bb
b
ccc
Multiple comma separated items allowed. (provider: fred)
frequency : Optional[Literal['a', 'q', 'm', 'w', 'd', 'wef', 'weth', 'wew', 'wetu', 'wem', 'wesu', 'wesa', 'bwew', 'bwem']]
Frequency aggregation to convert daily data to lower frequency.

View File

@@ -290,6 +290,8 @@ INDEX_CHOICES = [
"ccc",
]
index_choices_str = "\n ".join(INDEX_CHOICES)
class FredBondIndicesQueryParams(BondIndicesQueryParams):
"""FRED Bond Indices Query."""
@@ -308,7 +310,11 @@ class FredBondIndicesQueryParams(BondIndicesQueryParams):
index: str = Field(
default="yield_curve",
description="The specific index to query."
+ " Used in conjunction with 'category' and 'index_type', default is 'yield_curve'.",
+ " Used in conjunction with 'category' and 'index_type', default is 'yield_curve'."
+ f"""
Possible values are:
{index_choices_str}\n
""",
)
frequency: Union[
None,
@@ -455,8 +461,8 @@ class FredBondIndicesFetcher(
if values["category"] == "us":
if index not in BAML_CATEGORIES.get("us"): # type: ignore
message = (
"Invalid index for category: 'us'."
+ f" Must be one of {','.join(BAML_CATEGORIES.get('us'))}." # type: ignore
f"Invalid index, {index}, for category: 'us'."
+ f" Must be one of {', '.join(BAML_CATEGORIES.get('us'))}." # type: ignore
)
messages.append(message)
elif (
@@ -473,8 +479,8 @@ class FredBondIndicesFetcher(
if values["category"] == "high_yield":
if index not in ("us", "europe", "emerging"):
message = (
"Invalid index for category: 'high_yield'."
+ f" Must be one of {','.join(BAML_CATEGORIES.get('high_yield', ''))}." # type: ignore
f"Invalid index, {index}, for category: 'high_yield'."
+ f" Must be one of {', '.join(BAML_CATEGORIES.get('high_yield', ''))}." # type: ignore
)
messages.append(message)
else:
@@ -482,8 +488,8 @@ class FredBondIndicesFetcher(
if values["category"] == "emerging_markets":
if index not in BAML_CATEGORIES.get("emerging_markets"): # type: ignore
message = (
"Invalid index for category: 'emerging_markets'."
+ f" Must be one of {','.join(BAML_CATEGORIES.get('emerging_markets', ''))}." # type: ignore
f"Invalid index, {index}, for category: 'emerging_markets'."
+ f" Must be one of {', '.join(BAML_CATEGORIES.get('emerging_markets', ''))}." # type: ignore
)
messages.append(message)
else: