mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
* FMP * tiingo * yfinance * intrinio * polygon * fmp interval descriptions * alpha_vantage * update unit tests * tests * static files * black * black * black again * codespell * codespell again * futures historical * ruff * some more black * pylint * now black again * test params * skip deprecated * fmp test cassette * fix some tests * fix test_query * fix bad symbol in toolkit integration tests * attempt at parameter deprecation warning * Fix edge case * test params * more test params * that's the ticket --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
107 lines
2.7 KiB
Python
107 lines
2.7 KiB
Python
"""Test crypto extension."""
|
|
|
|
import pytest
|
|
from extensions.tests.conftest import parametrize
|
|
from openbb_core.app.model.obbject import OBBject
|
|
|
|
# pylint: disable=redefined-outer-name
|
|
|
|
|
|
@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
|
|
|
|
|
|
@parametrize(
|
|
"params",
|
|
[
|
|
({"query": "asd"}),
|
|
({"query": "btc", "provider": "fmp"}),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_crypto_search(params, obb):
|
|
params = {p: v for p, v in params.items() if v}
|
|
|
|
result = obb.crypto.search(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@parametrize(
|
|
"params",
|
|
[
|
|
(
|
|
{
|
|
"interval": "1d",
|
|
"provider": "fmp",
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-01-02",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"interval": "1m",
|
|
"sort": "desc",
|
|
"limit": 49999,
|
|
"provider": "polygon",
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-01-02",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"interval": "1d",
|
|
"sort": "desc",
|
|
"limit": 49999,
|
|
"provider": "polygon",
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"interval": "1d",
|
|
"provider": "yfinance",
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-01-04",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"provider": "tiingo",
|
|
"interval": "1d",
|
|
"exchanges": None,
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"provider": "tiingo",
|
|
"interval": "1h",
|
|
"exchanges": ["POLONIEX", "GDAX"],
|
|
"symbol": "BTCUSD",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-01-02",
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_crypto_price_historical(params, obb):
|
|
result = obb.crypto.price.historical(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|