Get the current oil / energy benchmark price
Returns the current real-time price for a crude oil or energy benchmark (one `type` per request), with optional currency and unit conversion and 52-week high/low.
Example code
// Using @orth/sdk - The simplest way to call APIs
// Install: npm install @orth/sdk
import Orthogonal from "@orth/sdk";
const orthogonal = new Orthogonal({
apiKey: process.env.ORTHOGONAL_API_KEY,
});
const output = await orthogonal.run({
api: "api-ninjas",
path: "/v1/oilprice"
});
console.log(output);Query parameters
The oil/energy benchmark to return. Defaults to wti. crude_oil, brent_crude_oil, gasoline_rbob, and heating_oil are also accepted as aliases. (Allowed: wti, brent, natural_gas, gasoline, diesel) (Default: wti)
ISO 4217 currency code to convert the price into (e.g., EUR, GBP, INR).
Target unit to convert the price into. Must match the benchmark's dimension: crude oil, gasoline, and diesel (volume) accept barrel, gallon, liter, or cubic_meter; natural_gas (energy) accepts MMBtu, MWh, GJ, or therm. (Allowed: barrel, gallon, liter, cubic_meter, MMBtu, MWh, GJ, therm)