From 0ad4de26902ada67cd6e04dc9e870d8335ba5ac0 Mon Sep 17 00:00:00 2001 From: James Maslek Date: Mon, 24 Jul 2023 13:13:56 -0400 Subject: [PATCH 1/6] downgrade jupyter deps --- poetry.lock | 79 +++++++++++++------------------------------ pyproject.toml | 2 ++ requirements-full.txt | 6 ++-- requirements.txt | 6 ++-- 4 files changed, 29 insertions(+), 64 deletions(-) diff --git a/poetry.lock b/poetry.lock index 22d20175c76..59dcbd99fc7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3488,26 +3488,27 @@ format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339- [[package]] name = "jupyter-client" -version = "8.3.0" +version = "7.4.1" description = "Jupyter protocol implementation and client libraries" optional = false -python-versions = ">=3.8" +python-versions = ">=3.7" files = [ - {file = "jupyter_client-8.3.0-py3-none-any.whl", hash = "sha256:7441af0c0672edc5d28035e92ba5e32fadcfa8a4e608a434c228836a89df6158"}, - {file = "jupyter_client-8.3.0.tar.gz", hash = "sha256:3af69921fe99617be1670399a0b857ad67275eefcfa291e2c81a160b7b650f5f"}, + {file = "jupyter_client-7.4.1-py3-none-any.whl", hash = "sha256:bbf6404ef64afff3d4f583c90c6335545959657b7dec3a86c440d7b1368407ea"}, + {file = "jupyter_client-7.4.1.tar.gz", hash = "sha256:3f30b1f27dc61adf5d0f5d466ef7185f6a19140c54395600b6df9adbe7d5ebcf"}, ] [package.dependencies] -importlib-metadata = {version = ">=4.8.3", markers = "python_version < \"3.10\""} -jupyter-core = ">=4.12,<5.0.dev0 || >=5.1.dev0" +entrypoints = "*" +jupyter-core = ">=4.9.2" +nest-asyncio = ">=1.5.4" python-dateutil = ">=2.8.2" pyzmq = ">=23.0" tornado = ">=6.2" -traitlets = ">=5.3" +traitlets = "*" [package.extras] -docs = ["ipykernel", "myst-parser", "pydata-sphinx-theme", "sphinx (>=4)", "sphinx-autodoc-typehints", "sphinxcontrib-github-alt", "sphinxcontrib-spelling"] -test = ["coverage", "ipykernel (>=6.14)", "mypy", "paramiko", "pre-commit", "pytest", "pytest-cov", "pytest-jupyter[client] (>=0.4.1)", "pytest-timeout"] +doc = ["ipykernel", "myst-parser", "sphinx (>=1.3.6)", "sphinx-rtd-theme", "sphinxcontrib-github-alt"] +test = ["codecov", "coverage", "ipykernel (>=6.5)", "ipython", "mypy", "pre-commit", "pytest", "pytest-asyncio (>=0.18)", "pytest-cov", "pytest-timeout"] [[package]] name = "jupyter-core" @@ -3594,39 +3595,35 @@ jupyter-server = ">=1.1.2" [[package]] name = "jupyter-server" -version = "2.7.0" +version = "1.23.6" description = "The backend—i.e. core services, APIs, and REST endpoints—to Jupyter web applications." optional = false -python-versions = ">=3.8" +python-versions = ">=3.7" files = [ - {file = "jupyter_server-2.7.0-py3-none-any.whl", hash = "sha256:6a77912aff643e53fa14bdb2634884b52b784a4be77ce8e93f7283faed0f0849"}, - {file = "jupyter_server-2.7.0.tar.gz", hash = "sha256:36da0a266d31a41ac335a366c88933c17dfa5bb817a48f5c02c16d303bc9477f"}, + {file = "jupyter_server-1.23.6-py3-none-any.whl", hash = "sha256:ede3a5c09b075541d960bb02854b617c0ffa58706c37de92e2d1c5acdc359c20"}, + {file = "jupyter_server-1.23.6.tar.gz", hash = "sha256:fde15df6d11a053b17cf2450eea9984ec9a6f28ad3cb2caa73c31e53ea184fc1"}, ] [package.dependencies] -anyio = ">=3.1.0" +anyio = ">=3.1.0,<4" argon2-cffi = "*" jinja2 = "*" -jupyter-client = ">=7.4.4" +jupyter-client = ">=6.1.12" jupyter-core = ">=4.12,<5.0.dev0 || >=5.1.dev0" -jupyter-events = ">=0.6.0" -jupyter-server-terminals = "*" nbconvert = ">=6.4.4" -nbformat = ">=5.3.0" -overrides = "*" +nbformat = ">=5.2.0" packaging = "*" prometheus-client = "*" pywinpty = {version = "*", markers = "os_name == \"nt\""} -pyzmq = ">=24" -send2trash = "*" +pyzmq = ">=17" +Send2Trash = "*" terminado = ">=0.8.3" -tornado = ">=6.2.0" -traitlets = ">=5.6.0" +tornado = ">=6.1.0" +traitlets = ">=5.1" websocket-client = "*" [package.extras] -docs = ["ipykernel", "jinja2", "jupyter-client", "jupyter-server", "myst-parser", "nbformat", "prometheus-client", "pydata-sphinx-theme", "send2trash", "sphinx-autodoc-typehints", "sphinxcontrib-github-alt", "sphinxcontrib-openapi (>=0.8.0)", "sphinxcontrib-spelling", "sphinxemoji", "tornado", "typing-extensions"] -test = ["flaky", "ipykernel", "pre-commit", "pytest (>=7.0)", "pytest-console-scripts", "pytest-jupyter[server] (>=0.4)", "pytest-timeout", "requests"] +test = ["coverage", "ipykernel", "pre-commit", "pytest (>=7.0)", "pytest-console-scripts", "pytest-cov", "pytest-mock", "pytest-timeout", "pytest-tornasync", "requests"] [[package]] name = "jupyter-server-fileid" @@ -3647,25 +3644,6 @@ jupyter-server = ">=1.15,<3" cli = ["click"] test = ["jupyter-server[test] (>=1.15,<3)", "pytest", "pytest-cov"] -[[package]] -name = "jupyter-server-terminals" -version = "0.4.4" -description = "A Jupyter Server Extension Providing Terminals." -optional = false -python-versions = ">=3.8" -files = [ - {file = "jupyter_server_terminals-0.4.4-py3-none-any.whl", hash = "sha256:75779164661cec02a8758a5311e18bb8eb70c4e86c6b699403100f1585a12a36"}, - {file = "jupyter_server_terminals-0.4.4.tar.gz", hash = "sha256:57ab779797c25a7ba68e97bcfb5d7740f2b5e8a83b5e8102b10438041a7eac5d"}, -] - -[package.dependencies] -pywinpty = {version = ">=2.0.3", markers = "os_name == \"nt\""} -terminado = ">=0.8.3" - -[package.extras] -docs = ["jinja2", "jupyter-server", "mistune (<3.0)", "myst-parser", "nbformat", "packaging", "pydata-sphinx-theme", "sphinxcontrib-github-alt", "sphinxcontrib-openapi", "sphinxcontrib-spelling", "sphinxemoji", "tornado"] -test = ["coverage", "jupyter-server (>=2.0.0)", "pytest (>=7.0)", "pytest-cov", "pytest-jupyter[server] (>=0.5.3)", "pytest-timeout"] - [[package]] name = "jupyter-server-ydoc" version = "0.8.0" @@ -5369,17 +5347,6 @@ numpy = ">=1.7" qdldl = "*" scipy = ">=0.13.2" -[[package]] -name = "overrides" -version = "7.3.1" -description = "A decorator to automatically detect mismatch when overriding a method." -optional = false -python-versions = ">=3.6" -files = [ - {file = "overrides-7.3.1-py3-none-any.whl", hash = "sha256:6187d8710a935d09b0bcef8238301d6ee2569d2ac1ae0ec39a8c7924e27f58ca"}, - {file = "overrides-7.3.1.tar.gz", hash = "sha256:8b97c6c1e1681b78cbc9424b138d880f0803c2254c5ebaabdde57bb6c62093f2"}, -] - [[package]] name = "packaging" version = "23.1" @@ -10484,4 +10451,4 @@ optimization = ["Riskfolio-Lib"] [metadata] lock-version = "2.0" python-versions = "^3.8.1,<3.11, !=3.9.7" -content-hash = "38dff4b9cdf474ad09c493b85b4168826350c6f8cb4da920ee4a823e5a807525" +content-hash = "09a307f72efb6144c29754ed42e716d70a29dc61607c082b0bd067fede7bdb87" diff --git a/pyproject.toml b/pyproject.toml index 919bfe76844..4a08b390c82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -119,6 +119,8 @@ arch = "^5.5.0" llama-index = "0.7.11" langchain = "0.0.237" ffn = "0.3.6" +jupyter-client = "7.4.1" +jupyter-server = "1.23.6" diff --git a/requirements-full.txt b/requirements-full.txt index d0015c945d5..b320112f8fa 100644 --- a/requirements-full.txt +++ b/requirements-full.txt @@ -155,14 +155,13 @@ json5==0.9.14 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7 jsonpointer==2.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jsonschema==4.17.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jsonschema[format-nongpl]==4.17.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" -jupyter-client==8.3.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" +jupyter-client==7.4.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyter-core==5.3.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyter-dash==0.4.2 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7" jupyter-events==0.6.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyter-server-fileid==0.9.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" -jupyter-server-terminals==0.4.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyter-server-ydoc==0.8.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" -jupyter-server==2.7.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" +jupyter-server==1.23.6 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyter-ydoc==0.2.5 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyterlab-pygments==0.2.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyterlab-server==2.23.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" @@ -225,7 +224,6 @@ openapi-schema-pydantic==1.2.4 ; python_full_version >= "3.8.1" and python_versi openpyxl==3.1.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" orjson==3.9.2 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7" osqp==0.6.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" -overrides==7.3.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" packaging==23.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" pandas-datareader==0.10.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" pandas-market-calendars==3.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" diff --git a/requirements.txt b/requirements.txt index d4dc9bd53d0..ebb336be0d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -107,13 +107,12 @@ json5==0.9.14 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7 jsonpointer==2.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jsonschema==4.17.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jsonschema[format-nongpl]==4.17.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" -jupyter-client==8.3.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" +jupyter-client==7.4.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyter-core==5.3.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyter-events==0.6.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyter-server-fileid==0.9.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" -jupyter-server-terminals==0.4.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyter-server-ydoc==0.8.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" -jupyter-server==2.7.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" +jupyter-server==1.23.6 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyter-ydoc==0.2.5 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyterlab-pygments==0.2.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" jupyterlab-server==2.23.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" @@ -154,7 +153,6 @@ onetimepass==1.0.1 ; python_full_version >= "3.8.1" and python_version < "3.11" openai==0.27.8 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" openapi-schema-pydantic==1.2.4 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7" openpyxl==3.1.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" -overrides==7.3.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" packaging==23.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" pandas-datareader==0.10.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" pandas-market-calendars==3.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" From 73be75f9c113def177592948908c62b6faccb71b Mon Sep 17 00:00:00 2001 From: Pratyush Shukla Date: Tue, 25 Jul 2023 00:20:42 +0530 Subject: [PATCH 2/6] `adjClose` not returned in Polygon and code refactoring --- .../fmp/openbb_fmp/models/stock_eod.py | 25 +++++++------------ .../openbb_polygon/models/stock_eod.py | 2 +- .../openbb_provider/models/stock_eod.py | 1 - 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/openbb_sdk/providers/fmp/openbb_fmp/models/stock_eod.py b/openbb_sdk/providers/fmp/openbb_fmp/models/stock_eod.py index f8e9806d4cc..add57ce8114 100644 --- a/openbb_sdk/providers/fmp/openbb_fmp/models/stock_eod.py +++ b/openbb_sdk/providers/fmp/openbb_fmp/models/stock_eod.py @@ -1,10 +1,9 @@ """FMP Stocks end of day fetcher.""" -from datetime import date, datetime, timedelta +from datetime import datetime, timedelta from typing import Dict, List, Literal, Optional -from openbb_provider.abstract.data import Data, QueryParams from openbb_provider.abstract.fetcher import Fetcher from openbb_provider.helpers import data_transformer, get_querystring from openbb_provider.models.stock_eod import StockEODData, StockEODQueryParams @@ -13,7 +12,7 @@ from pydantic import Field, NonNegativeInt, validator from openbb_fmp.utils.helpers import get_data_many -class FMPStockEODQueryParams(QueryParams): +class FMPStockEODQueryParams(StockEODQueryParams): """FMP Stock end of day query. Source: https://financialmodelingprep.com/developer/docs/#Stock-Historical-Price @@ -32,21 +31,15 @@ class FMPStockEODQueryParams(QueryParams): The type of the series. Only "line" is supported. """ - symbol: str = Field(min_length=1) + # symbol: str = Field(min_length=1) series_type: Optional[Literal["line"]] - start_date: date - end_date: date + # start_date: date + # end_date: date timeseries: Optional[NonNegativeInt] # Number of days to looks back -class FMPStockEODData(Data): - date: datetime - open: float - high: float - low: float - close: float +class FMPStockEODData(StockEODData): adjClose: float = Field(alias="adj_close") - volume: float unadjustedVolume: float change: float changePercent: float @@ -72,13 +65,13 @@ class FMPStockEODFetcher( query: StockEODQueryParams, extra_params: Optional[Dict] = None ) -> FMPStockEODQueryParams: now = datetime.now() - start_date = query.start_date if query.start_date else now - timedelta(days=5) - end_date = query.end_date if query.end_date else now + start_date = query.start_date or (now - timedelta(days=5)) + end_date = query.end_date or now return FMPStockEODQueryParams( symbol=query.symbol, start_date=start_date, end_date=end_date, - **extra_params if extra_params else {}, + **extra_params or {}, ) @staticmethod diff --git a/openbb_sdk/providers/polygon/openbb_polygon/models/stock_eod.py b/openbb_sdk/providers/polygon/openbb_polygon/models/stock_eod.py index 8981a248270..9fae5c614d4 100644 --- a/openbb_sdk/providers/polygon/openbb_polygon/models/stock_eod.py +++ b/openbb_sdk/providers/polygon/openbb_polygon/models/stock_eod.py @@ -64,7 +64,7 @@ class PolygonStockEODFetcher( symbol=query.symbol, start_date=start_date, end_date=end_date, - **extra_params if extra_params else {}, + **extra_params or {}, ) @staticmethod diff --git a/openbb_sdk/sdk/provider/openbb_provider/models/stock_eod.py b/openbb_sdk/sdk/provider/openbb_provider/models/stock_eod.py index a832e246aca..4bfb3ec837a 100644 --- a/openbb_sdk/sdk/provider/openbb_provider/models/stock_eod.py +++ b/openbb_sdk/sdk/provider/openbb_provider/models/stock_eod.py @@ -58,5 +58,4 @@ class StockEODData(Data): high: PositiveFloat low: PositiveFloat close: PositiveFloat - adj_close: Optional[PositiveFloat] volume: PositiveFloat From f7b2caf3dc55fc7a8e3b80a1b0fb63eb654e106e Mon Sep 17 00:00:00 2001 From: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Date: Mon, 24 Jul 2023 23:09:39 +0200 Subject: [PATCH 3/6] Fix to_dict() --- openbb_sdk/sdk/core/openbb_core/app/model/command_output.py | 2 +- openbb_sdk/sdk/core/openbb_core/app/static/container.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openbb_sdk/sdk/core/openbb_core/app/model/command_output.py b/openbb_sdk/sdk/core/openbb_core/app/model/command_output.py index 987ae9028b5..9d3f9ba7c80 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/model/command_output.py +++ b/openbb_sdk/sdk/core/openbb_core/app/model/command_output.py @@ -79,7 +79,7 @@ class CommandOutput(GenericModel, Generic[T], Tagged): Dict[str, List] Dictionary of lists. """ - df = self.to_dataframe() + df = self.to_dataframe().reset_index() results = {} for field in df.columns: results[field] = df[field].tolist() diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/container.py b/openbb_sdk/sdk/core/openbb_core/app/static/container.py index 460bda05b6c..bdc9a3408b4 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/container.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/container.py @@ -1,5 +1,6 @@ from openbb_core.app.command_runner import CommandRunnerSession + class Container: def __init__(self, command_runner_session: CommandRunnerSession) -> None: From 2a603d7a13997ac92de32cc37fcf7a4e35aa5240 Mon Sep 17 00:00:00 2001 From: Theodore Aptekarev Date: Tue, 25 Jul 2023 10:05:15 +0300 Subject: [PATCH 4/6] Lint black --- openbb_sdk/sdk/core/openbb_core/app/static/container.py | 1 - .../sdk/core/openbb_core/app/static/package/__commands__.py | 1 - 2 files changed, 2 deletions(-) diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/container.py b/openbb_sdk/sdk/core/openbb_core/app/static/container.py index bdc9a3408b4..75cd907ab74 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/container.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/container.py @@ -2,6 +2,5 @@ from openbb_core.app.command_runner import CommandRunnerSession class Container: - def __init__(self, command_runner_session: CommandRunnerSession) -> None: self._command_runner_session = command_runner_session diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/__commands__.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/__commands__.py index 465e59d17d5..d059a295ecb 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/__commands__.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/__commands__.py @@ -1,7 +1,6 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### - from openbb_core.app.static.container import Container From 228bbfa2e7b160542076b52f66fa15a568dc6112 Mon Sep 17 00:00:00 2001 From: Theodore Aptekarev Date: Tue, 25 Jul 2023 17:09:09 +0300 Subject: [PATCH 5/6] Update readme --- openbb_sdk/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/openbb_sdk/README.md b/openbb_sdk/README.md index 862203e5bb6..1220341f618 100644 --- a/openbb_sdk/README.md +++ b/openbb_sdk/README.md @@ -37,16 +37,6 @@ pip install ./openbb_sdk This will install the SDK and all the dependencies into the site-packages folder of the virtual environment. -While we're still developing it is required to create the static python interface: - -```python -import openbb -openbb._rebuild_python_interface() -exit() -``` - -Right now you need to do this before the first launch and every time you install or uninstall a new extension. - ## API keys To connect to APIs you need to provide the API keys. Here 3 options how you can provide them: @@ -143,3 +133,13 @@ From the root of the OpenBB Terminal repo run: When developing a specific extension cd into the extension folder and run: `pip install -U -e .` + +While we're still developing it is required to create the static python interface: + +```python +import openbb +openbb._rebuild_python_interface() +exit() +``` + +Right now you need to do this before the first launch and every time you install or uninstall a new extension. From 068b472e4def849784be30acde9e90db52ab9334 Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Tue, 25 Jul 2023 16:09:16 +0100 Subject: [PATCH 6/6] fix fred helpers --- openbb_sdk/providers/fred/openbb_fred/utils/fred_helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openbb_sdk/providers/fred/openbb_fred/utils/fred_helpers.py b/openbb_sdk/providers/fred/openbb_fred/utils/fred_helpers.py index aba13a2ff24..08b13e6823f 100644 --- a/openbb_sdk/providers/fred/openbb_fred/utils/fred_helpers.py +++ b/openbb_sdk/providers/fred/openbb_fred/utils/fred_helpers.py @@ -1,4 +1,6 @@ import csv +import os +from pathlib import Path from typing import List, Literal CPI_COUNTRIES = Literal[ @@ -61,8 +63,10 @@ CPI_FREQUENCY = Literal["monthly", "quarterly", "annual"] def all_cpi_options(harmonized: bool = False) -> List[dict]: data = [] + current_dir = os.path.dirname(os.path.realpath(__file__)) file = "harmonized_cpi.csv" if harmonized else "cpi.csv" - with open(file, encoding="utf-8") as csv_file_handler: + + with open(Path(current_dir, file), encoding="utf-8") as csv_file_handler: csv_reader = csv.DictReader(csv_file_handler) for rows in csv_reader: row = {key.lstrip("\ufeff"): value for key, value in rows.items()}