@allratestoday/sdk 1.4.5 → 1.5.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/dist/index.d.mts CHANGED
@@ -19,13 +19,21 @@ interface RateResponse {
19
19
  currency: string;
20
20
  amount: number;
21
21
  };
22
+ /** Units of `to` per 1 unit of `from`. */
22
23
  rate: number;
24
+ /** Rate type label, e.g. `interbank` (live mid-market). */
23
25
  source: string;
26
+ /** Rate timestamp (ISO 8601, UTC) when the API returns one. */
27
+ time?: string;
24
28
  }
25
29
  interface AuthRateResponse {
30
+ /** Units of `target` per 1 unit of `source`. */
26
31
  rate: number;
32
+ /** Base currency code. */
27
33
  source: string;
34
+ /** Quote currency code. */
28
35
  target: string;
36
+ /** Rate timestamp (ISO 8601, UTC). */
29
37
  time: string;
30
38
  }
31
39
  interface LatestOptions extends RequestOptions {
@@ -36,19 +44,24 @@ interface LatestOptions extends RequestOptions {
36
44
  }
37
45
  interface LatestResponse {
38
46
  base: string;
47
+ /** Timestamp of the rates (ISO 8601, UTC). */
39
48
  date: string;
49
+ /** Units of each currency per 1 unit of `base`. */
40
50
  rates: Record<string, number>;
41
51
  }
42
52
  interface ForDateOptions extends RequestOptions {
43
53
  /** Base currency code. Default: `USD` */
44
54
  base?: string;
45
- /** Array of target currency codes. */
46
- symbols?: string[];
55
+ /** Target currency codes (required). Each symbol is one history request. */
56
+ symbols: string[];
47
57
  }
48
58
  interface ForDateResponse {
49
59
  base: string;
60
+ /** The date you asked for (YYYY-MM-DD). */
50
61
  date: string;
51
62
  rates: Record<string, number>;
63
+ /** Date of the data point actually used per currency. Equal to `date` unless no point exists for that day (then the closest earlier one). */
64
+ rateDates: Record<string, string>;
52
65
  }
53
66
  interface ConvertOptions extends RequestOptions {
54
67
  /** Historical date for conversion (YYYY-MM-DD or Date object). */
@@ -60,13 +73,16 @@ interface ConvertResponse {
60
73
  amount: number;
61
74
  result: number;
62
75
  rate: number;
76
+ /** Requested date, for historical conversions. */
63
77
  date?: string;
78
+ /** Date of the data point actually used, for historical conversions. */
79
+ rateDate?: string;
64
80
  }
65
81
  interface TimeSeriesOptions extends RequestOptions {
66
82
  /** Base currency code. Default: `USD` */
67
83
  base?: string;
68
- /** Array of target currency codes. */
69
- symbols?: string[];
84
+ /** Target currency codes (required). Each symbol is one history request. */
85
+ symbols: string[];
70
86
  }
71
87
  interface TimeSeriesResponse {
72
88
  base: string;
@@ -74,21 +90,42 @@ interface TimeSeriesResponse {
74
90
  endDate: string;
75
91
  rates: Record<string, Record<string, number>>;
76
92
  }
93
+ type HistoryPeriod = '1d' | '7d' | '30d' | '1y';
94
+ interface HistoryPoint {
95
+ /** `YYYY-MM-DD` for daily/weekly points, full ISO timestamp for hourly (`1d`) points. */
96
+ date: string;
97
+ rate: number;
98
+ /** Unix time in milliseconds. */
99
+ timestamp: number;
100
+ }
77
101
  interface HistoricalRateResponse {
78
102
  source: string;
79
103
  target: string;
80
104
  period: string;
105
+ /** Most recent point in the series. */
81
106
  current: {
82
107
  rate: number;
83
108
  time: string;
84
109
  };
110
+ /** Points oldest first. `time` is the point's date (or timestamp for `1d`). */
85
111
  rates: Array<{
86
112
  rate: number;
87
113
  time: string;
88
114
  }>;
115
+ /** Raw points as the API returns them. */
116
+ data: HistoryPoint[];
117
+ }
118
+ interface CurrencyInfo {
119
+ code: string;
120
+ name: string;
121
+ symbol: string;
89
122
  }
90
123
  interface SymbolsResponse {
124
+ /** Code → name, e.g. `{ USD: 'US Dollar' }`. */
91
125
  symbols: Record<string, string>;
126
+ /** Full list with display symbols. */
127
+ currencies: CurrencyInfo[];
128
+ count: number;
92
129
  }
93
130
  interface OfficialRateOptions extends RequestOptions {
94
131
  /** Base currency of the pair, e.g. `USD`. Give together with `target` to narrow to one pair. */
@@ -120,14 +157,33 @@ interface OfficialRatesResponse {
120
157
  target?: string;
121
158
  rate?: number;
122
159
  rate_type?: string;
123
- /** True when the pair was cross-computed inside the bank's own table rather than published directly. */
160
+ /** True when the pair is not published as-is: the inverse of a published rate (keyless), or a cross via the bank's base (`officialRatesOn`). */
124
161
  derived?: boolean;
125
- method?: 'published' | 'inverse';
162
+ method?: 'published' | 'inverse' | 'cross';
126
163
  /** True when the institution is behind its own publication schedule. */
127
164
  stale?: boolean;
128
165
  attribution: OfficialRateAttribution;
129
166
  free_key: string;
130
167
  }
168
+ interface DatedOfficialRatesResponse {
169
+ bank: string;
170
+ /** Institution name, e.g. `European Central Bank`. */
171
+ name: string;
172
+ /** The date you asked for (YYYY-MM-DD). */
173
+ requested_date: string;
174
+ /** Publication date of the table actually returned. Earlier than `requested_date` on weekends/holidays. */
175
+ rate_date: string;
176
+ published_on_requested_date: boolean;
177
+ /** Full published table. Present when no pair was requested. */
178
+ rates?: OfficialRateEntry[];
179
+ source?: string;
180
+ target?: string;
181
+ rate?: number;
182
+ rate_type?: string;
183
+ derived?: boolean;
184
+ method?: 'published' | 'inverse' | 'cross';
185
+ disclaimer?: string;
186
+ }
131
187
  interface OfficialSource {
132
188
  /** Pass this as `bank` to `officialRates()`. */
133
189
  code: string;
@@ -144,10 +200,17 @@ interface OfficialSourcesResponse {
144
200
  docs: string;
145
201
  free_key: string;
146
202
  }
203
+ type AllRatesTodayErrorCode = 'missing_key' | 'invalid_argument' | 'http' | 'timeout' | 'network';
147
204
  declare class AllRatesTodayError extends Error {
148
- /** HTTP status code (when available). */
205
+ /** HTTP status code, for `code: 'http'` errors. */
149
206
  status?: number;
150
- constructor(message: string, status?: number);
207
+ /** What went wrong: `missing_key`, `invalid_argument`, `http`, `timeout` or `network`. */
208
+ code: AllRatesTodayErrorCode;
209
+ /** Parsed JSON error body from the API, e.g. `{ error, used, limit, plan, resets_at }` on 429. */
210
+ details?: Record<string, unknown>;
211
+ constructor(message: string, status?: number, code?: AllRatesTodayErrorCode, details?: Record<string, unknown>, options?: {
212
+ cause?: unknown;
213
+ });
151
214
  }
152
215
  declare class AllRatesToday {
153
216
  private apiKey?;
@@ -166,6 +229,16 @@ declare class AllRatesToday {
166
229
  private resolveKey;
167
230
  private request;
168
231
  private formatDate;
232
+ private requireSymbols;
233
+ /**
234
+ * Smallest history window that reaches back to `start`. Market history is
235
+ * served as windows ending today (7 days, 30 days, 1 year), so older dates
236
+ * are not available from the market-rate API.
237
+ */
238
+ private windowFor;
239
+ private history;
240
+ /** Last point on or before `date` (YYYY-MM-DD). */
241
+ private pointOn;
169
242
  /**
170
243
  * Get the latest exchange rates.
171
244
  *
@@ -179,36 +252,34 @@ declare class AllRatesToday {
179
252
  */
180
253
  latest(options?: LatestOptions): Promise<LatestResponse>;
181
254
  /**
182
- * Get exchange rates for a specific historical date.
183
- *
184
- * ```ts
185
- * // Using a string
186
- * const data = await client.forDate('2026-01-15');
255
+ * Get mid-market rates for a past date within the last 365 days.
187
256
  *
188
- * // Using a Date object
189
- * const data = await client.forDate(new Date('2026-01-15'));
257
+ * One history request per symbol. Billed per request by window: dates up to
258
+ * 29 days ago cost 1 call per symbol, older dates (up to 1 year) cost 12,
259
+ * because the 1-year window is weekly points. If a day has no point, the
260
+ * closest earlier one is used and reported in `rateDates`.
190
261
  *
191
- * // With options
192
- * const data = await client.forDate('2026-01-15', { base: 'EUR', symbols: ['USD', 'GBP'] });
262
+ * ```ts
263
+ * const data = await client.forDate('2026-10-01', { base: 'USD', symbols: ['EUR', 'GBP'] });
264
+ * // { base: 'USD', date: '2026-10-01', rates: { EUR: 0.85, GBP: 0.74 }, rateDates: { ... } }
193
265
  * ```
194
266
  */
195
- forDate(date: string | Date, options?: ForDateOptions): Promise<ForDateResponse>;
267
+ forDate(date: string | Date, options: ForDateOptions): Promise<ForDateResponse>;
196
268
  /**
197
- * Get exchange rate time series between two dates.
269
+ * Daily mid-market rates between two dates within the last 365 days.
198
270
  *
199
- * ```ts
200
- * const data = await client.timeSeries('2026-01-01', '2026-03-31', {
201
- * base: 'USD',
202
- * symbols: ['EUR', 'GBP'],
203
- * });
271
+ * One history request per symbol. Ranges starting up to 29 days ago return
272
+ * daily points (1 call per symbol); older starts use the 1-year window,
273
+ * which has weekly points and costs 12 calls per symbol.
204
274
  *
205
- * // Access rates by date
206
- * console.log(data.rates['2026-01-15']); // { EUR: 0.92, GBP: 0.78 }
275
+ * ```ts
276
+ * const data = await client.timeSeries('2026-10-01', '2026-10-10', { symbols: ['EUR', 'GBP'] });
277
+ * console.log(data.rates['2026-10-05']); // { EUR: 0.86, GBP: 0.75 }
207
278
  * ```
208
279
  */
209
- timeSeries(startDate: string | Date, endDate: string | Date, options?: TimeSeriesOptions): Promise<TimeSeriesResponse>;
280
+ timeSeries(startDate: string | Date, endDate: string | Date, options: TimeSeriesOptions): Promise<TimeSeriesResponse>;
210
281
  /**
211
- * Get all supported currency symbols.
282
+ * Get all supported currency codes and names. **No API key needed.**
212
283
  *
213
284
  * ```ts
214
285
  * const { symbols } = await client.symbols();
@@ -231,14 +302,27 @@ declare class AllRatesToday {
231
302
  * const table = await client.officialRates('ecb');
232
303
  * console.log(table.rate_date, table.rates);
233
304
  *
234
- * // One pair — cross-computed inside the bank's table when not published directly
305
+ * // One pair — published as-is or the inverse of a published rate (`derived: true`)
235
306
  * const usd = await client.officialRates('ecb', { source: 'EUR', target: 'USD' });
236
307
  * console.log(`ECB ${usd.rate_date}: 1 EUR = ${usd.rate} USD`);
237
308
  * ```
238
309
  *
239
- * Dated tables and history need a free key: see `/api/v1/central-bank/{bank}/{date}`.
310
+ * Cross pairs and past dates need a key: use `officialRatesOn()`.
240
311
  */
241
312
  officialRates(bank: string, options?: OfficialRateOptions): Promise<OfficialRatesResponse>;
313
+ /**
314
+ * Official table (or one pair) as published on a given date. Needs an API
315
+ * key; 1 call. On weekends and holidays the last earlier publication is
316
+ * returned (`published_on_requested_date: false`). Unlike the keyless
317
+ * `officialRates()`, any pair inside the table can be cross-computed
318
+ * (`method: 'cross'`), e.g. USD/GBP from the ECB's EUR table.
319
+ *
320
+ * ```ts
321
+ * const r = await client.officialRatesOn('rbi', '2026-09-30', { source: 'USD', target: 'INR' });
322
+ * console.log(r.rate_date, r.rate); // 2026-09-30 95.9832
323
+ * ```
324
+ */
325
+ officialRatesOn(bank: string, date: string | Date, options?: OfficialRateOptions): Promise<DatedOfficialRatesResponse>;
242
326
  /**
243
327
  * Every covered official source with its code, name, latest publication
244
328
  * date and whether it is behind schedule. **No API key needed.**
@@ -272,7 +356,8 @@ declare class AllRatesToday {
272
356
  */
273
357
  getRates(source: string, target: string, options?: RequestOptions): Promise<AuthRateResponse[]>;
274
358
  /**
275
- * Get historical rates by period.
359
+ * Mid-market history for a preset window ending today: `1d` (hourly),
360
+ * `7d` / `30d` (daily) or `1y` (weekly). `1y` is billed as 12 calls.
276
361
  *
277
362
  * ```ts
278
363
  * const history = await client.getHistoricalRates('USD', 'EUR', '30d');
@@ -281,7 +366,7 @@ declare class AllRatesToday {
281
366
  * });
282
367
  * ```
283
368
  */
284
- getHistoricalRates(source: string, target: string, period?: '1d' | '7d' | '30d' | '1y', options?: RequestOptions): Promise<HistoricalRateResponse>;
369
+ getHistoricalRates(source: string, target: string, period?: HistoryPeriod, options?: RequestOptions): Promise<HistoricalRateResponse>;
285
370
  /**
286
371
  * Convert an amount between two currencies.
287
372
  *
@@ -298,4 +383,4 @@ declare class AllRatesToday {
298
383
  convert(from: string, to: string, amount: number, options?: ConvertOptions): Promise<ConvertResponse>;
299
384
  }
300
385
 
301
- export { AllRatesToday, AllRatesTodayError, type AllRatesTodayOptions, type AuthRateResponse, type ConvertOptions, type ConvertResponse, type ForDateOptions, type ForDateResponse, type HistoricalRateResponse, type LatestOptions, type LatestResponse, type OfficialRateAttribution, type OfficialRateEntry, type OfficialRateOptions, type OfficialRatesResponse, type OfficialSource, type OfficialSourcesResponse, type RateResponse, type RequestOptions, type SymbolsResponse, type TimeSeriesOptions, type TimeSeriesResponse, AllRatesToday as default };
386
+ export { AllRatesToday, AllRatesTodayError, type AllRatesTodayErrorCode, type AllRatesTodayOptions, type AuthRateResponse, type ConvertOptions, type ConvertResponse, type CurrencyInfo, type DatedOfficialRatesResponse, type ForDateOptions, type ForDateResponse, type HistoricalRateResponse, type HistoryPeriod, type HistoryPoint, type LatestOptions, type LatestResponse, type OfficialRateAttribution, type OfficialRateEntry, type OfficialRateOptions, type OfficialRatesResponse, type OfficialSource, type OfficialSourcesResponse, type RateResponse, type RequestOptions, type SymbolsResponse, type TimeSeriesOptions, type TimeSeriesResponse, AllRatesToday as default };
package/dist/index.d.ts CHANGED
@@ -19,13 +19,21 @@ interface RateResponse {
19
19
  currency: string;
20
20
  amount: number;
21
21
  };
22
+ /** Units of `to` per 1 unit of `from`. */
22
23
  rate: number;
24
+ /** Rate type label, e.g. `interbank` (live mid-market). */
23
25
  source: string;
26
+ /** Rate timestamp (ISO 8601, UTC) when the API returns one. */
27
+ time?: string;
24
28
  }
25
29
  interface AuthRateResponse {
30
+ /** Units of `target` per 1 unit of `source`. */
26
31
  rate: number;
32
+ /** Base currency code. */
27
33
  source: string;
34
+ /** Quote currency code. */
28
35
  target: string;
36
+ /** Rate timestamp (ISO 8601, UTC). */
29
37
  time: string;
30
38
  }
31
39
  interface LatestOptions extends RequestOptions {
@@ -36,19 +44,24 @@ interface LatestOptions extends RequestOptions {
36
44
  }
37
45
  interface LatestResponse {
38
46
  base: string;
47
+ /** Timestamp of the rates (ISO 8601, UTC). */
39
48
  date: string;
49
+ /** Units of each currency per 1 unit of `base`. */
40
50
  rates: Record<string, number>;
41
51
  }
42
52
  interface ForDateOptions extends RequestOptions {
43
53
  /** Base currency code. Default: `USD` */
44
54
  base?: string;
45
- /** Array of target currency codes. */
46
- symbols?: string[];
55
+ /** Target currency codes (required). Each symbol is one history request. */
56
+ symbols: string[];
47
57
  }
48
58
  interface ForDateResponse {
49
59
  base: string;
60
+ /** The date you asked for (YYYY-MM-DD). */
50
61
  date: string;
51
62
  rates: Record<string, number>;
63
+ /** Date of the data point actually used per currency. Equal to `date` unless no point exists for that day (then the closest earlier one). */
64
+ rateDates: Record<string, string>;
52
65
  }
53
66
  interface ConvertOptions extends RequestOptions {
54
67
  /** Historical date for conversion (YYYY-MM-DD or Date object). */
@@ -60,13 +73,16 @@ interface ConvertResponse {
60
73
  amount: number;
61
74
  result: number;
62
75
  rate: number;
76
+ /** Requested date, for historical conversions. */
63
77
  date?: string;
78
+ /** Date of the data point actually used, for historical conversions. */
79
+ rateDate?: string;
64
80
  }
65
81
  interface TimeSeriesOptions extends RequestOptions {
66
82
  /** Base currency code. Default: `USD` */
67
83
  base?: string;
68
- /** Array of target currency codes. */
69
- symbols?: string[];
84
+ /** Target currency codes (required). Each symbol is one history request. */
85
+ symbols: string[];
70
86
  }
71
87
  interface TimeSeriesResponse {
72
88
  base: string;
@@ -74,21 +90,42 @@ interface TimeSeriesResponse {
74
90
  endDate: string;
75
91
  rates: Record<string, Record<string, number>>;
76
92
  }
93
+ type HistoryPeriod = '1d' | '7d' | '30d' | '1y';
94
+ interface HistoryPoint {
95
+ /** `YYYY-MM-DD` for daily/weekly points, full ISO timestamp for hourly (`1d`) points. */
96
+ date: string;
97
+ rate: number;
98
+ /** Unix time in milliseconds. */
99
+ timestamp: number;
100
+ }
77
101
  interface HistoricalRateResponse {
78
102
  source: string;
79
103
  target: string;
80
104
  period: string;
105
+ /** Most recent point in the series. */
81
106
  current: {
82
107
  rate: number;
83
108
  time: string;
84
109
  };
110
+ /** Points oldest first. `time` is the point's date (or timestamp for `1d`). */
85
111
  rates: Array<{
86
112
  rate: number;
87
113
  time: string;
88
114
  }>;
115
+ /** Raw points as the API returns them. */
116
+ data: HistoryPoint[];
117
+ }
118
+ interface CurrencyInfo {
119
+ code: string;
120
+ name: string;
121
+ symbol: string;
89
122
  }
90
123
  interface SymbolsResponse {
124
+ /** Code → name, e.g. `{ USD: 'US Dollar' }`. */
91
125
  symbols: Record<string, string>;
126
+ /** Full list with display symbols. */
127
+ currencies: CurrencyInfo[];
128
+ count: number;
92
129
  }
93
130
  interface OfficialRateOptions extends RequestOptions {
94
131
  /** Base currency of the pair, e.g. `USD`. Give together with `target` to narrow to one pair. */
@@ -120,14 +157,33 @@ interface OfficialRatesResponse {
120
157
  target?: string;
121
158
  rate?: number;
122
159
  rate_type?: string;
123
- /** True when the pair was cross-computed inside the bank's own table rather than published directly. */
160
+ /** True when the pair is not published as-is: the inverse of a published rate (keyless), or a cross via the bank's base (`officialRatesOn`). */
124
161
  derived?: boolean;
125
- method?: 'published' | 'inverse';
162
+ method?: 'published' | 'inverse' | 'cross';
126
163
  /** True when the institution is behind its own publication schedule. */
127
164
  stale?: boolean;
128
165
  attribution: OfficialRateAttribution;
129
166
  free_key: string;
130
167
  }
168
+ interface DatedOfficialRatesResponse {
169
+ bank: string;
170
+ /** Institution name, e.g. `European Central Bank`. */
171
+ name: string;
172
+ /** The date you asked for (YYYY-MM-DD). */
173
+ requested_date: string;
174
+ /** Publication date of the table actually returned. Earlier than `requested_date` on weekends/holidays. */
175
+ rate_date: string;
176
+ published_on_requested_date: boolean;
177
+ /** Full published table. Present when no pair was requested. */
178
+ rates?: OfficialRateEntry[];
179
+ source?: string;
180
+ target?: string;
181
+ rate?: number;
182
+ rate_type?: string;
183
+ derived?: boolean;
184
+ method?: 'published' | 'inverse' | 'cross';
185
+ disclaimer?: string;
186
+ }
131
187
  interface OfficialSource {
132
188
  /** Pass this as `bank` to `officialRates()`. */
133
189
  code: string;
@@ -144,10 +200,17 @@ interface OfficialSourcesResponse {
144
200
  docs: string;
145
201
  free_key: string;
146
202
  }
203
+ type AllRatesTodayErrorCode = 'missing_key' | 'invalid_argument' | 'http' | 'timeout' | 'network';
147
204
  declare class AllRatesTodayError extends Error {
148
- /** HTTP status code (when available). */
205
+ /** HTTP status code, for `code: 'http'` errors. */
149
206
  status?: number;
150
- constructor(message: string, status?: number);
207
+ /** What went wrong: `missing_key`, `invalid_argument`, `http`, `timeout` or `network`. */
208
+ code: AllRatesTodayErrorCode;
209
+ /** Parsed JSON error body from the API, e.g. `{ error, used, limit, plan, resets_at }` on 429. */
210
+ details?: Record<string, unknown>;
211
+ constructor(message: string, status?: number, code?: AllRatesTodayErrorCode, details?: Record<string, unknown>, options?: {
212
+ cause?: unknown;
213
+ });
151
214
  }
152
215
  declare class AllRatesToday {
153
216
  private apiKey?;
@@ -166,6 +229,16 @@ declare class AllRatesToday {
166
229
  private resolveKey;
167
230
  private request;
168
231
  private formatDate;
232
+ private requireSymbols;
233
+ /**
234
+ * Smallest history window that reaches back to `start`. Market history is
235
+ * served as windows ending today (7 days, 30 days, 1 year), so older dates
236
+ * are not available from the market-rate API.
237
+ */
238
+ private windowFor;
239
+ private history;
240
+ /** Last point on or before `date` (YYYY-MM-DD). */
241
+ private pointOn;
169
242
  /**
170
243
  * Get the latest exchange rates.
171
244
  *
@@ -179,36 +252,34 @@ declare class AllRatesToday {
179
252
  */
180
253
  latest(options?: LatestOptions): Promise<LatestResponse>;
181
254
  /**
182
- * Get exchange rates for a specific historical date.
183
- *
184
- * ```ts
185
- * // Using a string
186
- * const data = await client.forDate('2026-01-15');
255
+ * Get mid-market rates for a past date within the last 365 days.
187
256
  *
188
- * // Using a Date object
189
- * const data = await client.forDate(new Date('2026-01-15'));
257
+ * One history request per symbol. Billed per request by window: dates up to
258
+ * 29 days ago cost 1 call per symbol, older dates (up to 1 year) cost 12,
259
+ * because the 1-year window is weekly points. If a day has no point, the
260
+ * closest earlier one is used and reported in `rateDates`.
190
261
  *
191
- * // With options
192
- * const data = await client.forDate('2026-01-15', { base: 'EUR', symbols: ['USD', 'GBP'] });
262
+ * ```ts
263
+ * const data = await client.forDate('2026-10-01', { base: 'USD', symbols: ['EUR', 'GBP'] });
264
+ * // { base: 'USD', date: '2026-10-01', rates: { EUR: 0.85, GBP: 0.74 }, rateDates: { ... } }
193
265
  * ```
194
266
  */
195
- forDate(date: string | Date, options?: ForDateOptions): Promise<ForDateResponse>;
267
+ forDate(date: string | Date, options: ForDateOptions): Promise<ForDateResponse>;
196
268
  /**
197
- * Get exchange rate time series between two dates.
269
+ * Daily mid-market rates between two dates within the last 365 days.
198
270
  *
199
- * ```ts
200
- * const data = await client.timeSeries('2026-01-01', '2026-03-31', {
201
- * base: 'USD',
202
- * symbols: ['EUR', 'GBP'],
203
- * });
271
+ * One history request per symbol. Ranges starting up to 29 days ago return
272
+ * daily points (1 call per symbol); older starts use the 1-year window,
273
+ * which has weekly points and costs 12 calls per symbol.
204
274
  *
205
- * // Access rates by date
206
- * console.log(data.rates['2026-01-15']); // { EUR: 0.92, GBP: 0.78 }
275
+ * ```ts
276
+ * const data = await client.timeSeries('2026-10-01', '2026-10-10', { symbols: ['EUR', 'GBP'] });
277
+ * console.log(data.rates['2026-10-05']); // { EUR: 0.86, GBP: 0.75 }
207
278
  * ```
208
279
  */
209
- timeSeries(startDate: string | Date, endDate: string | Date, options?: TimeSeriesOptions): Promise<TimeSeriesResponse>;
280
+ timeSeries(startDate: string | Date, endDate: string | Date, options: TimeSeriesOptions): Promise<TimeSeriesResponse>;
210
281
  /**
211
- * Get all supported currency symbols.
282
+ * Get all supported currency codes and names. **No API key needed.**
212
283
  *
213
284
  * ```ts
214
285
  * const { symbols } = await client.symbols();
@@ -231,14 +302,27 @@ declare class AllRatesToday {
231
302
  * const table = await client.officialRates('ecb');
232
303
  * console.log(table.rate_date, table.rates);
233
304
  *
234
- * // One pair — cross-computed inside the bank's table when not published directly
305
+ * // One pair — published as-is or the inverse of a published rate (`derived: true`)
235
306
  * const usd = await client.officialRates('ecb', { source: 'EUR', target: 'USD' });
236
307
  * console.log(`ECB ${usd.rate_date}: 1 EUR = ${usd.rate} USD`);
237
308
  * ```
238
309
  *
239
- * Dated tables and history need a free key: see `/api/v1/central-bank/{bank}/{date}`.
310
+ * Cross pairs and past dates need a key: use `officialRatesOn()`.
240
311
  */
241
312
  officialRates(bank: string, options?: OfficialRateOptions): Promise<OfficialRatesResponse>;
313
+ /**
314
+ * Official table (or one pair) as published on a given date. Needs an API
315
+ * key; 1 call. On weekends and holidays the last earlier publication is
316
+ * returned (`published_on_requested_date: false`). Unlike the keyless
317
+ * `officialRates()`, any pair inside the table can be cross-computed
318
+ * (`method: 'cross'`), e.g. USD/GBP from the ECB's EUR table.
319
+ *
320
+ * ```ts
321
+ * const r = await client.officialRatesOn('rbi', '2026-09-30', { source: 'USD', target: 'INR' });
322
+ * console.log(r.rate_date, r.rate); // 2026-09-30 95.9832
323
+ * ```
324
+ */
325
+ officialRatesOn(bank: string, date: string | Date, options?: OfficialRateOptions): Promise<DatedOfficialRatesResponse>;
242
326
  /**
243
327
  * Every covered official source with its code, name, latest publication
244
328
  * date and whether it is behind schedule. **No API key needed.**
@@ -272,7 +356,8 @@ declare class AllRatesToday {
272
356
  */
273
357
  getRates(source: string, target: string, options?: RequestOptions): Promise<AuthRateResponse[]>;
274
358
  /**
275
- * Get historical rates by period.
359
+ * Mid-market history for a preset window ending today: `1d` (hourly),
360
+ * `7d` / `30d` (daily) or `1y` (weekly). `1y` is billed as 12 calls.
276
361
  *
277
362
  * ```ts
278
363
  * const history = await client.getHistoricalRates('USD', 'EUR', '30d');
@@ -281,7 +366,7 @@ declare class AllRatesToday {
281
366
  * });
282
367
  * ```
283
368
  */
284
- getHistoricalRates(source: string, target: string, period?: '1d' | '7d' | '30d' | '1y', options?: RequestOptions): Promise<HistoricalRateResponse>;
369
+ getHistoricalRates(source: string, target: string, period?: HistoryPeriod, options?: RequestOptions): Promise<HistoricalRateResponse>;
285
370
  /**
286
371
  * Convert an amount between two currencies.
287
372
  *
@@ -298,4 +383,4 @@ declare class AllRatesToday {
298
383
  convert(from: string, to: string, amount: number, options?: ConvertOptions): Promise<ConvertResponse>;
299
384
  }
300
385
 
301
- export { AllRatesToday, AllRatesTodayError, type AllRatesTodayOptions, type AuthRateResponse, type ConvertOptions, type ConvertResponse, type ForDateOptions, type ForDateResponse, type HistoricalRateResponse, type LatestOptions, type LatestResponse, type OfficialRateAttribution, type OfficialRateEntry, type OfficialRateOptions, type OfficialRatesResponse, type OfficialSource, type OfficialSourcesResponse, type RateResponse, type RequestOptions, type SymbolsResponse, type TimeSeriesOptions, type TimeSeriesResponse, AllRatesToday as default };
386
+ export { AllRatesToday, AllRatesTodayError, type AllRatesTodayErrorCode, type AllRatesTodayOptions, type AuthRateResponse, type ConvertOptions, type ConvertResponse, type CurrencyInfo, type DatedOfficialRatesResponse, type ForDateOptions, type ForDateResponse, type HistoricalRateResponse, type HistoryPeriod, type HistoryPoint, type LatestOptions, type LatestResponse, type OfficialRateAttribution, type OfficialRateEntry, type OfficialRateOptions, type OfficialRatesResponse, type OfficialSource, type OfficialSourcesResponse, type RateResponse, type RequestOptions, type SymbolsResponse, type TimeSeriesOptions, type TimeSeriesResponse, AllRatesToday as default };