oilpriceapi 0.6.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +418 -123
- package/dist/cjs/client.js +490 -0
- package/dist/cjs/errors.js +80 -0
- package/dist/cjs/index.js +82 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/resources/alerts.js +387 -0
- package/dist/cjs/resources/analytics.js +226 -0
- package/dist/cjs/resources/bunker-fuels.js +196 -0
- package/dist/cjs/resources/commodities.js +115 -0
- package/dist/cjs/resources/data-quality.js +144 -0
- package/dist/cjs/resources/data-sources.js +297 -0
- package/dist/cjs/resources/diesel.js +119 -0
- package/dist/cjs/resources/drilling.js +269 -0
- package/dist/cjs/resources/ei/drilling-productivity.js +108 -0
- package/dist/cjs/resources/ei/forecasts.js +106 -0
- package/dist/cjs/resources/ei/frac-focus.js +155 -0
- package/dist/cjs/resources/ei/index.js +98 -0
- package/dist/cjs/resources/ei/oil-inventories.js +97 -0
- package/dist/cjs/resources/ei/opec-production.js +97 -0
- package/dist/cjs/resources/ei/rig-counts.js +93 -0
- package/dist/cjs/resources/ei/well-permits.js +124 -0
- package/dist/cjs/resources/forecasts.js +162 -0
- package/dist/cjs/resources/futures.js +233 -0
- package/dist/cjs/resources/rig-counts.js +161 -0
- package/dist/cjs/resources/storage.js +166 -0
- package/dist/cjs/resources/webhooks.js +294 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/version.js +24 -0
- package/dist/client.d.ts +116 -5
- package/dist/client.js +169 -47
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +25 -16
- package/dist/index.d.ts +45 -6
- package/dist/index.js +40 -3
- package/dist/resources/alerts.d.ts +52 -15
- package/dist/resources/alerts.js +121 -109
- package/dist/resources/analytics.d.ts +325 -0
- package/dist/resources/analytics.js +222 -0
- package/dist/resources/bunker-fuels.d.ts +270 -0
- package/dist/resources/bunker-fuels.js +192 -0
- package/dist/resources/commodities.d.ts +148 -0
- package/dist/resources/commodities.js +111 -0
- package/dist/resources/data-quality.d.ts +229 -0
- package/dist/resources/data-quality.js +140 -0
- package/dist/resources/data-sources.d.ts +365 -0
- package/dist/resources/data-sources.js +293 -0
- package/dist/resources/diesel.d.ts +1 -1
- package/dist/resources/diesel.js +9 -38
- package/dist/resources/drilling.d.ts +403 -0
- package/dist/resources/drilling.js +265 -0
- package/dist/resources/ei/drilling-productivity.d.ts +173 -0
- package/dist/resources/ei/drilling-productivity.js +104 -0
- package/dist/resources/ei/forecasts.d.ts +177 -0
- package/dist/resources/ei/forecasts.js +102 -0
- package/dist/resources/ei/frac-focus.d.ts +212 -0
- package/dist/resources/ei/frac-focus.js +151 -0
- package/dist/resources/ei/index.d.ts +140 -0
- package/dist/resources/ei/index.js +88 -0
- package/dist/resources/ei/oil-inventories.d.ts +155 -0
- package/dist/resources/ei/oil-inventories.js +93 -0
- package/dist/resources/ei/opec-production.d.ts +146 -0
- package/dist/resources/ei/opec-production.js +93 -0
- package/dist/resources/ei/rig-counts.d.ts +131 -0
- package/dist/resources/ei/rig-counts.js +89 -0
- package/dist/resources/ei/well-permits.d.ts +178 -0
- package/dist/resources/ei/well-permits.js +120 -0
- package/dist/resources/forecasts.d.ts +200 -0
- package/dist/resources/forecasts.js +158 -0
- package/dist/resources/futures.d.ts +322 -0
- package/dist/resources/futures.js +229 -0
- package/dist/resources/rig-counts.d.ts +221 -0
- package/dist/resources/rig-counts.js +157 -0
- package/dist/resources/storage.d.ts +182 -0
- package/dist/resources/storage.js +162 -0
- package/dist/resources/webhooks.d.ts +326 -0
- package/dist/resources/webhooks.js +290 -0
- package/dist/types.d.ts +79 -8
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -2
- package/package.json +17 -8
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Energy Intelligence Resource
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive energy market intelligence including rig counts, inventories,
|
|
5
|
+
* OPEC production, drilling productivity, forecasts, well permits, and FracFocus data.
|
|
6
|
+
*/
|
|
7
|
+
import type { OilPriceAPI } from "../../client.js";
|
|
8
|
+
import { EIRigCountsResource } from "./rig-counts.js";
|
|
9
|
+
import { EIOilInventoriesResource } from "./oil-inventories.js";
|
|
10
|
+
import { EIOPECProductionResource } from "./opec-production.js";
|
|
11
|
+
import { EIDrillingProductivityResource } from "./drilling-productivity.js";
|
|
12
|
+
import { EIForecastsResource } from "./forecasts.js";
|
|
13
|
+
import { EIWellPermitsResource } from "./well-permits.js";
|
|
14
|
+
import { EIFracFocusResource } from "./frac-focus.js";
|
|
15
|
+
/**
|
|
16
|
+
* Well timeline event
|
|
17
|
+
*/
|
|
18
|
+
export interface WellTimelineEvent {
|
|
19
|
+
/** Event type */
|
|
20
|
+
event_type: string;
|
|
21
|
+
/** Event date */
|
|
22
|
+
date: string;
|
|
23
|
+
/** Event description */
|
|
24
|
+
description?: string;
|
|
25
|
+
/** Source of data */
|
|
26
|
+
source?: string;
|
|
27
|
+
/** Additional metadata */
|
|
28
|
+
metadata?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Well timeline data
|
|
32
|
+
*/
|
|
33
|
+
export interface WellTimeline {
|
|
34
|
+
/** API well number */
|
|
35
|
+
api_number: string;
|
|
36
|
+
/** Well name */
|
|
37
|
+
well_name?: string;
|
|
38
|
+
/** Operator */
|
|
39
|
+
operator?: string;
|
|
40
|
+
/** State */
|
|
41
|
+
state?: string;
|
|
42
|
+
/** Timeline events */
|
|
43
|
+
events: WellTimelineEvent[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Energy Intelligence Resource
|
|
47
|
+
*
|
|
48
|
+
* Access comprehensive energy market intelligence from EIA, Baker Hughes,
|
|
49
|
+
* FracFocus, and other authoritative sources.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* import { OilPriceAPI } from 'oilpriceapi';
|
|
54
|
+
*
|
|
55
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
56
|
+
*
|
|
57
|
+
* // Rig counts
|
|
58
|
+
* const rigCounts = await client.ei.rigCounts.latest();
|
|
59
|
+
* console.log(`Total rigs: ${rigCounts.total_rigs}`);
|
|
60
|
+
*
|
|
61
|
+
* // Oil inventories
|
|
62
|
+
* const inventories = await client.ei.oilInventories.latest();
|
|
63
|
+
* console.log(`Crude stocks: ${inventories.level} ${inventories.unit}`);
|
|
64
|
+
*
|
|
65
|
+
* // OPEC production
|
|
66
|
+
* const opec = await client.ei.opecProduction.total();
|
|
67
|
+
* console.log(`OPEC production: ${opec.total_production_bpd} bpd`);
|
|
68
|
+
*
|
|
69
|
+
* // Well timeline
|
|
70
|
+
* const timeline = await client.ei.wellTimeline('42-123-12345');
|
|
71
|
+
* timeline.events.forEach(e => {
|
|
72
|
+
* console.log(`${e.date}: ${e.event_type}`);
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare class EnergyIntelligenceResource {
|
|
77
|
+
private client;
|
|
78
|
+
/**
|
|
79
|
+
* Baker Hughes rig count data
|
|
80
|
+
*/
|
|
81
|
+
readonly rigCounts: EIRigCountsResource;
|
|
82
|
+
/**
|
|
83
|
+
* EIA crude oil inventory data
|
|
84
|
+
*/
|
|
85
|
+
readonly oilInventories: EIOilInventoriesResource;
|
|
86
|
+
/**
|
|
87
|
+
* OPEC production data
|
|
88
|
+
*/
|
|
89
|
+
readonly opecProduction: EIOPECProductionResource;
|
|
90
|
+
/**
|
|
91
|
+
* EIA drilling productivity report data
|
|
92
|
+
*/
|
|
93
|
+
readonly drillingProductivity: EIDrillingProductivityResource;
|
|
94
|
+
/**
|
|
95
|
+
* EIA and IEA forecast data
|
|
96
|
+
*/
|
|
97
|
+
readonly forecasts: EIForecastsResource;
|
|
98
|
+
/**
|
|
99
|
+
* Well permit data
|
|
100
|
+
*/
|
|
101
|
+
readonly wellPermits: EIWellPermitsResource;
|
|
102
|
+
/**
|
|
103
|
+
* FracFocus disclosure data
|
|
104
|
+
*/
|
|
105
|
+
readonly fracFocus: EIFracFocusResource;
|
|
106
|
+
constructor(client: OilPriceAPI);
|
|
107
|
+
/**
|
|
108
|
+
* Get well timeline by API number
|
|
109
|
+
*
|
|
110
|
+
* Returns chronological timeline of events for a specific well including
|
|
111
|
+
* permits, drilling, completion, production, and FracFocus disclosures.
|
|
112
|
+
*
|
|
113
|
+
* @param apiNumber - API well number (e.g., "42-123-12345")
|
|
114
|
+
* @returns Well timeline with events
|
|
115
|
+
*
|
|
116
|
+
* @throws {NotFoundError} If well not found
|
|
117
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const timeline = await client.ei.wellTimeline('42-123-12345');
|
|
122
|
+
* console.log(`Well: ${timeline.well_name}`);
|
|
123
|
+
* console.log(`Operator: ${timeline.operator}`);
|
|
124
|
+
* console.log(`Events: ${timeline.events.length}`);
|
|
125
|
+
*
|
|
126
|
+
* timeline.events.forEach(event => {
|
|
127
|
+
* console.log(`${event.date}: ${event.event_type} - ${event.description}`);
|
|
128
|
+
* });
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
wellTimeline(apiNumber: string): Promise<WellTimeline>;
|
|
132
|
+
}
|
|
133
|
+
export type { RigCountRecord, RigCountByBasin, RigCountByState, HistoricalRigCount, } from "./rig-counts.js";
|
|
134
|
+
export type { OilInventoryRecord, OilInventorySummary, InventoryByProduct, HistoricalInventory, CushingInventory, } from "./oil-inventories.js";
|
|
135
|
+
export type { OPECProductionRecord, TotalOPECProduction, ProductionByCountry, HistoricalProduction, TopProducer, } from "./opec-production.js";
|
|
136
|
+
export type { DrillingProductivityRecord, DrillingProductivitySummary, DUCWellInventory, ProductivityByBasin, HistoricalProductivity, ProductivityTrend, } from "./drilling-productivity.js";
|
|
137
|
+
export type { ForecastRecord, ForecastSummary, PriceForecast, ProductionForecast, HistoricalForecast, ForecastComparison, } from "./forecasts.js";
|
|
138
|
+
export type { WellPermitRecord, WellPermitSummary, PermitsByState, PermitsByOperator, PermitsByFormation, WellPermitSearchQuery, } from "./well-permits.js";
|
|
139
|
+
export type { FracFocusRecord, FracFocusSummary, DisclosuresByState, DisclosuresByOperator, ChemicalUsage, WellChemical, FracFocusSearchQuery, } from "./frac-focus.js";
|
|
140
|
+
export { EIRigCountsResource, EIOilInventoriesResource, EIOPECProductionResource, EIDrillingProductivityResource, EIForecastsResource, EIWellPermitsResource, EIFracFocusResource, };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Energy Intelligence Resource
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive energy market intelligence including rig counts, inventories,
|
|
5
|
+
* OPEC production, drilling productivity, forecasts, well permits, and FracFocus data.
|
|
6
|
+
*/
|
|
7
|
+
import { EIRigCountsResource } from "./rig-counts.js";
|
|
8
|
+
import { EIOilInventoriesResource } from "./oil-inventories.js";
|
|
9
|
+
import { EIOPECProductionResource } from "./opec-production.js";
|
|
10
|
+
import { EIDrillingProductivityResource } from "./drilling-productivity.js";
|
|
11
|
+
import { EIForecastsResource } from "./forecasts.js";
|
|
12
|
+
import { EIWellPermitsResource } from "./well-permits.js";
|
|
13
|
+
import { EIFracFocusResource } from "./frac-focus.js";
|
|
14
|
+
import { ValidationError } from "../../errors.js";
|
|
15
|
+
/**
|
|
16
|
+
* Energy Intelligence Resource
|
|
17
|
+
*
|
|
18
|
+
* Access comprehensive energy market intelligence from EIA, Baker Hughes,
|
|
19
|
+
* FracFocus, and other authoritative sources.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { OilPriceAPI } from 'oilpriceapi';
|
|
24
|
+
*
|
|
25
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
26
|
+
*
|
|
27
|
+
* // Rig counts
|
|
28
|
+
* const rigCounts = await client.ei.rigCounts.latest();
|
|
29
|
+
* console.log(`Total rigs: ${rigCounts.total_rigs}`);
|
|
30
|
+
*
|
|
31
|
+
* // Oil inventories
|
|
32
|
+
* const inventories = await client.ei.oilInventories.latest();
|
|
33
|
+
* console.log(`Crude stocks: ${inventories.level} ${inventories.unit}`);
|
|
34
|
+
*
|
|
35
|
+
* // OPEC production
|
|
36
|
+
* const opec = await client.ei.opecProduction.total();
|
|
37
|
+
* console.log(`OPEC production: ${opec.total_production_bpd} bpd`);
|
|
38
|
+
*
|
|
39
|
+
* // Well timeline
|
|
40
|
+
* const timeline = await client.ei.wellTimeline('42-123-12345');
|
|
41
|
+
* timeline.events.forEach(e => {
|
|
42
|
+
* console.log(`${e.date}: ${e.event_type}`);
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export class EnergyIntelligenceResource {
|
|
47
|
+
constructor(client) {
|
|
48
|
+
this.client = client;
|
|
49
|
+
this.rigCounts = new EIRigCountsResource(client);
|
|
50
|
+
this.oilInventories = new EIOilInventoriesResource(client);
|
|
51
|
+
this.opecProduction = new EIOPECProductionResource(client);
|
|
52
|
+
this.drillingProductivity = new EIDrillingProductivityResource(client);
|
|
53
|
+
this.forecasts = new EIForecastsResource(client);
|
|
54
|
+
this.wellPermits = new EIWellPermitsResource(client);
|
|
55
|
+
this.fracFocus = new EIFracFocusResource(client);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get well timeline by API number
|
|
59
|
+
*
|
|
60
|
+
* Returns chronological timeline of events for a specific well including
|
|
61
|
+
* permits, drilling, completion, production, and FracFocus disclosures.
|
|
62
|
+
*
|
|
63
|
+
* @param apiNumber - API well number (e.g., "42-123-12345")
|
|
64
|
+
* @returns Well timeline with events
|
|
65
|
+
*
|
|
66
|
+
* @throws {NotFoundError} If well not found
|
|
67
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const timeline = await client.ei.wellTimeline('42-123-12345');
|
|
72
|
+
* console.log(`Well: ${timeline.well_name}`);
|
|
73
|
+
* console.log(`Operator: ${timeline.operator}`);
|
|
74
|
+
* console.log(`Events: ${timeline.events.length}`);
|
|
75
|
+
*
|
|
76
|
+
* timeline.events.forEach(event => {
|
|
77
|
+
* console.log(`${event.date}: ${event.event_type} - ${event.description}`);
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
async wellTimeline(apiNumber) {
|
|
82
|
+
if (!apiNumber || typeof apiNumber !== "string") {
|
|
83
|
+
throw new ValidationError("API number must be a non-empty string");
|
|
84
|
+
}
|
|
85
|
+
return this.client["request"](`/v1/ei/wells/${apiNumber}/timeline`, {});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export { EIRigCountsResource, EIOilInventoriesResource, EIOPECProductionResource, EIDrillingProductivityResource, EIForecastsResource, EIWellPermitsResource, EIFracFocusResource, };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Energy Intelligence - Oil Inventories Resource
|
|
3
|
+
*
|
|
4
|
+
* Access EIA crude oil inventory data including total US stocks, Cushing levels,
|
|
5
|
+
* and regional breakdowns.
|
|
6
|
+
*/
|
|
7
|
+
import type { OilPriceAPI } from "../../client.js";
|
|
8
|
+
/**
|
|
9
|
+
* Oil inventory record
|
|
10
|
+
*/
|
|
11
|
+
export interface OilInventoryRecord {
|
|
12
|
+
/** Record ID */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Inventory level in thousand barrels */
|
|
15
|
+
level: number;
|
|
16
|
+
/** Unit of measurement */
|
|
17
|
+
unit: string;
|
|
18
|
+
/** Product type (e.g., "crude_oil", "gasoline", "distillate") */
|
|
19
|
+
product?: string;
|
|
20
|
+
/** Location (e.g., "US_TOTAL", "CUSHING", "PADD1") */
|
|
21
|
+
location?: string;
|
|
22
|
+
/** Change from previous week */
|
|
23
|
+
change?: number;
|
|
24
|
+
/** Report date */
|
|
25
|
+
date: string;
|
|
26
|
+
/** ISO timestamp */
|
|
27
|
+
timestamp: string;
|
|
28
|
+
/** Additional metadata */
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Oil inventory summary
|
|
33
|
+
*/
|
|
34
|
+
export interface OilInventorySummary {
|
|
35
|
+
/** Total US crude oil stocks */
|
|
36
|
+
total_crude: number;
|
|
37
|
+
/** Cushing stocks */
|
|
38
|
+
cushing?: number;
|
|
39
|
+
/** SPR stocks */
|
|
40
|
+
spr?: number;
|
|
41
|
+
/** Total products */
|
|
42
|
+
total_products?: number;
|
|
43
|
+
/** Unit */
|
|
44
|
+
unit: string;
|
|
45
|
+
/** As of date */
|
|
46
|
+
as_of_date: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Inventory by product type
|
|
50
|
+
*/
|
|
51
|
+
export interface InventoryByProduct {
|
|
52
|
+
/** Product type */
|
|
53
|
+
product: string;
|
|
54
|
+
/** Inventory level */
|
|
55
|
+
level: number;
|
|
56
|
+
/** Change from previous week */
|
|
57
|
+
change?: number;
|
|
58
|
+
/** Unit */
|
|
59
|
+
unit: string;
|
|
60
|
+
/** Date */
|
|
61
|
+
date: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Historical inventory data point
|
|
65
|
+
*/
|
|
66
|
+
export interface HistoricalInventory {
|
|
67
|
+
/** Date */
|
|
68
|
+
date: string;
|
|
69
|
+
/** Inventory level */
|
|
70
|
+
level: number;
|
|
71
|
+
/** Change */
|
|
72
|
+
change?: number;
|
|
73
|
+
/** Unit */
|
|
74
|
+
unit: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Cushing inventory data
|
|
78
|
+
*/
|
|
79
|
+
export interface CushingInventory {
|
|
80
|
+
/** Inventory level */
|
|
81
|
+
level: number;
|
|
82
|
+
/** Change from previous week */
|
|
83
|
+
change?: number;
|
|
84
|
+
/** Percentage of capacity */
|
|
85
|
+
capacity_percent?: number;
|
|
86
|
+
/** Unit */
|
|
87
|
+
unit: string;
|
|
88
|
+
/** Date */
|
|
89
|
+
date: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* EI Oil Inventories Resource
|
|
93
|
+
*
|
|
94
|
+
* Access EIA crude oil and petroleum product inventory data.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
99
|
+
*
|
|
100
|
+
* // Get latest inventories
|
|
101
|
+
* const latest = await client.ei.oilInventories.latest();
|
|
102
|
+
* console.log(`Total crude: ${latest.level} ${latest.unit}`);
|
|
103
|
+
*
|
|
104
|
+
* // Get Cushing stocks
|
|
105
|
+
* const cushing = await client.ei.oilInventories.cushing();
|
|
106
|
+
* console.log(`Cushing: ${cushing.level} ${cushing.unit}`);
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare class EIOilInventoriesResource {
|
|
110
|
+
private client;
|
|
111
|
+
constructor(client: OilPriceAPI);
|
|
112
|
+
/**
|
|
113
|
+
* List all oil inventory records
|
|
114
|
+
*
|
|
115
|
+
* @returns Array of inventory records
|
|
116
|
+
*/
|
|
117
|
+
list(): Promise<OilInventoryRecord[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Get a specific inventory record
|
|
120
|
+
*
|
|
121
|
+
* @param id - Record ID
|
|
122
|
+
* @returns Inventory record
|
|
123
|
+
*/
|
|
124
|
+
get(id: string): Promise<OilInventoryRecord>;
|
|
125
|
+
/**
|
|
126
|
+
* Get latest oil inventory data
|
|
127
|
+
*
|
|
128
|
+
* @returns Latest inventory record
|
|
129
|
+
*/
|
|
130
|
+
latest(): Promise<OilInventoryRecord>;
|
|
131
|
+
/**
|
|
132
|
+
* Get inventory summary
|
|
133
|
+
*
|
|
134
|
+
* @returns Inventory summary across all products
|
|
135
|
+
*/
|
|
136
|
+
summary(): Promise<OilInventorySummary>;
|
|
137
|
+
/**
|
|
138
|
+
* Get inventories by product type
|
|
139
|
+
*
|
|
140
|
+
* @returns Array of inventories by product
|
|
141
|
+
*/
|
|
142
|
+
byProduct(): Promise<InventoryByProduct[]>;
|
|
143
|
+
/**
|
|
144
|
+
* Get historical inventory data
|
|
145
|
+
*
|
|
146
|
+
* @returns Array of historical inventory levels
|
|
147
|
+
*/
|
|
148
|
+
historical(): Promise<HistoricalInventory[]>;
|
|
149
|
+
/**
|
|
150
|
+
* Get Cushing, OK inventory data
|
|
151
|
+
*
|
|
152
|
+
* @returns Cushing inventory data
|
|
153
|
+
*/
|
|
154
|
+
cushing(): Promise<CushingInventory>;
|
|
155
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Energy Intelligence - Oil Inventories Resource
|
|
3
|
+
*
|
|
4
|
+
* Access EIA crude oil inventory data including total US stocks, Cushing levels,
|
|
5
|
+
* and regional breakdowns.
|
|
6
|
+
*/
|
|
7
|
+
import { ValidationError } from "../../errors.js";
|
|
8
|
+
/**
|
|
9
|
+
* EI Oil Inventories Resource
|
|
10
|
+
*
|
|
11
|
+
* Access EIA crude oil and petroleum product inventory data.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
16
|
+
*
|
|
17
|
+
* // Get latest inventories
|
|
18
|
+
* const latest = await client.ei.oilInventories.latest();
|
|
19
|
+
* console.log(`Total crude: ${latest.level} ${latest.unit}`);
|
|
20
|
+
*
|
|
21
|
+
* // Get Cushing stocks
|
|
22
|
+
* const cushing = await client.ei.oilInventories.cushing();
|
|
23
|
+
* console.log(`Cushing: ${cushing.level} ${cushing.unit}`);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export class EIOilInventoriesResource {
|
|
27
|
+
constructor(client) {
|
|
28
|
+
this.client = client;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* List all oil inventory records
|
|
32
|
+
*
|
|
33
|
+
* @returns Array of inventory records
|
|
34
|
+
*/
|
|
35
|
+
async list() {
|
|
36
|
+
const response = await this.client["request"]("/v1/ei/oil_inventories", {});
|
|
37
|
+
return Array.isArray(response) ? response : response.data;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get a specific inventory record
|
|
41
|
+
*
|
|
42
|
+
* @param id - Record ID
|
|
43
|
+
* @returns Inventory record
|
|
44
|
+
*/
|
|
45
|
+
async get(id) {
|
|
46
|
+
if (!id || typeof id !== "string") {
|
|
47
|
+
throw new ValidationError("Record ID must be a non-empty string");
|
|
48
|
+
}
|
|
49
|
+
return this.client["request"](`/v1/ei/oil_inventories/${id}`, {});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get latest oil inventory data
|
|
53
|
+
*
|
|
54
|
+
* @returns Latest inventory record
|
|
55
|
+
*/
|
|
56
|
+
async latest() {
|
|
57
|
+
return this.client["request"]("/v1/ei/oil_inventories/latest", {});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get inventory summary
|
|
61
|
+
*
|
|
62
|
+
* @returns Inventory summary across all products
|
|
63
|
+
*/
|
|
64
|
+
async summary() {
|
|
65
|
+
return this.client["request"]("/v1/ei/oil_inventories/summary", {});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get inventories by product type
|
|
69
|
+
*
|
|
70
|
+
* @returns Array of inventories by product
|
|
71
|
+
*/
|
|
72
|
+
async byProduct() {
|
|
73
|
+
const response = await this.client["request"]("/v1/ei/oil_inventories/by_product", {});
|
|
74
|
+
return Array.isArray(response) ? response : response.data;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get historical inventory data
|
|
78
|
+
*
|
|
79
|
+
* @returns Array of historical inventory levels
|
|
80
|
+
*/
|
|
81
|
+
async historical() {
|
|
82
|
+
const response = await this.client["request"]("/v1/ei/oil_inventories/historical", {});
|
|
83
|
+
return Array.isArray(response) ? response : response.data;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get Cushing, OK inventory data
|
|
87
|
+
*
|
|
88
|
+
* @returns Cushing inventory data
|
|
89
|
+
*/
|
|
90
|
+
async cushing() {
|
|
91
|
+
return this.client["request"]("/v1/ei/oil_inventories/cushing", {});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Energy Intelligence - OPEC Production Resource
|
|
3
|
+
*
|
|
4
|
+
* Access OPEC crude oil production data by country with historical trends.
|
|
5
|
+
*/
|
|
6
|
+
import type { OilPriceAPI } from "../../client.js";
|
|
7
|
+
/**
|
|
8
|
+
* OPEC production record
|
|
9
|
+
*/
|
|
10
|
+
export interface OPECProductionRecord {
|
|
11
|
+
/** Record ID */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Country name */
|
|
14
|
+
country?: string;
|
|
15
|
+
/** Production volume in barrels per day */
|
|
16
|
+
production_bpd: number;
|
|
17
|
+
/** Unit of measurement */
|
|
18
|
+
unit: string;
|
|
19
|
+
/** Change from previous month */
|
|
20
|
+
change?: number;
|
|
21
|
+
/** Report date */
|
|
22
|
+
date: string;
|
|
23
|
+
/** Month */
|
|
24
|
+
month?: string;
|
|
25
|
+
/** ISO timestamp */
|
|
26
|
+
timestamp: string;
|
|
27
|
+
/** Additional metadata */
|
|
28
|
+
metadata?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Total OPEC production
|
|
32
|
+
*/
|
|
33
|
+
export interface TotalOPECProduction {
|
|
34
|
+
/** Total production in barrels per day */
|
|
35
|
+
total_production_bpd: number;
|
|
36
|
+
/** Change from previous month */
|
|
37
|
+
change?: number;
|
|
38
|
+
/** Unit */
|
|
39
|
+
unit: string;
|
|
40
|
+
/** As of date */
|
|
41
|
+
as_of_date: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Production by country
|
|
45
|
+
*/
|
|
46
|
+
export interface ProductionByCountry {
|
|
47
|
+
/** Country name */
|
|
48
|
+
country: string;
|
|
49
|
+
/** Production in barrels per day */
|
|
50
|
+
production_bpd: number;
|
|
51
|
+
/** Change from previous month */
|
|
52
|
+
change?: number;
|
|
53
|
+
/** Percentage of total OPEC production */
|
|
54
|
+
percentage?: number;
|
|
55
|
+
/** Date */
|
|
56
|
+
date: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Historical production data point
|
|
60
|
+
*/
|
|
61
|
+
export interface HistoricalProduction {
|
|
62
|
+
/** Date */
|
|
63
|
+
date: string;
|
|
64
|
+
/** Production in barrels per day */
|
|
65
|
+
production_bpd: number;
|
|
66
|
+
/** Change */
|
|
67
|
+
change?: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Top producer data
|
|
71
|
+
*/
|
|
72
|
+
export interface TopProducer {
|
|
73
|
+
/** Country name */
|
|
74
|
+
country: string;
|
|
75
|
+
/** Production in barrels per day */
|
|
76
|
+
production_bpd: number;
|
|
77
|
+
/** Percentage of total */
|
|
78
|
+
percentage: number;
|
|
79
|
+
/** Rank */
|
|
80
|
+
rank: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* EI OPEC Production Resource
|
|
84
|
+
*
|
|
85
|
+
* Access OPEC crude oil production data and analytics.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
90
|
+
*
|
|
91
|
+
* // Get total OPEC production
|
|
92
|
+
* const total = await client.ei.opecProduction.total();
|
|
93
|
+
* console.log(`Total OPEC: ${total.total_production_bpd} bpd`);
|
|
94
|
+
*
|
|
95
|
+
* // Get top producers
|
|
96
|
+
* const top = await client.ei.opecProduction.topProducers();
|
|
97
|
+
* top.forEach(p => console.log(`${p.rank}. ${p.country}: ${p.production_bpd} bpd`));
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare class EIOPECProductionResource {
|
|
101
|
+
private client;
|
|
102
|
+
constructor(client: OilPriceAPI);
|
|
103
|
+
/**
|
|
104
|
+
* List all OPEC production records
|
|
105
|
+
*
|
|
106
|
+
* @returns Array of production records
|
|
107
|
+
*/
|
|
108
|
+
list(): Promise<OPECProductionRecord[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Get a specific production record
|
|
111
|
+
*
|
|
112
|
+
* @param id - Record ID
|
|
113
|
+
* @returns Production record
|
|
114
|
+
*/
|
|
115
|
+
get(id: string): Promise<OPECProductionRecord>;
|
|
116
|
+
/**
|
|
117
|
+
* Get latest OPEC production data
|
|
118
|
+
*
|
|
119
|
+
* @returns Latest production record
|
|
120
|
+
*/
|
|
121
|
+
latest(): Promise<OPECProductionRecord>;
|
|
122
|
+
/**
|
|
123
|
+
* Get total OPEC production
|
|
124
|
+
*
|
|
125
|
+
* @returns Total OPEC production summary
|
|
126
|
+
*/
|
|
127
|
+
total(): Promise<TotalOPECProduction>;
|
|
128
|
+
/**
|
|
129
|
+
* Get production by country
|
|
130
|
+
*
|
|
131
|
+
* @returns Array of production by country
|
|
132
|
+
*/
|
|
133
|
+
byCountry(): Promise<ProductionByCountry[]>;
|
|
134
|
+
/**
|
|
135
|
+
* Get historical production data
|
|
136
|
+
*
|
|
137
|
+
* @returns Array of historical production levels
|
|
138
|
+
*/
|
|
139
|
+
historical(): Promise<HistoricalProduction[]>;
|
|
140
|
+
/**
|
|
141
|
+
* Get top OPEC producers
|
|
142
|
+
*
|
|
143
|
+
* @returns Array of top producing countries
|
|
144
|
+
*/
|
|
145
|
+
topProducers(): Promise<TopProducer[]>;
|
|
146
|
+
}
|