Get the official daily spot price for an oil / energy benchmark
Returns the U.S. EIA's official daily spot price for the benchmark's physical hub, one `type` per request. The EIA publishes weekly, so the date field says which trading day the price is for.
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/oilspot"
});
console.log(output);Query parameters
The 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)