From 63e20728229cafd38eeccda72548cc72a5d2948b Mon Sep 17 00:00:00 2001 From: montezdesousa Date: Mon, 10 Jul 2023 00:56:02 +0100 Subject: [PATCH] fix forex load and add crypto load --- .../openbb_provider/model/data/forex_eod.py | 4 ++-- .../builtin_extensions/crypto/crypto_router.py | 18 +++++++++++++++--- .../builtin_extensions/forex/forex_router.py | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/openbb_providers/openbb_provider/model/data/forex_eod.py b/openbb_providers/openbb_provider/model/data/forex_eod.py index e20d243de60..d8bb72057d5 100644 --- a/openbb_providers/openbb_provider/model/data/forex_eod.py +++ b/openbb_providers/openbb_provider/model/data/forex_eod.py @@ -4,7 +4,7 @@ from datetime import date, datetime from typing import Optional -from pydantic import Field, PositiveFloat +from pydantic import Field, NonNegativeFloat, PositiveFloat from openbb_provider.metadata import DESCRIPTIONS from openbb_provider.model.abstract.data import Data, QueryParams @@ -57,4 +57,4 @@ class ForexEODData(Data): low: PositiveFloat close: PositiveFloat adj_close: Optional[PositiveFloat] - volume: PositiveFloat + volume: NonNegativeFloat diff --git a/openbb_sdk/builtin_extensions/crypto/crypto_router.py b/openbb_sdk/builtin_extensions/crypto/crypto_router.py index 5446e8e36b8..e20eeb91a87 100644 --- a/openbb_sdk/builtin_extensions/crypto/crypto_router.py +++ b/openbb_sdk/builtin_extensions/crypto/crypto_router.py @@ -1,11 +1,23 @@ +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 ( + ExtraParams, + ProviderChoices, + StandardParams, +) +from openbb_sdk_core.app.query import Query from openbb_sdk_core.app.router import Router router = Router(prefix="") -@router.command -def load() -> CommandOutput[Empty]: # type: ignore +@router.command(query="CryptoEOD") +def load( + cc: CommandContext, + provider_choices: ProviderChoices, + standard_params: StandardParams, + extra_params: ExtraParams, +) -> CommandOutput[Empty]: # type: ignore """Crypto Intraday Price.""" - return CommandOutput(results=Empty()) + return CommandOutput(results=Query(**locals()).execute()) diff --git a/openbb_sdk/builtin_extensions/forex/forex_router.py b/openbb_sdk/builtin_extensions/forex/forex_router.py index 518020042dc..0f448143a63 100644 --- a/openbb_sdk/builtin_extensions/forex/forex_router.py +++ b/openbb_sdk/builtin_extensions/forex/forex_router.py @@ -12,7 +12,7 @@ from openbb_sdk_core.app.router import Router router = Router(prefix="") -@router.command(query="ForexPrice") +@router.command(query="ForexEOD") def load( cc: CommandContext, provider_choices: ProviderChoices,