@apifreaks/openapi-specs 0.4.2 → 0.4.3
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.cjs +657 -84
- package/dist/index.js +657 -84
- package/dist/specs/commodity/commodity-fluctuation.yaml +81 -7
- package/dist/specs/commodity/commodity-prices.yaml +130 -22
- package/dist/specs/commodity/commodity-symbols.yaml +54 -7
- package/dist/specs/commodity/commodity-time-series.yaml +94 -7
- package/dist/specs/commodity/historical-commodity-prices.yaml +112 -30
- package/package.json +1 -1
- package/specs/README.md +1 -1
- package/specs/commodity/commodity-fluctuation.json +118 -8
- package/specs/commodity/commodity-prices.json +176 -23
- package/specs/commodity/commodity-symbols.json +64 -7
- package/specs/commodity/commodity-time-series.json +136 -8
- package/specs/commodity/historical-commodity-prices.json +158 -33
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"openapi": "3.1.1",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "Historical Commodity Prices, Delivered Simply.",
|
|
5
|
-
"version": "
|
|
6
|
-
"description": "Retrieve OHLC (open, high, low, close) price data for any supported commodity on a specific date. Data is available from January 1990 onwards for
|
|
5
|
+
"version": "2.0.0",
|
|
6
|
+
"description": "Retrieve OHLC (open, high, low, close) price data for any supported commodity on a specific date. Data is available from January 1990 onwards for 245+ commodities, and only closing rates are available for monthly-updated commodities. If a commodity has no rate on the requested date, the API falls back to the last available rate before that date and returns it along with its actual date. Accepts one or more comma-separated commodity symbols and a date in YYYY-MM-DD format. If some requested symbols can't be resolved (unsupported, or no rate on or before the requested date), a 206 Partial Content response is returned with the resolved rates plus an `unresolved` object. Returns a 400 error for invalid dates and a 404 error for unsupported symbols or missing rates.",
|
|
7
7
|
"contact": {
|
|
8
8
|
"name": "APIFreaks Support",
|
|
9
9
|
"url": "https://apifreaks.com/contact",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"servers": [
|
|
14
14
|
{
|
|
15
|
-
"url": "https://api.apifreaks.com/
|
|
15
|
+
"url": "https://api.apifreaks.com/v2.0",
|
|
16
16
|
"description": "Historical Commodity Prices API Server"
|
|
17
17
|
}
|
|
18
18
|
],
|
|
@@ -95,32 +95,107 @@
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
+
"206": {
|
|
99
|
+
"description": "Partial Content — Some requested symbols could not be resolved",
|
|
100
|
+
"content": {
|
|
101
|
+
"application/json": {
|
|
102
|
+
"schema": {
|
|
103
|
+
"$ref": "#/components/schemas/HistoricalCommodityPricesResponse"
|
|
104
|
+
},
|
|
105
|
+
"examples": {
|
|
106
|
+
"partial": {
|
|
107
|
+
"summary": "One valid symbol, one unresolved symbol",
|
|
108
|
+
"value": {
|
|
109
|
+
"success": true,
|
|
110
|
+
"date": "2025-01-10",
|
|
111
|
+
"rates": {
|
|
112
|
+
"XAU": {
|
|
113
|
+
"date": "2025-01-10",
|
|
114
|
+
"open": 2669.93,
|
|
115
|
+
"high": 2697.85,
|
|
116
|
+
"low": 2663.61,
|
|
117
|
+
"close": 2689.44
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"unresolved": {
|
|
121
|
+
"FAKESYM": {
|
|
122
|
+
"message": "We don't support this symbol, please visit our symbols page to see supported symbols."
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"headers": {
|
|
131
|
+
"X-AF-Credits-Cost": {
|
|
132
|
+
"$ref": "#/components/headers/X-AF-Credits-Cost"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
98
136
|
"400": {
|
|
99
|
-
"description": "Bad
|
|
137
|
+
"description": "Bad Request — Missing parameters or invalid date",
|
|
100
138
|
"content": {
|
|
101
139
|
"application/json": {
|
|
102
140
|
"schema": {
|
|
103
141
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
104
142
|
},
|
|
105
143
|
"examples": {
|
|
144
|
+
"missingSymbols": {
|
|
145
|
+
"summary": "Missing required symbols parameter",
|
|
146
|
+
"value": {
|
|
147
|
+
"error": "Invalid Param Exception",
|
|
148
|
+
"message": "please pass correct parameters",
|
|
149
|
+
"path": "/v2.0/commodity/rates/historical",
|
|
150
|
+
"status": 400,
|
|
151
|
+
"timestamp": "2026-09-14T08:44:32.013Z"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
106
154
|
"invalidDateFormat": {
|
|
107
155
|
"summary": "Invalid date format",
|
|
108
156
|
"value": {
|
|
109
|
-
"timestamp":
|
|
110
|
-
"
|
|
157
|
+
"timestamp": "2026-09-14T08:45:13.934Z",
|
|
158
|
+
"path": "/rates/historical",
|
|
159
|
+
"code": 400,
|
|
111
160
|
"error": "VALIDATION_ERROR",
|
|
112
|
-
"message": "Invalid Date Format (YYYY-MM-DD)."
|
|
113
|
-
"path": "/v1.0/commodity/rates/historical"
|
|
161
|
+
"message": "Invalid Date Format (YYYY-MM-DD)."
|
|
114
162
|
}
|
|
115
163
|
},
|
|
116
164
|
"dateNotExist": {
|
|
117
165
|
"summary": "Date does not exist",
|
|
118
166
|
"value": {
|
|
119
|
-
"timestamp":
|
|
120
|
-
"
|
|
167
|
+
"timestamp": "2026-09-14T08:44:01.487Z",
|
|
168
|
+
"path": "/rates/historical",
|
|
169
|
+
"code": 400,
|
|
121
170
|
"error": "VALIDATION_ERROR",
|
|
122
|
-
"message": "Invalid Date: The provided date does not exist."
|
|
123
|
-
|
|
171
|
+
"message": "Invalid Date: The provided date does not exist."
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"headers": {
|
|
178
|
+
"X-AF-Credits-Cost": {
|
|
179
|
+
"$ref": "#/components/headers/X-AF-Credits-Cost"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"402": {
|
|
184
|
+
"description": "Payment Required — Maximum symbols per request exceeded",
|
|
185
|
+
"content": {
|
|
186
|
+
"application/json": {
|
|
187
|
+
"schema": {
|
|
188
|
+
"$ref": "#/components/schemas/ErrorResponse"
|
|
189
|
+
},
|
|
190
|
+
"examples": {
|
|
191
|
+
"maxSymbolsExceeded": {
|
|
192
|
+
"summary": "Too many symbols requested",
|
|
193
|
+
"value": {
|
|
194
|
+
"timestamp": "2026-09-14T08:44:01.978Z",
|
|
195
|
+
"path": "/rates/historical",
|
|
196
|
+
"code": 402,
|
|
197
|
+
"error": "PAYMENT_REQUIRED",
|
|
198
|
+
"message": "Maximum symbols per request exceeded"
|
|
124
199
|
}
|
|
125
200
|
}
|
|
126
201
|
}
|
|
@@ -143,21 +218,26 @@
|
|
|
143
218
|
"symbolNotFound": {
|
|
144
219
|
"summary": "Symbol Not Found",
|
|
145
220
|
"value": {
|
|
146
|
-
"timestamp":
|
|
147
|
-
"
|
|
221
|
+
"timestamp": "2026-09-14T08:44:01.978Z",
|
|
222
|
+
"path": "/rates/historical",
|
|
223
|
+
"code": 404,
|
|
148
224
|
"error": "SYMBOL_NOT_FOUND",
|
|
149
225
|
"message": "The symbol is not supported, please visit the documentation for a list of supported symbols",
|
|
150
|
-
"
|
|
226
|
+
"unresolved": {
|
|
227
|
+
"FAKESYM": {
|
|
228
|
+
"message": "We don't support this symbol, please visit our symbols page to see supported symbols."
|
|
229
|
+
}
|
|
230
|
+
}
|
|
151
231
|
}
|
|
152
232
|
},
|
|
153
233
|
"rateNotFound": {
|
|
154
234
|
"summary": "Rate Not Found",
|
|
155
235
|
"value": {
|
|
156
|
-
"timestamp":
|
|
157
|
-
"
|
|
236
|
+
"timestamp": "2026-09-14T08:44:02.528Z",
|
|
237
|
+
"path": "/rates/historical",
|
|
238
|
+
"code": 404,
|
|
158
239
|
"error": "RATE_NOT_FOUND",
|
|
159
|
-
"message": "no rates found for the specified date"
|
|
160
|
-
"path": "/v1.0/commodity/rates/historical"
|
|
240
|
+
"message": "no rates found for the specified date"
|
|
161
241
|
}
|
|
162
242
|
}
|
|
163
243
|
}
|
|
@@ -203,6 +283,26 @@
|
|
|
203
283
|
},
|
|
204
284
|
"rates": {
|
|
205
285
|
"$ref": "#/components/schemas/HistoricalCommodityRates"
|
|
286
|
+
},
|
|
287
|
+
"unresolved": {
|
|
288
|
+
"type": "object",
|
|
289
|
+
"description": "Present only on a 206 Partial Content response, when some requested symbols could not be resolved. Map of each unresolved symbol to a detail message and optional close-match suggestions.",
|
|
290
|
+
"additionalProperties": {
|
|
291
|
+
"type": "object",
|
|
292
|
+
"properties": {
|
|
293
|
+
"message": {
|
|
294
|
+
"type": "string",
|
|
295
|
+
"description": "Detail message explaining why this symbol was not resolved."
|
|
296
|
+
},
|
|
297
|
+
"suggestions": {
|
|
298
|
+
"type": "array",
|
|
299
|
+
"description": "Optional list of supported symbols that closely match the unresolved symbol.",
|
|
300
|
+
"items": {
|
|
301
|
+
"type": "string"
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
206
306
|
}
|
|
207
307
|
},
|
|
208
308
|
"description": "Historical commodity prices response containing success status, date, and OHLC rate data."
|
|
@@ -224,7 +324,7 @@
|
|
|
224
324
|
"properties": {
|
|
225
325
|
"date": {
|
|
226
326
|
"type": "string",
|
|
227
|
-
"description": "Date for which prices were fetched (YYYY-MM-DD)."
|
|
327
|
+
"description": "Date for which prices were fetched (YYYY-MM-DD). May differ from the requested `date` when the API falls back to the last available rate before it."
|
|
228
328
|
},
|
|
229
329
|
"open": {
|
|
230
330
|
"type": "number",
|
|
@@ -250,19 +350,12 @@
|
|
|
250
350
|
},
|
|
251
351
|
"ErrorResponse": {
|
|
252
352
|
"type": "object",
|
|
253
|
-
"
|
|
353
|
+
"description": "Standard error envelope returned by the API on failed requests. Gateway-level validation errors populate status; commodity-service errors (date/symbol/rate validation) populate code instead — check whichever is present.",
|
|
354
|
+
"required": ["message"],
|
|
254
355
|
"properties": {
|
|
255
|
-
"timestamp": {
|
|
256
|
-
"type": "integer",
|
|
257
|
-
"description": "Unix timestamp in milliseconds when the error occurred."
|
|
258
|
-
},
|
|
259
|
-
"status": {
|
|
260
|
-
"type": "integer",
|
|
261
|
-
"description": "HTTP status code returned with the error."
|
|
262
|
-
},
|
|
263
356
|
"error": {
|
|
264
357
|
"type": "string",
|
|
265
|
-
"description": "
|
|
358
|
+
"description": "Short error category or exception type (e.g., Invalid Param Exception, VALIDATION_ERROR, SYMBOL_NOT_FOUND, RATE_NOT_FOUND)."
|
|
266
359
|
},
|
|
267
360
|
"message": {
|
|
268
361
|
"type": "string",
|
|
@@ -270,10 +363,42 @@
|
|
|
270
363
|
},
|
|
271
364
|
"path": {
|
|
272
365
|
"type": "string",
|
|
273
|
-
"description": "API endpoint path that produced the error."
|
|
366
|
+
"description": "API endpoint path (gateway errors) or internal service path (commodity-service errors) that produced the error."
|
|
367
|
+
},
|
|
368
|
+
"status": {
|
|
369
|
+
"type": "integer",
|
|
370
|
+
"description": "HTTP status code. Present on gateway-level errors."
|
|
371
|
+
},
|
|
372
|
+
"code": {
|
|
373
|
+
"type": "integer",
|
|
374
|
+
"description": "HTTP status code. Present on commodity-service errors instead of status."
|
|
375
|
+
},
|
|
376
|
+
"timestamp": {
|
|
377
|
+
"type": "string",
|
|
378
|
+
"format": "date-time",
|
|
379
|
+
"description": "Timestamp when the error occurred (ISO 8601)."
|
|
380
|
+
},
|
|
381
|
+
"unresolved": {
|
|
382
|
+
"type": "object",
|
|
383
|
+
"description": "Present only on SYMBOL_NOT_FOUND errors. Map of each unresolved symbol to a detail message and optional close-match suggestions.",
|
|
384
|
+
"additionalProperties": {
|
|
385
|
+
"type": "object",
|
|
386
|
+
"properties": {
|
|
387
|
+
"message": {
|
|
388
|
+
"type": "string",
|
|
389
|
+
"description": "Detail message explaining why this symbol was not resolved."
|
|
390
|
+
},
|
|
391
|
+
"suggestions": {
|
|
392
|
+
"type": "array",
|
|
393
|
+
"description": "Optional list of supported symbols that closely match the unresolved symbol.",
|
|
394
|
+
"items": {
|
|
395
|
+
"type": "string"
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
274
400
|
}
|
|
275
|
-
}
|
|
276
|
-
"description": "Standard error envelope returned by the API on failed requests."
|
|
401
|
+
}
|
|
277
402
|
}
|
|
278
403
|
},
|
|
279
404
|
"headers": {
|