openbb-oilpriceapi
OpenBB provider fetchers for source-timestamped records from OilPriceAPI. Dataset access depends on the API key's plan, source, and account entitlements.
Install
python -m pip install openbb-oilpriceapi
The package registers the oilpriceapi provider extension and these provider
models:
| Provider model | Fetcher | Purpose |
|---|---|---|
OilPrice |
OilPriceAPIFetcher |
Latest available price record |
OilHistorical |
OilHistoricalFetcher |
Versioned historical-period records |
These are provider fetchers, not an OpenBB router extension. OpenBB documents direct fetcher execution as the supported way to use a provider independently of a router.
Quickstart
Create or manage a key at the OilPriceAPI signup page, then set it outside your source code:
export OPENBB_OILPRICEAPI_API_KEY="your_key"
python examples/quickstart.py BRENT
The equivalent Python query is:
import asyncio
import os
from openbb_oilpriceapi.models import OilPriceAPIFetcher
prices = asyncio.run(
OilPriceAPIFetcher.fetch_data(
{"symbol": "BRENT"},
{"api_key": os.environ["OPENBB_OILPRICEAPI_API_KEY"]},
)
)
record = prices[0]
print(record.symbol, record.price, record.currency, record.updated_at, record.source)
For an OpenBB application settings file, the credential name is
oilpriceapi_api_key. After installing a provider into an existing OpenBB
environment, rebuild its extension map as described in the
OpenBB provider documentation.
Symbols
The package deliberately exposes a curated, versioned set of OpenBB-style
symbols rather than dynamically importing /commodities. OpenBB query choices
must be deterministic, while the API catalog and account entitlements can
change independently. A mapping means the provider can construct the request;
it does not guarantee that every API key can access that dataset. New mappings
are reviewed and shipped in provider releases.
| Symbol | OilPriceAPI code |
|---|---|
WTI |
WTI_USD |
BRENT |
BRENT_CRUDE_USD |
URALS |
URALS_CRUDE_USD |
DUBAI |
DUBAI_CRUDE_USD |
NG |
NATURAL_GAS_USD |
NG_EU |
DUTCH_TTF_EUR |
NG_UK |
NATURAL_GAS_GBP |
COAL |
COAL_USD |
DIESEL_US |
DIESEL_USD |
GASOLINE_US |
GASOLINE_USD |
Omitting symbol from OilPriceAPIFetcher requests the API's default latest
record. It does not request the complete catalog.
Historical Query
import asyncio
import os
from openbb_oilpriceapi.models import OilHistoricalFetcher
history = asyncio.run(
OilHistoricalFetcher.fetch_data(
{"symbol": "WTI", "period": "past_week"},
{"api_key": os.environ["OPENBB_OILPRICEAPI_API_KEY"]},
)
)
for record in history:
print(record.date, record.price, record.currency, record.unit, record.source)
Supported request values are past_day, past_week, past_month, and
past_year.
Response timestamps, units, currencies, and source labels are taken from the
API response. The provider raises a typed error instead of inventing values
when a successful response is empty or malformed.
Error Recovery
The public exception classes are:
AuthenticationError: add or replace the configured API key.EntitlementError: review the current pricing and access options.RateLimitError: retry after the account's rate-limit window.ProviderTimeoutError: retry the request later.ResponseSchemaError: preserve the response context and report upstream schema drift.NotFoundError: check the requested symbol mapping.
Product Facts
Do not copy plan limits, catalog totals, source cadence, or redistribution terms from this repository. Those facts change independently of the provider. Use the versioned product-facts contract, API documentation, and data-usage policy when publishing derived material.
Development
poetry install
poetry run pytest -q
poetry build
To run the bounded production smoke (one latest request and one past_year
request) with a safe test credential:
OPENBB_OILPRICEAPI_API_KEY="..." poetry run python scripts/live_smoke.py
The smoke prints only the returned symbol and history record count; it never prints the credential or request headers.
License
Metadata
Release files for openbb-oilpriceapi 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| openbb_oilpriceapi-0.3.2.tar.gz | 11.4 kB | Without provenance | Details for openbb_oilpriceapi-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openbb_oilpriceapi-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for openbb_oilpriceapi-0.3.2-py3-none-any.whl |
Total release size: 25.1 kB
Release files / openbb_oilpriceapi-0.3.2.tar.gz
| Download URL | openbb_oilpriceapi-0.3.2.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3ae8176847b21d391fa5d6c1a40eb0a438ea80541114a61a8ee454e7ec63c07
|
|
BLAKE2b-256 checksum How to use checksums |
f6cd885b2a560cef5a6cf1a4b1536c4b20c3a2bcf3a8a82457146e81ed7cdc8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.15 Linux/6.17.0-1022-azure
|
Release files / openbb_oilpriceapi-0.3.2-py3-none-any.whl
| Download URL | openbb_oilpriceapi-0.3.2-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d5d273a7ade4e9dc3d4898af8e29d25eb4d571efe97223a33c4cb080a76be39
|
|
BLAKE2b-256 checksum How to use checksums |
ac93549a3494250a54572ed89b5d6294aafbcf509b27d3992958299fdc80c111
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.15 Linux/6.17.0-1022-azure
|
Security for openbb-oilpriceapi 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.