-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* removed options and futures * add derivatives extension * cleanup
- Loading branch information
Showing
21 changed files
with
631 additions
and
615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
openbb_platform/extensions/futures/README.md → ...platform/extensions/derivatives/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# Futures data extension for OpenBB Platform | ||
# OpenBB Derivatives Extension | ||
|
||
This extension provides a set of commands for futures data retrieval. | ||
This extension provides derivatives data for the OpenBB Platform. | ||
|
||
## Installation | ||
|
||
To install the extension, run the following command in this folder: | ||
|
||
```bash | ||
pip install openbb-futures | ||
pip install openbb-derivatives | ||
``` | ||
|
||
For development please check [Contribution Guidelines](https://github.com/OpenBB-finance/OpenBBTerminal/blob/develop/openbb_platform/CONTRIBUTING.md). | ||
|
||
Documentation available [here](https://docs.openbb.co/platform). | ||
Documentation available [here](https://docs.openbb.co/sdk). |
106 changes: 106 additions & 0 deletions
106
openbb_platform/extensions/derivatives/integration/test_derivatives_api.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
"""API integration tests for the derivatives extension.""" | ||
|
||
import pytest | ||
import requests | ||
from openbb_provider.utils.helpers import get_querystring | ||
|
||
# pylint: disable=too-many-lines,redefined-outer-name | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def headers(): | ||
return {} | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"params", | ||
[ | ||
({"provider": "intrinio", "symbol": "AAPL", "date": "2023-01-25"}), | ||
({"provider": "cboe", "symbol": "AAPL"}), | ||
], | ||
) | ||
@pytest.mark.integration | ||
def test_derivatives_options_chains(params, headers): | ||
params = {p: v for p, v in params.items() if v} | ||
|
||
query_str = get_querystring(params, []) | ||
url = f"http://0.0.0.0:8000/api/v1/derivatives/options/chains?{query_str}" | ||
result = requests.get(url, headers=headers, timeout=10) | ||
assert isinstance(result, requests.Response) | ||
assert result.status_code == 200 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"params", | ||
[ | ||
({"symbol": "AAPL"}), | ||
({"provider": "intrinio", "source": "delayed", "symbol": "AAPL"}), | ||
({"provider": "intrinio", "symbol": "PLTR", "source": "delayed"}), | ||
], | ||
) | ||
@pytest.mark.integration | ||
def test_derivatives_options_unusual(params, headers): | ||
params = {p: v for p, v in params.items() if v} | ||
|
||
query_str = get_querystring(params, []) | ||
url = f"http://0.0.0.0:8000/api/v1/derivatives/options/unusual?{query_str}" | ||
result = requests.get(url, headers=headers, timeout=10) | ||
assert isinstance(result, requests.Response) | ||
assert result.status_code == 200 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"params", | ||
[ | ||
( | ||
{ | ||
"provider": "yfinance", | ||
"symbol": "ES", | ||
"start_date": "2023-01-01", | ||
"end_date": "2023-06-06", | ||
"expiration": "2024-06", | ||
} | ||
), | ||
( | ||
{ | ||
"provider": "yfinance", | ||
"interval": "1d", | ||
"period": "max", | ||
"prepost": True, | ||
"adjust": True, | ||
"back_adjust": True, | ||
"symbol": "ES", | ||
"start_date": "2023-01-01", | ||
"end_date": "2023-06-06", | ||
"expiration": "2024-06", | ||
} | ||
), | ||
], | ||
) | ||
@pytest.mark.integration | ||
def test_derivatives_futures_historical(params, headers): | ||
params = {p: v for p, v in params.items() if v} | ||
|
||
query_str = get_querystring(params, []) | ||
url = f"http://0.0.0.0:8000/api/v1/derivatives/futures/historical?{query_str}" | ||
result = requests.get(url, headers=headers, timeout=10) | ||
assert isinstance(result, requests.Response) | ||
assert result.status_code == 200 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"params", | ||
[ | ||
({"provider": "cboe", "symbol": "VXM", "date": "2023-01-25"}), | ||
({"provider": "yfinance", "symbol": "ES", "date": "2023-08-01"}), | ||
], | ||
) | ||
@pytest.mark.integration | ||
def test_derivatives_futures_curve(params, headers): | ||
params = {p: v for p, v in params.items() if v} | ||
|
||
query_str = get_querystring(params, []) | ||
url = f"http://0.0.0.0:8000/api/v1/derivatives/futures/curve?{query_str}" | ||
result = requests.get(url, headers=headers, timeout=30) | ||
assert isinstance(result, requests.Response) | ||
assert result.status_code == 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
openbb_platform/extensions/derivatives/openbb_derivatives/derivatives_router.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"""Derivatives Router.""" | ||
|
||
from openbb_core.app.router import Router | ||
|
||
from openbb_derivatives.futures.futures_router import router as futures_router | ||
from openbb_derivatives.options.options_router import router as options_router | ||
|
||
router = Router(prefix="") | ||
router.include_router(options_router) | ||
router.include_router(futures_router) |
1 change: 1 addition & 0 deletions
1
openbb_platform/extensions/derivatives/openbb_derivatives/futures/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Futures.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
openbb_platform/extensions/derivatives/openbb_derivatives/options/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Options.""" |
File renamed without changes.
Oops, something went wrong.