summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanglewood <85772166+deeleeramone@users.noreply.github.com>2024-07-04 09:57:26 -0700
committerGitHub <noreply@github.com>2024-07-04 09:57:26 -0700
commitf9779bc3fe00a72c46da1b1eed3cbb4c97c4c8d9 (patch)
treed98eeeebba0553fefa5a2ac51ab0277c80a869c4
parentd9abc6b04490760bf8a4b99f6420838313c02d06 (diff)
parent5ba54725536a3eb8121f2ed7ea47076789abecea (diff)
Merge branch 'develop' into feature/openbb-storefeature/openbb-store
-rw-r--r--openbb_platform/core/openbb_core/app/provider_interface.py19
-rw-r--r--openbb_platform/core/openbb_core/app/version.py20
-rw-r--r--openbb_platform/openbb/assets/reference.json23
-rw-r--r--openbb_platform/openbb/package/economy.py2
-rw-r--r--openbb_platform/providers/oecd/openbb_oecd/models/unemployment.py19
5 files changed, 49 insertions, 34 deletions
diff --git a/openbb_platform/core/openbb_core/app/provider_interface.py b/openbb_platform/core/openbb_core/app/provider_interface.py
index 6c9a558161a..8eb2f5371b6 100644
--- a/openbb_platform/core/openbb_core/app/provider_interface.py
+++ b/openbb_platform/core/openbb_core/app/provider_interface.py
@@ -15,7 +15,7 @@ from typing import (
Union,
)
-from fastapi import Query
+from fastapi import Body, Query
from pydantic import (
BaseModel,
ConfigDict,
@@ -290,6 +290,23 @@ class ProviderInterface(metaclass=SingletonMeta):
else:
default = field.default
+ if (
+ hasattr(annotation, "__name__")
+ and annotation.__name__ in ["Dict", "dict", "Data"] # type: ignore
+ or field.kw_only is True
+ ):
+ return DataclassField(
+ new_name,
+ annotation,
+ Body(
+ default=default,
+ title=provider_name,
+ description=description,
+ alias=field.alias or None,
+ json_schema_extra=getattr(field, "json_schema_extra", None),
+ ),
+ )
+
if query:
# We need to use query if we want the field description to show
# up in the swagger, it's a fastapi limitation
diff --git a/openbb_platform/core/openbb_core/app/version.py b/openbb_platform/core/openbb_core/app/version.py
index 39872d98a1c..c49232ed6e6 100644
--- a/openbb_platform/core/openbb_core/app/version.py
+++ b/openbb_platform/core/openbb_core/app/version.py
@@ -2,10 +2,12 @@
import shutil
import subprocess
+from importlib.metadata import (
+ PackageNotFoundError,
+ version as pkg_version,
+)
from pathlib import Path
-import pkg_resources
-
PACKAGE = "openbb"
@@ -13,15 +15,15 @@ def get_package_version(package: str):
"""Retrieve the version of a package from installed pip packages."""
is_nightly = False
try:
- version = pkg_resources.get_distribution(package).version
- except pkg_resources.DistributionNotFound:
+ version = pkg_version(package)
+ except PackageNotFoundError:
package += "-nightly"
is_nightly = True
try:
- version = pkg_resources.get_distribution(package).version
- except pkg_resources.DistributionNotFound:
+ version = pkg_version(package)
+ except PackageNotFoundError:
package = "openbb-core"
- version = pkg_resources.get_distribution(package).version
+ version = pkg_version(package)
version += "core"
if is_git_repo(Path(__file__).parent.resolve()) and not is_nightly:
@@ -56,10 +58,10 @@ def get_major_minor(version: str) -> tuple[int, int]:
try:
VERSION = get_package_version(PACKAGE)
-except pkg_resources.DistributionNotFound:
+except PackageNotFoundError:
VERSION = "unknown"
try:
CORE_VERSION = get_package_version("openbb-core")
-except pkg_resources.DistributionNotFound:
+except PackageNotFoundError:
CORE_VERSION = "unknown"
diff --git a/openbb_platform/openbb/assets/reference.json b/openbb_platform/openbb/assets/reference.json
index 9139dd5420c..28947a0e598 100644
--- a/openbb_platform/openbb/assets/reference.json
+++ b/openbb_platform/openbb/assets/reference.json
@@ -3,7 +3,7 @@
"info": {
"title": "OpenBB Platform (Python)",
"description": "Investment research for everyone, anywhere.",
- "core": "1.2.7",
+ "core": "1.2.9",
"extensions": {
"openbb_core_extension": [
"commodity@1.1.3",
@@ -2443,8 +2443,8 @@
},
{
"name": "date",
- "type": "Union[date, str]",
- "description": "A specific date to get data for.",
+ "type": "Union[Union[Union[str, date], str], List[Union[Union[str, date], str]]]",
+ "description": "A specific date to get data for. Multiple items allowed for provider(s): yfinance.",
"default": null,
"optional": true,
"choices": null
@@ -2491,6 +2491,14 @@
"data": {
"standard": [
{
+ "name": "date",
+ "type": "date",
+ "description": "The date of the data.",
+ "default": null,
+ "optional": true,
+ "choices": null
+ },
+ {
"name": "expiration",
"type": "str",
"description": "Futures expiration month.",
@@ -2501,7 +2509,7 @@
{
"name": "price",
"type": "float",
- "description": "The close price.",
+ "description": "The price of the futures contract.",
"default": null,
"optional": true,
"choices": null
@@ -5374,17 +5382,14 @@
},
{
"name": "age",
- "type": "Literal['total', '15-24', '25-54', '55-64', '15-64', '15-74']",
+ "type": "Literal['total', '15-24', '25+']",
"description": "Age group to get unemployment for. Total indicates 15 years or over",
"default": "total",
"optional": true,
"choices": [
"total",
"15-24",
- "25-54",
- "55-64",
- "15-64",
- "15-74"
+ "25+"
]
},
{
diff --git a/openbb_platform/openbb/package/economy.py b/openbb_platform/openbb/package/economy.py
index e6719909149..65befb797d2 100644
--- a/openbb_platform/openbb/package/economy.py
+++ b/openbb_platform/openbb/package/economy.py
@@ -2187,7 +2187,7 @@ class ROUTER_economy(Container):
The provider to use, by default None. If None, the priority list configured in the settings is used. Default priority: oecd.
sex : Literal['total', 'male', 'female']
Sex to get unemployment for. (provider: oecd)
- age : Literal['total', '15-24', '25-54', '55-64', '15-64', '15-74']
+ age : Literal['total', '15-24', '25+']
Age group to get unemployment for. Total indicates 15 years or over (provider: oecd)
seasonal_adjustment : bool
Whether to get seasonally adjusted unemployment. Defaults to False. (provider: oecd)
diff --git a/openbb_platform/providers/oecd/openbb_oecd/models/unemployment.py b/openbb_platform/providers/oecd/openbb_oecd/models/unemployment.py
index 236513430d2..5641c967188 100644
--- a/openbb_platform/providers/oecd/openbb_oecd/models/unemployment.py
+++ b/openbb_platform/providers/oecd/openbb_oecd/models/unemployment.py
@@ -29,18 +29,12 @@ CountriesList = sorted(list(countries)) # type: ignore
AGES = [
"total",
"15-24",
- "25-54",
- "55-64",
- "15-64",
- "15-74",
+ "25+",
]
AgesLiteral = Literal[
"total",
"15-24",
- "25-54",
- "55-64",
- "15-64",
- "15-74",
+ "25+",
]
@@ -55,7 +49,7 @@ class OECDUnemploymentQueryParams(UnemploymentQueryParams):
country: str = Field(
description=QUERY_DESCRIPTIONS.get("country", ""),
default="united_states",
- choices=CountriesList,
+ json_schema_extra={"choices": CountriesList}, # type: ignore
)
sex: Literal["total", "male", "female"] = Field(
description="Sex to get unemployment for.",
@@ -65,7 +59,7 @@ class OECDUnemploymentQueryParams(UnemploymentQueryParams):
age: Literal[AgesLiteral] = Field(
description="Age group to get unemployment for. Total indicates 15 years or over",
default="total",
- json_schema_extra={"choices": AGES},
+ json_schema_extra={"choices": AGES}, # type: ignore
)
seasonal_adjustment: bool = Field(
description="Whether to get seasonally adjusted unemployment. Defaults to False.",
@@ -131,10 +125,7 @@ class OECDUnemploymentFetcher(
age = {
"total": "Y_GE15",
"15-24": "Y15T24",
- "15-64": "Y15T64",
- "15-74": "Y15T74",
- "25-54": "Y25T54",
- "55-64": "Y55T64",
+ "25+": "Y_GE25",
}[query.age]
seasonal_adjustment = "Y" if query.seasonal_adjustment else "N"