add fred provider

This commit is contained in:
montezdesousa
2023-07-10 00:36:44 +01:00
parent 1edaf8edd7
commit e191d14fc9
3 changed files with 13 additions and 10 deletions

View File

@@ -4,7 +4,12 @@ from typing import List, Literal, Union
from openbb_sdk_core.app.model.command_context import CommandContext
from openbb_sdk_core.app.model.command_output import CommandOutput
from openbb_sdk_core.app.model.results.empty import Empty
from openbb_sdk_core.app.provider_interface import ProviderChoices
from openbb_sdk_core.app.provider_interface import (
ProviderChoices,
StandardParams,
ExtraParams,
)
from openbb_sdk_core.app.query import Query
from openbb_sdk_core.app.router import Router
datetype = Union[datetime.datetime, str]
@@ -53,20 +58,15 @@ def corecpi(
# pylint: disable=too-many-arguments
@router.command
@router.command(query="CPI")
def cpi(
cc: CommandContext,
provider_choices: ProviderChoices,
countries: list_str,
start_date: datetype,
end_date: datetype,
units: Literal["growth_previous", "growth_same", "index_2015"] = "growth_same",
frequency: Literal["annual", "monthly", "quarterly"] = "monthly",
harmonized: bool = False,
smart_select: bool = True,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> CommandOutput[Empty]: # type: ignore
"""CPI."""
return CommandOutput(results=Empty())
return CommandOutput(results=Query(**locals()).execute())
@router.command

View File

@@ -207,6 +207,7 @@ class HubManager:
credentials = Credentials(
fmp_api_key=settings.features_keys.API_KEY_FINANCIALMODELINGPREP,
polygon_api_key=settings.features_keys.API_POLYGON_KEY,
fred_api_key=settings.features_keys.API_FRED_KEY,
)
return credentials
@@ -216,6 +217,7 @@ class HubManager:
features_keys = FeaturesKeys(
API_KEY_FINANCIALMODELINGPREP=credentials.fmp_api_key,
API_POLYGON_KEY=credentials.polygon_api_key,
API_FRED_KEY=credentials.fred_api_key,
)
hub_user_settings = HubUserSettings(features_keys=features_keys)
return hub_user_settings

View File

@@ -7,6 +7,7 @@ class Credentials(BaseModel):
fmp_api_key: Optional[str] = None
polygon_api_key: Optional[str] = None
benzinga_api_key: Optional[str] = None
fred_api_key: Optional[str] = None
class Config:
validate_assignment = True