mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
feature/commodities-lbma-fixing: Adds Commodity Extension and LBMA Gold/Silver daily fixing levels (#5760)
* add commodity extension and add lbma fixing endpoint * dev_install.py * readme url * renovate the standard model * makes a query_params model for nasdaq data link * literal not optional * unused imports * missing test params * test cassette * DataLink query param description * test file import * actually fix import * from openbb_core.provider..... * ruff * another import statement * black * async router * move query_params * update version * version numbers * extension_map * satisfy pylint? * pylint * Update pyproject.toml * black * poetry lock * Update extension_map.json * Update __extensions__.py * Update module_map.json * clean descriptions --------- Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
"""Test Commodity extension."""
|
||||
|
||||
import pytest
|
||||
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
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"params",
|
||||
[
|
||||
(
|
||||
{
|
||||
"asset": "gold",
|
||||
"start_date": None,
|
||||
"end_date": None,
|
||||
"collapse": None,
|
||||
"transform": None,
|
||||
"provider": "nasdaq",
|
||||
}
|
||||
),
|
||||
(
|
||||
{
|
||||
"asset": "silver",
|
||||
"start_date": "1990-01-01",
|
||||
"end_date": "2023-01-01",
|
||||
"collapse": "monthly",
|
||||
"transform": "diff",
|
||||
"provider": "nasdaq",
|
||||
}
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_commodity_lbma_fixing(params, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
|
||||
result = obb.commodity.lbma_fixing(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
Reference in New Issue
Block a user