Merge remote-tracking branch 'upstream/feature/openbb-sdk-v4' into feature/sdk-j2

This commit is contained in:
James Maslek
2023-08-15 09:01:12 -04:00
60 changed files with 1134 additions and 516 deletions

View File

@@ -1819,7 +1819,7 @@ def stocks_load(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]:
k["rma"] = dict(length=ma)
return k
data = basemodel_to_df(kwargs["OBBject_item"], index=kwargs.get("index", "date"))
data = basemodel_to_df(kwargs["obbject_item"], index=kwargs.get("index", "date"))
standard_params = kwargs["standard_params"].__dict__
ma = standard_params.get("ma", None)
prepost = standard_params.get("prepost", False)
@@ -1838,7 +1838,7 @@ def stocks_load(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]:
def stocks_news(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]:
data = basemodel_to_df(kwargs["OBBject_item"], index=kwargs.get("index", "date"))
data = basemodel_to_df(kwargs["obbject_item"], index=kwargs.get("index", "date"))
standard_params = kwargs["standard_params"].__dict__
columnwidth = standard_params.get("columnwidth", None)
@@ -2104,7 +2104,7 @@ def stocks_ins_filt(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]:
def stocks_multiples(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]:
data = basemodel_to_df(kwargs["OBBject_item"], index=kwargs.get("index", "date"))
data = basemodel_to_df(kwargs["obbject_item"], index=kwargs.get("index", "date"))
standard_params = kwargs["standard_params"].__dict__
columnwidth = standard_params.get("columnwidth", None)

View File

@@ -41,6 +41,13 @@ def get_fama_raw(start_date: str, end_date: str) -> pd.DataFrame:
df["HML"] = df["HML"] / 100
df["RF"] = df["RF"] / 100
df = df.set_index("Date")
dt_start_date = pd.to_datetime(start_date, format="%Y-%m-%d")
if dt_start_date > df.index.max():
raise ValueError(
f"Start date '{dt_start_date}' is after the last date available for Fama-French '{df.index[-1]}'"
)
df = df.loc[start_date:end_date] # type: ignore
return df

View File

@@ -85,7 +85,7 @@ def capm(data: List[Data], target: str) -> OBBject[CAPMModel]:
df_target = get_target_columns(df, ["date", target])
df_target = df_target.set_index("date")
df_target["return"] = df_target.pct_change()
df_target.loc[:, "return"] = df_target.pct_change()
df_target = df_target.dropna()
start_date = df_target.index.min().strftime("%Y-%m-%d")
end_date = df_target.index.max().strftime("%Y-%m-%d")

168
openbb_sdk/poetry.lock generated vendored
View File

@@ -160,14 +160,14 @@ files = [
[[package]]
name = "async-timeout"
version = "4.0.2"
version = "4.0.3"
description = "Timeout context manager for asyncio programs"
category = "main"
optional = false
python-versions = ">=3.6"
python-versions = ">=3.7"
files = [
{file = "async-timeout-4.0.2.tar.gz", hash = "sha256:2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15"},
{file = "async_timeout-4.0.2-py3-none-any.whl", hash = "sha256:8ca1e4fcf50d07413d66d1a5e416e42cfdf5851c981d679a09851a6853383b3c"},
{file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"},
{file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"},
]
[[package]]
@@ -412,23 +412,19 @@ test = ["flake8", "isort", "pytest"]
[[package]]
name = "dnspython"
version = "2.4.0"
version = "2.4.2"
description = "DNS toolkit"
category = "main"
optional = false
python-versions = ">=3.8,<4.0"
files = [
{file = "dnspython-2.4.0-py3-none-any.whl", hash = "sha256:46b4052a55b56beea3a3bdd7b30295c292bd6827dd442348bc116f2d35b17f0a"},
{file = "dnspython-2.4.0.tar.gz", hash = "sha256:758e691dbb454d5ccf4e1b154a19e52847f79e21a42fef17b969144af29a4e6c"},
{file = "dnspython-2.4.2-py3-none-any.whl", hash = "sha256:57c6fbaaeaaf39c891292012060beb141791735dbb4004798328fc2c467402d8"},
{file = "dnspython-2.4.2.tar.gz", hash = "sha256:8dcfae8c7460a2f84b4072e26f1c9f4101ca20c071649cb7c34e8b6a93d58984"},
]
[package.dependencies]
httpcore = {version = ">=0.17.3", markers = "python_version >= \"3.8\""}
sniffio = ">=1.1,<2.0"
[package.extras]
dnssec = ["cryptography (>=2.6,<42.0)"]
doh = ["h2 (>=4.1.0)", "httpx (>=0.24.1)"]
doh = ["h2 (>=4.1.0)", "httpcore (>=0.17.3)", "httpx (>=0.24.1)"]
doq = ["aioquic (>=0.9.20)"]
idna = ["idna (>=2.1,<4.0)"]
trio = ["trio (>=0.14,<0.23)"]
@@ -455,14 +451,14 @@ gmpy2 = ["gmpy2"]
[[package]]
name = "exceptiongroup"
version = "1.1.2"
version = "1.1.3"
description = "Backport of PEP 654 (exception groups)"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "exceptiongroup-1.1.2-py3-none-any.whl", hash = "sha256:e346e69d186172ca7cf029c8c1d16235aa0e04035e5750b4b95039e65204328f"},
{file = "exceptiongroup-1.1.2.tar.gz", hash = "sha256:12c3e887d6485d16943a309616de20ae5582633e0a2eda17f4e10fd61c1e8af5"},
{file = "exceptiongroup-1.1.3-py3-none-any.whl", hash = "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3"},
{file = "exceptiongroup-1.1.3.tar.gz", hash = "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9"},
]
[package.extras]
@@ -689,16 +685,35 @@ files = [
{file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"},
]
[[package]]
name = "importlib-metadata"
version = "6.8.0"
description = "Read metadata from Python packages"
optional = false
python-versions = ">=3.8"
files = [
{file = "importlib_metadata-6.8.0-py3-none-any.whl", hash = "sha256:3ebb78df84a805d7698245025b975d9d67053cd94c79245ba4b3eb694abe68bb"},
{file = "importlib_metadata-6.8.0.tar.gz", hash = "sha256:dbace7892d8c0c4ac1ad096662232f831d4e64f4c4545bd53016a3e9d4654743"},
]
[package.dependencies]
zipp = ">=0.5"
[package.extras]
docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
perf = ["ipython"]
testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"]
[[package]]
name = "importlib-resources"
version = "6.0.0"
version = "6.0.1"
description = "Read resources from Python packages"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
{file = "importlib_resources-6.0.0-py3-none-any.whl", hash = "sha256:d952faee11004c045f785bb5636e8f885bed30dc3c940d5d42798a2a4541c185"},
{file = "importlib_resources-6.0.0.tar.gz", hash = "sha256:4cf94875a8368bd89531a756df9a9ebe1f150e0f885030b461237bc7f2d905f2"},
{file = "importlib_resources-6.0.1-py3-none-any.whl", hash = "sha256:134832a506243891221b88b4ae1213327eea96ceb4e407a00d790bb0626f45cf"},
{file = "importlib_resources-6.0.1.tar.gz", hash = "sha256:4359457e42708462b9626a04657c6208ad799ceb41e5c58c57ffa0e6a098a5d4"},
]
[package.dependencies]
@@ -722,14 +737,14 @@ files = [
[[package]]
name = "jsonschema"
version = "4.18.4"
version = "4.19.0"
description = "An implementation of JSON Schema validation for Python"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
{file = "jsonschema-4.18.4-py3-none-any.whl", hash = "sha256:971be834317c22daaa9132340a51c01b50910724082c2c1a2ac87eeec153a3fe"},
{file = "jsonschema-4.18.4.tar.gz", hash = "sha256:fb3642735399fa958c0d2aad7057901554596c63349f4f6b283c493cf692a25d"},
{file = "jsonschema-4.19.0-py3-none-any.whl", hash = "sha256:043dc26a3845ff09d20e4420d6012a9c91c9aa8999fa184e7efcfeccb41e32cb"},
{file = "jsonschema-4.19.0.tar.gz", hash = "sha256:6e1e7569ac13be8139b2dd2c21a55d350066ee3f80df06c608b398cdc6f30e8f"},
]
[package.dependencies]
@@ -999,14 +1014,14 @@ files = [
[[package]]
name = "nbformat"
version = "5.9.1"
version = "5.9.2"
description = "The Jupyter Notebook format"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
{file = "nbformat-5.9.1-py3-none-any.whl", hash = "sha256:b7968ebf4811178a4108ee837eae1442e3f054132100f0359219e9ed1ce3ca45"},
{file = "nbformat-5.9.1.tar.gz", hash = "sha256:3a7f52d040639cbd8a3890218c8b0ffb93211588c57446c90095e32ba5881b5d"},
{file = "nbformat-5.9.2-py3-none-any.whl", hash = "sha256:1c5172d786a41b82bcfd0c23f9e6b6f072e8fb49c39250219e4acfff1efe89e9"},
{file = "nbformat-5.9.2.tar.gz", hash = "sha256:5f98b5ba1997dff175e77e0c17d5c10a96eaed2cbd1de3533d1fc35d5e111192"},
]
[package.dependencies]
@@ -1132,6 +1147,7 @@ develop = false
bcrypt = "^4.0.1"
fastapi = "^0.100.1"
html5lib = "^1.1"
importlib_metadata = "^6.8.0"
openbb-provider = {path = "../provider"}
pandas = ">1.5.3"
passlib = "^1.7.4"
@@ -1575,30 +1591,30 @@ files = [
[[package]]
name = "platformdirs"
version = "3.9.1"
version = "3.10.0"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "platformdirs-3.9.1-py3-none-any.whl", hash = "sha256:ad8291ae0ae5072f66c16945166cb11c63394c7a3ad1b1bc9828ca3162da8c2f"},
{file = "platformdirs-3.9.1.tar.gz", hash = "sha256:1b42b450ad933e981d56e59f1b97495428c9bd60698baab9f3eb3d00d5822421"},
{file = "platformdirs-3.10.0-py3-none-any.whl", hash = "sha256:d7c24979f292f916dc9cbf8648319032f551ea8c49a4c9bf2fb556a02070ec1d"},
{file = "platformdirs-3.10.0.tar.gz", hash = "sha256:b45696dab2d7cc691a3226759c0d3b00c47c8b6e293d96f6436f733303f77f6d"},
]
[package.extras]
docs = ["furo (>=2023.5.20)", "proselint (>=0.13)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"]
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)"]
docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.1)", "sphinx-autodoc-typehints (>=1.24)"]
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)"]
[[package]]
name = "plotly"
version = "5.15.0"
version = "5.16.0"
description = "An open-source, interactive data visualization library for Python"
category = "main"
optional = false
python-versions = ">=3.6"
files = [
{file = "plotly-5.15.0-py2.py3-none-any.whl", hash = "sha256:3508876bbd6aefb8a692c21a7128ca87ce42498dd041efa5c933ee44b55aab24"},
{file = "plotly-5.15.0.tar.gz", hash = "sha256:822eabe53997d5ebf23c77e1d1fcbf3bb6aa745eb05d532afd4b6f9a2e2ab02f"},
{file = "plotly-5.16.0-py2.py3-none-any.whl", hash = "sha256:046ba0cd9f6b251780e0d93313016ec5e2cb69d9a68da818cd7110e6c77a4011"},
{file = "plotly-5.16.0.tar.gz", hash = "sha256:13dc052665dcb4d9eefd89847c0b144984e99aca5c8008f9885d2583b77d8b7d"},
]
[package.dependencies]
@@ -1671,48 +1687,48 @@ files = [
[[package]]
name = "pydantic"
version = "1.10.11"
version = "1.10.12"
description = "Data validation and settings management using python type hints"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "pydantic-1.10.11-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ff44c5e89315b15ff1f7fdaf9853770b810936d6b01a7bcecaa227d2f8fe444f"},
{file = "pydantic-1.10.11-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a6c098d4ab5e2d5b3984d3cb2527e2d6099d3de85630c8934efcfdc348a9760e"},
{file = "pydantic-1.10.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:16928fdc9cb273c6af00d9d5045434c39afba5f42325fb990add2c241402d151"},
{file = "pydantic-1.10.11-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0588788a9a85f3e5e9ebca14211a496409cb3deca5b6971ff37c556d581854e7"},
{file = "pydantic-1.10.11-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e9baf78b31da2dc3d3f346ef18e58ec5f12f5aaa17ac517e2ffd026a92a87588"},
{file = "pydantic-1.10.11-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:373c0840f5c2b5b1ccadd9286782852b901055998136287828731868027a724f"},
{file = "pydantic-1.10.11-cp310-cp310-win_amd64.whl", hash = "sha256:c3339a46bbe6013ef7bdd2844679bfe500347ac5742cd4019a88312aa58a9847"},
{file = "pydantic-1.10.11-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:08a6c32e1c3809fbc49debb96bf833164f3438b3696abf0fbeceb417d123e6eb"},
{file = "pydantic-1.10.11-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a451ccab49971af043ec4e0d207cbc8cbe53dbf148ef9f19599024076fe9c25b"},
{file = "pydantic-1.10.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5b02d24f7b2b365fed586ed73582c20f353a4c50e4be9ba2c57ab96f8091ddae"},
{file = "pydantic-1.10.11-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3f34739a89260dfa420aa3cbd069fbcc794b25bbe5c0a214f8fb29e363484b66"},
{file = "pydantic-1.10.11-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:e297897eb4bebde985f72a46a7552a7556a3dd11e7f76acda0c1093e3dbcf216"},
{file = "pydantic-1.10.11-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d185819a7a059550ecb85d5134e7d40f2565f3dd94cfd870132c5f91a89cf58c"},
{file = "pydantic-1.10.11-cp311-cp311-win_amd64.whl", hash = "sha256:4400015f15c9b464c9db2d5d951b6a780102cfa5870f2c036d37c23b56f7fc1b"},
{file = "pydantic-1.10.11-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:2417de68290434461a266271fc57274a138510dca19982336639484c73a07af6"},
{file = "pydantic-1.10.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:331c031ba1554b974c98679bd0780d89670d6fd6f53f5d70b10bdc9addee1713"},
{file = "pydantic-1.10.11-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8268a735a14c308923e8958363e3a3404f6834bb98c11f5ab43251a4e410170c"},
{file = "pydantic-1.10.11-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:44e51ba599c3ef227e168424e220cd3e544288c57829520dc90ea9cb190c3248"},
{file = "pydantic-1.10.11-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d7781f1d13b19700b7949c5a639c764a077cbbdd4322ed505b449d3ca8edcb36"},
{file = "pydantic-1.10.11-cp37-cp37m-win_amd64.whl", hash = "sha256:7522a7666157aa22b812ce14c827574ddccc94f361237ca6ea8bb0d5c38f1629"},
{file = "pydantic-1.10.11-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bc64eab9b19cd794a380179ac0e6752335e9555d214cfcb755820333c0784cb3"},
{file = "pydantic-1.10.11-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8dc77064471780262b6a68fe67e013298d130414d5aaf9b562c33987dbd2cf4f"},
{file = "pydantic-1.10.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fe429898f2c9dd209bd0632a606bddc06f8bce081bbd03d1c775a45886e2c1cb"},
{file = "pydantic-1.10.11-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:192c608ad002a748e4a0bed2ddbcd98f9b56df50a7c24d9a931a8c5dd053bd3d"},
{file = "pydantic-1.10.11-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:ef55392ec4bb5721f4ded1096241e4b7151ba6d50a50a80a2526c854f42e6a2f"},
{file = "pydantic-1.10.11-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:41e0bb6efe86281623abbeeb0be64eab740c865388ee934cd3e6a358784aca6e"},
{file = "pydantic-1.10.11-cp38-cp38-win_amd64.whl", hash = "sha256:265a60da42f9f27e0b1014eab8acd3e53bd0bad5c5b4884e98a55f8f596b2c19"},
{file = "pydantic-1.10.11-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:469adf96c8e2c2bbfa655fc7735a2a82f4c543d9fee97bd113a7fb509bf5e622"},
{file = "pydantic-1.10.11-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e6cbfbd010b14c8a905a7b10f9fe090068d1744d46f9e0c021db28daeb8b6de1"},
{file = "pydantic-1.10.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:abade85268cc92dff86d6effcd917893130f0ff516f3d637f50dadc22ae93999"},
{file = "pydantic-1.10.11-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e9738b0f2e6c70f44ee0de53f2089d6002b10c33264abee07bdb5c7f03038303"},
{file = "pydantic-1.10.11-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:787cf23e5a0cde753f2eabac1b2e73ae3844eb873fd1f5bdbff3048d8dbb7604"},
{file = "pydantic-1.10.11-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:174899023337b9fc685ac8adaa7b047050616136ccd30e9070627c1aaab53a13"},
{file = "pydantic-1.10.11-cp39-cp39-win_amd64.whl", hash = "sha256:1954f8778489a04b245a1e7b8b22a9d3ea8ef49337285693cf6959e4b757535e"},
{file = "pydantic-1.10.11-py3-none-any.whl", hash = "sha256:008c5e266c8aada206d0627a011504e14268a62091450210eda7c07fabe6963e"},
{file = "pydantic-1.10.11.tar.gz", hash = "sha256:f66d479cf7eb331372c470614be6511eae96f1f120344c25f3f9bb59fb1b5528"},
{file = "pydantic-1.10.12-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a1fcb59f2f355ec350073af41d927bf83a63b50e640f4dbaa01053a28b7a7718"},
{file = "pydantic-1.10.12-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b7ccf02d7eb340b216ec33e53a3a629856afe1c6e0ef91d84a4e6f2fb2ca70fe"},
{file = "pydantic-1.10.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8fb2aa3ab3728d950bcc885a2e9eff6c8fc40bc0b7bb434e555c215491bcf48b"},
{file = "pydantic-1.10.12-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:771735dc43cf8383959dc9b90aa281f0b6092321ca98677c5fb6125a6f56d58d"},
{file = "pydantic-1.10.12-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ca48477862372ac3770969b9d75f1bf66131d386dba79506c46d75e6b48c1e09"},
{file = "pydantic-1.10.12-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a5e7add47a5b5a40c49b3036d464e3c7802f8ae0d1e66035ea16aa5b7a3923ed"},
{file = "pydantic-1.10.12-cp310-cp310-win_amd64.whl", hash = "sha256:e4129b528c6baa99a429f97ce733fff478ec955513630e61b49804b6cf9b224a"},
{file = "pydantic-1.10.12-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b0d191db0f92dfcb1dec210ca244fdae5cbe918c6050b342d619c09d31eea0cc"},
{file = "pydantic-1.10.12-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:795e34e6cc065f8f498c89b894a3c6da294a936ee71e644e4bd44de048af1405"},
{file = "pydantic-1.10.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:69328e15cfda2c392da4e713443c7dbffa1505bc9d566e71e55abe14c97ddc62"},
{file = "pydantic-1.10.12-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2031de0967c279df0d8a1c72b4ffc411ecd06bac607a212892757db7462fc494"},
{file = "pydantic-1.10.12-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:ba5b2e6fe6ca2b7e013398bc7d7b170e21cce322d266ffcd57cca313e54fb246"},
{file = "pydantic-1.10.12-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:2a7bac939fa326db1ab741c9d7f44c565a1d1e80908b3797f7f81a4f86bc8d33"},
{file = "pydantic-1.10.12-cp311-cp311-win_amd64.whl", hash = "sha256:87afda5539d5140cb8ba9e8b8c8865cb5b1463924d38490d73d3ccfd80896b3f"},
{file = "pydantic-1.10.12-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:549a8e3d81df0a85226963611950b12d2d334f214436a19537b2efed61b7639a"},
{file = "pydantic-1.10.12-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:598da88dfa127b666852bef6d0d796573a8cf5009ffd62104094a4fe39599565"},
{file = "pydantic-1.10.12-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ba5c4a8552bff16c61882db58544116d021d0b31ee7c66958d14cf386a5b5350"},
{file = "pydantic-1.10.12-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c79e6a11a07da7374f46970410b41d5e266f7f38f6a17a9c4823db80dadf4303"},
{file = "pydantic-1.10.12-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ab26038b8375581dc832a63c948f261ae0aa21f1d34c1293469f135fa92972a5"},
{file = "pydantic-1.10.12-cp37-cp37m-win_amd64.whl", hash = "sha256:e0a16d274b588767602b7646fa05af2782576a6cf1022f4ba74cbb4db66f6ca8"},
{file = "pydantic-1.10.12-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6a9dfa722316f4acf4460afdf5d41d5246a80e249c7ff475c43a3a1e9d75cf62"},
{file = "pydantic-1.10.12-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a73f489aebd0c2121ed974054cb2759af8a9f747de120acd2c3394cf84176ccb"},
{file = "pydantic-1.10.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b30bcb8cbfccfcf02acb8f1a261143fab622831d9c0989707e0e659f77a18e0"},
{file = "pydantic-1.10.12-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2fcfb5296d7877af406ba1547dfde9943b1256d8928732267e2653c26938cd9c"},
{file = "pydantic-1.10.12-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:2f9a6fab5f82ada41d56b0602606a5506aab165ca54e52bc4545028382ef1c5d"},
{file = "pydantic-1.10.12-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:dea7adcc33d5d105896401a1f37d56b47d443a2b2605ff8a969a0ed5543f7e33"},
{file = "pydantic-1.10.12-cp38-cp38-win_amd64.whl", hash = "sha256:1eb2085c13bce1612da8537b2d90f549c8cbb05c67e8f22854e201bde5d98a47"},
{file = "pydantic-1.10.12-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ef6c96b2baa2100ec91a4b428f80d8f28a3c9e53568219b6c298c1125572ebc6"},
{file = "pydantic-1.10.12-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6c076be61cd0177a8433c0adcb03475baf4ee91edf5a4e550161ad57fc90f523"},
{file = "pydantic-1.10.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2d5a58feb9a39f481eda4d5ca220aa8b9d4f21a41274760b9bc66bfd72595b86"},
{file = "pydantic-1.10.12-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e5f805d2d5d0a41633651a73fa4ecdd0b3d7a49de4ec3fadf062fe16501ddbf1"},
{file = "pydantic-1.10.12-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:1289c180abd4bd4555bb927c42ee42abc3aee02b0fb2d1223fb7c6e5bef87dbe"},
{file = "pydantic-1.10.12-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5d1197e462e0364906cbc19681605cb7c036f2475c899b6f296104ad42b9f5fb"},
{file = "pydantic-1.10.12-cp39-cp39-win_amd64.whl", hash = "sha256:fdbdd1d630195689f325c9ef1a12900524dceb503b00a987663ff4f58669b93d"},
{file = "pydantic-1.10.12-py3-none-any.whl", hash = "sha256:b749a43aa51e32839c9d71dc67eb1e4221bb04af1033a32e3923d46f9effa942"},
{file = "pydantic-1.10.12.tar.gz", hash = "sha256:0fe8a415cea8f340e7a9af9c54fc71a649b43e8ca3cc732986116b3cb135d303"},
]
[package.dependencies]
@@ -1977,14 +1993,14 @@ dev = ["auditwheel", "wheel"]
[[package]]
name = "referencing"
version = "0.30.0"
version = "0.30.2"
description = "JSON Referencing + Python"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
{file = "referencing-0.30.0-py3-none-any.whl", hash = "sha256:c257b08a399b6c2f5a3510a50d28ab5dbc7bbde049bcaf954d43c446f83ab548"},
{file = "referencing-0.30.0.tar.gz", hash = "sha256:47237742e990457f7512c7d27486394a9aadaf876cbfaa4be65b27b4f4d47c6b"},
{file = "referencing-0.30.2-py3-none-any.whl", hash = "sha256:449b6669b6121a9e96a7f9e410b245d471e8d48964c67113ce9afe50c8dd7bdf"},
{file = "referencing-0.30.2.tar.gz", hash = "sha256:794ad8003c65938edcdbc027f1933215e0d0ccc0291e3ce20a4d87432b59efc0"},
]
[package.dependencies]
@@ -2399,14 +2415,14 @@ tinycss2 = ">=0.6.0"
[[package]]
name = "tenacity"
version = "8.2.2"
version = "8.2.3"
description = "Retry code until it succeeds"
category = "main"
optional = false
python-versions = ">=3.6"
python-versions = ">=3.7"
files = [
{file = "tenacity-8.2.2-py3-none-any.whl", hash = "sha256:2f277afb21b851637e8f52e6a613ff08734c347dc19ade928e519d7d2d8569b0"},
{file = "tenacity-8.2.2.tar.gz", hash = "sha256:43af037822bd0029025877f3b2d97cc4d7bb0c2991000a3d59d71517c5c969e0"},
{file = "tenacity-8.2.3-py3-none-any.whl", hash = "sha256:ce510e327a630c9e1beaf17d42e6ffacc88185044ad85cf74c0a8887c6a0f88c"},
{file = "tenacity-8.2.3.tar.gz", hash = "sha256:5398ef0d78e63f40007c1fb4c0bff96e1911394d2fa8d194f77619c05ff6cc8a"},
]
[package.extras]

View File

@@ -9,7 +9,9 @@ from openbb_cboe.models.stock_search import CboeStockSearchFetcher
cboe_provider = Provider(
name="cboe",
website="https://www.cboe.com/",
description="""Provider for CBOE.""",
description="""Cboe is the world's go-to derivatives and exchange network,
delivering cutting-edge trading, clearing and investment solutions to people
around the world.""",
required_credentials=None,
fetcher_dict={
"StockSearch": CboeStockSearchFetcher,

View File

@@ -3,7 +3,7 @@
import os
from datetime import date, datetime, timedelta
from pathlib import Path
from typing import Optional, Tuple
from typing import List, Optional, Tuple
import numpy as np
import pandas as pd
@@ -139,7 +139,7 @@ def get_cboe_index_directory() -> pd.DataFrame:
},
)
indices_order: list[str] = [
indices_order: List[str] = [
"Ticker",
"Name",
"Description",
@@ -197,7 +197,7 @@ def stock_search(query: str, ticker: bool = False) -> dict:
return pd.DataFrame()
def get_ticker_info(symbol: str) -> Tuple[pd.DataFrame, list[str]]:
def get_ticker_info(symbol: str) -> Tuple[pd.DataFrame, List[str]]:
"""Gets basic info for the symbol and expiration dates
Parameters

View File

@@ -52,7 +52,7 @@ class FMPCashFlowStatementData(CashFlowStatementData):
"purchases_of_investments": "purchasesOfInvestments",
"sales_maturities_of_investments": "salesMaturitiesOfInvestments",
"other_investing_activities": "otherInvestingActivites",
"net_cash_flow_from_investing_activities": "netCashUsedForInvestingActivites",
"net_cash_used_for_investing_activities": "netCashUsedForInvestingActivites",
"debt_repayment": "debtRepayment",
"common_stock_issued": "commonStockIssued",
"common_stock_repurchased": "commonStockRepurchased",
@@ -65,13 +65,15 @@ class FMPCashFlowStatementData(CashFlowStatementData):
"cash_at_beginning_of_period": "cashAtBeginningOfPeriod",
"operating_cash_flow": "operatingCashFlow",
"capital_expenditure": "capitalExpenditure",
"net_cash_flow": "freeCashFlow",
"free_cash_flow": "freeCashFlow",
}
# Leftovers below
calendarYear: Optional[int]
calendar_year: Optional[int] = Field(
description="Calendar Year", alias="calendarYear"
)
link: Optional[str]
finalLink: Optional[str]
final_link: Optional[str] = Field(description="Final Link", alias="finalLink")
class FMPCashFlowStatementFetcher(
@@ -103,4 +105,4 @@ class FMPCashFlowStatementFetcher(
def transform_data(
data: List[FMPCashFlowStatementData],
) -> List[FMPCashFlowStatementData]:
return data
return [CashFlowStatementData.parse_obj(d.dict()) for d in data]

View File

@@ -35,6 +35,8 @@ class FMPRiskPremiumFetcher(
List[FMPRiskPremiumData],
]
):
"""FMP Risk Premium Fetcher."""
@staticmethod
def transform_query(params: Dict[str, Any]) -> FMPRiskPremiumQueryParams:
return FMPRiskPremiumQueryParams(**params)

View File

@@ -1,3 +1,4 @@
"""OpenBB API Account Router."""
from fastapi import APIRouter, Depends, Form, HTTPException, status
from fastapi.security import OAuth2PasswordRequestForm
from openbb_core.api.dependency.user import (
@@ -23,6 +24,7 @@ async def login_for_access_token(
user_service: Annotated[UserService, Depends(get_user_service)],
openbb_hub: bool = Form(True),
) -> TokenResponse:
"""Login for access token."""
user_settings = authenticate_user(
password=form_data.password,
user_service=user_service,
@@ -55,6 +57,7 @@ async def login_for_access_token(
async def push_user_settings_to_hub(
user_settings: Annotated[UserSettings, Depends(get_user)]
) -> UserSettings:
"""Push user settings to hub."""
if user_settings.profile.hub_session:
hs = HubService(user_settings.profile.hub_session)
hs.push(user_settings)
@@ -71,6 +74,7 @@ async def pull_user_settings_from_hub(
user_settings: Annotated[UserSettings, Depends(get_user)],
user_service: Annotated[UserService, Depends(get_user_service)],
) -> UserSettings:
"""Pull user settings from hub."""
if user_settings.profile.hub_session:
hs = HubService(user_settings.profile.hub_session)
incoming = hs.pull()
@@ -90,6 +94,7 @@ async def pull_user_settings_from_hub(
async def disconnect_from_hub(
user_settings: Annotated[UserSettings, Depends(get_user)],
) -> bool:
"""Disconnect from hub."""
if user_settings.profile.hub_session:
hs = HubService(user_settings.profile.hub_session)
result = hs.disconnect()

View File

@@ -195,7 +195,7 @@ class ChartingManager(metaclass=SingletonMeta):
user_settings: UserSettings,
system_settings: SystemSettings,
route: str,
OBBject_item: Generic[T],
obbject_item: Generic[T],
**kwargs,
):
"""
@@ -215,7 +215,7 @@ class ChartingManager(metaclass=SingletonMeta):
User settings.
route : str
Route name, example: `/stocks/load`.
OBBject_item
obbject_item
Command output item.
Returns
-------
@@ -235,7 +235,7 @@ class ChartingManager(metaclass=SingletonMeta):
self.handle_backend(self._charting_extension, self._charting_settings)
kwargs["OBBject_item"] = OBBject_item
kwargs["obbject_item"] = obbject_item
kwargs["charting_settings"] = self._charting_settings
charting_function = self.get_chart_function(self._charting_extension, route)

View File

@@ -228,8 +228,8 @@ class ParametersBuilder:
class StaticCommandRunner:
logging_manager = LoggingManager()
charting_manager = ChartingManager()
logging_manager: LoggingManager = LoggingManager()
charting_manager: ChartingManager = ChartingManager()
@staticmethod
def __run_in_isolation(func, args=None, kwargs=None) -> OBBject:
@@ -255,21 +255,21 @@ class StaticCommandRunner:
with context_manager as warning_list:
if system_settings.run_in_isolation:
OBBject = cls.__run_in_isolation(func=func, kwargs=kwargs)
obbject = cls.__run_in_isolation(func=func, kwargs=kwargs)
else:
OBBject = func(**kwargs)
obbject = func(**kwargs)
OBBject.provider = getattr(
obbject.provider = getattr(
kwargs.get("provider_choices", None), "provider", None
)
if warning_list:
OBBject.warnings = list(map(cast_warning, warning_list))
obbject.warnings = list(map(cast_warning, warning_list))
except Exception as e:
raise OpenBBError(e) from e
return OBBject
return obbject
@classmethod
def __chart(
@@ -282,15 +282,15 @@ class StaticCommandRunner:
) -> None:
"""Create a chart from the command output"""
try:
OBBject.chart = cls.charting_manager.chart(
obbject.chart = cls.charting_manager.chart(
user_settings=user_settings,
system_settings=system_settings,
route=route,
OBBject_item=OBBject.results,
obbject_item=obbject.results,
**kwargs,
)
except Exception as e:
OBBject.chart = Chart(error=Error(message=str(e)))
obbject.chart = Chart(error=Error(message=str(e)))
if system_settings.debug_mode:
raise
@@ -328,15 +328,15 @@ class StaticCommandRunner:
# commands.py and the function signature does not expect "chart"
kwargs.pop("chart", None)
OBBject = cls.__command(
obbject = cls.__command(
system_settings=system_settings,
func=func,
kwargs=kwargs,
)
if chart and OBBject.results:
if chart and obbject.results:
cls.__chart(
OBBject=OBBject,
obbject=obbject,
user_settings=user_settings,
system_settings=system_settings,
route=route,
@@ -346,13 +346,13 @@ class StaticCommandRunner:
cls.logging_manager.log(
user_settings=user_settings,
system_settings=system_settings,
OBBject=OBBject,
obbject=obbject,
route=route,
func=func,
kwargs=kwargs,
)
return OBBject
return obbject
@classmethod
def __update_managers_settings(
@@ -384,7 +384,7 @@ class StaticCommandRunner:
func = command_map.get_command(route=route)
if func:
OBBject = cls.__execute_func(
obbject = cls.__execute_func(
route=route,
args=args, # type: ignore
execution_context=execution_context,
@@ -400,7 +400,7 @@ class StaticCommandRunner:
journal_id=journal.id,
arguments=kwargs,
duration=duration,
output=OBBject,
output=obbject,
route=route,
timestamp=timestamp,
)

View File

@@ -42,7 +42,7 @@ class LoggingManager(metaclass=SingletonMeta):
__init__(system_settings, user_settings)
Logging Manager Constructor.
log(user_settings, system_settings, OBBject, route, func, kwargs)
log(user_settings, system_settings, obbject, route, func, kwargs)
Log command output and relevant information.
logging_settings
@@ -225,14 +225,14 @@ class LoggingManager(metaclass=SingletonMeta):
# Truncate kwargs if too long
kwargs = {k: str(v)[:100] for k, v in kwargs.items()}
log_level = logger.error if OBBject.error else logger.info
log_level = logger.error if obbject.error else logger.info
log_level(
"ERROR: %s" if OBBject.error else "CMD: %s",
"ERROR: %s" if obbject.error else "CMD: %s",
json.dumps(
{
"route": route,
"input": kwargs,
"error": OBBject.error,
"error": obbject.error,
},
default=pydantic_encoder,
),

View File

@@ -68,7 +68,7 @@ class OBBject(GenericModel, Generic[T], Tagged):
Union[pd.DataFrame, Dict[str, pd.DataFrame]]
Pandas dataframe or dictionary of dataframes.
"""
if self.results is None:
if not self.results:
raise OpenBBError("Results not found.")
try:
@@ -134,6 +134,7 @@ class OBBject(GenericModel, Generic[T], Tagged):
def show(self):
"""Displays chart."""
if not self.chart and not self.chart.fig:
if not self.chart or not self.chart.fig:
raise OpenBBError("Chart not found.")
self.chart.fig.show()

View File

@@ -50,17 +50,17 @@ def filter_inputs(**kwargs) -> dict:
def filter_output(OBBject: OBBject) -> OBBject:
"""Filter command output."""
if OBBject.warnings:
for w in OBBject.warnings:
if obbject.warnings:
for w in obbject.warnings:
category = getattr(builtins, w.category, OpenBBWarning)
print(f"{category.__name__}: {w.message}")
error = OBBject.error
error = obbject.error
if error:
raise OpenBBError(error.message)
chart = OBBject.chart
chart = obbject.chart
if chart and chart.error:
raise OpenBBError(chart.error.message)
return OBBject
return obbject

View File

@@ -1,7 +1,6 @@
### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###
from openbb_core.app.static.container import Container

View File

@@ -74,8 +74,8 @@
"stocks_fa_own": "/stocks/fa/own",
"stocks_fa_pt": "/stocks/fa/pt",
"stocks_fa_pta": "/stocks/fa/pta",
"stocks_fa_ratios": "/stocks/fa/ratios",
"stocks_fa_rating": "/stocks/fa/rating",
"stocks_fa_ratios": "/stocks/fa/ratios",
"stocks_fa_revfc": "/stocks/fa/revfc",
"stocks_fa_revgeo": "/stocks/fa/revgeo",
"stocks_fa_revseg": "/stocks/fa/revseg",

View File

@@ -670,7 +670,7 @@ class CLASS_stocks(Container):
] = False,
chart: bool = False,
provider: Optional[Literal["cboe"]] = None,
**kwargs
**kwargs,
) -> OBBject[List]:
"""Search for a company or stock ticker.
@@ -752,7 +752,7 @@ class CLASS_stocks(Container):
],
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs
**kwargs,
) -> OBBject[List]:
"""Load stock data for a specific ticker.
@@ -868,7 +868,7 @@ class CLASS_stocks(Container):
],
chart: bool = False,
provider: Optional[Literal["cboe"]] = None,
**kwargs
**kwargs,
) -> OBBject[BaseModel]:
"""Get general price and performance metrics of a stock.

View File

@@ -607,27 +607,29 @@ class CLASS_stocks_fa(Container):
period : Optional[str]
Reporting period of the statement.
cash_at_beginning_of_period : Optional[int]
None
Cash at beginning of period.
net_income : Optional[int]
None
Net income.
depreciation_and_amortization : Optional[int]
None
Depreciation and amortization.
stock_based_compensation : Optional[int]
None
Stock based compensation.
other_non_cash_items : Optional[int]
Other non-cash items.
deferred_income_tax : Optional[int]
Deferred income tax.
free_cash_flow : Optional[int]
Net cash flow from operating, investing and financing activities
inventory : Optional[int]
None
accounts_receivables : Optional[int]
None
Inventory.
accounts_payables : Optional[int]
None
Accounts payables.
accounts_receivables : Optional[int]
Accounts receivables.
change_in_working_capital : Optional[int]
Change in working capital.
other_working_capital : Optional[int]
Accrued expenses and other, Unearned revenue.
net_cash_flow_from_operating_activities : Optional[int]
None
capital_expenditure : Optional[int]
Purchases of property and equipment.
other_investing_activities : Optional[int]
@@ -635,29 +637,37 @@ class CLASS_stocks_fa(Container):
acquisitions_net : Optional[int]
Acquisitions, net of cash acquired, and other
sales_maturities_of_investments : Optional[int]
None
Sales and maturities of investments.
purchases_of_investments : Optional[int]
None
Purchases of investments.
net_cash_flow_from_operating_activities : Optional[int]
Net cash flow from operating activities.
net_cash_flow_from_investing_activities : Optional[int]
None
investments_in_property_plant_and_equipment : Optional[int]
None
dividends_paid : Optional[int]
None
common_stock_repurchased : Optional[int]
None
debt_repayment : Optional[int]
None
other_financing_activities : Optional[int]
None
Net cash flow from investing activities.
net_cash_flow_from_financing_activities : Optional[int]
None
Net cash flow from financing activities.
investments_in_property_plant_and_equipment : Optional[int]
Investments in property, plant, and equipment.
net_cash_used_for_investing_activities : Optional[int]
Net cash used for investing activities.
effect_of_forex_changes_on_cash : Optional[int]
Foreign currency effect on cash, cash equivalents, and restricted cash
dividends_paid : Optional[int]
Payments for dividends and dividend equivalents
common_stock_issued : Optional[int]
Proceeds from issuance of common stock
common_stock_repurchased : Optional[int]
Payments related to repurchase of common stock
debt_repayment : Optional[int]
Payments of long-term debt
other_financing_activities : Optional[int]
Other financing activities, net
net_change_in_cash : Optional[int]
Net increase (decrease) in cash, cash equivalents, and restricted cash
cash_at_end_of_period : Optional[int]
None
Cash, cash equivalents, and restricted cash at end of period
operating_cash_flow : Optional[int]
Net cash flow from operating activities
polygon
=======
@@ -2822,9 +2832,9 @@ class CLASS_stocks_fa(Container):
OpenBBCustomParameter(description="Symbol to get data for."),
],
date: Annotated[
datetime.date,
Optional[datetime.date],
OpenBBCustomParameter(description="A specific date to get data for."),
],
] = None,
page: Annotated[
Optional[int],
OpenBBCustomParameter(description="The page number of the data to fetch."),
@@ -2845,7 +2855,7 @@ class CLASS_stocks_fa(Container):
The provider to use for the query.
symbol : str
Symbol to get data for.
date : date
date : Optional[date]
A specific date to get data for.
page : Optional[int]
The page number of the data to fetch.
@@ -3154,6 +3164,23 @@ class CLASS_stocks_fa(Container):
return filter_output(o)
@filter_call
@validate_arguments
def rating(
self, chart: bool = False
) -> OBBject[openbb_core.app.model.results.empty.Empty]:
"""Analyst prices and ratings over time of the company.""" # noqa: E501
inputs = filter_inputs(
chart=chart,
)
o = self._command_runner_session.run(
"/stocks/fa/rating",
**inputs,
).output
return filter_output(o)
@filter_call
@validate_arguments
def ratios(

View File

@@ -23,7 +23,7 @@ class CLASS_stocks_options(Container):
],
chart: bool = False,
provider: Optional[Literal["cboe"]] = None,
**kwargs
**kwargs,
) -> OBBject[List]:
"""Get the complete options chain for a ticker.

View File

@@ -1,3 +1,5 @@
"""Package Builder Class."""
import builtins
import shutil
import subprocess
@@ -245,7 +247,7 @@ class DocstringGenerator:
@staticmethod
def get_OBBject_description() -> str:
"""Get the command output description."""
OBBject_description = (
obbject_description = (
"\nReturns\n"
"-------\n"
"OBBject\n"
@@ -261,7 +263,7 @@ class DocstringGenerator:
" Chart object.\n"
)
return OBBject_description
return obbject_description
@staticmethod
def get_available_providers(query_mapping: dict) -> str:
@@ -531,7 +533,6 @@ class MethodDefinition:
od: OrderedDict[str, Parameter], model_name: Optional[str] = None
) -> OrderedDict[str, Parameter]:
"""Add the field description to the param signature."""
if model_name:
available_fields = (
get_provider_interface()
@@ -561,6 +562,7 @@ class MethodDefinition:
def build_func_params(
parameter_map: Dict[str, Parameter], model_name: Optional[str] = None
) -> str:
"""Build the function params."""
od = MethodDefinition.format_params(parameter_map=parameter_map)
MethodDefinition.add_field_descriptions(
od=od, model_name=model_name
@@ -611,6 +613,7 @@ class MethodDefinition:
return_type: type,
model_name: Optional[str] = None,
) -> str:
"""Build the command method signature."""
func_params = MethodDefinition.build_func_params(parameter_map, model_name)
func_returns = MethodDefinition.build_func_returns(return_type)
code = "\n @filter_call"

View File

@@ -9,9 +9,14 @@ def basemodel_to_df(
) -> pd.DataFrame:
"""Convert list of BaseModel to a Pandas DataFrame."""
data_list = [data] if not isinstance(data, list) else data
if isinstance(data, list):
df = pd.DataFrame([d.dict() for d in data])
else:
try:
df = pd.DataFrame(data.dict())
except ValueError:
df = pd.DataFrame(data.dict(), index=["values"])
df = pd.DataFrame([d.dict() for d in data_list])
if index and index in df.columns:
df = df.set_index(index)
if df.index.name == "date":

348
openbb_sdk/sdk/core/poetry.lock generated vendored
View File

@@ -1,10 +1,9 @@
# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand.
# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand.
[[package]]
name = "anyio"
version = "3.7.1"
description = "High level compatibility layer for multiple asynchronous event loop implementations"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -26,7 +25,6 @@ trio = ["trio (<0.22)"]
name = "backoff"
version = "2.2.1"
description = "Function decoration for backoff and retry"
category = "main"
optional = false
python-versions = ">=3.7,<4.0"
files = [
@@ -38,7 +36,6 @@ files = [
name = "bcrypt"
version = "4.0.1"
description = "Modern password hashing for your software and your servers"
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@@ -73,7 +70,6 @@ typecheck = ["mypy"]
name = "certifi"
version = "2023.7.22"
description = "Python package for providing Mozilla's CA Bundle."
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@@ -85,7 +81,6 @@ files = [
name = "charset-normalizer"
version = "3.2.0"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
category = "main"
optional = false
python-versions = ">=3.7.0"
files = [
@@ -170,7 +165,6 @@ files = [
name = "click"
version = "8.1.6"
description = "Composable command line interface toolkit"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -185,7 +179,6 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""}
name = "colorama"
version = "0.4.6"
description = "Cross-platform colored terminal text."
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
files = [
@@ -195,23 +188,18 @@ files = [
[[package]]
name = "dnspython"
version = "2.4.0"
version = "2.4.2"
description = "DNS toolkit"
category = "main"
optional = false
python-versions = ">=3.8,<4.0"
files = [
{file = "dnspython-2.4.0-py3-none-any.whl", hash = "sha256:46b4052a55b56beea3a3bdd7b30295c292bd6827dd442348bc116f2d35b17f0a"},
{file = "dnspython-2.4.0.tar.gz", hash = "sha256:758e691dbb454d5ccf4e1b154a19e52847f79e21a42fef17b969144af29a4e6c"},
{file = "dnspython-2.4.2-py3-none-any.whl", hash = "sha256:57c6fbaaeaaf39c891292012060beb141791735dbb4004798328fc2c467402d8"},
{file = "dnspython-2.4.2.tar.gz", hash = "sha256:8dcfae8c7460a2f84b4072e26f1c9f4101ca20c071649cb7c34e8b6a93d58984"},
]
[package.dependencies]
httpcore = {version = ">=0.17.3", markers = "python_version >= \"3.8\""}
sniffio = ">=1.1,<2.0"
[package.extras]
dnssec = ["cryptography (>=2.6,<42.0)"]
doh = ["h2 (>=4.1.0)", "httpx (>=0.24.1)"]
doh = ["h2 (>=4.1.0)", "httpcore (>=0.17.3)", "httpx (>=0.24.1)"]
doq = ["aioquic (>=0.9.20)"]
idna = ["idna (>=2.1,<4.0)"]
trio = ["trio (>=0.14,<0.23)"]
@@ -221,7 +209,6 @@ wmi = ["wmi (>=1.5.1,<2.0.0)"]
name = "ecdsa"
version = "0.18.0"
description = "ECDSA cryptographic signature library (pure python)"
category = "main"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
files = [
@@ -238,14 +225,13 @@ gmpy2 = ["gmpy2"]
[[package]]
name = "exceptiongroup"
version = "1.1.2"
version = "1.1.3"
description = "Backport of PEP 654 (exception groups)"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "exceptiongroup-1.1.2-py3-none-any.whl", hash = "sha256:e346e69d186172ca7cf029c8c1d16235aa0e04035e5750b4b95039e65204328f"},
{file = "exceptiongroup-1.1.2.tar.gz", hash = "sha256:12c3e887d6485d16943a309616de20ae5582633e0a2eda17f4e10fd61c1e8af5"},
{file = "exceptiongroup-1.1.3-py3-none-any.whl", hash = "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3"},
{file = "exceptiongroup-1.1.3.tar.gz", hash = "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9"},
]
[package.extras]
@@ -253,31 +239,27 @@ test = ["pytest (>=6)"]
[[package]]
name = "fastapi"
version = "0.95.2"
version = "0.100.1"
description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "fastapi-0.95.2-py3-none-any.whl", hash = "sha256:d374dbc4ef2ad9b803899bd3360d34c534adc574546e25314ab72c0c4411749f"},
{file = "fastapi-0.95.2.tar.gz", hash = "sha256:4d9d3e8c71c73f11874bcf5e33626258d143252e329a01002f767306c64fb982"},
{file = "fastapi-0.100.1-py3-none-any.whl", hash = "sha256:ec6dd52bfc4eff3063cfcd0713b43c87640fefb2687bbbe3d8a08d94049cdf32"},
{file = "fastapi-0.100.1.tar.gz", hash = "sha256:522700d7a469e4a973d92321ab93312448fbe20fca9c8da97effc7e7bc56df23"},
]
[package.dependencies]
pydantic = ">=1.6.2,<1.7 || >1.7,<1.7.1 || >1.7.1,<1.7.2 || >1.7.2,<1.7.3 || >1.7.3,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0"
pydantic = ">=1.7.4,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0 || >2.0.0,<2.0.1 || >2.0.1,<3.0.0"
starlette = ">=0.27.0,<0.28.0"
typing-extensions = ">=4.5.0"
[package.extras]
all = ["email-validator (>=1.1.1)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=2.11.2)", "orjson (>=3.2.1)", "python-multipart (>=0.0.5)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"]
dev = ["pre-commit (>=2.17.0,<3.0.0)", "ruff (==0.0.138)", "uvicorn[standard] (>=0.12.0,<0.21.0)"]
doc = ["mdx-include (>=1.4.1,<2.0.0)", "mkdocs (>=1.1.2,<2.0.0)", "mkdocs-markdownextradata-plugin (>=0.1.7,<0.3.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "pyyaml (>=5.3.1,<7.0.0)", "typer-cli (>=0.0.13,<0.0.14)", "typer[all] (>=0.6.1,<0.8.0)"]
test = ["anyio[trio] (>=3.2.1,<4.0.0)", "black (==23.1.0)", "coverage[toml] (>=6.5.0,<8.0)", "databases[sqlite] (>=0.3.2,<0.7.0)", "email-validator (>=1.1.1,<2.0.0)", "flask (>=1.1.2,<3.0.0)", "httpx (>=0.23.0,<0.24.0)", "isort (>=5.0.6,<6.0.0)", "mypy (==0.982)", "orjson (>=3.2.1,<4.0.0)", "passlib[bcrypt] (>=1.7.2,<2.0.0)", "peewee (>=3.13.3,<4.0.0)", "pytest (>=7.1.3,<8.0.0)", "python-jose[cryptography] (>=3.3.0,<4.0.0)", "python-multipart (>=0.0.5,<0.0.7)", "pyyaml (>=5.3.1,<7.0.0)", "ruff (==0.0.138)", "sqlalchemy (>=1.3.18,<1.4.43)", "types-orjson (==3.6.2)", "types-ujson (==5.7.0.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0)"]
all = ["email-validator (>=2.0.0)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=2.11.2)", "orjson (>=3.2.1)", "pydantic-extra-types (>=2.0.0)", "pydantic-settings (>=2.0.0)", "python-multipart (>=0.0.5)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"]
[[package]]
name = "h11"
version = "0.14.0"
description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -289,7 +271,6 @@ files = [
name = "html5lib"
version = "1.1"
description = "HTML parser based on the WHATWG HTML specification"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
files = [
@@ -307,33 +288,10 @@ chardet = ["chardet (>=2.2)"]
genshi = ["genshi"]
lxml = ["lxml"]
[[package]]
name = "httpcore"
version = "0.17.3"
description = "A minimal low-level HTTP client."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "httpcore-0.17.3-py3-none-any.whl", hash = "sha256:c2789b767ddddfa2a5782e3199b2b7f6894540b17b16ec26b2c4d8e103510b87"},
{file = "httpcore-0.17.3.tar.gz", hash = "sha256:a6f30213335e34c1ade7be6ec7c47f19f50c56db36abef1a9dfa3815b1cb3888"},
]
[package.dependencies]
anyio = ">=3.0,<5.0"
certifi = "*"
h11 = ">=0.13,<0.15"
sniffio = ">=1.0.0,<2.0.0"
[package.extras]
http2 = ["h2 (>=3,<5)"]
socks = ["socksio (>=1.0.0,<2.0.0)"]
[[package]]
name = "idna"
version = "3.4"
description = "Internationalized Domain Names in Applications (IDNA)"
category = "main"
optional = false
python-versions = ">=3.5"
files = [
@@ -341,11 +299,29 @@ files = [
{file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"},
]
[[package]]
name = "importlib-metadata"
version = "6.8.0"
description = "Read metadata from Python packages"
optional = false
python-versions = ">=3.8"
files = [
{file = "importlib_metadata-6.8.0-py3-none-any.whl", hash = "sha256:3ebb78df84a805d7698245025b975d9d67053cd94c79245ba4b3eb694abe68bb"},
{file = "importlib_metadata-6.8.0.tar.gz", hash = "sha256:dbace7892d8c0c4ac1ad096662232f831d4e64f4c4545bd53016a3e9d4654743"},
]
[package.dependencies]
zipp = ">=0.5"
[package.extras]
docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
perf = ["ipython"]
testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"]
[[package]]
name = "monotonic"
version = "1.6"
description = "An implementation of time.monotonic() for Python 2 & < 3.3"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -357,7 +333,6 @@ files = [
name = "numpy"
version = "1.24.4"
description = "Fundamental package for array computing in Python"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@@ -393,44 +368,42 @@ files = [
[[package]]
name = "numpy"
version = "1.25.1"
version = "1.25.2"
description = "Fundamental package for array computing in Python"
category = "main"
optional = false
python-versions = ">=3.9"
files = [
{file = "numpy-1.25.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:77d339465dff3eb33c701430bcb9c325b60354698340229e1dff97745e6b3efa"},
{file = "numpy-1.25.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d736b75c3f2cb96843a5c7f8d8ccc414768d34b0a75f466c05f3a739b406f10b"},
{file = "numpy-1.25.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4a90725800caeaa160732d6b31f3f843ebd45d6b5f3eec9e8cc287e30f2805bf"},
{file = "numpy-1.25.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c6c9261d21e617c6dc5eacba35cb68ec36bb72adcff0dee63f8fbc899362588"},
{file = "numpy-1.25.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0def91f8af6ec4bb94c370e38c575855bf1d0be8a8fbfba42ef9c073faf2cf19"},
{file = "numpy-1.25.1-cp310-cp310-win32.whl", hash = "sha256:fd67b306320dcadea700a8f79b9e671e607f8696e98ec255915c0c6d6b818503"},
{file = "numpy-1.25.1-cp310-cp310-win_amd64.whl", hash = "sha256:c1516db588987450b85595586605742879e50dcce923e8973f79529651545b57"},
{file = "numpy-1.25.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6b82655dd8efeea69dbf85d00fca40013d7f503212bc5259056244961268b66e"},
{file = "numpy-1.25.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e8f6049c4878cb16960fbbfb22105e49d13d752d4d8371b55110941fb3b17800"},
{file = "numpy-1.25.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:41a56b70e8139884eccb2f733c2f7378af06c82304959e174f8e7370af112e09"},
{file = "numpy-1.25.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d5154b1a25ec796b1aee12ac1b22f414f94752c5f94832f14d8d6c9ac40bcca6"},
{file = "numpy-1.25.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:38eb6548bb91c421261b4805dc44def9ca1a6eef6444ce35ad1669c0f1a3fc5d"},
{file = "numpy-1.25.1-cp311-cp311-win32.whl", hash = "sha256:791f409064d0a69dd20579345d852c59822c6aa087f23b07b1b4e28ff5880fcb"},
{file = "numpy-1.25.1-cp311-cp311-win_amd64.whl", hash = "sha256:c40571fe966393b212689aa17e32ed905924120737194b5d5c1b20b9ed0fb171"},
{file = "numpy-1.25.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3d7abcdd85aea3e6cdddb59af2350c7ab1ed764397f8eec97a038ad244d2d105"},
{file = "numpy-1.25.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:1a180429394f81c7933634ae49b37b472d343cccb5bb0c4a575ac8bbc433722f"},
{file = "numpy-1.25.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d412c1697c3853c6fc3cb9751b4915859c7afe6a277c2bf00acf287d56c4e625"},
{file = "numpy-1.25.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:20e1266411120a4f16fad8efa8e0454d21d00b8c7cee5b5ccad7565d95eb42dd"},
{file = "numpy-1.25.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:f76aebc3358ade9eacf9bc2bb8ae589863a4f911611694103af05346637df1b7"},
{file = "numpy-1.25.1-cp39-cp39-win32.whl", hash = "sha256:247d3ffdd7775bdf191f848be8d49100495114c82c2bd134e8d5d075fb386a1c"},
{file = "numpy-1.25.1-cp39-cp39-win_amd64.whl", hash = "sha256:1d5d3c68e443c90b38fdf8ef40e60e2538a27548b39b12b73132456847f4b631"},
{file = "numpy-1.25.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:35a9527c977b924042170a0887de727cd84ff179e478481404c5dc66b4170009"},
{file = "numpy-1.25.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0d3fe3dd0506a28493d82dc3cf254be8cd0d26f4008a417385cbf1ae95b54004"},
{file = "numpy-1.25.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:012097b5b0d00a11070e8f2e261128c44157a8689f7dedcf35576e525893f4fe"},
{file = "numpy-1.25.1.tar.gz", hash = "sha256:9a3a9f3a61480cc086117b426a8bd86869c213fc4072e606f01c4e4b66eb92bf"},
{file = "numpy-1.25.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:db3ccc4e37a6873045580d413fe79b68e47a681af8db2e046f1dacfa11f86eb3"},
{file = "numpy-1.25.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:90319e4f002795ccfc9050110bbbaa16c944b1c37c0baeea43c5fb881693ae1f"},
{file = "numpy-1.25.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dfe4a913e29b418d096e696ddd422d8a5d13ffba4ea91f9f60440a3b759b0187"},
{file = "numpy-1.25.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f08f2e037bba04e707eebf4bc934f1972a315c883a9e0ebfa8a7756eabf9e357"},
{file = "numpy-1.25.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bec1e7213c7cb00d67093247f8c4db156fd03075f49876957dca4711306d39c9"},
{file = "numpy-1.25.2-cp310-cp310-win32.whl", hash = "sha256:7dc869c0c75988e1c693d0e2d5b26034644399dd929bc049db55395b1379e044"},
{file = "numpy-1.25.2-cp310-cp310-win_amd64.whl", hash = "sha256:834b386f2b8210dca38c71a6e0f4fd6922f7d3fcff935dbe3a570945acb1b545"},
{file = "numpy-1.25.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c5462d19336db4560041517dbb7759c21d181a67cb01b36ca109b2ae37d32418"},
{file = "numpy-1.25.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c5652ea24d33585ea39eb6a6a15dac87a1206a692719ff45d53c5282e66d4a8f"},
{file = "numpy-1.25.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d60fbae8e0019865fc4784745814cff1c421df5afee233db6d88ab4f14655a2"},
{file = "numpy-1.25.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:60e7f0f7f6d0eee8364b9a6304c2845b9c491ac706048c7e8cf47b83123b8dbf"},
{file = "numpy-1.25.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:bb33d5a1cf360304754913a350edda36d5b8c5331a8237268c48f91253c3a364"},
{file = "numpy-1.25.2-cp311-cp311-win32.whl", hash = "sha256:5883c06bb92f2e6c8181df7b39971a5fb436288db58b5a1c3967702d4278691d"},
{file = "numpy-1.25.2-cp311-cp311-win_amd64.whl", hash = "sha256:5c97325a0ba6f9d041feb9390924614b60b99209a71a69c876f71052521d42a4"},
{file = "numpy-1.25.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b79e513d7aac42ae918db3ad1341a015488530d0bb2a6abcbdd10a3a829ccfd3"},
{file = "numpy-1.25.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:eb942bfb6f84df5ce05dbf4b46673ffed0d3da59f13635ea9b926af3deb76926"},
{file = "numpy-1.25.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e0746410e73384e70d286f93abf2520035250aad8c5714240b0492a7302fdca"},
{file = "numpy-1.25.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7806500e4f5bdd04095e849265e55de20d8cc4b661b038957354327f6d9b295"},
{file = "numpy-1.25.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8b77775f4b7df768967a7c8b3567e309f617dd5e99aeb886fa14dc1a0791141f"},
{file = "numpy-1.25.2-cp39-cp39-win32.whl", hash = "sha256:2792d23d62ec51e50ce4d4b7d73de8f67a2fd3ea710dcbc8563a51a03fb07b01"},
{file = "numpy-1.25.2-cp39-cp39-win_amd64.whl", hash = "sha256:76b4115d42a7dfc5d485d358728cdd8719be33cc5ec6ec08632a5d6fca2ed380"},
{file = "numpy-1.25.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:1a1329e26f46230bf77b02cc19e900db9b52f398d6722ca853349a782d4cff55"},
{file = "numpy-1.25.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4c3abc71e8b6edba80a01a52e66d83c5d14433cbcd26a40c329ec7ed09f37901"},
{file = "numpy-1.25.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:1b9735c27cea5d995496f46a8b1cd7b408b3f34b6d50459d9ac8fe3a20cc17bf"},
{file = "numpy-1.25.2.tar.gz", hash = "sha256:fd608e19c8d7c55021dffd43bfe5492fab8cc105cc8986f813f8c3c048b38760"},
]
[[package]]
name = "openbb-provider"
version = "0.2.0"
description = ""
category = "main"
optional = false
python-versions = "^3.8"
files = []
@@ -447,39 +420,36 @@ url = "../provider"
[[package]]
name = "pandas"
version = "1.5.3"
version = "2.0.3"
description = "Powerful data structures for data analysis, time series, and statistics"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
{file = "pandas-1.5.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3749077d86e3a2f0ed51367f30bf5b82e131cc0f14260c4d3e499186fccc4406"},
{file = "pandas-1.5.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:972d8a45395f2a2d26733eb8d0f629b2f90bebe8e8eddbb8829b180c09639572"},
{file = "pandas-1.5.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:50869a35cbb0f2e0cd5ec04b191e7b12ed688874bd05dd777c19b28cbea90996"},
{file = "pandas-1.5.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c3ac844a0fe00bfaeb2c9b51ab1424e5c8744f89860b138434a363b1f620f354"},
{file = "pandas-1.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a0a56cef15fd1586726dace5616db75ebcfec9179a3a55e78f72c5639fa2a23"},
{file = "pandas-1.5.3-cp310-cp310-win_amd64.whl", hash = "sha256:478ff646ca42b20376e4ed3fa2e8d7341e8a63105586efe54fa2508ee087f328"},
{file = "pandas-1.5.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6973549c01ca91ec96199e940495219c887ea815b2083722821f1d7abfa2b4dc"},
{file = "pandas-1.5.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c39a8da13cede5adcd3be1182883aea1c925476f4e84b2807a46e2775306305d"},
{file = "pandas-1.5.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f76d097d12c82a535fda9dfe5e8dd4127952b45fea9b0276cb30cca5ea313fbc"},
{file = "pandas-1.5.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e474390e60ed609cec869b0da796ad94f420bb057d86784191eefc62b65819ae"},
{file = "pandas-1.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5f2b952406a1588ad4cad5b3f55f520e82e902388a6d5a4a91baa8d38d23c7f6"},
{file = "pandas-1.5.3-cp311-cp311-win_amd64.whl", hash = "sha256:bc4c368f42b551bf72fac35c5128963a171b40dce866fb066540eeaf46faa003"},
{file = "pandas-1.5.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:14e45300521902689a81f3f41386dc86f19b8ba8dd5ac5a3c7010ef8d2932813"},
{file = "pandas-1.5.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9842b6f4b8479e41968eced654487258ed81df7d1c9b7b870ceea24ed9459b31"},
{file = "pandas-1.5.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:26d9c71772c7afb9d5046e6e9cf42d83dd147b5cf5bcb9d97252077118543792"},
{file = "pandas-1.5.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5fbcb19d6fceb9e946b3e23258757c7b225ba450990d9ed63ccceeb8cae609f7"},
{file = "pandas-1.5.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:565fa34a5434d38e9d250af3c12ff931abaf88050551d9fbcdfafca50d62babf"},
{file = "pandas-1.5.3-cp38-cp38-win32.whl", hash = "sha256:87bd9c03da1ac870a6d2c8902a0e1fd4267ca00f13bc494c9e5a9020920e1d51"},
{file = "pandas-1.5.3-cp38-cp38-win_amd64.whl", hash = "sha256:41179ce559943d83a9b4bbacb736b04c928b095b5f25dd2b7389eda08f46f373"},
{file = "pandas-1.5.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:c74a62747864ed568f5a82a49a23a8d7fe171d0c69038b38cedf0976831296fa"},
{file = "pandas-1.5.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c4c00e0b0597c8e4f59e8d461f797e5d70b4d025880516a8261b2817c47759ee"},
{file = "pandas-1.5.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a50d9a4336a9621cab7b8eb3fb11adb82de58f9b91d84c2cd526576b881a0c5a"},
{file = "pandas-1.5.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd05f7783b3274aa206a1af06f0ceed3f9b412cf665b7247eacd83be41cf7bf0"},
{file = "pandas-1.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9f69c4029613de47816b1bb30ff5ac778686688751a5e9c99ad8c7031f6508e5"},
{file = "pandas-1.5.3-cp39-cp39-win32.whl", hash = "sha256:7cec0bee9f294e5de5bbfc14d0573f65526071029d036b753ee6507d2a21480a"},
{file = "pandas-1.5.3-cp39-cp39-win_amd64.whl", hash = "sha256:dfd681c5dc216037e0b0a2c821f5ed99ba9f03ebcf119c7dac0e9a7b960b9ec9"},
{file = "pandas-1.5.3.tar.gz", hash = "sha256:74a3fd7e5a7ec052f183273dc7b0acd3a863edf7520f5d3a1765c04ffdb3b0b1"},
{file = "pandas-2.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e4c7c9f27a4185304c7caf96dc7d91bc60bc162221152de697c98eb0b2648dd8"},
{file = "pandas-2.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f167beed68918d62bffb6ec64f2e1d8a7d297a038f86d4aed056b9493fca407f"},
{file = "pandas-2.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce0c6f76a0f1ba361551f3e6dceaff06bde7514a374aa43e33b588ec10420183"},
{file = "pandas-2.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba619e410a21d8c387a1ea6e8a0e49bb42216474436245718d7f2e88a2f8d7c0"},
{file = "pandas-2.0.3-cp310-cp310-win32.whl", hash = "sha256:3ef285093b4fe5058eefd756100a367f27029913760773c8bf1d2d8bebe5d210"},
{file = "pandas-2.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:9ee1a69328d5c36c98d8e74db06f4ad518a1840e8ccb94a4ba86920986bb617e"},
{file = "pandas-2.0.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b084b91d8d66ab19f5bb3256cbd5ea661848338301940e17f4492b2ce0801fe8"},
{file = "pandas-2.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:37673e3bdf1551b95bf5d4ce372b37770f9529743d2498032439371fc7b7eb26"},
{file = "pandas-2.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b9cb1e14fdb546396b7e1b923ffaeeac24e4cedd14266c3497216dd4448e4f2d"},
{file = "pandas-2.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d9cd88488cceb7635aebb84809d087468eb33551097d600c6dad13602029c2df"},
{file = "pandas-2.0.3-cp311-cp311-win32.whl", hash = "sha256:694888a81198786f0e164ee3a581df7d505024fbb1f15202fc7db88a71d84ebd"},
{file = "pandas-2.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:6a21ab5c89dcbd57f78d0ae16630b090eec626360085a4148693def5452d8a6b"},
{file = "pandas-2.0.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9e4da0d45e7f34c069fe4d522359df7d23badf83abc1d1cef398895822d11061"},
{file = "pandas-2.0.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:32fca2ee1b0d93dd71d979726b12b61faa06aeb93cf77468776287f41ff8fdc5"},
{file = "pandas-2.0.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:258d3624b3ae734490e4d63c430256e716f488c4fcb7c8e9bde2d3aa46c29089"},
{file = "pandas-2.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eae3dc34fa1aa7772dd3fc60270d13ced7346fcbcfee017d3132ec625e23bb0"},
{file = "pandas-2.0.3-cp38-cp38-win32.whl", hash = "sha256:f3421a7afb1a43f7e38e82e844e2bca9a6d793d66c1a7f9f0ff39a795bbc5e02"},
{file = "pandas-2.0.3-cp38-cp38-win_amd64.whl", hash = "sha256:69d7f3884c95da3a31ef82b7618af5710dba95bb885ffab339aad925c3e8ce78"},
{file = "pandas-2.0.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5247fb1ba347c1261cbbf0fcfba4a3121fbb4029d95d9ef4dc45406620b25c8b"},
{file = "pandas-2.0.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:81af086f4543c9d8bb128328b5d32e9986e0c84d3ee673a2ac6fb57fd14f755e"},
{file = "pandas-2.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1994c789bf12a7c5098277fb43836ce090f1073858c10f9220998ac74f37c69b"},
{file = "pandas-2.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5ec591c48e29226bcbb316e0c1e9423622bc7a4eaf1ef7c3c9fa1a3981f89641"},
{file = "pandas-2.0.3-cp39-cp39-win32.whl", hash = "sha256:04dbdbaf2e4d46ca8da896e1805bc04eb85caa9a82e259e8eed00254d5e0c682"},
{file = "pandas-2.0.3-cp39-cp39-win_amd64.whl", hash = "sha256:1168574b036cd8b93abc746171c9b4f1b83467438a5e45909fed645cf8692dbc"},
{file = "pandas-2.0.3.tar.gz", hash = "sha256:c02f372a88e0d17f36d3093a644c73cfc1788e876a7c4bcb4020a77512e2043c"},
]
[package.dependencies]
@@ -488,17 +458,37 @@ numpy = [
{version = ">=1.21.0", markers = "python_version >= \"3.10\""},
{version = ">=1.23.2", markers = "python_version >= \"3.11\""},
]
python-dateutil = ">=2.8.1"
python-dateutil = ">=2.8.2"
pytz = ">=2020.1"
tzdata = ">=2022.1"
[package.extras]
test = ["hypothesis (>=5.5.3)", "pytest (>=6.0)", "pytest-xdist (>=1.31)"]
all = ["PyQt5 (>=5.15.1)", "SQLAlchemy (>=1.4.16)", "beautifulsoup4 (>=4.9.3)", "bottleneck (>=1.3.2)", "brotlipy (>=0.7.0)", "fastparquet (>=0.6.3)", "fsspec (>=2021.07.0)", "gcsfs (>=2021.07.0)", "html5lib (>=1.1)", "hypothesis (>=6.34.2)", "jinja2 (>=3.0.0)", "lxml (>=4.6.3)", "matplotlib (>=3.6.1)", "numba (>=0.53.1)", "numexpr (>=2.7.3)", "odfpy (>=1.4.1)", "openpyxl (>=3.0.7)", "pandas-gbq (>=0.15.0)", "psycopg2 (>=2.8.6)", "pyarrow (>=7.0.0)", "pymysql (>=1.0.2)", "pyreadstat (>=1.1.2)", "pytest (>=7.3.2)", "pytest-asyncio (>=0.17.0)", "pytest-xdist (>=2.2.0)", "python-snappy (>=0.6.0)", "pyxlsb (>=1.0.8)", "qtpy (>=2.2.0)", "s3fs (>=2021.08.0)", "scipy (>=1.7.1)", "tables (>=3.6.1)", "tabulate (>=0.8.9)", "xarray (>=0.21.0)", "xlrd (>=2.0.1)", "xlsxwriter (>=1.4.3)", "zstandard (>=0.15.2)"]
aws = ["s3fs (>=2021.08.0)"]
clipboard = ["PyQt5 (>=5.15.1)", "qtpy (>=2.2.0)"]
compression = ["brotlipy (>=0.7.0)", "python-snappy (>=0.6.0)", "zstandard (>=0.15.2)"]
computation = ["scipy (>=1.7.1)", "xarray (>=0.21.0)"]
excel = ["odfpy (>=1.4.1)", "openpyxl (>=3.0.7)", "pyxlsb (>=1.0.8)", "xlrd (>=2.0.1)", "xlsxwriter (>=1.4.3)"]
feather = ["pyarrow (>=7.0.0)"]
fss = ["fsspec (>=2021.07.0)"]
gcp = ["gcsfs (>=2021.07.0)", "pandas-gbq (>=0.15.0)"]
hdf5 = ["tables (>=3.6.1)"]
html = ["beautifulsoup4 (>=4.9.3)", "html5lib (>=1.1)", "lxml (>=4.6.3)"]
mysql = ["SQLAlchemy (>=1.4.16)", "pymysql (>=1.0.2)"]
output-formatting = ["jinja2 (>=3.0.0)", "tabulate (>=0.8.9)"]
parquet = ["pyarrow (>=7.0.0)"]
performance = ["bottleneck (>=1.3.2)", "numba (>=0.53.1)", "numexpr (>=2.7.1)"]
plot = ["matplotlib (>=3.6.1)"]
postgresql = ["SQLAlchemy (>=1.4.16)", "psycopg2 (>=2.8.6)"]
spss = ["pyreadstat (>=1.1.2)"]
sql-other = ["SQLAlchemy (>=1.4.16)"]
test = ["hypothesis (>=6.34.2)", "pytest (>=7.3.2)", "pytest-asyncio (>=0.17.0)", "pytest-xdist (>=2.2.0)"]
xml = ["lxml (>=4.6.3)"]
[[package]]
name = "passlib"
version = "1.7.4"
description = "comprehensive password hashing framework supporting over 30 schemes"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -516,7 +506,6 @@ totp = ["cryptography"]
name = "posthog"
version = "3.0.1"
description = "Integrate PostHog into any python application."
category = "main"
optional = false
python-versions = "*"
files = [
@@ -540,7 +529,6 @@ test = ["coverage", "flake8", "freezegun (==0.3.15)", "mock (>=2.0.0)", "pylint"
name = "pyasn1"
version = "0.5.0"
description = "Pure-Python implementation of ASN.1 types and DER/BER/CER codecs (X.208)"
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7"
files = [
@@ -550,48 +538,47 @@ files = [
[[package]]
name = "pydantic"
version = "1.10.11"
version = "1.10.12"
description = "Data validation and settings management using python type hints"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "pydantic-1.10.11-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ff44c5e89315b15ff1f7fdaf9853770b810936d6b01a7bcecaa227d2f8fe444f"},
{file = "pydantic-1.10.11-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a6c098d4ab5e2d5b3984d3cb2527e2d6099d3de85630c8934efcfdc348a9760e"},
{file = "pydantic-1.10.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:16928fdc9cb273c6af00d9d5045434c39afba5f42325fb990add2c241402d151"},
{file = "pydantic-1.10.11-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0588788a9a85f3e5e9ebca14211a496409cb3deca5b6971ff37c556d581854e7"},
{file = "pydantic-1.10.11-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e9baf78b31da2dc3d3f346ef18e58ec5f12f5aaa17ac517e2ffd026a92a87588"},
{file = "pydantic-1.10.11-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:373c0840f5c2b5b1ccadd9286782852b901055998136287828731868027a724f"},
{file = "pydantic-1.10.11-cp310-cp310-win_amd64.whl", hash = "sha256:c3339a46bbe6013ef7bdd2844679bfe500347ac5742cd4019a88312aa58a9847"},
{file = "pydantic-1.10.11-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:08a6c32e1c3809fbc49debb96bf833164f3438b3696abf0fbeceb417d123e6eb"},
{file = "pydantic-1.10.11-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a451ccab49971af043ec4e0d207cbc8cbe53dbf148ef9f19599024076fe9c25b"},
{file = "pydantic-1.10.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5b02d24f7b2b365fed586ed73582c20f353a4c50e4be9ba2c57ab96f8091ddae"},
{file = "pydantic-1.10.11-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3f34739a89260dfa420aa3cbd069fbcc794b25bbe5c0a214f8fb29e363484b66"},
{file = "pydantic-1.10.11-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:e297897eb4bebde985f72a46a7552a7556a3dd11e7f76acda0c1093e3dbcf216"},
{file = "pydantic-1.10.11-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d185819a7a059550ecb85d5134e7d40f2565f3dd94cfd870132c5f91a89cf58c"},
{file = "pydantic-1.10.11-cp311-cp311-win_amd64.whl", hash = "sha256:4400015f15c9b464c9db2d5d951b6a780102cfa5870f2c036d37c23b56f7fc1b"},
{file = "pydantic-1.10.11-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:2417de68290434461a266271fc57274a138510dca19982336639484c73a07af6"},
{file = "pydantic-1.10.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:331c031ba1554b974c98679bd0780d89670d6fd6f53f5d70b10bdc9addee1713"},
{file = "pydantic-1.10.11-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8268a735a14c308923e8958363e3a3404f6834bb98c11f5ab43251a4e410170c"},
{file = "pydantic-1.10.11-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:44e51ba599c3ef227e168424e220cd3e544288c57829520dc90ea9cb190c3248"},
{file = "pydantic-1.10.11-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d7781f1d13b19700b7949c5a639c764a077cbbdd4322ed505b449d3ca8edcb36"},
{file = "pydantic-1.10.11-cp37-cp37m-win_amd64.whl", hash = "sha256:7522a7666157aa22b812ce14c827574ddccc94f361237ca6ea8bb0d5c38f1629"},
{file = "pydantic-1.10.11-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bc64eab9b19cd794a380179ac0e6752335e9555d214cfcb755820333c0784cb3"},
{file = "pydantic-1.10.11-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8dc77064471780262b6a68fe67e013298d130414d5aaf9b562c33987dbd2cf4f"},
{file = "pydantic-1.10.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fe429898f2c9dd209bd0632a606bddc06f8bce081bbd03d1c775a45886e2c1cb"},
{file = "pydantic-1.10.11-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:192c608ad002a748e4a0bed2ddbcd98f9b56df50a7c24d9a931a8c5dd053bd3d"},
{file = "pydantic-1.10.11-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:ef55392ec4bb5721f4ded1096241e4b7151ba6d50a50a80a2526c854f42e6a2f"},
{file = "pydantic-1.10.11-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:41e0bb6efe86281623abbeeb0be64eab740c865388ee934cd3e6a358784aca6e"},
{file = "pydantic-1.10.11-cp38-cp38-win_amd64.whl", hash = "sha256:265a60da42f9f27e0b1014eab8acd3e53bd0bad5c5b4884e98a55f8f596b2c19"},
{file = "pydantic-1.10.11-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:469adf96c8e2c2bbfa655fc7735a2a82f4c543d9fee97bd113a7fb509bf5e622"},
{file = "pydantic-1.10.11-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e6cbfbd010b14c8a905a7b10f9fe090068d1744d46f9e0c021db28daeb8b6de1"},
{file = "pydantic-1.10.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:abade85268cc92dff86d6effcd917893130f0ff516f3d637f50dadc22ae93999"},
{file = "pydantic-1.10.11-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e9738b0f2e6c70f44ee0de53f2089d6002b10c33264abee07bdb5c7f03038303"},
{file = "pydantic-1.10.11-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:787cf23e5a0cde753f2eabac1b2e73ae3844eb873fd1f5bdbff3048d8dbb7604"},
{file = "pydantic-1.10.11-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:174899023337b9fc685ac8adaa7b047050616136ccd30e9070627c1aaab53a13"},
{file = "pydantic-1.10.11-cp39-cp39-win_amd64.whl", hash = "sha256:1954f8778489a04b245a1e7b8b22a9d3ea8ef49337285693cf6959e4b757535e"},
{file = "pydantic-1.10.11-py3-none-any.whl", hash = "sha256:008c5e266c8aada206d0627a011504e14268a62091450210eda7c07fabe6963e"},
{file = "pydantic-1.10.11.tar.gz", hash = "sha256:f66d479cf7eb331372c470614be6511eae96f1f120344c25f3f9bb59fb1b5528"},
{file = "pydantic-1.10.12-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a1fcb59f2f355ec350073af41d927bf83a63b50e640f4dbaa01053a28b7a7718"},
{file = "pydantic-1.10.12-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b7ccf02d7eb340b216ec33e53a3a629856afe1c6e0ef91d84a4e6f2fb2ca70fe"},
{file = "pydantic-1.10.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8fb2aa3ab3728d950bcc885a2e9eff6c8fc40bc0b7bb434e555c215491bcf48b"},
{file = "pydantic-1.10.12-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:771735dc43cf8383959dc9b90aa281f0b6092321ca98677c5fb6125a6f56d58d"},
{file = "pydantic-1.10.12-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ca48477862372ac3770969b9d75f1bf66131d386dba79506c46d75e6b48c1e09"},
{file = "pydantic-1.10.12-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a5e7add47a5b5a40c49b3036d464e3c7802f8ae0d1e66035ea16aa5b7a3923ed"},
{file = "pydantic-1.10.12-cp310-cp310-win_amd64.whl", hash = "sha256:e4129b528c6baa99a429f97ce733fff478ec955513630e61b49804b6cf9b224a"},
{file = "pydantic-1.10.12-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b0d191db0f92dfcb1dec210ca244fdae5cbe918c6050b342d619c09d31eea0cc"},
{file = "pydantic-1.10.12-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:795e34e6cc065f8f498c89b894a3c6da294a936ee71e644e4bd44de048af1405"},
{file = "pydantic-1.10.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:69328e15cfda2c392da4e713443c7dbffa1505bc9d566e71e55abe14c97ddc62"},
{file = "pydantic-1.10.12-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2031de0967c279df0d8a1c72b4ffc411ecd06bac607a212892757db7462fc494"},
{file = "pydantic-1.10.12-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:ba5b2e6fe6ca2b7e013398bc7d7b170e21cce322d266ffcd57cca313e54fb246"},
{file = "pydantic-1.10.12-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:2a7bac939fa326db1ab741c9d7f44c565a1d1e80908b3797f7f81a4f86bc8d33"},
{file = "pydantic-1.10.12-cp311-cp311-win_amd64.whl", hash = "sha256:87afda5539d5140cb8ba9e8b8c8865cb5b1463924d38490d73d3ccfd80896b3f"},
{file = "pydantic-1.10.12-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:549a8e3d81df0a85226963611950b12d2d334f214436a19537b2efed61b7639a"},
{file = "pydantic-1.10.12-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:598da88dfa127b666852bef6d0d796573a8cf5009ffd62104094a4fe39599565"},
{file = "pydantic-1.10.12-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ba5c4a8552bff16c61882db58544116d021d0b31ee7c66958d14cf386a5b5350"},
{file = "pydantic-1.10.12-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c79e6a11a07da7374f46970410b41d5e266f7f38f6a17a9c4823db80dadf4303"},
{file = "pydantic-1.10.12-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ab26038b8375581dc832a63c948f261ae0aa21f1d34c1293469f135fa92972a5"},
{file = "pydantic-1.10.12-cp37-cp37m-win_amd64.whl", hash = "sha256:e0a16d274b588767602b7646fa05af2782576a6cf1022f4ba74cbb4db66f6ca8"},
{file = "pydantic-1.10.12-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6a9dfa722316f4acf4460afdf5d41d5246a80e249c7ff475c43a3a1e9d75cf62"},
{file = "pydantic-1.10.12-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a73f489aebd0c2121ed974054cb2759af8a9f747de120acd2c3394cf84176ccb"},
{file = "pydantic-1.10.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b30bcb8cbfccfcf02acb8f1a261143fab622831d9c0989707e0e659f77a18e0"},
{file = "pydantic-1.10.12-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2fcfb5296d7877af406ba1547dfde9943b1256d8928732267e2653c26938cd9c"},
{file = "pydantic-1.10.12-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:2f9a6fab5f82ada41d56b0602606a5506aab165ca54e52bc4545028382ef1c5d"},
{file = "pydantic-1.10.12-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:dea7adcc33d5d105896401a1f37d56b47d443a2b2605ff8a969a0ed5543f7e33"},
{file = "pydantic-1.10.12-cp38-cp38-win_amd64.whl", hash = "sha256:1eb2085c13bce1612da8537b2d90f549c8cbb05c67e8f22854e201bde5d98a47"},
{file = "pydantic-1.10.12-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ef6c96b2baa2100ec91a4b428f80d8f28a3c9e53568219b6c298c1125572ebc6"},
{file = "pydantic-1.10.12-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6c076be61cd0177a8433c0adcb03475baf4ee91edf5a4e550161ad57fc90f523"},
{file = "pydantic-1.10.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2d5a58feb9a39f481eda4d5ca220aa8b9d4f21a41274760b9bc66bfd72595b86"},
{file = "pydantic-1.10.12-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e5f805d2d5d0a41633651a73fa4ecdd0b3d7a49de4ec3fadf062fe16501ddbf1"},
{file = "pydantic-1.10.12-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:1289c180abd4bd4555bb927c42ee42abc3aee02b0fb2d1223fb7c6e5bef87dbe"},
{file = "pydantic-1.10.12-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5d1197e462e0364906cbc19681605cb7c036f2475c899b6f296104ad42b9f5fb"},
{file = "pydantic-1.10.12-cp39-cp39-win_amd64.whl", hash = "sha256:fdbdd1d630195689f325c9ef1a12900524dceb503b00a987663ff4f58669b93d"},
{file = "pydantic-1.10.12-py3-none-any.whl", hash = "sha256:b749a43aa51e32839c9d71dc67eb1e4221bb04af1033a32e3923d46f9effa942"},
{file = "pydantic-1.10.12.tar.gz", hash = "sha256:0fe8a415cea8f340e7a9af9c54fc71a649b43e8ca3cc732986116b3cb135d303"},
]
[package.dependencies]
@@ -606,7 +593,6 @@ email = ["email-validator (>=1.0.3)"]
name = "pymongo"
version = "4.4.1"
description = "Python driver for MongoDB <http://www.mongodb.org>"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -701,7 +687,6 @@ zstd = ["zstandard"]
name = "python-dateutil"
version = "2.8.2"
description = "Extensions to the standard Python datetime module"
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
files = [
@@ -716,7 +701,6 @@ six = ">=1.5"
name = "python-dotenv"
version = "1.0.0"
description = "Read key-value pairs from a .env file and set them as environment variables"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@@ -731,7 +715,6 @@ cli = ["click (>=5.0)"]
name = "python-jose"
version = "3.3.0"
description = "JOSE implementation in Python"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -753,7 +736,6 @@ pycryptodome = ["pyasn1", "pycryptodome (>=3.3.1,<4.0.0)"]
name = "python-multipart"
version = "0.0.6"
description = "A streaming multipart parser for Python"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -768,7 +750,6 @@ dev = ["atomicwrites (==1.2.1)", "attrs (==19.2.0)", "coverage (==6.5.0)", "hatc
name = "pytz"
version = "2023.3"
description = "World timezone definitions, modern and historical"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -780,7 +761,6 @@ files = [
name = "requests"
version = "2.31.0"
description = "Python HTTP for Humans."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -802,7 +782,6 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
name = "rsa"
version = "4.9"
description = "Pure-Python RSA implementation"
category = "main"
optional = false
python-versions = ">=3.6,<4"
files = [
@@ -817,7 +796,6 @@ pyasn1 = ">=0.1.3"
name = "six"
version = "1.16.0"
description = "Python 2 and 3 compatibility utilities"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
files = [
@@ -829,7 +807,6 @@ files = [
name = "sniffio"
version = "1.3.0"
description = "Sniff out which async library your code is running under"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -841,7 +818,6 @@ files = [
name = "starlette"
version = "0.27.0"
description = "The little ASGI library that shines."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -860,7 +836,6 @@ full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart", "pyyam
name = "typing-extensions"
version = "4.7.1"
description = "Backported and Experimental Type Hints for Python 3.7+"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -868,11 +843,21 @@ files = [
{file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"},
]
[[package]]
name = "tzdata"
version = "2023.3"
description = "Provider of IANA time zone data"
optional = false
python-versions = ">=2"
files = [
{file = "tzdata-2023.3-py2.py3-none-any.whl", hash = "sha256:7e65763eef3120314099b6939b5546db7adce1e7d6f2e179e3df563c70511eda"},
{file = "tzdata-2023.3.tar.gz", hash = "sha256:11ef1e08e54acb0d4f95bdb1be05da659673de4acbd21bf9c69e94cc5e907a3a"},
]
[[package]]
name = "urllib3"
version = "1.26.16"
description = "HTTP library with thread-safe connection pooling, file post, and more."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
files = [
@@ -889,7 +874,6 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
name = "uuid7"
version = "0.1.0"
description = "UUID version 7, generating time-sorted UUIDs with 200ns time resolution and 48 bits of randomness"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -901,7 +885,6 @@ files = [
name = "uvicorn"
version = "0.20.0"
description = "The lightning-fast ASGI server."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -920,7 +903,6 @@ standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)",
name = "webencodings"
version = "0.5.1"
description = "Character encoding aliases for legacy web content"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -932,7 +914,6 @@ files = [
name = "websockets"
version = "10.4"
description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1007,7 +988,22 @@ files = [
{file = "websockets-10.4.tar.gz", hash = "sha256:eef610b23933c54d5d921c92578ae5f89813438fded840c2e9809d378dc765d3"},
]
[[package]]
name = "zipp"
version = "3.16.2"
description = "Backport of pathlib-compatible object wrapper for zip files"
optional = false
python-versions = ">=3.8"
files = [
{file = "zipp-3.16.2-py3-none-any.whl", hash = "sha256:679e51dd4403591b2d6838a48de3d283f3d188412a9782faadf845f298736ba0"},
{file = "zipp-3.16.2.tar.gz", hash = "sha256:ebc15946aa78bd63458992fc81ec3b6f7b1e92d51c35e6de1c3804e73b799147"},
]
[package.extras]
docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy (>=0.9.1)", "pytest-ruff"]
[metadata]
lock-version = "2.0"
python-versions = "^3.8"
content-hash = "bc04cdf720095f921a5b5822e7e7acfb543316b16ed634070d9b9e8c15973766"
content-hash = "5384af548195f51290891419c7e7ea3a0a6c7de16ed66ff41882237d64b45796"

View File

@@ -9,6 +9,7 @@ packages = [{ include = "openbb_core" }]
[tool.poetry.dependencies]
python = "^3.8"
uvicorn = "^0.20.0"
importlib_metadata = "^6.8.0"
websockets = "^10.4"
pandas = ">1.5.3"
requests = "^2.28.2"

View File

@@ -103,7 +103,7 @@ def test_log_startup(logging_manager):
@pytest.mark.parametrize(
"user_settings, system_settings, OBBject, route, func, kwargs",
"user_settings, system_settings, obbject, route, func, kwargs",
[
(
"mock_settings",
@@ -132,7 +132,7 @@ def test_log_startup(logging_manager):
],
)
def test_log(
logging_manager, user_settings, system_settings, OBBject, route, func, kwargs
logging_manager, user_settings, system_settings, obbject, route, func, kwargs
):
with patch(
"openbb_core.app.logs.logging_manager.LoggingSettings",
@@ -145,7 +145,7 @@ def test_log(
logging_manager.log(
user_settings=user_settings,
system_settings=system_settings,
OBBject=OBBject,
obbject=obbject,
route=route,
func=func,
kwargs=kwargs,
@@ -162,7 +162,7 @@ def test_log(
logging_manager.log(
user_settings=user_settings,
system_settings=system_settings,
OBBject=OBBject,
obbject=obbject,
route=route,
func=mock_callable,
kwargs=kwargs,
@@ -171,10 +171,10 @@ def test_log(
expected_log_data = {
"route": route,
"input": kwargs,
"error": OBBject.error,
"error": obbject.error,
}
if OBBject.error:
if obbject.error:
mock_error.assert_called_once_with(
"ERROR: %s",
json.dumps(expected_log_data),

View File

@@ -3,6 +3,7 @@ from unittest.mock import MagicMock, patch
import pandas as pd
import pytest
from openbb_core.app.model.obbject import Chart, OBBject, OpenBBError
from openbb_provider.abstract.data import Data
def test_OBBject():
@@ -43,13 +44,15 @@ def test_to_dataframe_no_results():
pd.DataFrame({"value": [10, 20]}, index=pd.RangeIndex(start=0, stop=2)),
),
# Test case 3: Empty results
([], pd.DataFrame()),
([], OpenBBError("Results not found.")),
# Test case 4: Results as None, should raise OpenBBError
(None, OpenBBError("Results not found.")),
],
)
def test_to_dataframe(results, expected_df):
# Arrange
if results:
results = [Data(**d) for d in results]
co = OBBject(results=results)
# Act and Assert
@@ -82,44 +85,54 @@ def test_to_dataframe(results, expected_df):
},
),
# Test case 3: Empty results
([], {}),
([], OpenBBError("Results not found.")),
],
)
def test_to_dict(results, expected):
# Arrange
if results:
results = [Data(**d) for d in results]
co = OBBject(results=results)
# Act
result = co.to_dict()
result.pop("index", None)
# Act and Assert
if isinstance(expected, Exception):
with pytest.raises(expected.__class__) as exc_info:
co.to_dict()
# Assert
assert result == expected
assert str(exc_info.value) == str(expected)
else:
result = co.to_dict()
result.pop("index", None)
assert result == expected
@patch("openbb_core.app.model.obbject.ChartingManager")
@patch("openbb_core.app.model.obbject.Chart")
def test_to_plotly_json_with_existing_chart(mock_chart, mock_charting_manager):
@patch("openbb_core.app.charting_manager.ChartingManager.to_chart")
@patch("openbb_core.app.model.obbject.OBBject.to_dataframe")
def test_to_chart_with_existing_chart(mock_to_dataframe, mock_to_chart):
# Arrange
mock_instance = OBBject()
mock_instance.chart = Chart(content={"existing_chart_data": "some_data"})
# mock the return value of ChartingManager.to_chart()
mock_to_chart.return_value = Chart(
content={"content": "some_new_content"}, fig={"fig": "some_mock_fig"}
)
# Act
result = mock_instance.to_plotly_json()
result = mock_instance.to_chart()
# Assert
assert result == {"existing_chart_data": "some_data"}
assert result == {"fig": "some_mock_fig"}
assert mock_instance.chart.content == {"content": "some_new_content"}
# Ensure ChartingManager and Chart constructors were not called
mock_charting_manager.assert_not_called()
mock_chart.assert_not_called()
mock_to_dataframe.assert_called_once()
@patch("openbb_core.app.model.obbject.obbject.to_dataframe")
@patch("openbb_core.app.model.obbject.ChartingManager")
@patch("openbb_core.app.model.obbject.Chart")
def test_to_plotly_json_with_new_chart(
mock_chart,
mock_charting_manager,
mock_to_dataframe,
):
@@ -135,47 +148,51 @@ def test_to_plotly_json_with_new_chart(
# Arrange
mock_instance = OBBject()
mock_charting_manager_instance = mock_charting_manager.return_value
mock_charting_manager_instance.to_plotly_json.return_value = {
"new_chart_data": "some_data"
}
mock_charting_manager_instance.to_chart.return_value = Chart(
content={"content": "some_new_content"}, fig={"fig": "some_mock_fig"}
)
mock_to_dataframe.return_value = get_mock_dataframe()
# Act
result = mock_instance.to_plotly_json(
create_chart=True, chart_option="option_value"
)
result = mock_instance.to_chart()
# Assert
assert result == {"new_chart_data": "some_data"}
assert result == {"fig": "some_mock_fig"}
assert mock_instance.chart.content == {"content": "some_new_content"}
# Ensure self.to_dataframe() was called
mock_to_dataframe.assert_called_once()
# Ensure ChartingManager was called with the correct parameters
mock_charting_manager_instance.to_plotly_json.assert_called_once()
# Ensure Chart constructor was called with the correct parameters
mock_chart.assert_called_once_with(
content={"new_chart_data": "some_data"}, format="plotly"
)
mock_charting_manager_instance.to_chart.assert_called_once()
def test_show_chart_exists():
mock_instance = OBBject()
# Arrange
mock_instance.chart = MagicMock(spec=Chart)
mock_instance.chart.fig = MagicMock()
mock_instance.chart.fig.show.return_value = MagicMock()
# Act
mock_instance.show()
# Assert
mock_instance.chart.show.assert_called_once()
mock_instance.chart.fig.show.assert_called_once()
def test_show_chart_not_found():
def test_show_chart_no_chart():
mock_instance = OBBject()
# Arrange
mock_instance.chart = None
# Act and Assert
with pytest.raises(OpenBBError, match="Chart not found."):
mock_instance.show()
def test_show_chart_no_fig():
mock_instance = OBBject()
# Arrange
mock_instance.chart = Chart()
# Act and Assert
with pytest.raises(OpenBBError, match="Chart not found."):

View File

@@ -0,0 +1,56 @@
from typing import Any, List, Optional, Tuple, TypeVar
from openbb_core.app.repository.base.in_memory_repository import (
Repository,
)
from pydantic import BaseModel
T = TypeVar("T", bound=BaseModel)
def test_repository():
class TestRepository(Repository):
def __init__(self, test_arg_1, test_arg_2):
self.test_arg_1 = test_arg_1
self.test_arg_2 = test_arg_2
super().__init__(collection_name=test_arg_1, database_name=test_arg_2)
@property
def collection_name(self):
return "test_collection"
def create(self, model):
pass
@property
def database_name(self):
return "test_database"
def delete(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def delete_all(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def read(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def read_all(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def update(self, model: T):
pass
def mock_method(self):
return self.test_arg_1, self.test_arg_2
jr = TestRepository("xpto_1", "xpto_2")
assert isinstance(jr, Repository)

View File

@@ -0,0 +1,57 @@
from typing import Any, List, Optional, Tuple, TypeVar
from unittest.mock import MagicMock
from openbb_core.app.repository.base.mongodb_repository import (
Repository,
)
from pydantic import BaseModel
T = TypeVar("T", bound=BaseModel)
def test_repository():
class TestRepository(Repository):
def __init__(self, test_arg_1, test_arg_2, test_collection_name, mock_client):
self.test_arg_1 = test_arg_1
self.test_arg_2 = test_arg_2
super().__init__(collection_name=test_collection_name, client=mock_client)
@property
def collection_name(self):
return "test_collection"
def create(self, model):
pass
@property
def database_name(self):
return "test_database"
def delete(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def delete_all(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def read(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def read_all(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def update(self, model: T):
pass
def mock_method(self):
return self.test_arg_1, self.test_arg_2
jr = TestRepository("xpto_1", "xpto_2", "test_collection_name", MagicMock())
assert isinstance(jr, Repository)

View File

@@ -0,0 +1,56 @@
from typing import Any, List, Optional, Tuple, TypeVar
from openbb_core.app.repository.in_memory.access_token_repository import (
AccessTokenRepository,
)
from pydantic import BaseModel
T = TypeVar("T", bound=BaseModel)
def test_journal_entry_repository():
class TestAccessTokenRepository(AccessTokenRepository):
def __init__(self, test_arg_1, test_arg_2):
self.test_arg_1 = test_arg_1
self.test_arg_2 = test_arg_2
super().__init__()
@property
def collection_name(self):
return "test_collection"
def create(self, model):
pass
@property
def database_name(self):
return "test_database"
def delete(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def delete_all(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def read(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def read_all(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def update(self, model: T):
pass
def mock_method(self):
return self.test_arg_1, self.test_arg_2
jr = TestAccessTokenRepository("xpto_1", "xpto_2")
assert isinstance(jr, AccessTokenRepository)

View File

@@ -0,0 +1,56 @@
from typing import Any, List, Optional, Tuple, TypeVar
from openbb_core.app.repository.in_memory.journal_entry_repository import (
JournalEntryRepository,
)
from pydantic import BaseModel
T = TypeVar("T", bound=BaseModel)
def test_journal_entry_repository():
class TestJournalEntryRepository(JournalEntryRepository):
def __init__(self, test_arg_1, test_arg_2):
self.test_arg_1 = test_arg_1
self.test_arg_2 = test_arg_2
super().__init__()
@property
def collection_name(self):
return "test_collection"
def create(self, model):
pass
@property
def database_name(self):
return "test_database"
def delete(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def delete_all(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def read(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def read_all(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def update(self, model: T):
pass
def mock_method(self):
return self.test_arg_1, self.test_arg_2
jr = TestJournalEntryRepository("xpto_1", "xpto_2")
assert isinstance(jr, JournalEntryRepository)

View File

@@ -0,0 +1,56 @@
from typing import Any, List, Optional, Tuple, TypeVar
from openbb_core.app.repository.in_memory.journal_repository import (
JournalRepository,
)
from pydantic import BaseModel
T = TypeVar("T", bound=BaseModel)
def test_journal_repository():
class TestJournalRepository(JournalRepository):
def __init__(self, test_arg_1, test_arg_2):
self.test_arg_1 = test_arg_1
self.test_arg_2 = test_arg_2
super().__init__()
@property
def collection_name(self):
return "test_collection"
def create(self, model):
pass
@property
def database_name(self):
return "test_database"
def delete(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def delete_all(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def read(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def read_all(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def update(self, model: T):
pass
def mock_method(self):
return self.test_arg_1, self.test_arg_2
jr = TestJournalRepository("xpto_1", "xpto_2")
assert isinstance(jr, JournalRepository)

View File

@@ -0,0 +1,63 @@
from typing import Any, List, Optional, Tuple, TypeVar
from openbb_core.app.repository.in_memory.user_settings_repository import (
UserSettingsRepository,
)
from pydantic import BaseModel
T = TypeVar("T", bound=BaseModel)
def test_journal_entry_repository():
class TestUserSettingsRepository(UserSettingsRepository):
def __init__(self, test_arg_1, test_arg_2):
self.test_arg_1 = test_arg_1
self.test_arg_2 = test_arg_2
super().__init__()
@property
def collection_name(self):
return "test_collection"
def create(self, model):
pass
@property
def database_name(self):
return "test_database"
def delete(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def delete_all(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def read(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def read_all(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def update(self, model: T):
pass
def mock_method(self):
return self.test_arg_1, self.test_arg_2
def read_by_profile(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
jr = TestUserSettingsRepository("xpto_1", "xpto_2")
assert isinstance(jr, UserSettingsRepository)

View File

@@ -0,0 +1,57 @@
from typing import Any, List, Optional, Tuple, TypeVar
from unittest.mock import MagicMock
from openbb_core.app.repository.mongodb.journal_entry_repository import (
JournalEntryRepository,
)
from pydantic import BaseModel
T = TypeVar("T", bound=BaseModel)
def test_journal_entry_repository():
class TestJournalEntryRepository(JournalEntryRepository):
def __init__(self, test_arg_1, test_arg_2, mock_client):
self.test_arg_1 = test_arg_1
self.test_arg_2 = test_arg_2
super().__init__(client=mock_client)
@property
def collection_name(self):
return "test_collection"
def create(self, model):
pass
@property
def database_name(self):
return "test_database"
def delete(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def delete_all(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def read(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def read_all(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def update(self, model: T):
pass
def mock_method(self):
return self.test_arg_1, self.test_arg_2
jr = TestJournalEntryRepository("xpto_1", "xpto_2", MagicMock())
assert isinstance(jr, JournalEntryRepository)

View File

@@ -0,0 +1,57 @@
from typing import Any, List, Optional, Tuple, TypeVar
from unittest.mock import MagicMock
from openbb_core.app.repository.mongodb.journal_repository import (
JournalRepository,
)
from pydantic import BaseModel
T = TypeVar("T", bound=BaseModel)
def test_journal_repository():
class TestJournalRepository(JournalRepository):
def __init__(self, test_arg_1, test_arg_2, mock_client):
self.test_arg_1 = test_arg_1
self.test_arg_2 = test_arg_2
super().__init__(client=mock_client)
@property
def collection_name(self):
return "test_collection"
def create(self, model):
pass
@property
def database_name(self):
return "test_database"
def delete(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def delete_all(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def read(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def read_all(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def update(self, model: T):
pass
def mock_method(self):
return self.test_arg_1, self.test_arg_2
jr = TestJournalRepository("xpto_1", "xpto_2", MagicMock())
assert isinstance(jr, JournalRepository)

View File

@@ -0,0 +1,64 @@
from typing import Any, List, Optional, Tuple, TypeVar
from unittest.mock import MagicMock
from openbb_core.app.repository.mongodb.user_settings_repository import (
UserSettingsRepository,
)
from pydantic import BaseModel
T = TypeVar("T", bound=BaseModel)
def test_journal_entry_repository():
class TestUserSettingsRepository(UserSettingsRepository):
def __init__(self, test_arg_1, test_arg_2, mock_client):
self.test_arg_1 = test_arg_1
self.test_arg_2 = test_arg_2
super().__init__(client=mock_client)
@property
def collection_name(self):
return "test_collection"
def create(self, model):
pass
@property
def database_name(self):
return "test_database"
def delete(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def delete_all(self, filter_list: Optional[List[Tuple[str, Any]]] = None):
pass
def read(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def read_all(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
def update(self, model: T):
pass
def mock_method(self):
return self.test_arg_1, self.test_arg_2
def read_by_profile(
self,
field_list: Optional[List[str]] = None,
filter_list: Optional[List[Tuple[str, Any]]] = None,
):
pass
jr = TestUserSettingsRepository("xpto_1", "xpto_2", MagicMock())
assert isinstance(jr, UserSettingsRepository)

View File

@@ -41,4 +41,4 @@ def test_filter_output():
"""Test filter_output."""
OBBject = filter_output(OBBject())
assert OBBject is not None
assert obbject is not None

View File

@@ -56,13 +56,6 @@ def test_init(query):
assert query
def test_to_query_params(query):
"""Test to_query_params."""
standard_params = create_mock_query()
assert query.to_query_params(standard_params)
def test_filter_extra_params(query):
"""Test filter_extra_params."""
extra_params = create_mock_extra_params()

View File

@@ -196,8 +196,9 @@ def test_complete_signature_error(signature_inspector):
def valid_function() -> OBBject[int]:
return OBBject(results=[1, 2, 3])
with pytest.raises(AttributeError):
signature_inspector.complete_signature(valid_function, "invalid_model")
assert (
signature_inspector.complete_signature(valid_function, "invalid_model") is None
)
def test_validate_signature(signature_inspector):

View File

@@ -56,13 +56,6 @@ def test_init(query):
assert query
def test_to_query_params(query):
"""Test to_query_params."""
standard_params = create_mock_query()
assert query.to_query_params(standard_params)
def test_filter_extra_params(query):
"""Test filter_extra_params."""
extra_params = create_mock_extra_params()

View File

@@ -196,8 +196,9 @@ def test_complete_signature_error(signature_inspector):
def valid_function() -> OBBject[int]:
return OBBject(results=[1, 2, 3])
with pytest.raises(AttributeError):
signature_inspector.complete_signature(valid_function, "invalid_model")
assert (
signature_inspector.complete_signature(valid_function, "invalid_model") is None
)
def test_validate_signature(signature_inspector):

View File

@@ -0,0 +1 @@
"""OpenBB Provider Abstract Class."""

View File

@@ -1,3 +1,4 @@
"""The OpenBB Standardized Data Model."""
from pydantic import BaseModel, Extra
@@ -5,8 +6,11 @@ class Data(BaseModel):
"""The OpenBB Standardized Data Model."""
def __repr__(self):
"""Return a string representation of the object."""
return f"{self.__class__.__name__}({', '.join([f'{k}={v}' for k, v in self.dict().items()])})"
class Config:
"""Pydantic configuration."""
extra = Extra.allow
allow_population_by_field_name = True

View File

@@ -1,4 +1,4 @@
"""Abstract class for providers."""
"""Provider Abstract Class."""
from typing import Dict, List, Optional, Type
@@ -6,8 +6,7 @@ from openbb_provider.abstract.fetcher import Fetcher
class Provider:
"""This class serves as provider extensions entry point and must be
created by each provider."""
"""Serves as provider extension entry point and must be created by each provider."""
def __init__(
self,

View File

@@ -1,3 +1,4 @@
"""The OpenBB Standardized QueryParams Model that holds the query input parameters."""
from pydantic import BaseModel
@@ -5,7 +6,10 @@ class QueryParams(BaseModel):
"""The OpenBB Standardized QueryParams Model that holds the query input parameters."""
class Config:
"""Pydantic Config."""
allow_population_by_field_name = True
def __repr__(self):
"""Return the string representation of the QueryParams object."""
return f"{self.__class__.__name__}({', '.join([f'{k}={v}' for k, v in self.dict().items()])})"

View File

@@ -1,27 +0,0 @@
"""Common descriptions for model fields."""
QUERY_DESCRIPTIONS = {
"symbol": "Symbol to get data for.",
"start_date": "Start date of the data, in YYYY-MM-DD format.",
"end_date": "End date of the data, in YYYY-MM-DD format.",
"weekly": "Whether to return weekly data.",
"monthly": "Whether to return monthly data.",
"period": "Period of the data to return (quarterly or annually).",
"date": "A specific date to get data for.",
"limit": "The number of data entries to return.",
"countries": "The country or countries to get data.",
"units": "The data units.",
"frequency": "The data time frequency.",
}
DATA_DESCRIPTIONS = {
"symbol": "Symbol representing the entity requested in the data.",
"date": "The date of the data.",
"open": "The open price of the symbol.",
"high": "The high price of the symbol.",
"low": "The low price of the symbol.",
"close": "The close price of the symbol.",
"volume": "The volume of the symbol.",
"adj_close": "The adjusted close price of the symbol.",
"vwap": "Volume Weighted Average Price of the symbol.",
}

View File

@@ -1,3 +1,4 @@
"""Query executor module."""
from typing import Any, Dict, Optional, Type
from openbb_provider.abstract.fetcher import Fetcher, GenericDataType
@@ -6,6 +7,8 @@ from openbb_provider.registry import Registry, RegistryLoader
class ProviderError(Exception):
"""Exception raised for errors in the provider."""
pass
@@ -13,6 +16,7 @@ class QueryExecutor:
"""Class to execute queries from providers."""
def __init__(self, registry: Optional[Registry] = None) -> None:
"""Initialize the query executor."""
self.registry = registry or RegistryLoader.from_extensions()
def get_provider(self, provider_name: str) -> Provider:

View File

@@ -1,3 +1,5 @@
"""Provider Registry Module."""
from typing import Dict
import importlib_metadata
@@ -6,26 +8,34 @@ from openbb_provider.abstract.provider import Provider
class Registry:
"""Class to maintain registry of providers"""
"""Maintain registry of providers."""
def __init__(self) -> None:
"""Initialize the registry."""
self._providers: Dict[str, Provider] = {}
@property
def providers(self):
"""Return a dictionary of providers."""
return self._providers
def include_provider(self, provider: Provider) -> None:
"""Include a provider in the registry."""
self._providers[provider.name.lower()] = provider
class LoadingError(Exception):
"""Error loading providers."""
pass
class RegistryLoader:
"""Load providers from entry points."""
@staticmethod
def from_extensions() -> Registry:
"""Load providers from entry points."""
registry = Registry()
for entry_point in importlib_metadata.entry_points(
group="openbb_provider_extension"

View File

@@ -14,6 +14,7 @@ class RegistryMap:
"""Class to store information about providers in the registry."""
def __init__(self, registry: Optional[Registry] = None) -> None:
"""Initialize Registry Map."""
self._registry = registry or RegistryLoader.from_extensions()
self._required_credentials = self._get_required_credentials(self._registry)
self._available_providers = self._get_available_providers(self._registry)
@@ -42,6 +43,7 @@ class RegistryMap:
@property
def return_map(self) -> MapType:
"""Get provider registry return map."""
return self._return_map
@property

View File

@@ -0,0 +1 @@
"""OpenBB Provider Package."""

View File

@@ -1,4 +1,5 @@
from typing import List, Literal, Optional, Union
"""Base models for OpenBB Provider."""
from typing import List, Literal, Optional, Set, Union
from pydantic import BaseModel, Field, NonNegativeInt, validator
@@ -7,16 +8,21 @@ from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS
class BaseSymbol(BaseModel):
"""Base model for symbol query params."""
symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", ""))
@validator("symbol", pre=True, check_fields=False, always=True)
def upper_symbol(cls, v: Union[str, List[str], set[str]]):
def upper_symbol(cls, v: Union[str, List[str], Set[str]]):
"""Convert symbol to uppercase."""
if isinstance(v, str):
return v.upper()
return ",".join([symbol.upper() for symbol in list(v)])
class FinancialStatementQueryParams(QueryParams, BaseSymbol):
"""Base model for financial statement query params."""
period: Literal["annually", "quarterly"] = Field(
default="annually", description=QUERY_DESCRIPTIONS.get("period", "")
)

View File

@@ -28,21 +28,30 @@ class CashFlowStatementData(Data):
accepted_date: Optional[datetime] = Field(description="Accepted date.")
period: Optional[str] = Field(description="Reporting period of the statement.")
cash_at_beginning_of_period: Optional[int]
net_income: Optional[int]
depreciation_and_amortization: Optional[int]
stock_based_compensation: Optional[int]
cash_at_beginning_of_period: Optional[int] = Field(
description="Cash at beginning of period."
)
net_income: Optional[int] = Field(description="Net income.")
depreciation_and_amortization: Optional[int] = Field(
description="Depreciation and amortization."
)
stock_based_compensation: Optional[int] = Field(
description="Stock based compensation."
)
other_non_cash_items: Optional[int] = Field(description="Other non-cash items.")
deferred_income_tax: Optional[int] = Field(description="Deferred income tax.")
inventory: Optional[int]
accounts_receivables: Optional[int]
accounts_payables: Optional[int]
free_cash_flow: Optional[int] = Field(
description="Net cash provided by operating activities."
)
inventory: Optional[int] = Field(description="Inventory.")
accounts_payables: Optional[int] = Field(description="Accounts payables.")
accounts_receivables: Optional[int] = Field(description="Accounts receivables.")
change_in_working_capital: Optional[int] = Field(
description="Change in working capital."
)
other_working_capital: Optional[int] = Field(
description="Accrued expenses and other, Unearned revenue."
)
net_cash_flow_from_operating_activities: Optional[int]
capital_expenditure: Optional[int] = Field(
description="Purchases of property and equipment."
@@ -53,24 +62,56 @@ class CashFlowStatementData(Data):
acquisitions_net: Optional[int] = Field(
description="Acquisitions, net of cash acquired, and other"
)
sales_maturities_of_investments: Optional[int]
purchases_of_investments: Optional[int]
net_cash_flow_from_investing_activities: Optional[int]
investments_in_property_plant_and_equipment: Optional[int]
dividends_paid: Optional[int]
common_stock_repurchased: Optional[int]
debt_repayment: Optional[int]
other_financing_activities: Optional[int]
net_cash_flow_from_financing_activities: Optional[int]
sales_maturities_of_investments: Optional[int] = Field(
description="Sales and maturities of investments."
)
purchases_of_investments: Optional[int] = Field(
description="Purchases of investments."
)
net_cash_flow_from_operating_activities: Optional[int] = Field(
description="Net cash flow from operating activities."
)
net_cash_flow_from_investing_activities: Optional[int] = Field(
description="Net cash flow from investing activities."
)
net_cash_flow_from_financing_activities: Optional[int] = Field(
description="Net cash flow from financing activities."
)
investments_in_property_plant_and_equipment: Optional[int] = Field(
description="Investments in property, plant, and equipment."
)
net_cash_used_for_investing_activities: Optional[int] = Field(
description="Net cash used for investing activities."
)
effect_of_forex_changes_on_cash: Optional[int] = Field(
description="Foreign currency effect on cash, cash equivalents, and restricted cash"
)
dividends_paid: Optional[int] = Field(
description="Payments for dividends and dividend equivalents"
)
common_stock_issued: Optional[int] = Field(
description="Proceeds from issuance of common stock"
)
common_stock_repurchased: Optional[int] = Field(
description="Payments related to repurchase of common stock"
)
debt_repayment: Optional[int] = Field(description="Payments of long-term debt")
other_financing_activities: Optional[int] = Field(
description="Other financing activities, net"
)
net_change_in_cash: Optional[int] = Field(
description="Net increase (decrease) in cash, cash equivalents, and restricted cash"
)
cash_at_end_of_period: Optional[int]
cash_at_end_of_period: Optional[int] = Field(
description="Cash, cash equivalents, and restricted cash at end of period"
)
free_cash_flow: Optional[int] = Field(
description="Net cash flow from operating, investing and financing activities"
)
operating_cash_flow: Optional[int] = Field(
description="Net cash flow from operating activities"
)

View File

@@ -1,3 +1,4 @@
"""CPI data and query params."""
from datetime import date as dateType
from typing import List, Literal, Optional
@@ -101,6 +102,7 @@ class CPIData(Data):
@validator("value", pre=True)
def value_validate(cls, v: str): # pylint: disable=E0213
"""Validate value."""
if v == ".":
return 0.0
return float(v)

View File

@@ -9,6 +9,8 @@ from openbb_provider.abstract.data import Data
class FinancialRatiosData(Data):
"""Financial ratios data model."""
symbol: str = Field(description="The symbol of the company.")
date: str = Field(description="The date of the financial ratios.")
period: str = Field(description="The period of the financial ratios.")

View File

@@ -36,12 +36,21 @@ class HistoricalDividendsData(Data):
@validator("declaration_date", pre=True, check_fields=False)
def declaration_date_validate(cls, v: str): # pylint: disable=E0213
"""Validate declaration date."""
if not isinstance(v, str):
return v
return dateType.fromisoformat(v) if v else None
@validator("record_date", pre=True, check_fields=False)
def record_date_validate(cls, v: str): # pylint: disable=E0213
"""Record date validator."""
if not isinstance(v, str):
return v
return dateType.fromisoformat(v) if v else None
@validator("payment_date", pre=True, check_fields=False)
def payment_date_validate(cls, v: str): # pylint: disable=E0213
"""Payment date validator."""
if not isinstance(v, str):
return v
return dateType.fromisoformat(v) if v else None

View File

@@ -1,6 +1,5 @@
"""Historical Employees data model."""
from datetime import date, datetime
from pydantic import Field, validator
@@ -38,12 +37,15 @@ class HistoricalEmployeesData(Data, BaseSymbol):
@validator("acceptance_time", pre=True, check_fields=False)
def acceptance_time_validate(cls, v): # pylint: disable=E0213
"""Validate acceptance time."""
return datetime.strptime(v, "%Y-%m-%d %H:%M:%S")
@validator("period_of_report", pre=True, check_fields=False)
def period_of_report_validate(cls, v): # pylint: disable=E0213
"""Validate period of report."""
return datetime.strptime(v, "%Y-%m-%d")
@validator("filing_date", pre=True, check_fields=False)
def filing_date_validate(cls, v): # pylint: disable=E0213
"""Validate filing date."""
return datetime.strptime(v, "%Y-%m-%d")

View File

@@ -24,6 +24,7 @@ class StockNewsQueryParams(QueryParams):
@validator("symbols", pre=True)
def symbols_validate(cls, v: str): # pylint: disable=E0213
"""Validate the symbols."""
return v.upper()

View File

@@ -28,7 +28,6 @@ def most_recent_quarter(base: dateType = dateType.today()) -> dateType:
date : date
The most recent quarter date.
"""
base = min(base, dateType.today()) # This prevents dates from being in the future
exacts = [(3, 31), (6, 30), (9, 30), (12, 31)]
for exact in exacts:
@@ -46,17 +45,20 @@ def most_recent_quarter(base: dateType = dateType.today()) -> dateType:
class StockOwnershipQueryParams(QueryParams, BaseSymbol):
"""Stock ownership Query."""
date: dateType = Field(description=QUERY_DESCRIPTIONS.get("date", ""))
date: Optional[dateType] = Field(description=QUERY_DESCRIPTIONS.get("date", ""))
page: Optional[int] = Field(
default=0, description="The page number of the data to fetch."
)
@validator("date", pre=True)
def time_validate(cls, v: str): # pylint: disable=E0213
@validator("date", pre=True, check_fields=False)
def time_validate(cls, v: str): # pylint: disable=E021
"""Validate the date."""
if v is None:
v = dateType.today()
if isinstance(v, str):
base = datetime.strptime(v, "%Y-%m-%d").date()
return most_recent_quarter(base)
return v
return most_recent_quarter(v)
class StockOwnershipData(Data):
@@ -64,154 +66,115 @@ class StockOwnershipData(Data):
date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", ""))
cik: int = Field(description="The cik of the stock ownership.")
filing_date: dateType = Field(
alias="filingDate", description="The filing date of the stock ownership."
)
filing_date: dateType = Field(description="The filing date of the stock ownership.")
investor_name: str = Field(
...,
alias="investorName",
description="The investor name of the stock ownership.",
)
symbol: str = Field(description="The symbol of the stock ownership.")
security_name: str = Field(
...,
alias="securityName",
description="The security name of the stock ownership.",
)
type_of_security: str = Field(
...,
alias="typeOfSecurity",
description="The type of security of the stock ownership.",
)
security_cusip: str = Field(
...,
alias="securityCusip",
description="The security cusip of the stock ownership.",
)
shares_type: str = Field(
alias="sharesType", description="The shares type of the stock ownership."
)
shares_type: str = Field(description="The shares type of the stock ownership.")
put_call_share: str = Field(
...,
alias="putCallShare",
description="The put call share of the stock ownership.",
)
investment_discretion: str = Field(
...,
alias="investmentDiscretion",
description="The investment discretion of the stock ownership.",
)
industry_title: str = Field(
...,
alias="industryTitle",
description="The industry title of the stock ownership.",
)
weight: float = Field(description="The weight of the stock ownership.")
last_weight: float = Field(
alias="lastWeight", description="The last weight of the stock ownership."
)
last_weight: float = Field(description="The last weight of the stock ownership.")
change_in_weight: float = Field(
...,
alias="changeInWeight",
description="The change in weight of the stock ownership.",
)
change_in_weight_percentage: float = Field(
...,
alias="changeInWeightPercentage",
description="The change in weight percentage of the stock ownership.",
)
market_value: int = Field(
alias="marketValue", description="The market value of the stock ownership."
)
market_value: int = Field(description="The market value of the stock ownership.")
last_market_value: int = Field(
...,
alias="lastMarketValue",
description="The last market value of the stock ownership.",
)
change_in_market_value: int = Field(
...,
alias="changeInMarketValue",
description="The change in market value of the stock ownership.",
)
change_in_market_value_percentage: float = Field(
...,
alias="changeInMarketValuePercentage",
description="The change in market value percentage of the stock ownership.",
)
shares_number: int = Field(
...,
alias="sharesNumber",
description="The shares number of the stock ownership.",
)
last_shares_number: int = Field(
...,
alias="lastSharesNumber",
description="The last shares number of the stock ownership.",
)
change_in_shares_number: float = Field(
...,
alias="changeInSharesNumber",
description="The change in shares number of the stock ownership.",
)
change_in_shares_number_percentage: float = Field(
...,
alias="changeInSharesNumberPercentage",
description="The change in shares number percentage of the stock ownership.",
)
quarter_end_price: float = Field(
...,
alias="quarterEndPrice",
description="The quarter end price of the stock ownership.",
)
avg_price_paid: float = Field(
...,
alias="avgPricePaid",
description="The average price paid of the stock ownership.",
)
is_new: bool = Field(alias="isNew", description="Is the stock ownership new.")
is_sold_out: bool = Field(
alias="isSoldOut", description="Is the stock ownership sold out."
)
is_new: bool = Field(description="Is the stock ownership new.")
is_sold_out: bool = Field(description="Is the stock ownership sold out.")
ownership: float = Field(description="How much is the ownership.")
last_ownership: float = Field(
alias="lastOwnership", description="The last ownership amount."
)
change_in_ownership: float = Field(
alias="changeInOwnership", description="The change in ownership amount."
)
last_ownership: float = Field(description="The last ownership amount.")
change_in_ownership: float = Field(description="The change in ownership amount.")
change_in_ownership_percentage: float = Field(
...,
alias="changeInOwnershipPercentage",
description="The change in ownership percentage.",
)
holding_period: int = Field(
...,
alias="holdingPeriod",
description="The holding period of the stock ownership.",
)
first_added: dateType = Field(
...,
alias="firstAdded",
description="The first added date of the stock ownership.",
)
performance: float = Field(description="The performance of the stock ownership.")
performance_percentage: float = Field(
...,
alias="performancePercentage",
description="The performance percentage of the stock ownership.",
)
last_performance: float = Field(
...,
alias="lastPerformance",
description="The last performance of the stock ownership.",
)
change_in_performance: float = Field(
...,
alias="changeInPerformance",
description="The change in performance of the stock ownership.",
)
is_counted_for_performance: bool = Field(
...,
alias="isCountedForPerformance",
description="Is the stock ownership counted for performance.",
)

View File

@@ -0,0 +1 @@
"""OpenBB Provider Utils."""

View File

@@ -10,21 +10,20 @@ from openbb_provider.abstract.fetcher import DataType, ProviderDataType
def get_querystring(items: dict, exclude: List[str]) -> str:
"""Turns a dictionary into a querystring, excluding the keys in the exclude list.
"""Turn a dictionary into a querystring, excluding the keys in the exclude list.
Parameters:
-----------
Parameters
----------
items: dict
The dictionary to be turned into a querystring.
exclude: List[str]
The keys to be excluded from the querystring.
Returns:
--------
Returns
-------
str
The querystring.
"""
for item in exclude:
items.pop(item)
@@ -35,6 +34,7 @@ def get_querystring(items: dict, exclude: List[str]) -> str:
def process(
row: ProviderDataType, key: str, processors: Optional[Dict[str, Callable]] = None
):
"""Process a specific field."""
if not processors:
return getattr(row, key)
if key not in processors:
@@ -43,7 +43,7 @@ def process(
def camel_to_snake(name: str) -> str:
"Converts a camelCase string to snake_case."
"""Convert a camelCase string to snake_case."""
pattern = re.compile(r"(?<!^)(?=[A-Z])")
return pattern.sub("_", name).lower()
@@ -54,6 +54,7 @@ def convert_schema(
mapping: Dict[str, str],
processors: Optional[Dict[str, Callable]] = None,
):
"""Convert a specific schema to a given new_schema."""
mapped_fields = {
value: process(row, key, processors) for key, value in mapping.items()
}
@@ -61,7 +62,7 @@ def convert_schema(
def check_alias(field) -> bool:
"Checks if a field has an alias."
"""Check if a field has an alias."""
alias = getattr(field, "alias")
name = getattr(field, "name")
return alias != name
@@ -72,10 +73,10 @@ def data_transformer(
new_schema: Type[DataType],
processors: Optional[Dict[str, Callable]] = None,
) -> Union[List[DataType], DataType]:
"""Converts a specific data into the standardised version
"""Convert a specific data into the standardised version.
Parameters:
-----------
Parameters
----------
data: Union[List[ProviderDataType], ProviderDataType]
A list of pydantic schemas
@@ -85,11 +86,10 @@ def data_transformer(
processors: Optional[Dict[str, str]]
A dictionary with fields and custom processing functions
Returns:
--------
Returns
-------
List[DataType]
A list of the newly formatted schemas
"""
the_data = data[0] if isinstance(data, list) else data
fields = the_data.__dict__.keys()