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 maps the following OpenBB-style symbols to OilPriceAPI codes. A mapping means the provider can construct the request; it does not guarantee that every API key can access that dataset.
| 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, and past_month.
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
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openbb_oilpriceapi-0.2.0.tar.gz.
File metadata
- Download URL: openbb_oilpriceapi-0.2.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.13 Linux/6.17.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e0fef0744962e42497a198c6ac86d595eabf57cd76250a41a222465e8affae5
|
|
| MD5 |
3501a8c6b90a0cf16c9302de5fa5384e
|
|
| BLAKE2b-256 |
ade2581a632e3b6cd6aac6d158cceb9d984074ae8a350eed7fd4d863a747ea26
|
File details
Details for the file openbb_oilpriceapi-0.2.0-py3-none-any.whl.
File metadata
- Download URL: openbb_oilpriceapi-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.13 Linux/6.17.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df266624a75142d7baa52d208682ffdf2f18b729c1ae0d6c594f1e1ac9ebd1e2
|
|
| MD5 |
ae64bb17eb6ebb1bbda25fc130e32021
|
|
| BLAKE2b-256 |
3601d5895ae768ffcfec1d661d280853b1ecb8e1746937b760f9dffbeea04576
|