-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Open
Description
Summary
Request to add OilPriceAPI as a provider for real-time oil and commodity prices.
Provider Details
- Name: oilpriceapi
- Website: https://oilpriceapi.com
- API Documentation: https://docs.oilpriceapi.com
- PyPI Package: https://pypi.org/project/openbb-oilpriceapi/ (pending)
- GitHub: https://github.com/OilpriceAPI/openbb-oilpriceapi
Supported Data
- Crude Oil: WTI, Brent, Urals, Dubai
- Natural Gas: US (Henry Hub), EU (TTF), UK (NBP)
- Other: Coal, Diesel, Gasoline
Features Implemented
OilPricefetcher - Latest prices for all commoditiesOilHistoricalfetcher - Historical prices (past_day, past_week, past_month)- Error handling with retries (exponential backoff for rate limits)
- 89% test coverage (43 tests)
Why Add This Provider?
- Commodity Focus: OpenBB lacks a dedicated commodity price provider
- Reliability: Built-in retry logic and comprehensive error handling
- Free Tier: Users can get started with a free API key
- Well-Documented: Full README with examples and API reference
Implementation
The provider follows OpenBB conventions:
- Fetcher pattern with
transform_query,aextract_data,transform_data - Pydantic models for query params and data
- Symbol mapping between OpenBB and API codes
Usage Example
from openbb import obb
obb.user.credentials.oilpriceapi_api_key = "your_key"
# Get all commodity prices
prices = obb.commodity.oil.price(provider="oilpriceapi")
# Get historical WTI prices
history = obb.commodity.oil.historical(symbol="WTI", period="past_week", provider="oilpriceapi")I'm happy to submit a PR with the full provider implementation if you're interested in including it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels