Fluctuation Endpoint
Using the Metals-API API's fluctuation
endpoint you will be able to retrieve information about how currencies fluctuate on a day-to-day basis. (The date limits per API request depends on the acquired plan). To use this feature, simply append a start_date
and end_date
and choose the symbol you would like to query the API for.
API Request:
https://metals-api.com/api/fluctuation ? access_key = API_KEY & start_date = 2015-12-01 & end_date = 2015-12-24 & symbols = USD
Request Parameters:
Parameter | Description |
---|---|
access_key |
[required] Your API Key. |
start_date |
[required] The start date of your preferred fluctuation timeframe. (The date limits per API request depends on the acquired plan). |
end_date |
[required] The end date of your preferred fluctuation timeframe. (The date limits per API request depends on the acquired plan). |
base |
[optional] Enter the three-letter currency code or metal code of your preferred base currency. Default USD. |
symbols |
[required] Enter a list of comma-separated currency codes or metal codes to limit output symbols. (1 symbol per API request). |
type |
[optional] weekly, monthly, yearly |
API Response:
{ "success":true, "fluctuation":true, "start_date":"2018-02-25", "end_date":"2018-02-26", "base":"EUR", "rates":{ "USD":{ "start_rate":1.228952, "end_rate":1.232735, "change":0.0038, "change_pct":0.3078 }, "JPY":{ "start_rate":131.587611, "end_rate":131.651142, "change":0.0635, "change_pct":0.0483 }, [...] } }
Response Objects:
Response Object | Description |
---|---|
success |
Returns true or false depending on whether or not your API request has succeeded. |
fluctuation |
Returns true if a request to the fluctuation endpoint is made. |
start_date |
The start date of your time frame. |
end_date |
The end date of your time frame. |
base |
Returns the three-letter currency code or metal code of the base currency used for this request. |
rates |
Returns exchange rate data for the currencies you have requested. |
rates > start_rate |
Returns the exchange collected on your start date. |
rates > end_rate |
Returns the exchange collected on your end date. |
rates > change |
Returns the change (decimal number) of the given currency rate between your start and end date. |
rates > change |
Returns the percentage change of the given currency rate between your start and end date. |
Example request in Postman: