Files
OpenBB/openbb_platform/extensions/index/integration/test_index_python.py
Pratyush Shukla 9219a63c00 New Intrinio Endpoints (#5789)
* redefined CalendarDividend standard model

* fix nasdaq calendar dividend model

* removed Filings standard model

* add DiscoveryFilings standard model

* fix fmp calendar dividend and discovery filing models

* add cik description in standard model utils

* redefine CompanyFilings standard model

* fix fmp company filings model

* fix sec company filings model

* remove regulators/sec/filings command

* redefine InsiderTrading standard model

* fix fmp insider trading model

* redefine InstitutionalOwnership standard model

* fix fmp institutional ownership model

* redefine KeyMetrics standard model

* fix fmp key metrics model

* fix fmp market snapshots model

* add attributes standard model and commands

* redefine EquityInfo standard model

* remove SearchFinancialAttributes standard model file

* add new intrinio endpoints

* linting

* pass standard model description test

* fix tests? w/@montezdesousa

* pass fmp fetcher tests

* re-record sec company filings test

* pass intrinio fetcher tests

* re-record intrinio insider trading test

* index integration test

* regulators integration test

* equity integration test

* fix same owner name in intrinio instituional ownership

* re-record intrinio insider training

* crypto price historical integration test reduce end_date
2023-11-27 12:35:19 +00:00

283 lines
6.8 KiB
Python

"""Test economy extension."""
import pytest
from openbb_core.app.model.obbject import OBBject
@pytest.fixture(scope="session")
def obb(pytestconfig): # pylint: disable=inconsistent-return-statements
"""Fixture to setup obb."""
if pytestconfig.getoption("markexpr") != "not integration":
import openbb # pylint: disable=import-outside-toplevel
return openbb.obb
# pylint: disable=redefined-outer-name
@pytest.mark.parametrize(
"params",
[
({"index": "dowjones"}),
],
)
@pytest.mark.integration
def test_index_constituents(params, obb):
result = obb.index.constituents(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
@pytest.mark.parametrize(
"params",
[
(
{
"symbol": "AAVE100",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
(
{
"interval": "1m",
"provider": "cboe",
"symbol": "AAVE100",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
(
{
"interval": "1d",
"provider": "cboe",
"symbol": "AAVE100",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
(
{
"interval": "1min",
"provider": "fmp",
"symbol": "^DJI",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"timeseries": 1,
}
),
(
{
"interval": "1day",
"provider": "fmp",
"symbol": "^DJI",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"timeseries": 1,
}
),
(
{
"timespan": "minute",
"sort": "desc",
"limit": 49999,
"adjusted": True,
"multiplier": 1,
"provider": "polygon",
"symbol": "NDX",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
(
{
"timespan": "day",
"sort": "desc",
"limit": 49999,
"adjusted": True,
"multiplier": 1,
"provider": "polygon",
"symbol": "NDX",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
(
{
"interval": "1d",
"period": "max",
"prepost": True,
"rounding": True,
"provider": "yfinance",
"symbol": "DJI",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
(
{
"provider": "intrinio",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"symbol": "$DJI",
"tag": "level",
"sort": "desc",
"limit": 100,
"type": None,
}
),
],
)
@pytest.mark.integration
def test_index_market(params, obb):
result = obb.index.market(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
@pytest.mark.parametrize(
"params",
[
(
{
"symbol": "BUKBUS",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
(
{
"interval": "1m",
"provider": "cboe",
"symbol": "BUKBUS",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
(
{
"interval": "1d",
"provider": "cboe",
"symbol": "BUKBUS",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
],
)
@pytest.mark.integration
def test_index_european(params, obb):
result = obb.index.european(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
@pytest.mark.parametrize(
"params",
[
({"symbol": "BUKBUS"}),
],
)
@pytest.mark.integration
def test_index_european_constituents(params, obb):
result = obb.index.european_constituents(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
@pytest.mark.parametrize(
"params",
[
({}),
({"europe": True, "provider": "cboe"}),
({"provider": "fmp"}),
({"provider": "yfinance"}),
],
)
@pytest.mark.integration
def test_index_available(params, obb):
result = obb.index.available(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
@pytest.mark.parametrize(
"params",
[
({"query": "D", "is_symbol": True}),
({"europe": True, "provider": "cboe", "query": "A", "is_symbol": False}),
],
)
@pytest.mark.integration
def test_index_search(params, obb):
result = obb.index.search(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
@pytest.mark.parametrize(
"params",
[
({"region": "US"}),
],
)
@pytest.mark.integration
def test_index_snapshots(params, obb):
result = obb.index.snapshots(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
@pytest.mark.parametrize(
"params",
[
(
{
"series_name": "PE Ratio by Month",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"collapse": "monthly",
"transform": "diff",
"provider": "nasdaq",
}
),
],
)
@pytest.mark.integration
def test_index_sp500_multiples(params, obb):
result = obb.index.sp500_multiples(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
assert len(result.results) > 0
@pytest.mark.parametrize(
"params",
[
(
{
"symbol": "$GDP",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"limit": 100,
}
),
],
)
@pytest.mark.integration
def test_index_fred(params, obb):
result = obb.index.fred(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0