oilpriceapi 0.5.3 → 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 +395 -110
- package/dist/client.d.ts +83 -3
- package/dist/client.js +118 -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 +106 -6
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rig Counts Resource
|
|
3
|
+
*
|
|
4
|
+
* Access Baker Hughes rig count data including current counts, historical trends,
|
|
5
|
+
* and breakdowns by basin, state, and rig type.
|
|
6
|
+
*/
|
|
7
|
+
import type { OilPriceAPI } from "../client.js";
|
|
8
|
+
/**
|
|
9
|
+
* Rig count data
|
|
10
|
+
*/
|
|
11
|
+
export interface RigCountData {
|
|
12
|
+
/** Total rig count */
|
|
13
|
+
total: number;
|
|
14
|
+
/** Oil rigs */
|
|
15
|
+
oil?: number;
|
|
16
|
+
/** Gas rigs */
|
|
17
|
+
gas?: number;
|
|
18
|
+
/** Miscellaneous rigs */
|
|
19
|
+
misc?: number;
|
|
20
|
+
/** Breakdown by region/state */
|
|
21
|
+
breakdown?: Record<string, number>;
|
|
22
|
+
/** ISO timestamp when data was recorded */
|
|
23
|
+
timestamp: string;
|
|
24
|
+
/** Week-over-week change */
|
|
25
|
+
change?: number;
|
|
26
|
+
/** Year-over-year change */
|
|
27
|
+
year_over_year_change?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Historical rig count data point
|
|
31
|
+
*/
|
|
32
|
+
export interface HistoricalRigCountData {
|
|
33
|
+
/** Date in YYYY-MM-DD format */
|
|
34
|
+
date: string;
|
|
35
|
+
/** Total rig count */
|
|
36
|
+
total: number;
|
|
37
|
+
/** Oil rigs */
|
|
38
|
+
oil?: number;
|
|
39
|
+
/** Gas rigs */
|
|
40
|
+
gas?: number;
|
|
41
|
+
/** Miscellaneous rigs */
|
|
42
|
+
misc?: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Options for historical rig count query
|
|
46
|
+
*/
|
|
47
|
+
export interface HistoricalRigCountOptions {
|
|
48
|
+
/** Start date in ISO 8601 format (YYYY-MM-DD) */
|
|
49
|
+
startDate?: string;
|
|
50
|
+
/** End date in ISO 8601 format (YYYY-MM-DD) */
|
|
51
|
+
endDate?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Rig count trend data
|
|
55
|
+
*/
|
|
56
|
+
export interface RigCountTrend {
|
|
57
|
+
/** Time period (e.g., "week", "month", "quarter", "year") */
|
|
58
|
+
period: string;
|
|
59
|
+
/** Average rig count */
|
|
60
|
+
average: number;
|
|
61
|
+
/** Minimum rig count */
|
|
62
|
+
min: number;
|
|
63
|
+
/** Maximum rig count */
|
|
64
|
+
max: number;
|
|
65
|
+
/** Overall trend direction */
|
|
66
|
+
trend?: "up" | "down" | "flat";
|
|
67
|
+
/** Percentage change */
|
|
68
|
+
change_percent?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Rig count summary
|
|
72
|
+
*/
|
|
73
|
+
export interface RigCountSummary {
|
|
74
|
+
/** Current total */
|
|
75
|
+
current: number;
|
|
76
|
+
/** Week-over-week change */
|
|
77
|
+
week_change: number;
|
|
78
|
+
/** Month-over-month change */
|
|
79
|
+
month_change: number;
|
|
80
|
+
/** Year-over-year change */
|
|
81
|
+
year_change: number;
|
|
82
|
+
/** Breakdown by category */
|
|
83
|
+
breakdown: {
|
|
84
|
+
oil: number;
|
|
85
|
+
gas: number;
|
|
86
|
+
misc?: number;
|
|
87
|
+
};
|
|
88
|
+
/** ISO timestamp */
|
|
89
|
+
timestamp: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Rig Counts Resource
|
|
93
|
+
*
|
|
94
|
+
* Access Baker Hughes rig count data including current counts, historical data,
|
|
95
|
+
* trends, and summaries.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* import { OilPriceAPI } from 'oilpriceapi';
|
|
100
|
+
*
|
|
101
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
102
|
+
*
|
|
103
|
+
* // Get latest rig count
|
|
104
|
+
* const latest = await client.rigCounts.latest();
|
|
105
|
+
* console.log(`Total rigs: ${latest.total}`);
|
|
106
|
+
* console.log(`Oil: ${latest.oil}, Gas: ${latest.gas}`);
|
|
107
|
+
*
|
|
108
|
+
* // Get summary with changes
|
|
109
|
+
* const summary = await client.rigCounts.summary();
|
|
110
|
+
* console.log(`Week-over-week: ${summary.week_change}`);
|
|
111
|
+
* console.log(`Year-over-year: ${summary.year_change}`);
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export declare class RigCountsResource {
|
|
115
|
+
private client;
|
|
116
|
+
constructor(client: OilPriceAPI);
|
|
117
|
+
/**
|
|
118
|
+
* Get latest rig count data
|
|
119
|
+
*
|
|
120
|
+
* Returns the most recent Baker Hughes rig count.
|
|
121
|
+
*
|
|
122
|
+
* @returns Latest rig count data
|
|
123
|
+
*
|
|
124
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
125
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const latest = await client.rigCounts.latest();
|
|
130
|
+
* console.log(`Total rigs: ${latest.total}`);
|
|
131
|
+
* console.log(`Oil rigs: ${latest.oil}`);
|
|
132
|
+
* console.log(`Gas rigs: ${latest.gas}`);
|
|
133
|
+
* console.log(`Change: ${latest.change}`);
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
latest(): Promise<RigCountData>;
|
|
137
|
+
/**
|
|
138
|
+
* Get current rig count data
|
|
139
|
+
*
|
|
140
|
+
* Alias for latest(). Returns the most recent Baker Hughes rig count.
|
|
141
|
+
*
|
|
142
|
+
* @returns Current rig count data
|
|
143
|
+
*
|
|
144
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
145
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const current = await client.rigCounts.current();
|
|
150
|
+
* console.log(`Total rigs: ${current.total}`);
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
current(): Promise<RigCountData>;
|
|
154
|
+
/**
|
|
155
|
+
* Get historical rig count data
|
|
156
|
+
*
|
|
157
|
+
* Returns time series of rig counts.
|
|
158
|
+
*
|
|
159
|
+
* @param options - Date range filters
|
|
160
|
+
* @returns Array of historical rig count data
|
|
161
|
+
*
|
|
162
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
163
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* const history = await client.rigCounts.historical({
|
|
168
|
+
* startDate: '2024-01-01',
|
|
169
|
+
* endDate: '2024-12-31'
|
|
170
|
+
* });
|
|
171
|
+
*
|
|
172
|
+
* history.forEach(point => {
|
|
173
|
+
* console.log(`${point.date}: ${point.total} rigs (${point.oil} oil, ${point.gas} gas)`);
|
|
174
|
+
* });
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
historical(options?: HistoricalRigCountOptions): Promise<HistoricalRigCountData[]>;
|
|
178
|
+
/**
|
|
179
|
+
* Get rig count trend analysis
|
|
180
|
+
*
|
|
181
|
+
* Returns trend analysis for a specified time period.
|
|
182
|
+
*
|
|
183
|
+
* @param period - Time period (e.g., "week", "month", "quarter", "year")
|
|
184
|
+
* @returns Trend analysis data
|
|
185
|
+
*
|
|
186
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
187
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* const monthlyTrend = await client.rigCounts.trends('month');
|
|
192
|
+
* console.log(`Monthly average: ${monthlyTrend.average}`);
|
|
193
|
+
* console.log(`Trend: ${monthlyTrend.trend}`);
|
|
194
|
+
* console.log(`Change: ${monthlyTrend.change_percent}%`);
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
trends(period?: string): Promise<RigCountTrend>;
|
|
198
|
+
/**
|
|
199
|
+
* Get rig count summary
|
|
200
|
+
*
|
|
201
|
+
* Returns comprehensive summary including current count and changes
|
|
202
|
+
* across multiple time periods.
|
|
203
|
+
*
|
|
204
|
+
* @returns Rig count summary
|
|
205
|
+
*
|
|
206
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
207
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* const summary = await client.rigCounts.summary();
|
|
212
|
+
* console.log(`Current: ${summary.current}`);
|
|
213
|
+
* console.log(`Week-over-week: ${summary.week_change}`);
|
|
214
|
+
* console.log(`Month-over-month: ${summary.month_change}`);
|
|
215
|
+
* console.log(`Year-over-year: ${summary.year_change}`);
|
|
216
|
+
* console.log(`Oil rigs: ${summary.breakdown.oil}`);
|
|
217
|
+
* console.log(`Gas rigs: ${summary.breakdown.gas}`);
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
summary(): Promise<RigCountSummary>;
|
|
221
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rig Counts Resource
|
|
3
|
+
*
|
|
4
|
+
* Access Baker Hughes rig count data including current counts, historical trends,
|
|
5
|
+
* and breakdowns by basin, state, and rig type.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Rig Counts Resource
|
|
9
|
+
*
|
|
10
|
+
* Access Baker Hughes rig count data including current counts, historical data,
|
|
11
|
+
* trends, and summaries.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { OilPriceAPI } from 'oilpriceapi';
|
|
16
|
+
*
|
|
17
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
18
|
+
*
|
|
19
|
+
* // Get latest rig count
|
|
20
|
+
* const latest = await client.rigCounts.latest();
|
|
21
|
+
* console.log(`Total rigs: ${latest.total}`);
|
|
22
|
+
* console.log(`Oil: ${latest.oil}, Gas: ${latest.gas}`);
|
|
23
|
+
*
|
|
24
|
+
* // Get summary with changes
|
|
25
|
+
* const summary = await client.rigCounts.summary();
|
|
26
|
+
* console.log(`Week-over-week: ${summary.week_change}`);
|
|
27
|
+
* console.log(`Year-over-year: ${summary.year_change}`);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export class RigCountsResource {
|
|
31
|
+
constructor(client) {
|
|
32
|
+
this.client = client;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get latest rig count data
|
|
36
|
+
*
|
|
37
|
+
* Returns the most recent Baker Hughes rig count.
|
|
38
|
+
*
|
|
39
|
+
* @returns Latest rig count data
|
|
40
|
+
*
|
|
41
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
42
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const latest = await client.rigCounts.latest();
|
|
47
|
+
* console.log(`Total rigs: ${latest.total}`);
|
|
48
|
+
* console.log(`Oil rigs: ${latest.oil}`);
|
|
49
|
+
* console.log(`Gas rigs: ${latest.gas}`);
|
|
50
|
+
* console.log(`Change: ${latest.change}`);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
async latest() {
|
|
54
|
+
return this.client["request"]("/v1/rig-counts/latest", {});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get current rig count data
|
|
58
|
+
*
|
|
59
|
+
* Alias for latest(). Returns the most recent Baker Hughes rig count.
|
|
60
|
+
*
|
|
61
|
+
* @returns Current rig count data
|
|
62
|
+
*
|
|
63
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
64
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const current = await client.rigCounts.current();
|
|
69
|
+
* console.log(`Total rigs: ${current.total}`);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
async current() {
|
|
73
|
+
return this.client["request"]("/v1/rig-counts/current", {});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get historical rig count data
|
|
77
|
+
*
|
|
78
|
+
* Returns time series of rig counts.
|
|
79
|
+
*
|
|
80
|
+
* @param options - Date range filters
|
|
81
|
+
* @returns Array of historical rig count data
|
|
82
|
+
*
|
|
83
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
84
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const history = await client.rigCounts.historical({
|
|
89
|
+
* startDate: '2024-01-01',
|
|
90
|
+
* endDate: '2024-12-31'
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* history.forEach(point => {
|
|
94
|
+
* console.log(`${point.date}: ${point.total} rigs (${point.oil} oil, ${point.gas} gas)`);
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
async historical(options) {
|
|
99
|
+
const params = {};
|
|
100
|
+
if (options?.startDate)
|
|
101
|
+
params.start_date = options.startDate;
|
|
102
|
+
if (options?.endDate)
|
|
103
|
+
params.end_date = options.endDate;
|
|
104
|
+
const response = await this.client["request"]("/v1/rig-counts/historical", params);
|
|
105
|
+
return Array.isArray(response) ? response : response.data;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get rig count trend analysis
|
|
109
|
+
*
|
|
110
|
+
* Returns trend analysis for a specified time period.
|
|
111
|
+
*
|
|
112
|
+
* @param period - Time period (e.g., "week", "month", "quarter", "year")
|
|
113
|
+
* @returns Trend analysis data
|
|
114
|
+
*
|
|
115
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
116
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const monthlyTrend = await client.rigCounts.trends('month');
|
|
121
|
+
* console.log(`Monthly average: ${monthlyTrend.average}`);
|
|
122
|
+
* console.log(`Trend: ${monthlyTrend.trend}`);
|
|
123
|
+
* console.log(`Change: ${monthlyTrend.change_percent}%`);
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
async trends(period) {
|
|
127
|
+
const params = {};
|
|
128
|
+
if (period)
|
|
129
|
+
params.period = period;
|
|
130
|
+
return this.client["request"]("/v1/rig-counts/trends", params);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get rig count summary
|
|
134
|
+
*
|
|
135
|
+
* Returns comprehensive summary including current count and changes
|
|
136
|
+
* across multiple time periods.
|
|
137
|
+
*
|
|
138
|
+
* @returns Rig count summary
|
|
139
|
+
*
|
|
140
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
141
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* const summary = await client.rigCounts.summary();
|
|
146
|
+
* console.log(`Current: ${summary.current}`);
|
|
147
|
+
* console.log(`Week-over-week: ${summary.week_change}`);
|
|
148
|
+
* console.log(`Month-over-month: ${summary.month_change}`);
|
|
149
|
+
* console.log(`Year-over-year: ${summary.year_change}`);
|
|
150
|
+
* console.log(`Oil rigs: ${summary.breakdown.oil}`);
|
|
151
|
+
* console.log(`Gas rigs: ${summary.breakdown.gas}`);
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
async summary() {
|
|
155
|
+
return this.client["request"]("/v1/rig-counts/summary", {});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Resource
|
|
3
|
+
*
|
|
4
|
+
* Access crude oil storage data including total US inventory, Cushing hub levels,
|
|
5
|
+
* Strategic Petroleum Reserve (SPR), and regional breakdowns.
|
|
6
|
+
*/
|
|
7
|
+
import type { OilPriceAPI } from "../client.js";
|
|
8
|
+
/**
|
|
9
|
+
* Storage level data
|
|
10
|
+
*/
|
|
11
|
+
export interface StorageData {
|
|
12
|
+
/** Storage location code */
|
|
13
|
+
code: string;
|
|
14
|
+
/** Location name */
|
|
15
|
+
name?: string;
|
|
16
|
+
/** Current storage level */
|
|
17
|
+
level: number;
|
|
18
|
+
/** Unit of measurement (typically "thousand_barrels" or "million_barrels") */
|
|
19
|
+
unit: string;
|
|
20
|
+
/** ISO timestamp when data was recorded */
|
|
21
|
+
timestamp: string;
|
|
22
|
+
/** Change from previous period */
|
|
23
|
+
change?: number;
|
|
24
|
+
/** Percentage change */
|
|
25
|
+
change_percent?: number;
|
|
26
|
+
/** Additional metadata */
|
|
27
|
+
metadata?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Historical storage data point
|
|
31
|
+
*/
|
|
32
|
+
export interface HistoricalStorageData {
|
|
33
|
+
/** Date in YYYY-MM-DD format */
|
|
34
|
+
date: string;
|
|
35
|
+
/** Storage level */
|
|
36
|
+
level: number;
|
|
37
|
+
/** Unit of measurement */
|
|
38
|
+
unit: string;
|
|
39
|
+
/** Week-over-week change */
|
|
40
|
+
change?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Options for historical storage query
|
|
44
|
+
*/
|
|
45
|
+
export interface HistoricalStorageOptions {
|
|
46
|
+
/** Start date in ISO 8601 format (YYYY-MM-DD) */
|
|
47
|
+
startDate?: string;
|
|
48
|
+
/** End date in ISO 8601 format (YYYY-MM-DD) */
|
|
49
|
+
endDate?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Storage Resource
|
|
53
|
+
*
|
|
54
|
+
* Access crude oil storage data for US inventory levels, Cushing hub,
|
|
55
|
+
* Strategic Petroleum Reserve, and regional breakdowns.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* import { OilPriceAPI } from 'oilpriceapi';
|
|
60
|
+
*
|
|
61
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
62
|
+
*
|
|
63
|
+
* // Get all storage data
|
|
64
|
+
* const storage = await client.storage.all();
|
|
65
|
+
* console.log(`Total US inventory: ${storage.level} ${storage.unit}`);
|
|
66
|
+
*
|
|
67
|
+
* // Get Cushing levels
|
|
68
|
+
* const cushing = await client.storage.cushing();
|
|
69
|
+
* console.log(`Cushing: ${cushing.level} ${cushing.unit}`);
|
|
70
|
+
*
|
|
71
|
+
* // Get SPR levels
|
|
72
|
+
* const spr = await client.storage.spr();
|
|
73
|
+
* console.log(`SPR: ${spr.level} ${spr.unit}`);
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare class StorageResource {
|
|
77
|
+
private client;
|
|
78
|
+
constructor(client: OilPriceAPI);
|
|
79
|
+
/**
|
|
80
|
+
* Get all current storage levels
|
|
81
|
+
*
|
|
82
|
+
* Returns total US commercial crude oil inventory.
|
|
83
|
+
*
|
|
84
|
+
* @returns Current storage data
|
|
85
|
+
*
|
|
86
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
87
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const storage = await client.storage.all();
|
|
92
|
+
* console.log(`Total inventory: ${storage.level} ${storage.unit}`);
|
|
93
|
+
* if (storage.change) {
|
|
94
|
+
* console.log(`Change: ${storage.change > 0 ? '+' : ''}${storage.change}`);
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
all(): Promise<StorageData>;
|
|
99
|
+
/**
|
|
100
|
+
* Get Cushing, OK storage levels
|
|
101
|
+
*
|
|
102
|
+
* Returns current inventory at Cushing, Oklahoma - the key delivery point
|
|
103
|
+
* for WTI crude oil futures.
|
|
104
|
+
*
|
|
105
|
+
* @returns Cushing storage data
|
|
106
|
+
*
|
|
107
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
108
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const cushing = await client.storage.cushing();
|
|
113
|
+
* console.log(`Cushing inventory: ${cushing.level} ${cushing.unit}`);
|
|
114
|
+
* console.log(`Week-over-week change: ${cushing.change_percent}%`);
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
cushing(): Promise<StorageData>;
|
|
118
|
+
/**
|
|
119
|
+
* Get Strategic Petroleum Reserve (SPR) levels
|
|
120
|
+
*
|
|
121
|
+
* Returns current US Strategic Petroleum Reserve inventory.
|
|
122
|
+
*
|
|
123
|
+
* @returns SPR storage data
|
|
124
|
+
*
|
|
125
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
126
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const spr = await client.storage.spr();
|
|
131
|
+
* console.log(`SPR inventory: ${spr.level} ${spr.unit}`);
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
spr(): Promise<StorageData>;
|
|
135
|
+
/**
|
|
136
|
+
* Get regional storage breakdown
|
|
137
|
+
*
|
|
138
|
+
* Returns storage levels by region (PADD districts) or a specific region.
|
|
139
|
+
*
|
|
140
|
+
* @param region - Optional region code (e.g., "PADD1", "PADD2", "PADD3")
|
|
141
|
+
* @returns Regional storage data
|
|
142
|
+
*
|
|
143
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
144
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* // Get all regions
|
|
149
|
+
* const regions = await client.storage.regional();
|
|
150
|
+
*
|
|
151
|
+
* // Get specific region (Gulf Coast)
|
|
152
|
+
* const gulfCoast = await client.storage.regional('PADD3');
|
|
153
|
+
* console.log(`PADD 3 (Gulf Coast): ${gulfCoast.level} ${gulfCoast.unit}`);
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
regional(region?: string): Promise<StorageData | StorageData[]>;
|
|
157
|
+
/**
|
|
158
|
+
* Get historical storage data
|
|
159
|
+
*
|
|
160
|
+
* Returns time series of storage levels for a specific location.
|
|
161
|
+
*
|
|
162
|
+
* @param code - Storage location code (e.g., "US", "CUSHING", "SPR")
|
|
163
|
+
* @param options - Date range filters
|
|
164
|
+
* @returns Array of historical storage data
|
|
165
|
+
*
|
|
166
|
+
* @throws {NotFoundError} If location code not found
|
|
167
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const history = await client.storage.history('CUSHING', {
|
|
172
|
+
* startDate: '2024-01-01',
|
|
173
|
+
* endDate: '2024-12-31'
|
|
174
|
+
* });
|
|
175
|
+
*
|
|
176
|
+
* history.forEach(point => {
|
|
177
|
+
* console.log(`${point.date}: ${point.level} ${point.unit}`);
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
history(code: string, options?: HistoricalStorageOptions): Promise<HistoricalStorageData[]>;
|
|
182
|
+
}
|