mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
101 lines
2.5 KiB
Python
101 lines
2.5 KiB
Python
"""Test crypto extension."""
|
|
|
|
import pytest
|
|
from openbb_core.app.model.obbject import OBBject
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def obb(pytestconfig):
|
|
"""Fixture to setup obb."""
|
|
|
|
if pytestconfig.getoption("markexpr") != "not integration":
|
|
import openbb
|
|
|
|
return openbb.obb
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
(
|
|
{
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"interval": "1min",
|
|
"provider": "fmp",
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-01-02",
|
|
"timeseries": 1,
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"interval": "1day",
|
|
"provider": "fmp",
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
"timeseries": 1,
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"multiplier": 1,
|
|
"timespan": "minute",
|
|
"sort": "desc",
|
|
"limit": 49999,
|
|
"adjusted": True,
|
|
"provider": "polygon",
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-01-02",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"multiplier": 1,
|
|
"timespan": "day",
|
|
"sort": "desc",
|
|
"limit": 49999,
|
|
"adjusted": True,
|
|
"provider": "polygon",
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-01-02",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"interval": "5m",
|
|
"period": "max",
|
|
"provider": "yfinance",
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-01-02",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"interval": "1d",
|
|
"period": "max",
|
|
"provider": "yfinance",
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_crypto_load(params, obb):
|
|
result = obb.crypto.load(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|