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.
Files changed (80) hide show
  1. package/README.md +418 -123
  2. package/dist/cjs/client.js +490 -0
  3. package/dist/cjs/errors.js +80 -0
  4. package/dist/cjs/index.js +82 -0
  5. package/dist/cjs/package.json +1 -0
  6. package/dist/cjs/resources/alerts.js +387 -0
  7. package/dist/cjs/resources/analytics.js +226 -0
  8. package/dist/cjs/resources/bunker-fuels.js +196 -0
  9. package/dist/cjs/resources/commodities.js +115 -0
  10. package/dist/cjs/resources/data-quality.js +144 -0
  11. package/dist/cjs/resources/data-sources.js +297 -0
  12. package/dist/cjs/resources/diesel.js +119 -0
  13. package/dist/cjs/resources/drilling.js +269 -0
  14. package/dist/cjs/resources/ei/drilling-productivity.js +108 -0
  15. package/dist/cjs/resources/ei/forecasts.js +106 -0
  16. package/dist/cjs/resources/ei/frac-focus.js +155 -0
  17. package/dist/cjs/resources/ei/index.js +98 -0
  18. package/dist/cjs/resources/ei/oil-inventories.js +97 -0
  19. package/dist/cjs/resources/ei/opec-production.js +97 -0
  20. package/dist/cjs/resources/ei/rig-counts.js +93 -0
  21. package/dist/cjs/resources/ei/well-permits.js +124 -0
  22. package/dist/cjs/resources/forecasts.js +162 -0
  23. package/dist/cjs/resources/futures.js +233 -0
  24. package/dist/cjs/resources/rig-counts.js +161 -0
  25. package/dist/cjs/resources/storage.js +166 -0
  26. package/dist/cjs/resources/webhooks.js +294 -0
  27. package/dist/cjs/types.js +2 -0
  28. package/dist/cjs/version.js +24 -0
  29. package/dist/client.d.ts +116 -5
  30. package/dist/client.js +169 -47
  31. package/dist/errors.d.ts +6 -0
  32. package/dist/errors.js +25 -16
  33. package/dist/index.d.ts +45 -6
  34. package/dist/index.js +40 -3
  35. package/dist/resources/alerts.d.ts +52 -15
  36. package/dist/resources/alerts.js +121 -109
  37. package/dist/resources/analytics.d.ts +325 -0
  38. package/dist/resources/analytics.js +222 -0
  39. package/dist/resources/bunker-fuels.d.ts +270 -0
  40. package/dist/resources/bunker-fuels.js +192 -0
  41. package/dist/resources/commodities.d.ts +148 -0
  42. package/dist/resources/commodities.js +111 -0
  43. package/dist/resources/data-quality.d.ts +229 -0
  44. package/dist/resources/data-quality.js +140 -0
  45. package/dist/resources/data-sources.d.ts +365 -0
  46. package/dist/resources/data-sources.js +293 -0
  47. package/dist/resources/diesel.d.ts +1 -1
  48. package/dist/resources/diesel.js +9 -38
  49. package/dist/resources/drilling.d.ts +403 -0
  50. package/dist/resources/drilling.js +265 -0
  51. package/dist/resources/ei/drilling-productivity.d.ts +173 -0
  52. package/dist/resources/ei/drilling-productivity.js +104 -0
  53. package/dist/resources/ei/forecasts.d.ts +177 -0
  54. package/dist/resources/ei/forecasts.js +102 -0
  55. package/dist/resources/ei/frac-focus.d.ts +212 -0
  56. package/dist/resources/ei/frac-focus.js +151 -0
  57. package/dist/resources/ei/index.d.ts +140 -0
  58. package/dist/resources/ei/index.js +88 -0
  59. package/dist/resources/ei/oil-inventories.d.ts +155 -0
  60. package/dist/resources/ei/oil-inventories.js +93 -0
  61. package/dist/resources/ei/opec-production.d.ts +146 -0
  62. package/dist/resources/ei/opec-production.js +93 -0
  63. package/dist/resources/ei/rig-counts.d.ts +131 -0
  64. package/dist/resources/ei/rig-counts.js +89 -0
  65. package/dist/resources/ei/well-permits.d.ts +178 -0
  66. package/dist/resources/ei/well-permits.js +120 -0
  67. package/dist/resources/forecasts.d.ts +200 -0
  68. package/dist/resources/forecasts.js +158 -0
  69. package/dist/resources/futures.d.ts +322 -0
  70. package/dist/resources/futures.js +229 -0
  71. package/dist/resources/rig-counts.d.ts +221 -0
  72. package/dist/resources/rig-counts.js +157 -0
  73. package/dist/resources/storage.d.ts +182 -0
  74. package/dist/resources/storage.js +162 -0
  75. package/dist/resources/webhooks.d.ts +326 -0
  76. package/dist/resources/webhooks.js +290 -0
  77. package/dist/types.d.ts +79 -8
  78. package/dist/version.d.ts +1 -1
  79. package/dist/version.js +2 -2
  80. package/package.json +17 -8
@@ -0,0 +1,200 @@
1
+ /**
2
+ * Forecasts Resource
3
+ *
4
+ * Access official price forecasts from EIA, IEA, and other agencies including
5
+ * monthly outlooks, accuracy metrics, and historical archives.
6
+ */
7
+ import type { OilPriceAPI } from "../client.js";
8
+ /**
9
+ * Monthly forecast data
10
+ */
11
+ export interface MonthlyForecast {
12
+ /** Forecast period (e.g., "2024-03", "2024-Q2") */
13
+ period: string;
14
+ /** Commodity code */
15
+ commodity: string;
16
+ /** Forecasted price */
17
+ forecast_price: number;
18
+ /** Lower bound of forecast range */
19
+ lower_bound?: number;
20
+ /** Upper bound of forecast range */
21
+ upper_bound?: number;
22
+ /** Forecast source (e.g., "EIA", "IEA") */
23
+ source: string;
24
+ /** ISO timestamp when forecast was published */
25
+ published_at: string;
26
+ /** Additional metadata */
27
+ metadata?: Record<string, unknown>;
28
+ }
29
+ /**
30
+ * Forecast accuracy metrics
31
+ */
32
+ export interface ForecastAccuracy {
33
+ /** Commodity code */
34
+ commodity?: string;
35
+ /** Forecast source */
36
+ source: string;
37
+ /** Mean Absolute Percentage Error */
38
+ mape: number;
39
+ /** Root Mean Squared Error */
40
+ rmse: number;
41
+ /** Mean Error (bias) */
42
+ mean_error?: number;
43
+ /** Number of forecasts evaluated */
44
+ sample_size: number;
45
+ /** Time period evaluated */
46
+ period_evaluated: string;
47
+ /** ISO timestamp */
48
+ timestamp: string;
49
+ }
50
+ /**
51
+ * Archived forecast data
52
+ */
53
+ export interface ArchivedForecast {
54
+ /** Year of forecast */
55
+ year: number;
56
+ /** Month of forecast (1-12) */
57
+ month?: number;
58
+ /** Quarter of forecast (1-4) */
59
+ quarter?: number;
60
+ /** Commodity code */
61
+ commodity: string;
62
+ /** Forecasted price */
63
+ forecast_price: number;
64
+ /** Actual price (if available) */
65
+ actual_price?: number;
66
+ /** Forecast error */
67
+ error?: number;
68
+ /** Forecast source */
69
+ source: string;
70
+ /** ISO timestamp when forecast was published */
71
+ published_at: string;
72
+ }
73
+ /**
74
+ * Forecasts Resource
75
+ *
76
+ * Access official price forecasts from government agencies and research
77
+ * organizations including EIA, IEA, and others.
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * import { OilPriceAPI } from 'oilpriceapi';
82
+ *
83
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
84
+ *
85
+ * // Get monthly forecasts
86
+ * const forecasts = await client.forecasts.monthly();
87
+ * forecasts.forEach(f => {
88
+ * console.log(`${f.period}: $${f.forecast_price} (${f.source})`);
89
+ * });
90
+ *
91
+ * // Check forecast accuracy
92
+ * const accuracy = await client.forecasts.accuracy();
93
+ * console.log(`EIA MAPE: ${accuracy.mape}%`);
94
+ * ```
95
+ */
96
+ export declare class ForecastsResource {
97
+ private client;
98
+ constructor(client: OilPriceAPI);
99
+ /**
100
+ * Get monthly price forecasts
101
+ *
102
+ * Returns official monthly forecasts from EIA, IEA, and other agencies.
103
+ *
104
+ * @param commodity - Optional commodity code filter
105
+ * @returns Array of monthly forecasts
106
+ *
107
+ * @throws {OilPriceAPIError} If API request fails
108
+ * @throws {AuthenticationError} If API key is invalid
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * // Get all forecasts
113
+ * const allForecasts = await client.forecasts.monthly();
114
+ *
115
+ * // Get WTI forecasts only
116
+ * const wtiForecasts = await client.forecasts.monthly('WTI_USD');
117
+ *
118
+ * wtiForecasts.forEach(forecast => {
119
+ * console.log(`${forecast.period}: $${forecast.forecast_price}`);
120
+ * console.log(` Range: $${forecast.lower_bound} - $${forecast.upper_bound}`);
121
+ * console.log(` Source: ${forecast.source}`);
122
+ * });
123
+ * ```
124
+ */
125
+ monthly(commodity?: string): Promise<MonthlyForecast[]>;
126
+ /**
127
+ * Get forecast accuracy metrics
128
+ *
129
+ * Returns historical accuracy measurements for forecast sources.
130
+ *
131
+ * @returns Forecast accuracy data
132
+ *
133
+ * @throws {OilPriceAPIError} If API request fails
134
+ * @throws {AuthenticationError} If API key is invalid
135
+ *
136
+ * @example
137
+ * ```typescript
138
+ * const accuracy = await client.forecasts.accuracy();
139
+ * console.log(`Source: ${accuracy.source}`);
140
+ * console.log(`MAPE: ${accuracy.mape}%`);
141
+ * console.log(`RMSE: ${accuracy.rmse}`);
142
+ * console.log(`Sample size: ${accuracy.sample_size} forecasts`);
143
+ * ```
144
+ */
145
+ accuracy(): Promise<ForecastAccuracy>;
146
+ /**
147
+ * Get archived forecasts
148
+ *
149
+ * Returns historical forecasts with actual outcomes for accuracy analysis.
150
+ *
151
+ * @param year - Optional year filter
152
+ * @returns Array of archived forecasts
153
+ *
154
+ * @throws {OilPriceAPIError} If API request fails
155
+ * @throws {AuthenticationError} If API key is invalid
156
+ *
157
+ * @example
158
+ * ```typescript
159
+ * // Get all archived forecasts
160
+ * const archive = await client.forecasts.archive();
161
+ *
162
+ * // Get forecasts from specific year
163
+ * const archive2024 = await client.forecasts.archive(2024);
164
+ *
165
+ * archive2024.forEach(forecast => {
166
+ * if (forecast.actual_price) {
167
+ * console.log(`${forecast.year}-${forecast.month}:`);
168
+ * console.log(` Forecast: $${forecast.forecast_price}`);
169
+ * console.log(` Actual: $${forecast.actual_price}`);
170
+ * console.log(` Error: ${forecast.error}%`);
171
+ * }
172
+ * });
173
+ * ```
174
+ */
175
+ archive(year?: number): Promise<ArchivedForecast[]>;
176
+ /**
177
+ * Get forecast for a specific period
178
+ *
179
+ * @param period - Period identifier (e.g., "2024-03", "2024-Q2")
180
+ * @param commodity - Optional commodity code filter
181
+ * @returns Monthly forecast data
182
+ *
183
+ * @throws {NotFoundError} If period not found
184
+ * @throws {OilPriceAPIError} If API request fails
185
+ *
186
+ * @example
187
+ * ```typescript
188
+ * // Get March 2024 forecast
189
+ * const march2024 = await client.forecasts.get('2024-03');
190
+ *
191
+ * // Get Q2 2024 WTI forecast
192
+ * const q2Wti = await client.forecasts.get('2024-Q2', 'WTI_USD');
193
+ *
194
+ * console.log(`Period: ${march2024.period}`);
195
+ * console.log(`Forecast: $${march2024.forecast_price}`);
196
+ * console.log(`Published: ${march2024.published_at}`);
197
+ * ```
198
+ */
199
+ get(period: string, commodity?: string): Promise<MonthlyForecast>;
200
+ }
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Forecasts Resource
3
+ *
4
+ * Access official price forecasts from EIA, IEA, and other agencies including
5
+ * monthly outlooks, accuracy metrics, and historical archives.
6
+ */
7
+ import { ValidationError } from "../errors.js";
8
+ /**
9
+ * Forecasts Resource
10
+ *
11
+ * Access official price forecasts from government agencies and research
12
+ * organizations including EIA, IEA, and others.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { OilPriceAPI } from 'oilpriceapi';
17
+ *
18
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
19
+ *
20
+ * // Get monthly forecasts
21
+ * const forecasts = await client.forecasts.monthly();
22
+ * forecasts.forEach(f => {
23
+ * console.log(`${f.period}: $${f.forecast_price} (${f.source})`);
24
+ * });
25
+ *
26
+ * // Check forecast accuracy
27
+ * const accuracy = await client.forecasts.accuracy();
28
+ * console.log(`EIA MAPE: ${accuracy.mape}%`);
29
+ * ```
30
+ */
31
+ export class ForecastsResource {
32
+ constructor(client) {
33
+ this.client = client;
34
+ }
35
+ /**
36
+ * Get monthly price forecasts
37
+ *
38
+ * Returns official monthly forecasts from EIA, IEA, and other agencies.
39
+ *
40
+ * @param commodity - Optional commodity code filter
41
+ * @returns Array of monthly forecasts
42
+ *
43
+ * @throws {OilPriceAPIError} If API request fails
44
+ * @throws {AuthenticationError} If API key is invalid
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * // Get all forecasts
49
+ * const allForecasts = await client.forecasts.monthly();
50
+ *
51
+ * // Get WTI forecasts only
52
+ * const wtiForecasts = await client.forecasts.monthly('WTI_USD');
53
+ *
54
+ * wtiForecasts.forEach(forecast => {
55
+ * console.log(`${forecast.period}: $${forecast.forecast_price}`);
56
+ * console.log(` Range: $${forecast.lower_bound} - $${forecast.upper_bound}`);
57
+ * console.log(` Source: ${forecast.source}`);
58
+ * });
59
+ * ```
60
+ */
61
+ async monthly(commodity) {
62
+ const params = {};
63
+ if (commodity)
64
+ params.commodity = commodity;
65
+ const response = await this.client["request"]("/v1/forecasts/monthly", params);
66
+ return Array.isArray(response) ? response : response.forecasts;
67
+ }
68
+ /**
69
+ * Get forecast accuracy metrics
70
+ *
71
+ * Returns historical accuracy measurements for forecast sources.
72
+ *
73
+ * @returns Forecast accuracy data
74
+ *
75
+ * @throws {OilPriceAPIError} If API request fails
76
+ * @throws {AuthenticationError} If API key is invalid
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * const accuracy = await client.forecasts.accuracy();
81
+ * console.log(`Source: ${accuracy.source}`);
82
+ * console.log(`MAPE: ${accuracy.mape}%`);
83
+ * console.log(`RMSE: ${accuracy.rmse}`);
84
+ * console.log(`Sample size: ${accuracy.sample_size} forecasts`);
85
+ * ```
86
+ */
87
+ async accuracy() {
88
+ return this.client["request"]("/v1/forecasts/accuracy", {});
89
+ }
90
+ /**
91
+ * Get archived forecasts
92
+ *
93
+ * Returns historical forecasts with actual outcomes for accuracy analysis.
94
+ *
95
+ * @param year - Optional year filter
96
+ * @returns Array of archived forecasts
97
+ *
98
+ * @throws {OilPriceAPIError} If API request fails
99
+ * @throws {AuthenticationError} If API key is invalid
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * // Get all archived forecasts
104
+ * const archive = await client.forecasts.archive();
105
+ *
106
+ * // Get forecasts from specific year
107
+ * const archive2024 = await client.forecasts.archive(2024);
108
+ *
109
+ * archive2024.forEach(forecast => {
110
+ * if (forecast.actual_price) {
111
+ * console.log(`${forecast.year}-${forecast.month}:`);
112
+ * console.log(` Forecast: $${forecast.forecast_price}`);
113
+ * console.log(` Actual: $${forecast.actual_price}`);
114
+ * console.log(` Error: ${forecast.error}%`);
115
+ * }
116
+ * });
117
+ * ```
118
+ */
119
+ async archive(year) {
120
+ const params = {};
121
+ if (year)
122
+ params.year = year.toString();
123
+ const response = await this.client["request"]("/v1/forecasts/archive", params);
124
+ return Array.isArray(response) ? response : response.forecasts;
125
+ }
126
+ /**
127
+ * Get forecast for a specific period
128
+ *
129
+ * @param period - Period identifier (e.g., "2024-03", "2024-Q2")
130
+ * @param commodity - Optional commodity code filter
131
+ * @returns Monthly forecast data
132
+ *
133
+ * @throws {NotFoundError} If period not found
134
+ * @throws {OilPriceAPIError} If API request fails
135
+ *
136
+ * @example
137
+ * ```typescript
138
+ * // Get March 2024 forecast
139
+ * const march2024 = await client.forecasts.get('2024-03');
140
+ *
141
+ * // Get Q2 2024 WTI forecast
142
+ * const q2Wti = await client.forecasts.get('2024-Q2', 'WTI_USD');
143
+ *
144
+ * console.log(`Period: ${march2024.period}`);
145
+ * console.log(`Forecast: $${march2024.forecast_price}`);
146
+ * console.log(`Published: ${march2024.published_at}`);
147
+ * ```
148
+ */
149
+ async get(period, commodity) {
150
+ if (!period || typeof period !== "string") {
151
+ throw new ValidationError("Period must be a non-empty string");
152
+ }
153
+ const params = {};
154
+ if (commodity)
155
+ params.commodity = commodity;
156
+ return this.client["request"](`/v1/forecasts/monthly/${period}`, params);
157
+ }
158
+ }
@@ -0,0 +1,322 @@
1
+ /**
2
+ * Futures Resource
3
+ *
4
+ * Access futures contract data including latest prices, historical data,
5
+ * OHLC, intraday, spreads, curves, and continuous contracts.
6
+ */
7
+ import type { OilPriceAPI } from "../client.js";
8
+ /**
9
+ * Futures contract price data
10
+ */
11
+ export interface FuturesPrice {
12
+ /** Contract symbol */
13
+ contract: string;
14
+ /** Current price */
15
+ price: number;
16
+ /** Formatted price string */
17
+ formatted?: string;
18
+ /** Currency code */
19
+ currency: string;
20
+ /** Contract expiration date */
21
+ expiration?: string;
22
+ /** ISO timestamp when price was recorded */
23
+ timestamp: string;
24
+ /** Additional metadata */
25
+ metadata?: Record<string, unknown>;
26
+ }
27
+ /**
28
+ * Historical futures price data
29
+ */
30
+ export interface HistoricalFuturesPrice {
31
+ /** Contract symbol */
32
+ contract: string;
33
+ /** Price */
34
+ price: number;
35
+ /** ISO timestamp */
36
+ timestamp: string;
37
+ /** Volume */
38
+ volume?: number;
39
+ /** Open interest */
40
+ open_interest?: number;
41
+ }
42
+ /**
43
+ * Options for historical futures query
44
+ */
45
+ export interface HistoricalFuturesOptions {
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
+ * OHLC (Open, High, Low, Close) data for a futures contract
53
+ */
54
+ export interface FuturesOHLC {
55
+ /** Contract symbol */
56
+ contract: string;
57
+ /** Date for this OHLC data */
58
+ date: string;
59
+ /** Opening price */
60
+ open: number;
61
+ /** Highest price */
62
+ high: number;
63
+ /** Lowest price */
64
+ low: number;
65
+ /** Closing price */
66
+ close: number;
67
+ /** Trading volume */
68
+ volume?: number;
69
+ /** Open interest */
70
+ open_interest?: number;
71
+ }
72
+ /**
73
+ * Intraday price point
74
+ */
75
+ export interface IntradayPrice {
76
+ /** Time of day (e.g., "09:30", "14:00") */
77
+ time: string;
78
+ /** Price at this time */
79
+ price: number;
80
+ /** Volume at this time */
81
+ volume?: number;
82
+ }
83
+ /**
84
+ * Intraday futures data
85
+ */
86
+ export interface IntradayFuturesData {
87
+ /** Contract symbol */
88
+ contract: string;
89
+ /** Date for this intraday data */
90
+ date: string;
91
+ /** Array of intraday price points */
92
+ prices: IntradayPrice[];
93
+ }
94
+ /**
95
+ * Futures spread data
96
+ */
97
+ export interface FuturesSpread {
98
+ /** First contract symbol */
99
+ contract1: string;
100
+ /** Second contract symbol */
101
+ contract2: string;
102
+ /** Spread value (contract1 - contract2) */
103
+ spread: number;
104
+ /** Percentage spread */
105
+ spread_percent?: number;
106
+ /** ISO timestamp */
107
+ timestamp: string;
108
+ }
109
+ /**
110
+ * Futures curve point
111
+ */
112
+ export interface FuturesCurvePoint {
113
+ /** Contract expiration date */
114
+ expiration: string;
115
+ /** Months until expiration */
116
+ months_out: number;
117
+ /** Price */
118
+ price: number;
119
+ /** Contract symbol */
120
+ contract?: string;
121
+ }
122
+ /**
123
+ * Futures curve data
124
+ */
125
+ export interface FuturesCurveData {
126
+ /** Base contract */
127
+ contract: string;
128
+ /** ISO timestamp when curve was generated */
129
+ timestamp: string;
130
+ /** Array of curve points */
131
+ curve: FuturesCurvePoint[];
132
+ }
133
+ /**
134
+ * Continuous contract data point
135
+ */
136
+ export interface ContinuousContractPrice {
137
+ /** Date */
138
+ date: string;
139
+ /** Price */
140
+ price: number;
141
+ /** Active contract at this date */
142
+ active_contract?: string;
143
+ }
144
+ /**
145
+ * Continuous futures contract data
146
+ */
147
+ export interface ContinuousFuturesData {
148
+ /** Base contract */
149
+ contract: string;
150
+ /** Number of months for continuous contract */
151
+ months: number;
152
+ /** Array of continuous prices */
153
+ prices: ContinuousContractPrice[];
154
+ }
155
+ /**
156
+ * Futures Resource
157
+ *
158
+ * Access futures contract data including latest, historical, OHLC, intraday,
159
+ * spreads, curves, and continuous contracts.
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * import { OilPriceAPI } from 'oilpriceapi';
164
+ *
165
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
166
+ *
167
+ * // Get latest price
168
+ * const latest = await client.futures.latest('CL.1');
169
+ * console.log(`${latest.contract}: $${latest.price}`);
170
+ *
171
+ * // Get OHLC data
172
+ * const ohlc = await client.futures.ohlc('CL.1', '2024-01-15');
173
+ * console.log(`High: $${ohlc.high}, Low: $${ohlc.low}`);
174
+ *
175
+ * // Get futures curve
176
+ * const curve = await client.futures.curve('CL');
177
+ * curve.curve.forEach(point => {
178
+ * console.log(`${point.months_out}mo: $${point.price}`);
179
+ * });
180
+ * ```
181
+ */
182
+ export declare class FuturesResource {
183
+ private client;
184
+ constructor(client: OilPriceAPI);
185
+ /**
186
+ * Get latest price for a futures contract
187
+ *
188
+ * @param contract - Contract symbol (e.g., "CL.1", "BZ.2")
189
+ * @returns Latest futures price data
190
+ *
191
+ * @throws {NotFoundError} If contract not found
192
+ * @throws {OilPriceAPIError} If API request fails
193
+ *
194
+ * @example
195
+ * ```typescript
196
+ * const price = await client.futures.latest('CL.1');
197
+ * console.log(`WTI Front Month: $${price.price}`);
198
+ * ```
199
+ */
200
+ latest(contract: string): Promise<FuturesPrice>;
201
+ /**
202
+ * Get historical prices for a futures contract
203
+ *
204
+ * @param contract - Contract symbol (e.g., "CL.1", "BZ.2")
205
+ * @param options - Date range filters
206
+ * @returns Array of historical prices
207
+ *
208
+ * @throws {NotFoundError} If contract not found
209
+ * @throws {OilPriceAPIError} If API request fails
210
+ *
211
+ * @example
212
+ * ```typescript
213
+ * const history = await client.futures.historical('CL.1', {
214
+ * startDate: '2024-01-01',
215
+ * endDate: '2024-01-31'
216
+ * });
217
+ * console.log(`${history.length} historical prices`);
218
+ * ```
219
+ */
220
+ historical(contract: string, options?: HistoricalFuturesOptions): Promise<HistoricalFuturesPrice[]>;
221
+ /**
222
+ * Get OHLC (Open, High, Low, Close) data for a futures contract
223
+ *
224
+ * @param contract - Contract symbol (e.g., "CL.1", "BZ.2")
225
+ * @param date - Optional date in YYYY-MM-DD format (defaults to latest)
226
+ * @returns OHLC data
227
+ *
228
+ * @throws {NotFoundError} If contract not found
229
+ * @throws {OilPriceAPIError} If API request fails
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * const ohlc = await client.futures.ohlc('CL.1', '2024-01-15');
234
+ * console.log(`Open: $${ohlc.open}`);
235
+ * console.log(`High: $${ohlc.high}`);
236
+ * console.log(`Low: $${ohlc.low}`);
237
+ * console.log(`Close: $${ohlc.close}`);
238
+ * ```
239
+ */
240
+ ohlc(contract: string, date?: string): Promise<FuturesOHLC>;
241
+ /**
242
+ * Get intraday price data for a futures contract
243
+ *
244
+ * Returns price points throughout the trading day.
245
+ *
246
+ * @param contract - Contract symbol (e.g., "CL.1", "BZ.2")
247
+ * @returns Intraday price data
248
+ *
249
+ * @throws {NotFoundError} If contract not found
250
+ * @throws {OilPriceAPIError} If API request fails
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * const intraday = await client.futures.intraday('CL.1');
255
+ * intraday.prices.forEach(point => {
256
+ * console.log(`${point.time}: $${point.price}`);
257
+ * });
258
+ * ```
259
+ */
260
+ intraday(contract: string): Promise<IntradayFuturesData>;
261
+ /**
262
+ * Get spread between two futures contracts
263
+ *
264
+ * Calculates the price difference between two contracts (contract1 - contract2).
265
+ *
266
+ * @param contract1 - First contract symbol
267
+ * @param contract2 - Second contract symbol
268
+ * @returns Spread data
269
+ *
270
+ * @throws {NotFoundError} If either contract not found
271
+ * @throws {OilPriceAPIError} If API request fails
272
+ *
273
+ * @example
274
+ * ```typescript
275
+ * // Calculate spread between front month and second month
276
+ * const spread = await client.futures.spreads('CL.1', 'CL.2');
277
+ * console.log(`CL.1 - CL.2 spread: $${spread.spread}`);
278
+ * ```
279
+ */
280
+ spreads(contract1: string, contract2: string): Promise<FuturesSpread>;
281
+ /**
282
+ * Get futures curve for a contract
283
+ *
284
+ * Returns the forward curve showing prices across different expiration dates.
285
+ *
286
+ * @param contract - Base contract symbol (e.g., "CL", "BZ")
287
+ * @returns Futures curve data
288
+ *
289
+ * @throws {NotFoundError} If contract not found
290
+ * @throws {OilPriceAPIError} If API request fails
291
+ *
292
+ * @example
293
+ * ```typescript
294
+ * const curve = await client.futures.curve('CL');
295
+ * console.log('WTI Futures Curve:');
296
+ * curve.curve.forEach(point => {
297
+ * console.log(`${point.months_out} months: $${point.price}`);
298
+ * });
299
+ * ```
300
+ */
301
+ curve(contract: string): Promise<FuturesCurveData>;
302
+ /**
303
+ * Get continuous futures contract data
304
+ *
305
+ * Returns a continuous time series by rolling contracts before expiration.
306
+ *
307
+ * @param contract - Base contract symbol (e.g., "CL", "BZ")
308
+ * @param months - Number of months for continuous contract (default: 1 for front month)
309
+ * @returns Continuous contract data
310
+ *
311
+ * @throws {NotFoundError} If contract not found
312
+ * @throws {OilPriceAPIError} If API request fails
313
+ *
314
+ * @example
315
+ * ```typescript
316
+ * // Get continuous front month contract
317
+ * const continuous = await client.futures.continuous('CL', 1);
318
+ * console.log(`${continuous.prices.length} data points`);
319
+ * ```
320
+ */
321
+ continuous(contract: string, months?: number): Promise<ContinuousFuturesData>;
322
+ }