feat(oilpriceapi): add OilPriceAPI provider with CommoditySpotPrices - #7631
Open
karlwaldman wants to merge 2 commits into
Open
feat(oilpriceapi): add OilPriceAPI provider with CommoditySpotPrices#7631karlwaldman wants to merge 2 commits into
karlwaldman wants to merge 2 commits into
Conversation
Adds a new provider extension for OilPriceAPI (https://www.oilpriceapi.com), implementing the `CommoditySpotPrices` standard model behind `obb.commodity.price.spot`. Today that command has a single provider, `fred`, which serves 12 hardcoded FRED series at daily-or-slower cadence. OilPriceAPI's public catalogue (GET /v1/commodities) exposes 463 series — crude benchmarks, natural gas, refined products, coal, carbon, marine fuels and drilling activity — each carrying its own source timestamp and freshness metadata. Behaviour: - No start_date/end_date -> latest observation via /v1/prices/latest - Either date supplied -> daily series via /v1/prices/historical - `commodity` accepts friendly aliases (brent, wti, dutch_ttf, eu_carbon, ...) or any raw catalogue code, forwarded unchanged Depends only on openbb-core; uses amake_request rather than adding an HTTP client. Error envelopes from the API carry a code, message and request_id and are surfaced rather than swallowed. EmptyDataError distinguishes "unknown commodity" from "valid commodity, empty window". Verified against the live API before submission: latest brent -> 1 row 2026-08-05 BRENT_CRUDE_USD 79.31 barrel USD wti 2026-07-01..07-31 -> 29 rows 2026-07-01 WTI_USD 68.83 barrel USD raw code passthrough -> DUTCH_TTF_EUR 53.44 mwh EUR unknown commodity -> EmptyDataError naming /v1/commodities invalid credential -> OpenBBError UNAUTHORIZED with request_id empty date window -> EmptyDataError reporting records found vs window Registered as an optional provider in dev_install.py, matching the pattern used by nasdaq/tmx. Free tier is 200 requests/month with no card required, and a keyless demo endpoint (/v1/demo/prices) is available for evaluation without signing up.
…sts, README The provider implementation itself; the preceding commit registered it in dev_install.py. Verified against the live API before submission: latest brent -> 1 row 2026-08-05 BRENT_CRUDE_USD 79.31 barrel USD wti 2026-07-01..07-31 -> 29 rows 2026-07-01 WTI_USD 68.83 barrel USD raw code passthrough -> DUTCH_TTF_EUR 53.44 mwh EUR unknown commodity -> EmptyDataError naming /v1/commodities invalid credential -> OpenBBError UNAUTHORIZED with request_id empty date window -> EmptyDataError reporting records found vs window
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a provider extension for OilPriceAPI, implementing the
CommoditySpotPricesstandard model behindobb.commodity.price.spot.That command currently has one provider,
fred, serving 12 hardcoded FRED series. OilPriceAPI's public catalogue (GET /v1/commodities) exposes 463 series — crude benchmarks, natural gas, refined products, coal, carbon, marine fuels and drilling activity — each carrying its own source timestamp and freshness metadata.Behaviour
start_date/end_date/v1/prices/latest— latest observation/v1/prices/historical— daily seriescommodityaccepts friendly aliases (brent,wti,dutch_ttf,eu_carbon, …) or any raw catalogue code, forwarded unchanged.Design notes
openbb-core. Usesamake_requestrather than adding an HTTP client.code,messageandrequest_id— surfaced rather than swallowed.EmptyDataErrordistinguishes unknown commodity from valid commodity, empty window; the first message points at/v1/commodities.dev_install.py, matching thenasdaq/tmxpattern.Verification
Run against the live API before submission, not just unit-tested:
Credentials for review
Free tier is 200 requests/month, no card required (https://www.oilpriceapi.com/auth/signup). There is also a keyless demo endpoint if you'd rather not sign up at all:
Happy to provide a reviewer key — just say where to send it.
Not included
tests/record/cassettes are not committed:record_httpneeds to run in your CI environment to capture them against a real key. Glad to add them however you prefer — or I can record with a throwaway key if that's the convention.Docs: https://docs.oilpriceapi.com · OpenAPI: https://api.oilpriceapi.com/.well-known/openapi.json