mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
* add eia provider and weekly petroleum status report * codespell * sort imports * lint and update lock * move raise up in try block * add STEO * steo tests * linting * mypy * readme and docstring grammar police * fix test..? * add symbol field to steo * static files * update integration test * mypy * pylint * fix test..? * undo attempt to fix test * add empty init file * add empty init file * change package name so the tests don't fail * some updates * lint --------- Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
81 lines
2.2 KiB
Python
81 lines
2.2 KiB
Python
"""The Commodity router."""
|
|
|
|
# pylint: disable=unused-argument,unused-import
|
|
# flake8: noqa: F401
|
|
|
|
# pylint: disable=unused-argument
|
|
|
|
from openbb_core.app.model.command_context import CommandContext
|
|
from openbb_core.app.model.example import APIEx
|
|
from openbb_core.app.model.obbject import OBBject
|
|
from openbb_core.app.provider_interface import (
|
|
ExtraParams,
|
|
ProviderChoices,
|
|
StandardParams,
|
|
)
|
|
from openbb_core.app.query import Query
|
|
from openbb_core.app.router import Router
|
|
|
|
from openbb_commodity.price.price_router import router as price_router
|
|
|
|
router = Router(prefix="", description="Commodity market data.")
|
|
|
|
|
|
router.include_router(price_router)
|
|
|
|
|
|
@router.command(
|
|
model="PetroleumStatusReport",
|
|
examples=[
|
|
APIEx(
|
|
description="Get the EIA's Weekly Petroleum Status Report.",
|
|
parameters={"provider": "eia"},
|
|
),
|
|
APIEx(
|
|
description="Select the category of data, and filter for a specific table within the report.",
|
|
parameters={
|
|
"category": "weekly_estimates",
|
|
"table": "imports",
|
|
"provider": "eia",
|
|
},
|
|
),
|
|
],
|
|
)
|
|
async def petroleum_status_report(
|
|
cc: CommandContext,
|
|
provider_choices: ProviderChoices,
|
|
standard_params: StandardParams,
|
|
extra_params: ExtraParams,
|
|
) -> OBBject:
|
|
"""EIA Weekly Petroleum Status Report."""
|
|
return await OBBject.from_query(Query(**locals()))
|
|
|
|
|
|
@router.command(
|
|
model="ShortTermEnergyOutlook",
|
|
examples=[
|
|
APIEx(
|
|
description="Get the EIA's Short Term Energy Outlook.",
|
|
parameters={"provider": "eia"},
|
|
),
|
|
APIEx(
|
|
description="Select the specific table of data from the STEO. Table 03d is World Crude Oil Production.",
|
|
parameters={
|
|
"table": "03d",
|
|
"provider": "eia",
|
|
},
|
|
),
|
|
],
|
|
)
|
|
async def short_term_energy_outlook(
|
|
cc: CommandContext,
|
|
provider_choices: ProviderChoices,
|
|
standard_params: StandardParams,
|
|
extra_params: ExtraParams,
|
|
) -> OBBject:
|
|
"""Monthly short term (18 month) projections using EIA's STEO model.
|
|
|
|
Source: www.eia.gov/steo/
|
|
"""
|
|
return await OBBject.from_query(Query(**locals()))
|