mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-02 15:32:04 +00:00
Merge branch 'feature/openbb-sdk-v4' into feature/field_description
This commit is contained in:
20
openbb_sdk/README.md
vendored
20
openbb_sdk/README.md
vendored
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -58,5 +58,4 @@ class StockEODData(Data):
|
||||
high: PositiveFloat
|
||||
low: PositiveFloat
|
||||
close: PositiveFloat
|
||||
adj_close: Optional[PositiveFloat]
|
||||
volume: PositiveFloat
|
||||
|
||||
79
poetry.lock
generated
vendored
79
poetry.lock
generated
vendored
@@ -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"
|
||||
|
||||
2
pyproject.toml
vendored
2
pyproject.toml
vendored
@@ -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"
|
||||
|
||||
|
||||
|
||||
|
||||
6
requirements-full.txt
vendored
6
requirements-full.txt
vendored
@@ -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"
|
||||
|
||||
6
requirements.txt
vendored
6
requirements.txt
vendored
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user