oilpriceapi 0.6.0 → 0.7.0
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 +376 -113
- package/dist/client.d.ts +83 -3
- package/dist/client.js +104 -38
- package/dist/index.d.ts +31 -6
- package/dist/index.js +17 -3
- package/dist/resources/alerts.d.ts +52 -15
- package/dist/resources/alerts.js +143 -85
- package/dist/resources/analytics.d.ts +325 -0
- package/dist/resources/analytics.js +221 -0
- package/dist/resources/bunker-fuels.d.ts +270 -0
- package/dist/resources/bunker-fuels.js +191 -0
- package/dist/resources/commodities.d.ts +148 -0
- package/dist/resources/commodities.js +110 -0
- package/dist/resources/data-quality.d.ts +229 -0
- package/dist/resources/data-quality.js +139 -0
- package/dist/resources/data-sources.d.ts +365 -0
- package/dist/resources/data-sources.js +349 -0
- package/dist/resources/drilling.d.ts +403 -0
- package/dist/resources/drilling.js +264 -0
- package/dist/resources/ei/drilling-productivity.d.ts +173 -0
- package/dist/resources/ei/drilling-productivity.js +103 -0
- package/dist/resources/ei/forecasts.d.ts +177 -0
- package/dist/resources/ei/forecasts.js +101 -0
- package/dist/resources/ei/frac-focus.d.ts +212 -0
- package/dist/resources/ei/frac-focus.js +150 -0
- package/dist/resources/ei/index.d.ts +140 -0
- package/dist/resources/ei/index.js +87 -0
- package/dist/resources/ei/oil-inventories.d.ts +155 -0
- package/dist/resources/ei/oil-inventories.js +92 -0
- package/dist/resources/ei/opec-production.d.ts +146 -0
- package/dist/resources/ei/opec-production.js +92 -0
- package/dist/resources/ei/rig-counts.d.ts +131 -0
- package/dist/resources/ei/rig-counts.js +88 -0
- package/dist/resources/ei/well-permits.d.ts +178 -0
- package/dist/resources/ei/well-permits.js +119 -0
- package/dist/resources/forecasts.d.ts +200 -0
- package/dist/resources/forecasts.js +157 -0
- package/dist/resources/futures.d.ts +322 -0
- package/dist/resources/futures.js +228 -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 +161 -0
- package/dist/resources/webhooks.d.ts +290 -0
- package/dist/resources/webhooks.js +297 -0
- package/dist/types.d.ts +77 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Energy Intelligence - Drilling Productivity Resource
|
|
3
|
+
*
|
|
4
|
+
* Access EIA Drilling Productivity Report data including new well production,
|
|
5
|
+
* legacy decline rates, and DUC well inventories by basin.
|
|
6
|
+
*/
|
|
7
|
+
import type { OilPriceAPI } from "../../client.js";
|
|
8
|
+
/**
|
|
9
|
+
* Drilling productivity record
|
|
10
|
+
*/
|
|
11
|
+
export interface DrillingProductivityRecord {
|
|
12
|
+
/** Record ID */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Basin name */
|
|
15
|
+
basin?: string;
|
|
16
|
+
/** New well oil production per rig (barrels/day) */
|
|
17
|
+
new_well_oil_production?: number;
|
|
18
|
+
/** New well gas production per rig (mcf/day) */
|
|
19
|
+
new_well_gas_production?: number;
|
|
20
|
+
/** Legacy production change (oil) */
|
|
21
|
+
legacy_oil_change?: number;
|
|
22
|
+
/** Legacy production change (gas) */
|
|
23
|
+
legacy_gas_change?: number;
|
|
24
|
+
/** DUC well count */
|
|
25
|
+
duc_count?: number;
|
|
26
|
+
/** Report date */
|
|
27
|
+
date: string;
|
|
28
|
+
/** Month */
|
|
29
|
+
month?: string;
|
|
30
|
+
/** ISO timestamp */
|
|
31
|
+
timestamp: string;
|
|
32
|
+
/** Additional metadata */
|
|
33
|
+
metadata?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Drilling productivity summary
|
|
37
|
+
*/
|
|
38
|
+
export interface DrillingProductivitySummary {
|
|
39
|
+
/** Total new well oil production */
|
|
40
|
+
total_new_well_oil?: number;
|
|
41
|
+
/** Total new well gas production */
|
|
42
|
+
total_new_well_gas?: number;
|
|
43
|
+
/** Total DUC wells */
|
|
44
|
+
total_duc_wells?: number;
|
|
45
|
+
/** As of date */
|
|
46
|
+
as_of_date: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* DUC well data
|
|
50
|
+
*/
|
|
51
|
+
export interface DUCWellInventory {
|
|
52
|
+
/** Basin name */
|
|
53
|
+
basin: string;
|
|
54
|
+
/** DUC well count */
|
|
55
|
+
duc_count: number;
|
|
56
|
+
/** Change from previous month */
|
|
57
|
+
change?: number;
|
|
58
|
+
/** Date */
|
|
59
|
+
date: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Productivity by basin
|
|
63
|
+
*/
|
|
64
|
+
export interface ProductivityByBasin {
|
|
65
|
+
/** Basin name */
|
|
66
|
+
basin: string;
|
|
67
|
+
/** New well oil production */
|
|
68
|
+
new_well_oil_production?: number;
|
|
69
|
+
/** New well gas production */
|
|
70
|
+
new_well_gas_production?: number;
|
|
71
|
+
/** DUC count */
|
|
72
|
+
duc_count?: number;
|
|
73
|
+
/** Date */
|
|
74
|
+
date: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Historical productivity data point
|
|
78
|
+
*/
|
|
79
|
+
export interface HistoricalProductivity {
|
|
80
|
+
/** Date */
|
|
81
|
+
date: string;
|
|
82
|
+
/** New well oil production */
|
|
83
|
+
new_well_oil_production?: number;
|
|
84
|
+
/** New well gas production */
|
|
85
|
+
new_well_gas_production?: number;
|
|
86
|
+
/** DUC count */
|
|
87
|
+
duc_count?: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Productivity trend data
|
|
91
|
+
*/
|
|
92
|
+
export interface ProductivityTrend {
|
|
93
|
+
/** Basin name */
|
|
94
|
+
basin: string;
|
|
95
|
+
/** Trend direction */
|
|
96
|
+
trend: "up" | "down" | "flat";
|
|
97
|
+
/** Change percentage */
|
|
98
|
+
change_percent?: number;
|
|
99
|
+
/** Metric type */
|
|
100
|
+
metric: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* EI Drilling Productivity Resource
|
|
104
|
+
*
|
|
105
|
+
* Access EIA Drilling Productivity Report data for major US basins.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
110
|
+
*
|
|
111
|
+
* // Get latest productivity data
|
|
112
|
+
* const latest = await client.ei.drillingProductivity.latest();
|
|
113
|
+
* console.log(`Basin: ${latest.basin}`);
|
|
114
|
+
* console.log(`New well oil: ${latest.new_well_oil_production} bpd/rig`);
|
|
115
|
+
*
|
|
116
|
+
* // Get DUC wells
|
|
117
|
+
* const duc = await client.ei.drillingProductivity.ducWells();
|
|
118
|
+
* duc.forEach(d => console.log(`${d.basin}: ${d.duc_count} DUC wells`));
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export declare class EIDrillingProductivityResource {
|
|
122
|
+
private client;
|
|
123
|
+
constructor(client: OilPriceAPI);
|
|
124
|
+
/**
|
|
125
|
+
* List all drilling productivity records
|
|
126
|
+
*
|
|
127
|
+
* @returns Array of productivity records
|
|
128
|
+
*/
|
|
129
|
+
list(): Promise<DrillingProductivityRecord[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Get a specific productivity record
|
|
132
|
+
*
|
|
133
|
+
* @param id - Record ID
|
|
134
|
+
* @returns Productivity record
|
|
135
|
+
*/
|
|
136
|
+
get(id: string): Promise<DrillingProductivityRecord>;
|
|
137
|
+
/**
|
|
138
|
+
* Get latest drilling productivity data
|
|
139
|
+
*
|
|
140
|
+
* @returns Latest productivity record
|
|
141
|
+
*/
|
|
142
|
+
latest(): Promise<DrillingProductivityRecord>;
|
|
143
|
+
/**
|
|
144
|
+
* Get drilling productivity summary
|
|
145
|
+
*
|
|
146
|
+
* @returns Productivity summary across all basins
|
|
147
|
+
*/
|
|
148
|
+
summary(): Promise<DrillingProductivitySummary>;
|
|
149
|
+
/**
|
|
150
|
+
* Get DUC well inventories
|
|
151
|
+
*
|
|
152
|
+
* @returns Array of DUC well counts by basin
|
|
153
|
+
*/
|
|
154
|
+
ducWells(): Promise<DUCWellInventory[]>;
|
|
155
|
+
/**
|
|
156
|
+
* Get productivity by basin
|
|
157
|
+
*
|
|
158
|
+
* @returns Array of productivity data by basin
|
|
159
|
+
*/
|
|
160
|
+
byBasin(): Promise<ProductivityByBasin[]>;
|
|
161
|
+
/**
|
|
162
|
+
* Get historical productivity data
|
|
163
|
+
*
|
|
164
|
+
* @returns Array of historical productivity metrics
|
|
165
|
+
*/
|
|
166
|
+
historical(): Promise<HistoricalProductivity[]>;
|
|
167
|
+
/**
|
|
168
|
+
* Get productivity trends
|
|
169
|
+
*
|
|
170
|
+
* @returns Array of productivity trends by basin
|
|
171
|
+
*/
|
|
172
|
+
trends(): Promise<ProductivityTrend[]>;
|
|
173
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Energy Intelligence - Drilling Productivity Resource
|
|
3
|
+
*
|
|
4
|
+
* Access EIA Drilling Productivity Report data including new well production,
|
|
5
|
+
* legacy decline rates, and DUC well inventories by basin.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* EI Drilling Productivity Resource
|
|
9
|
+
*
|
|
10
|
+
* Access EIA Drilling Productivity Report data for major US basins.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
15
|
+
*
|
|
16
|
+
* // Get latest productivity data
|
|
17
|
+
* const latest = await client.ei.drillingProductivity.latest();
|
|
18
|
+
* console.log(`Basin: ${latest.basin}`);
|
|
19
|
+
* console.log(`New well oil: ${latest.new_well_oil_production} bpd/rig`);
|
|
20
|
+
*
|
|
21
|
+
* // Get DUC wells
|
|
22
|
+
* const duc = await client.ei.drillingProductivity.ducWells();
|
|
23
|
+
* duc.forEach(d => console.log(`${d.basin}: ${d.duc_count} DUC wells`));
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export class EIDrillingProductivityResource {
|
|
27
|
+
constructor(client) {
|
|
28
|
+
this.client = client;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* List all drilling productivity records
|
|
32
|
+
*
|
|
33
|
+
* @returns Array of productivity records
|
|
34
|
+
*/
|
|
35
|
+
async list() {
|
|
36
|
+
const response = await this.client["request"]("/v1/ei/drilling_productivities", {});
|
|
37
|
+
return Array.isArray(response) ? response : response.data;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get a specific productivity record
|
|
41
|
+
*
|
|
42
|
+
* @param id - Record ID
|
|
43
|
+
* @returns Productivity record
|
|
44
|
+
*/
|
|
45
|
+
async get(id) {
|
|
46
|
+
if (!id || typeof id !== "string") {
|
|
47
|
+
throw new Error("Record ID must be a non-empty string");
|
|
48
|
+
}
|
|
49
|
+
return this.client["request"](`/v1/ei/drilling_productivities/${id}`, {});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get latest drilling productivity data
|
|
53
|
+
*
|
|
54
|
+
* @returns Latest productivity record
|
|
55
|
+
*/
|
|
56
|
+
async latest() {
|
|
57
|
+
return this.client["request"]("/v1/ei/drilling_productivities/latest", {});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get drilling productivity summary
|
|
61
|
+
*
|
|
62
|
+
* @returns Productivity summary across all basins
|
|
63
|
+
*/
|
|
64
|
+
async summary() {
|
|
65
|
+
return this.client["request"]("/v1/ei/drilling_productivities/summary", {});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get DUC well inventories
|
|
69
|
+
*
|
|
70
|
+
* @returns Array of DUC well counts by basin
|
|
71
|
+
*/
|
|
72
|
+
async ducWells() {
|
|
73
|
+
const response = await this.client["request"]("/v1/ei/drilling_productivities/duc_wells", {});
|
|
74
|
+
return Array.isArray(response) ? response : response.data;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get productivity by basin
|
|
78
|
+
*
|
|
79
|
+
* @returns Array of productivity data by basin
|
|
80
|
+
*/
|
|
81
|
+
async byBasin() {
|
|
82
|
+
const response = await this.client["request"]("/v1/ei/drilling_productivities/by_basin", {});
|
|
83
|
+
return Array.isArray(response) ? response : response.data;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get historical productivity data
|
|
87
|
+
*
|
|
88
|
+
* @returns Array of historical productivity metrics
|
|
89
|
+
*/
|
|
90
|
+
async historical() {
|
|
91
|
+
const response = await this.client["request"]("/v1/ei/drilling_productivities/historical", {});
|
|
92
|
+
return Array.isArray(response) ? response : response.data;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get productivity trends
|
|
96
|
+
*
|
|
97
|
+
* @returns Array of productivity trends by basin
|
|
98
|
+
*/
|
|
99
|
+
async trends() {
|
|
100
|
+
const response = await this.client["request"]("/v1/ei/drilling_productivities/trends", {});
|
|
101
|
+
return Array.isArray(response) ? response : response.data;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Energy Intelligence - Forecasts Resource
|
|
3
|
+
*
|
|
4
|
+
* Access EIA and IEA price and production forecasts with historical accuracy metrics.
|
|
5
|
+
*/
|
|
6
|
+
import type { OilPriceAPI } from "../../client.js";
|
|
7
|
+
/**
|
|
8
|
+
* Forecast record
|
|
9
|
+
*/
|
|
10
|
+
export interface ForecastRecord {
|
|
11
|
+
/** Record ID */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Forecast source (e.g., "EIA", "IEA") */
|
|
14
|
+
source?: string;
|
|
15
|
+
/** Commodity or metric being forecasted */
|
|
16
|
+
commodity?: string;
|
|
17
|
+
/** Forecast value */
|
|
18
|
+
forecast_value: number;
|
|
19
|
+
/** Unit of measurement */
|
|
20
|
+
unit?: string;
|
|
21
|
+
/** Forecast period (e.g., "Q1 2025", "2025") */
|
|
22
|
+
period?: string;
|
|
23
|
+
/** Publication date */
|
|
24
|
+
published_date: string;
|
|
25
|
+
/** Target date */
|
|
26
|
+
target_date?: string;
|
|
27
|
+
/** ISO timestamp */
|
|
28
|
+
timestamp: string;
|
|
29
|
+
/** Additional metadata */
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Forecast summary
|
|
34
|
+
*/
|
|
35
|
+
export interface ForecastSummary {
|
|
36
|
+
/** Number of forecasts */
|
|
37
|
+
total_forecasts: number;
|
|
38
|
+
/** Latest forecast value */
|
|
39
|
+
latest_forecast?: number;
|
|
40
|
+
/** Average forecast */
|
|
41
|
+
average_forecast?: number;
|
|
42
|
+
/** As of date */
|
|
43
|
+
as_of_date: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Price forecast data
|
|
47
|
+
*/
|
|
48
|
+
export interface PriceForecast {
|
|
49
|
+
/** Commodity */
|
|
50
|
+
commodity: string;
|
|
51
|
+
/** Forecast source */
|
|
52
|
+
source: string;
|
|
53
|
+
/** Forecast price */
|
|
54
|
+
forecast_price: number;
|
|
55
|
+
/** Unit */
|
|
56
|
+
unit: string;
|
|
57
|
+
/** Target period */
|
|
58
|
+
period: string;
|
|
59
|
+
/** Published date */
|
|
60
|
+
published_date: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Production forecast data
|
|
64
|
+
*/
|
|
65
|
+
export interface ProductionForecast {
|
|
66
|
+
/** Region or country */
|
|
67
|
+
region: string;
|
|
68
|
+
/** Forecast source */
|
|
69
|
+
source: string;
|
|
70
|
+
/** Forecast production */
|
|
71
|
+
forecast_production: number;
|
|
72
|
+
/** Unit */
|
|
73
|
+
unit: string;
|
|
74
|
+
/** Target period */
|
|
75
|
+
period: string;
|
|
76
|
+
/** Published date */
|
|
77
|
+
published_date: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Historical forecast data point
|
|
81
|
+
*/
|
|
82
|
+
export interface HistoricalForecast {
|
|
83
|
+
/** Date */
|
|
84
|
+
date: string;
|
|
85
|
+
/** Forecast value */
|
|
86
|
+
forecast_value: number;
|
|
87
|
+
/** Actual value (if available) */
|
|
88
|
+
actual_value?: number;
|
|
89
|
+
/** Accuracy percentage */
|
|
90
|
+
accuracy_percent?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Forecast comparison data
|
|
94
|
+
*/
|
|
95
|
+
export interface ForecastComparison {
|
|
96
|
+
/** Period */
|
|
97
|
+
period: string;
|
|
98
|
+
/** EIA forecast */
|
|
99
|
+
eia_forecast?: number;
|
|
100
|
+
/** IEA forecast */
|
|
101
|
+
iea_forecast?: number;
|
|
102
|
+
/** Actual value (if available) */
|
|
103
|
+
actual_value?: number;
|
|
104
|
+
/** Difference between forecasts */
|
|
105
|
+
difference?: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* EI Forecasts Resource
|
|
109
|
+
*
|
|
110
|
+
* Access EIA and IEA price and production forecasts.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
115
|
+
*
|
|
116
|
+
* // Get latest forecasts
|
|
117
|
+
* const latest = await client.ei.forecasts.latest();
|
|
118
|
+
* console.log(`Latest forecast: ${latest.forecast_value} ${latest.unit}`);
|
|
119
|
+
*
|
|
120
|
+
* // Get price forecasts
|
|
121
|
+
* const prices = await client.ei.forecasts.prices();
|
|
122
|
+
* prices.forEach(p => console.log(`${p.commodity}: $${p.forecast_price} (${p.source})`));
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export declare class EIForecastsResource {
|
|
126
|
+
private client;
|
|
127
|
+
constructor(client: OilPriceAPI);
|
|
128
|
+
/**
|
|
129
|
+
* List all forecast records
|
|
130
|
+
*
|
|
131
|
+
* @returns Array of forecast records
|
|
132
|
+
*/
|
|
133
|
+
list(): Promise<ForecastRecord[]>;
|
|
134
|
+
/**
|
|
135
|
+
* Get a specific forecast record
|
|
136
|
+
*
|
|
137
|
+
* @param id - Record ID
|
|
138
|
+
* @returns Forecast record
|
|
139
|
+
*/
|
|
140
|
+
get(id: string): Promise<ForecastRecord>;
|
|
141
|
+
/**
|
|
142
|
+
* Get latest forecast data
|
|
143
|
+
*
|
|
144
|
+
* @returns Latest forecast record
|
|
145
|
+
*/
|
|
146
|
+
latest(): Promise<ForecastRecord>;
|
|
147
|
+
/**
|
|
148
|
+
* Get forecast summary
|
|
149
|
+
*
|
|
150
|
+
* @returns Forecast summary statistics
|
|
151
|
+
*/
|
|
152
|
+
summary(): Promise<ForecastSummary>;
|
|
153
|
+
/**
|
|
154
|
+
* Get price forecasts
|
|
155
|
+
*
|
|
156
|
+
* @returns Array of price forecasts
|
|
157
|
+
*/
|
|
158
|
+
prices(): Promise<PriceForecast[]>;
|
|
159
|
+
/**
|
|
160
|
+
* Get production forecasts
|
|
161
|
+
*
|
|
162
|
+
* @returns Array of production forecasts
|
|
163
|
+
*/
|
|
164
|
+
production(): Promise<ProductionForecast[]>;
|
|
165
|
+
/**
|
|
166
|
+
* Get historical forecast data
|
|
167
|
+
*
|
|
168
|
+
* @returns Array of historical forecasts with accuracy
|
|
169
|
+
*/
|
|
170
|
+
historical(): Promise<HistoricalForecast[]>;
|
|
171
|
+
/**
|
|
172
|
+
* Compare forecasts from different sources
|
|
173
|
+
*
|
|
174
|
+
* @returns Array of forecast comparisons
|
|
175
|
+
*/
|
|
176
|
+
compare(): Promise<ForecastComparison[]>;
|
|
177
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Energy Intelligence - Forecasts Resource
|
|
3
|
+
*
|
|
4
|
+
* Access EIA and IEA price and production forecasts with historical accuracy metrics.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* EI Forecasts Resource
|
|
8
|
+
*
|
|
9
|
+
* Access EIA and IEA price and production forecasts.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
14
|
+
*
|
|
15
|
+
* // Get latest forecasts
|
|
16
|
+
* const latest = await client.ei.forecasts.latest();
|
|
17
|
+
* console.log(`Latest forecast: ${latest.forecast_value} ${latest.unit}`);
|
|
18
|
+
*
|
|
19
|
+
* // Get price forecasts
|
|
20
|
+
* const prices = await client.ei.forecasts.prices();
|
|
21
|
+
* prices.forEach(p => console.log(`${p.commodity}: $${p.forecast_price} (${p.source})`));
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export class EIForecastsResource {
|
|
25
|
+
constructor(client) {
|
|
26
|
+
this.client = client;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* List all forecast records
|
|
30
|
+
*
|
|
31
|
+
* @returns Array of forecast records
|
|
32
|
+
*/
|
|
33
|
+
async list() {
|
|
34
|
+
const response = await this.client["request"]("/v1/ei/forecasts", {});
|
|
35
|
+
return Array.isArray(response) ? response : response.data;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get a specific forecast record
|
|
39
|
+
*
|
|
40
|
+
* @param id - Record ID
|
|
41
|
+
* @returns Forecast record
|
|
42
|
+
*/
|
|
43
|
+
async get(id) {
|
|
44
|
+
if (!id || typeof id !== "string") {
|
|
45
|
+
throw new Error("Record ID must be a non-empty string");
|
|
46
|
+
}
|
|
47
|
+
return this.client["request"](`/v1/ei/forecasts/${id}`, {});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get latest forecast data
|
|
51
|
+
*
|
|
52
|
+
* @returns Latest forecast record
|
|
53
|
+
*/
|
|
54
|
+
async latest() {
|
|
55
|
+
return this.client["request"]("/v1/ei/forecasts/latest", {});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get forecast summary
|
|
59
|
+
*
|
|
60
|
+
* @returns Forecast summary statistics
|
|
61
|
+
*/
|
|
62
|
+
async summary() {
|
|
63
|
+
return this.client["request"]("/v1/ei/forecasts/summary", {});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get price forecasts
|
|
67
|
+
*
|
|
68
|
+
* @returns Array of price forecasts
|
|
69
|
+
*/
|
|
70
|
+
async prices() {
|
|
71
|
+
const response = await this.client["request"]("/v1/ei/forecasts/prices", {});
|
|
72
|
+
return Array.isArray(response) ? response : response.data;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get production forecasts
|
|
76
|
+
*
|
|
77
|
+
* @returns Array of production forecasts
|
|
78
|
+
*/
|
|
79
|
+
async production() {
|
|
80
|
+
const response = await this.client["request"]("/v1/ei/forecasts/production", {});
|
|
81
|
+
return Array.isArray(response) ? response : response.data;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get historical forecast data
|
|
85
|
+
*
|
|
86
|
+
* @returns Array of historical forecasts with accuracy
|
|
87
|
+
*/
|
|
88
|
+
async historical() {
|
|
89
|
+
const response = await this.client["request"]("/v1/ei/forecasts/historical", {});
|
|
90
|
+
return Array.isArray(response) ? response : response.data;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Compare forecasts from different sources
|
|
94
|
+
*
|
|
95
|
+
* @returns Array of forecast comparisons
|
|
96
|
+
*/
|
|
97
|
+
async compare() {
|
|
98
|
+
const response = await this.client["request"]("/v1/ei/forecasts/compare", {});
|
|
99
|
+
return Array.isArray(response) ? response : response.data;
|
|
100
|
+
}
|
|
101
|
+
}
|