mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-29 05:21:48 +00:00
add fred provider
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user