mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
* dev install * add TMX provider extension * normalize ytm and coupopn_rate values * black * codespell * ruff * black again * pylint * ftw * undo what Pylint thinks is best * more black * renovate insider_trading standard model * fix tests * typo * tests * empty string * pylint unused argument * nans for some reason * black * static files * static files with openbb-tmx installed this time * yfinance TypeError..? * NA -> N/A * update for version bump * list exchange-calendars as tmx dependency * eod chains date -> eod_date * new line * not that file * more black * one more black * fix weird merge thing * ruff * index constituents params * insider trading * fixing things * black * black AGAIN * news integration params * the other missing param * ruff * historical dividends field update * add json_schema_extra * gainers * symbols -> symbol * company news symbol * unit test param * review items * wrangle a rogue field * index router example * company news thing - symbols -> symbol * field name map --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: James Maslek <jmaslek11@gmail.com>
95 lines
2.5 KiB
Python
95 lines
2.5 KiB
Python
"""Python interface integration tests for the derivatives extension."""
|
|
|
|
import pytest
|
|
from extensions.tests.conftest import parametrize
|
|
from openbb_core.app.model.obbject import OBBject
|
|
|
|
# pylint: disable=too-many-lines,redefined-outer-name
|
|
# pylint: disable=import-outside-toplevel,inconsistent-return-statements
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def obb(pytestconfig):
|
|
"""Fixture to setup obb."""
|
|
if pytestconfig.getoption("markexpr") != "not integration":
|
|
import openbb
|
|
|
|
return openbb.obb
|
|
|
|
|
|
@parametrize(
|
|
"params",
|
|
[
|
|
({"provider": "intrinio", "symbol": "AAPL", "date": "2023-01-25"}),
|
|
({"provider": "cboe", "symbol": "AAPL", "use_cache": False}),
|
|
(
|
|
{
|
|
"provider": "tmx",
|
|
"symbol": "SHOP",
|
|
"date": "2022-12-28",
|
|
"use_cache": False,
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_derivatives_options_chains(params, obb):
|
|
result = obb.derivatives.options.chains(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@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, obb):
|
|
result = obb.derivatives.options.unusual(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@parametrize(
|
|
"params",
|
|
[
|
|
(
|
|
{
|
|
"provider": "yfinance",
|
|
"interval": "1d",
|
|
"symbol": "CL,BZ",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
"expiration": "2025-12",
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_derivatives_futures_historical(params, obb):
|
|
result = obb.derivatives.futures.historical(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@parametrize(
|
|
"params",
|
|
[
|
|
({"symbol": "VX", "provider": "cboe", "date": None}),
|
|
({"provider": "yfinance", "symbol": "ES", "date": "2023-08-01"}),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_derivatives_futures_curve(params, obb):
|
|
result = obb.derivatives.futures.curve(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|