mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
* init
* Update helpers.py
* filter URL on raise
* polygon, fmp done, update cassettes
* updates
* cleanup
* revert tests for now
* Update discovery_filings.py
* Update helpers.py
* add `async` overload to `Fetcher.extract_data`
* update merged fred models
* tests, improve fred series
* Update insider_trading.py
* insider
* tests
* intrinio
* Update equity_historical.py
* implement abstract async extract on Fetcher, with simple switch
* cleanup
* Update helpers.py
* Update helpers.py
* fix fmp historical deprecated urls
* Revert "fix fmp historical deprecated urls"
This reverts commit 1a760a2473.
* fix fmp `index.market` 1day url missing query params
* Update test_fmp_market_indices_fetcher.yaml
* field fixes
* `extract_data_async` -> `aextract_data`, `async_request` -> `amake_request`
* `async_requests` -> `amake_requests`
* Update company_news.py
* add sort to index `integration` params
* add `client.py` tests
* Update equity_search.py
* Add lost v in platform api version string
* Resolve linter errors here and there
---------
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
264 lines
6.3 KiB
Python
264 lines
6.3 KiB
Python
"""Test economy extension."""
|
|
|
|
import pytest
|
|
from extensions.tests.conftest import parametrize
|
|
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
|
|
|
|
|
|
@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
|
|
|
|
|
|
@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,
|
|
"sort": "desc",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"interval": "1day",
|
|
"provider": "fmp",
|
|
"symbol": "^DJI",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
"timeseries": 1,
|
|
"sort": "desc",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"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
|
|
|
|
|
|
@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
|
|
|
|
|
|
@parametrize(
|
|
"params",
|
|
[
|
|
({"symbol": "BUKBUS", "provider": "cboe"}),
|
|
],
|
|
)
|
|
@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
|
|
|
|
|
|
@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
|
|
|
|
|
|
@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
|
|
|
|
|
|
@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
|
|
|
|
|
|
@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
|