@@ -41,30 +41,51 @@ await api.fetchSymbols();
4141[ Link] ( https://metalpriceapi.com/documentation#api_symbol )
4242
4343---
44- #### fetchLive(base, currencies)
44+ #### fetchLive(base, currencies, unit, purity, math )
4545
4646- ` base ` <[ string] > Optional. Pass in a base currency, defaults to USD.
4747- ` currencies ` <[ Array] <[ string] >> Optional. Pass in an array of currencies to return values for.
48+ - ` unit ` <[ string] > Optional. Pass in a unit for metal prices (e.g. ` troy_oz ` , ` gram ` , ` kilogram ` ).
49+ - ` purity ` <[ string] > Optional. Pass in a purity level for metal prices.
50+ - ` math ` <[ string] > Optional. Pass in a math expression to apply to the rates.
4851
4952``` js
50- await api .fetchLive (' USD' , [' XAU' , ' XAG' , ' XPD' , ' XPT' ]);
53+ await api .fetchLive (' USD' , [' XAU' , ' XAG' , ' XPD' , ' XPT' ], ' troy_oz ' , null , null );
5154```
5255
5356[ Link] ( https://metalpriceapi.com/documentation#api_realtime )
5457
5558---
56- #### fetchHistorical(date, base, currencies)
59+ #### fetchHistorical(date, base, currencies, unit )
5760
5861- ` date ` <[ string] > Required. Pass in a string with format ` YYYY-MM-DD `
5962- ` base ` <[ string] > Optional. Pass in a base currency, defaults to USD.
6063- ` currencies ` <[ Array] <[ string] >> Optional. Pass in an array of currencies to return values for.
64+ - ` unit ` <[ string] > Optional. Pass in a unit for metal prices (e.g. ` troy_oz ` , ` gram ` , ` kilogram ` ).
6165
6266``` js
63- await api .fetchHistorical (' 2024-02-05' , ' USD' , [' XAU' , ' XAG' , ' XPD' , ' XPT' ]);
67+ await api .fetchHistorical (' 2024-02-05' , ' USD' , [' XAU' , ' XAG' , ' XPD' , ' XPT' ], ' troy_oz ' );
6468```
6569
6670[ Link] ( https://metalpriceapi.com/documentation#api_historical )
6771
72+ ---
73+ #### hourly(base, currency, unit, startDate, endDate, math, dateType)
74+
75+ - ` base ` <[ string] > Optional. Pass in a base currency, defaults to USD.
76+ - ` currency ` <[ string] > Required. Specify currency you would like to get hourly rates for.
77+ - ` unit ` <[ string] > Optional. Pass in a unit for metal prices (e.g. ` troy_oz ` , ` gram ` , ` kilogram ` ).
78+ - ` startDate ` <[ string] > Required. Specify the start date using the format ` YYYY-MM-DD ` .
79+ - ` endDate ` <[ string] > Required. Specify the end date using the format ` YYYY-MM-DD ` .
80+ - ` math ` <[ string] > Optional. Pass in a math expression to apply to the rates.
81+ - ` dateType ` <[ string] > Optional. Pass in a date type, overrides date parameters if passed in.
82+
83+ ``` js
84+ await api .hourly (' USD' , ' XAU' , ' troy_oz' , ' 2025-11-03' , ' 2025-11-03' , null , null );
85+ ```
86+
87+ [ Link] ( https://metalpriceapi.com/documentation#api_hourly )
88+
6889---
6990#### ohlc(base, currency, date, unit, dateType)
7091
@@ -81,55 +102,59 @@ await api.ohlc('USD', 'XAU', '2024-02-06', 'troy_oz', null);
81102[ Link] ( https://metalpriceapi.com/documentation#api_ohlc )
82103
83104---
84- #### convert(from, to, amount, date)
105+ #### convert(from, to, amount, date, unit )
85106
86107- ` from ` <[ string] > Optional. Pass in a base currency, defaults to USD.
87108- ` to ` <[ string] > Required. Specify currency you would like to convert to.
88109- ` amount ` <[ number] > Required. The amount to convert.
89110- ` date ` <[ string] > Optional. Specify date to use historical midpoint value for conversion with format ` YYYY-MM-DD ` . Otherwise, it will use live exchange rate date if value not passed in.
111+ - ` unit ` <[ string] > Optional. Pass in a unit for metal prices (e.g. ` troy_oz ` , ` gram ` , ` kilogram ` ).
90112
91113``` js
92- await api .convert (' USD' , ' EUR' , 100 , ' 2024-02-05' );
114+ await api .convert (' USD' , ' EUR' , 100 , ' 2024-02-05' , null );
93115```
94116
95117[ Link] ( https://metalpriceapi.com/documentation#api_convert )
96118
97119---
98- #### timeframe(start_date, end_date , base, currencies)
120+ #### timeframe(startDate, endDate , base, currencies, unit )
99121
100- - ` start_date ` <[ string] > Required. Specify the start date of your timeframe using the format ` YYYY-MM-DD ` .
101- - ` end_date ` <[ string] > Required. Specify the end date of your timeframe using the format ` YYYY-MM-DD ` .
122+ - ` startDate ` <[ string] > Required. Specify the start date of your timeframe using the format ` YYYY-MM-DD ` .
123+ - ` endDate ` <[ string] > Required. Specify the end date of your timeframe using the format ` YYYY-MM-DD ` .
102124- ` base ` <[ string] > Optional. Pass in a base currency, defaults to USD.
103125- ` currencies ` <[ Array] <[ string] >> Optional. Pass in an array of currencies to return values for.
126+ - ` unit ` <[ string] > Optional. Pass in a unit for metal prices (e.g. ` troy_oz ` , ` gram ` , ` kilogram ` ).
104127
105128``` js
106- await api .timeframe (' 2024-02-05' , ' 2024-02-06' , ' USD' , [' XAU' , ' XAG' , ' XPD' , ' XPT' ]);
129+ await api .timeframe (' 2024-02-05' , ' 2024-02-06' , ' USD' , [' XAU' , ' XAG' , ' XPD' , ' XPT' ], ' troy_oz ' );
107130```
108131
109132[ Link] ( https://metalpriceapi.com/documentation#api_timeframe )
110133
111134---
112- #### change(start_date, end_date , base, currencies)
135+ #### change(startDate, endDate , base, currencies, dateType )
113136
114- - ` start_date ` <[ string] > Required. Specify the start date of your timeframe using the format ` YYYY-MM-DD ` .
115- - ` end_date ` <[ string] > Required. Specify the end date of your timeframe using the format ` YYYY-MM-DD ` .
137+ - ` startDate ` <[ string] > Required. Specify the start date of your timeframe using the format ` YYYY-MM-DD ` .
138+ - ` endDate ` <[ string] > Required. Specify the end date of your timeframe using the format ` YYYY-MM-DD ` .
116139- ` base ` <[ string] > Optional. Pass in a base currency, defaults to USD.
117140- ` currencies ` <[ Array] <[ string] >> Optional. Pass in an array of currencies to return values for.
141+ - ` dateType ` <[ string] > Optional. Pass in a date type, overrides date parameters if passed in.
118142
119143``` js
120- await api .change (' 2024-02-05' , ' 2024-02-06' , ' USD' , [' XAU' , ' XAG' , ' XPD' , ' XPT' ]);
144+ await api .change (' 2024-02-05' , ' 2024-02-06' , ' USD' , [' XAU' , ' XAG' , ' XPD' , ' XPT' ], null );
121145```
122146
123147[ Link] ( https://metalpriceapi.com/documentation#api_change )
124148
125149---
126- #### carat(base, date)
150+ #### carat(base, currency, date)
127151
128152- ` base ` <[ string] > Optional. Pass in a base currency, defaults to USD.
153+ - ` currency ` <[ string] > Optional. Pass in a metal code to get carat prices for (defaults to XAU).
129154- ` date ` <[ string] > Optional. Specify date to get Carat for specific date using format ` YYYY-MM-DD ` . If not specified, uses live rates.
130155
131156``` js
132- await api .carat (' USD' , ' 2024-02-06' );
157+ await api .carat (' USD' , ' XAU ' , ' 2024-02-06' );
133158```
134159
135160[ Link] ( https://metalpriceapi.com/documentation#api_carat )
0 commit comments