oilpriceapi 0.3.1 → 0.3.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.
- package/README.md +6 -7
- package/dist/client.js +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,13 +51,12 @@ const prices = await client.getLatestPrices();
|
|
|
51
51
|
// [
|
|
52
52
|
// {
|
|
53
53
|
// code: 'WTI_USD',
|
|
54
|
-
//
|
|
55
|
-
//
|
|
54
|
+
// price: 74.25,
|
|
55
|
+
// formatted: '$74.25',
|
|
56
56
|
// currency: 'USD',
|
|
57
|
-
//
|
|
58
|
-
// timestamp: '2024-11-24T12:00:00Z',
|
|
57
|
+
// type: 'spot_price',
|
|
59
58
|
// created_at: '2024-11-24T12:01:00Z',
|
|
60
|
-
//
|
|
59
|
+
// source: 'oilprice.investing_com'
|
|
61
60
|
// },
|
|
62
61
|
// // ... more prices
|
|
63
62
|
// ]
|
|
@@ -68,11 +67,11 @@ const prices = await client.getLatestPrices();
|
|
|
68
67
|
```typescript
|
|
69
68
|
// Get only WTI crude oil price
|
|
70
69
|
const wti = await client.getLatestPrices({ commodity: 'WTI_USD' });
|
|
71
|
-
console.log(`WTI:
|
|
70
|
+
console.log(`WTI: ${wti[0].formatted} per barrel`);
|
|
72
71
|
|
|
73
72
|
// Get only Brent crude price
|
|
74
73
|
const brent = await client.getLatestPrices({ commodity: 'BRENT_CRUDE_USD' });
|
|
75
|
-
console.log(`Brent:
|
|
74
|
+
console.log(`Brent: ${brent[0].formatted} per barrel`);
|
|
76
75
|
```
|
|
77
76
|
|
|
78
77
|
### Get Historical Prices (Past Week)
|
package/dist/client.js
CHANGED
|
@@ -121,7 +121,10 @@ export class OilPriceAPI {
|
|
|
121
121
|
headers: {
|
|
122
122
|
'Authorization': `Bearer ${this.apiKey}`,
|
|
123
123
|
'Content-Type': 'application/json',
|
|
124
|
-
'User-Agent': 'oilpriceapi-node/0.3.
|
|
124
|
+
'User-Agent': 'oilpriceapi-node/0.3.2',
|
|
125
|
+
'X-SDK-Language': 'javascript',
|
|
126
|
+
'X-SDK-Version': '0.3.2',
|
|
127
|
+
'X-Client-Type': 'sdk',
|
|
125
128
|
},
|
|
126
129
|
signal: controller.signal,
|
|
127
130
|
});
|