We are thrilled to announce an enhancement to our existing Change Query endpoint: the addition of the "recent" date type. This new feature allows you to easily track the 24-hour change of currencies, making it more convenient to display real-time data on your platforms.
The "recent" date type is a powerful addition that calculates the change from yesterday's closing rate to the current rate. This is particularly useful for displaying 24-hour changes on websites, providing a seamless experience for users who need up-to-date information.
While the "recent" date type calculates the change from yesterday's closing rate to the current rate, the "yesterday" date type calculates the change from the start of yesterday to the end of yesterday. This distinction is important for users who need to understand the difference between a full day's change and a rolling 24-hour change. For most use cases, the "recent" date type is the best choice.
To demonstrate the capabilities of the Change Query endpoint with the new "recent" date type, here is an example request:
https://api.metalpriceapi.com/v1/change
?api_key=[API_KEY]
&date_type=recent
&base=USD
¤cies=XAU
Parameter | Description |
---|---|
api_key |
[Required] Your API Key. More details. |
start_date |
[Required] Specify the start date of your timeframe. |
end_date |
[Required] Specify the end date of your timeframe. |
base |
[Optional] Specify a base currency. Defaults to USD if not defined. |
currencies |
[Optional] Specify a comma-separated list of currency codes. |
date_type |
[Optional] Use "recent", "yesterday", "week", "month", or "year" to override start and end dates. |
Before the introduction of the "recent" date type to the /change endpoint, displaying a 24-hour change required two separate queries: one to the /historical
endpoint to get the starting point and another to the /latest
endpoint to get the latest value. Now, with the "recent" date type, you can achieve this with a single request.
We hope this new feature enhances your experience and provides greater flexibility in how you use our API.
For any questions or support, feel free to contact our support team.