Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from OpenBB-finance/feature/openbb-sdk-v4
Browse files Browse the repository at this point in the history
Feature/openbb sdk v4
AdiSai authored Oct 26, 2023
2 parents ce7012f + af6ea23 commit edf779f
Showing 108 changed files with 8,370 additions and 562 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/platform-api-integration-test.yml
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ jobs:
./openbb_platform/providers/quandl \
./openbb_platform/providers/yfinance \
./openbb_platform/providers/oecd \
./openbb_platform/providers/biztoc \
./openbb_platform/extensions/charting \
./openbb_platform/extensions/futures \
./openbb_platform/extensions/qa \
@@ -90,7 +91,8 @@ jobs:
"fred_api_key": "${{ secrets.FRED_API_KEY }}",
"intrinio_api_key": "${{ secrets.INTRINIO_API_KEY }}",
"tradingeconomics_api_key": "${{ secrets.TRADINGECONOMICS_API_KEY }}",
"quandl_api_key": "${{ secrets.QUANDL_API_KEY }}"
"quandl_api_key": "${{ secrets.QUANDL_API_KEY }}",
"biztoc_api_key": "${{ secrets.BIZTOC_API_KEY }}"
}
}' > ~/.openbb_platform/user_settings.json
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -12,32 +12,35 @@
<img src="https://github.com/codespaces/badge.svg" height="20" />
</a>

OpenBB is committed to building the future of investment research by focusing on an open-source infrastructure accessible to everyone, everywhere.
The first financial terminal that is free and fully open source. With over 600 commands, the terminal has access to equity, options, crypto, forex, macro economy, fixed income, alternative datasets, and more.

<p align="center">
Sign up to the [OpenBB Hub](https://my.openbb.co/login) to use our Windows or MacOS installers to get started.

<a href="https://www.youtube.com/playlist?list=PLXcRIKcHAUP45_ZZCxxvPyXFKHdq9kM8T">
<p align="center">Getting started with the OpenBB Terminal</p>
</a>

<p align="center">
<p align="center">
<a href="https://www.youtube.com/watch?v=fqGPK8OVHLk" rel="OpenBB Terminal Demo">
<a href="https://www.youtube.com/playlist?list=PLXcRIKcHAUP45_ZZCxxvPyXFKHdq9kM8T" rel="OpenBB Terminal Demo">
<img src="images/openbb_terminal_illustration.gif" alt="OpenBB Terminal Illustration" width="100%"/>
</a>
<p align="center">Click on the GIF above for a DEMO</p>
</p>

<p align="center">
<a href="https://docs.openbb.co/terminal/installation">
<strong>≪ GETTING STARTED</strong>
<strong>≪ INSTALL</strong>
</a>
&nbsp · &nbsp
<a href="https://github.com/OpenBB-finance/OpenBBTerminal/tree/master/CONTRIBUTING.md">
<strong>CONTRIBUTING</strong>
<a href="https://my.openbb.co/app/terminal/data">
<strong>DATA</strong>
</a>
&nbsp · &nbsp
<a href="https://openbb.co/docs">
<strong>DOCUMENTATION</strong>
<a href="https://my.openbb.co/app/terminal/features">
<strong>SEE FEATURES</strong>
</a>
&nbsp · &nbsp
<a href="https://docs.openbb.co/terminal">
<strong>SEE FEATURES »</strong>
<a href="https://github.com/OpenBB-finance/OpenBBTerminal/tree/master/CONTRIBUTING.md">
<strong>CONTRIBUTING »</strong>
</a>
</p>
</p>
13 changes: 8 additions & 5 deletions openbb_platform/PUBLISH.md
Original file line number Diff line number Diff line change
@@ -6,13 +6,16 @@ Publishing checklist:
1. Ensure all unit tests pass: `pytest openbb_platform -m "not integration"`
2. Ensure all integration tests pass: `pytest openbb_platform -m integration`
3. Change the Platform version on `openbb_platform/platform/core/openbb_core/app/constants.py`
4. Run the publishing script: `python openbb_platform/dev_publish.py`
5. Update poetry files: `python openbb_platform/poetry_update.py`
3. Change the Platform version on:
- `openbb_platform/platform/core/openbb_core/app/constants.py`
- `openbb_platform/README.md`
4. Run the publishing script: `python openbb_platform/dev_utils/dev_publish.py`
5. Update poetry files: `python openbb_platform/dev_utils/poetry_update.py`
6. Open a PR so that changes are reflected on the main branch
7. If applicable, set the version on `constants.py` to use the `dev` tag again

Finally, check if everything worked:
Finally, check if everything works:

1. Install and test the package from Pypi on a clean environment
2. Check if all the `pyproject.toml` files are correct, including the `openbb_platform` one.
3. Double check if there is any new extension or provider that needs to be added to [integration tests GitHub Action workflow](/.github/workflows/platform-api-integration-test.yml).
3. Double check if there is any new extension or provider that needs to be added to [integration tests GitHub Action workflow](/.github/workflows/platform-api-integration-test.yml).
8 changes: 5 additions & 3 deletions openbb_platform/README.md
Original file line number Diff line number Diff line change
@@ -17,17 +17,19 @@ The OpenBB Platform provides a convenient way to access raw financial data from
The command below provides access to the core functionalities behind the OpenBB Platform.

```bash
pip install openbb==4.0.0a2
pip install openbb==4.0.0a4
```

> Note that the version `4.0.0a4` is an example and you should replace it with the latest version available.
To install extensions that expand the core functionalities specify the extension name or use `all` to install all.

```bash
# Install single extension, e.g. openbb-charting
pip install openbb[charting]==4.0.0a2
pip install openbb[charting]==4.0.0a4

# Install all available extensions
pip install openbb[all]==4.0.0a2
pip install openbb[all]==4.0.0a4
``````

> Note: These instruction are specific to v4. For installation instructions and documentation for v3 go to our [website](https://docs.openbb.co/sdk).
1 change: 1 addition & 0 deletions openbb_platform/dev_install.py
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@
# Community dependencies
openbb-alpha-vantage = { path = "./providers/alpha_vantage", optional = true, develop = true }
openbb-biztoc = { path = "./providers/biztoc", optional = true, develop = true }
openbb-cboe = { path = "./providers/cboe", optional = true, develop = true }
openbb-quandl = { path = "./providers/quandl", optional = true, develop = true }
openbb-yfinance = { path = "./providers/yfinance", optional = true, develop = true }
1 change: 1 addition & 0 deletions openbb_platform/extensions/charting/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions openbb_platform/extensions/charting/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[tool.poetry]
name = "openbb-charting"
version = "0.1.0a3"
version = "0.1.0a4"
description = "Charting extension for OpenBB"
authors = ["OpenBB Team <[email protected]>"]
readme = "README.md"
packages = [{ include = "openbb_charting" }]

[tool.poetry.dependencies]
python = ">=3.8,<3.12" # scipy forces python <4.0 explicitly
python = ">=3.8,<3.12" # scipy forces python <4.0 explicitly
scipy = "^1.10.0"
plotly = "^5.17.0"
statsmodels = "^0.14.0"
@@ -17,7 +17,7 @@ svglib = "^1.5.1"
aiohttp = "^3.8.4"
nbformat = "^5.9.2"
pandas-ta = "^0.3.14b"
openbb-core = "^0.1.0a4"
openbb-core = "^0.1.0a5"

[build-system]
requires = ["poetry-core"]
4 changes: 2 additions & 2 deletions openbb_platform/extensions/crypto/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "openbb-crypto"
version = "0.1.0a3"
version = "0.1.0a4"
description = "Crypto extension for OpenBB"
authors = ["OpenBB Team <[email protected]>"]
readme = "README.md"
packages = [{ include = "openbb_crypto" }]

[tool.poetry.dependencies]
python = "^3.8"
openbb-core = "^0.1.0a4"
openbb-core = "^0.1.0a5"

[build-system]
requires = ["poetry-core"]
8 changes: 4 additions & 4 deletions openbb_platform/extensions/econometrics/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[tool.poetry]
name = "openbb-econometrics"
version = "0.1.0a3"
version = "0.1.0a4"
description = "Econometrics Toolkit for OpenBB"
authors = ["OpenBB Team <[email protected]>"]
readme = "README.md"
packages = [{ include = "openbb_econometrics" }]

[tool.poetry.dependencies]
python = ">=3.8,<3.12" # scipy forces python <4.0 explicitly
python = ">=3.8,<3.12" # scipy forces python <4.0 explicitly
scipy = "^1.10.1"
statsmodels = "^0.14.0"
arch = "^5.5.0"
linearmodels = "<=4.25" # ^4.26 has setuptools-scm in setup_requires
openbb-core = { version = "^0.1.0a3" }
linearmodels = "<=4.25" # ^4.26 has setuptools-scm in setup_requires
openbb-core = { version = "^0.1.0a5" }

[build-system]
requires = ["poetry-core"]
Original file line number Diff line number Diff line change
@@ -166,7 +166,7 @@ def test_economy_index(params, headers):

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/economy/index?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
result = requests.get(url, headers=headers, timeout=20)
assert isinstance(result, requests.Response)
assert result.status_code == 200

@@ -360,7 +360,7 @@ def test_economy_sp500_multiples(params, headers):

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/economy/sp500_multiples?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
result = requests.get(url, headers=headers, timeout=20)
assert isinstance(result, requests.Response)
assert result.status_code == 200

4 changes: 2 additions & 2 deletions openbb_platform/extensions/economy/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "openbb-economy"
version = "0.1.0a3"
version = "0.1.0a4"
description = "Economy extension for OpenBB"
authors = ["OpenBB Team <[email protected]>"]
readme = "README.md"
packages = [{ include = "openbb_economy" }]

[tool.poetry.dependencies]
python = "^3.8"
openbb-core = "^0.1.0a4"
openbb-core = "^0.1.0a5"

[build-system]
requires = ["poetry-core"]
11 changes: 11 additions & 0 deletions openbb_platform/extensions/etf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ETF data extension for OpenBB SDK

This extension provides a set of commands for ETF data retrieval.

## Installation

To install the extension, run the following command in this folder:

```bash
pip install .
```
1 change: 1 addition & 0 deletions openbb_platform/extensions/etf/openbb_etf/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""OpenBB ETF Extension."""
40 changes: 40 additions & 0 deletions openbb_platform/extensions/etf/openbb_etf/etf_router.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""ETF Router."""

from openbb_core.app.model.command_context import CommandContext
from openbb_core.app.model.obbject import OBBject
from openbb_core.app.provider_interface import (
ExtraParams,
ProviderChoices,
StandardParams,
)
from openbb_core.app.query import Query
from openbb_core.app.router import Router
from pydantic import BaseModel

router = Router(prefix="")


# pylint: disable=unused-argument
@router.command(model="EtfSearch")
def search(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Search for ETFs.
An empty query returns the full list of ETFs from the provider.
"""
return OBBject(results=Query(**locals()).execute())


@router.command(model="EtfHistorical")
def historical(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""ETF Historical Market Price."""
return OBBject(results=Query(**locals()).execute())
18 changes: 18 additions & 0 deletions openbb_platform/extensions/etf/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[tool.poetry]
name = "openbb-etf"
version = "0.1.0a3"
description = "ETF extension for OpenBB"
authors = ["OpenBB Team <[email protected]>"]
readme = "README.md"
packages = [{ include = "openbb_etf" }]

[tool.poetry.dependencies]
python = "^3.8"
openbb-core = "^0.1.0a4"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.plugins."openbb_core_extension"]
etf = "openbb_etf.etf_router:router"
Empty file.
4 changes: 2 additions & 2 deletions openbb_platform/extensions/fixedincome/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "openbb-fixedincome"
version = "0.1.0a3"
version = "0.1.0a4"
description = "Fixed income extension for OpenBB"
authors = ["OpenBB Team <[email protected]>"]
readme = "README.md"
packages = [{ include = "openbb_fixedincome" }]

[tool.poetry.dependencies]
python = "^3.8"
openbb-core = "^0.1.0a4"
openbb-core = "^0.1.0a5"

[build-system]
requires = ["poetry-core"]
4 changes: 2 additions & 2 deletions openbb_platform/extensions/forex/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "openbb-forex"
version = "0.1.0a3"
version = "0.1.0a4"
description = "Forex extension for OpenBB"
authors = ["OpenBB Team <[email protected]>"]
readme = "README.md"
packages = [{ include = "openbb_forex" }]

[tool.poetry.dependencies]
python = "^3.8"
openbb-core = "^0.1.0a4"
openbb-core = "^0.1.0a5"

[build-system]
requires = ["poetry-core"]
4 changes: 2 additions & 2 deletions openbb_platform/extensions/futures/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "openbb-futures"
version = "0.1.0a3"
version = "0.1.0a4"
description = "Futures extension for OpenBB"
authors = ["OpenBB Team <[email protected]>"]
readme = "README.md"
packages = [{ include = "openbb_futures" }]

[tool.poetry.dependencies]
python = "^3.8"
openbb-core = "^0.1.0a4"
openbb-core = "^0.1.0a5"

[build-system]
requires = ["poetry-core"]
18 changes: 10 additions & 8 deletions openbb_platform/extensions/news/integration/test_news_api.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import base64

import pytest
import requests
from openbb_core.env import Env
from openbb_provider.utils.helpers import get_querystring


@pytest.fixture(scope="session")
def headers():
userpass = f"{Env().API_USERNAME}:{Env().API_PASSWORD}"
userpass_bytes = userpass.encode("ascii")
base64_bytes = base64.b64encode(userpass_bytes)

return {"Authorization": f"Basic {base64_bytes.decode('ascii')}"}
return {}


@pytest.mark.parametrize(
@@ -51,6 +44,15 @@ def headers():
"limit": 20,
}
),
(
{
"provider": "biztoc",
"filter": "tag",
"tag": "federalreserve",
"source": "bloomberg",
"term": "MSFT",
}
),
],
)
@pytest.mark.integration
Loading

0 comments on commit edf779f

Please sign in to comment.