Retrieve iShares Gold Trust (IAU) Historical Prices via Metals-API

Retrieve iShares Gold Trust (IAU) Historical Prices via Metals-API
The iShares Gold Trust (IAU) is a popular investment vehicle for those looking to gain exposure to the price of gold without the complexities of physical ownership. For developers and analysts interested in retrieving historical prices of IAU, the Metals-API offers a robust solution. This blog post will delve into the capabilities of the Metals-API, focusing on how to effectively access historical prices for gold (symbol: XAU) and explore the transformative potential of real-time metals data.
Metals-API Information
Metals-API is a powerful JSON API that provides real-time and historical data on precious metals. It is designed for developers who need reliable and accurate information to build applications that require up-to-date market insights. The API supports various endpoints that allow users to access the latest rates, historical data, and other valuable metrics related to precious metals.
About Gold (XAU)
Gold has long been a symbol of wealth and stability. In recent years, the digital transformation in precious metals has opened new avenues for investment and trading. With the rise of data analytics, market insights have become more accessible, allowing traders to make informed decisions based on real-time data. The integration of technology in trading platforms has revolutionized how investors interact with gold and other precious metals.
Innovation in price discovery has also been a significant theme in the gold market. As digital asset solutions emerge, investors can now access gold prices in a more streamlined manner. The Metals-API plays a crucial role in this transformation, providing developers with the tools needed to create next-generation applications that leverage real-time metals data.
API Description
The Metals-API is designed to empower developers by providing a comprehensive suite of features that facilitate the retrieval of metals data. With a focus on innovation and technological advancement, the API enables users to build applications that can analyze market trends, track price fluctuations, and convert currencies seamlessly.
For detailed information on how to use the API, refer to the Metals-API Documentation. This resource provides comprehensive guidance on the various endpoints available, including their functionalities and usage examples.
Key Features and Endpoints
The Metals-API offers several key features that are essential for developers working with precious metals data:
- Latest Rates Endpoint: Depending on your subscription plan, this endpoint returns real-time exchange rate data updated every 60 minutes, every 10 minutes, or even more frequently. This feature is crucial for applications that require up-to-the-minute pricing information.
- Historical Rates Endpoint: Historical rates are available for most currencies dating back to 2019. By appending a specific date to the API request, users can retrieve historical prices for gold and other metals.
- Bid And Ask Endpoint: This powerful feature allows users to retrieve real-time bid and ask prices for metals, providing insights into market liquidity and pricing dynamics.
- Convert Endpoint: The API includes a currency conversion endpoint, enabling users to convert any amount from one metal to another or to/from USD. This functionality is particularly useful for traders who operate in multiple currencies.
- Time-Series Endpoint: Users can query the API for daily historical rates between two dates of their choice, allowing for in-depth analysis of price trends over time.
- Fluctuation Endpoint: This endpoint provides information about how currencies fluctuate on a day-to-day basis, helping traders understand market volatility.
- Carat Endpoint: Users can retrieve information about gold rates by carat, which is essential for jewelers and those involved in the jewelry industry.
- Lowest/Highest Price Endpoint: This feature allows users to query the API for the lowest and highest price of gold over a specified period, providing insights into market extremes.
- Open/High/Low/Close (OHLC) Price Endpoint: Users can access OHLC data for a specific time period, which is vital for technical analysis and trading strategies.
- Historical LME Endpoint: This endpoint provides access to historical rates for LME symbols dating back to 2008, allowing for comprehensive analysis of market trends.
- API Key: Each user is assigned a unique API key that must be included in the API requests to authenticate and authorize access to the data.
- API Response: The API delivers exchange rates relative to USD by default, ensuring consistency in data interpretation.
- Available Endpoints: The Metals-API comes with a constantly updated endpoint that returns all available currencies and metals.
- Gold Price India Endpoint: This dedicated endpoint allows users to retrieve the latest gold price in India, catering to a specific market segment.
- News Endpoint: Users can access the latest news articles related to various metals, keeping them informed about market developments.
List of Symbols
The API provides access to a comprehensive range of metal symbols. For a complete list of all supported symbols and their specifications, refer to the Metals-API Supported Symbols page. This resource is invaluable for developers looking to integrate specific metals into their applications.
API Endpoint Examples and Responses
Understanding the structure of API responses is crucial for effective integration. Below are examples of various endpoints and their corresponding JSON responses:
Latest Rates Endpoint
{
"success": true,
"timestamp": 1742602242,
"base": "USD",
"date": "2025-03-22",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912,
"XPD": 0.000744,
"XCU": 0.294118,
"XAL": 0.434783,
"XNI": 0.142857,
"XZN": 0.344828
},
"unit": "per troy ounce"
}
The response indicates a successful request, providing the latest exchange rates for various metals, including gold (XAU).
Historical Rates Endpoint
{
"success": true,
"timestamp": 1742515842,
"base": "USD",
"date": "2025-03-21",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This response shows historical rates for a specific date, allowing users to analyze past performance and trends.
Time-series Endpoint
{
"success": true,
"timeseries": true,
"start_date": "2025-03-15",
"end_date": "2025-03-22",
"base": "USD",
"rates": {
"2025-03-15": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2025-03-17": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2025-03-22": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
The time-series response provides daily rates between specified dates, enabling users to visualize trends over time.
Convert Endpoint
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1742602242,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This example illustrates how to convert a specified amount from USD to gold (XAU), providing the resulting value in troy ounces.
Fluctuation Endpoint
{
"success": true,
"fluctuation": true,
"start_date": "2025-03-15",
"end_date": "2025-03-22",
"base": "USD",
"rates": {
"XAU": {
"start_rate": 0.000485,
"end_rate": 0.000482,
"change": -3.0e-6,
"change_pct": -0.62
},
"XAG": {
"start_rate": 0.03825,
"end_rate": 0.03815,
"change": -0.0001,
"change_pct": -0.26
},
"XPT": {
"start_rate": 0.000915,
"end_rate": 0.000912,
"change": -3.0e-6,
"change_pct": -0.33
}
},
"unit": "per troy ounce"
}
The fluctuation endpoint provides insights into how prices have changed over a specified period, which is essential for traders looking to capitalize on market movements.
OHLC (Open/High/Low/Close) Endpoint
{
"success": true,
"timestamp": 1742602242,
"base": "USD",
"date": "2025-03-22",
"rates": {
"XAU": {
"open": 0.000485,
"high": 0.000487,
"low": 0.000481,
"close": 0.000482
},
"XAG": {
"open": 0.03825,
"high": 0.0383,
"low": 0.0381,
"close": 0.03815
},
"XPT": {
"open": 0.000915,
"high": 0.000918,
"low": 0.00091,
"close": 0.000912
}
},
"unit": "per troy ounce"
}
This response provides the open, high, low, and close prices for a specific date, which is vital for technical analysis and trading strategies.
Bid/Ask Endpoint
{
"success": true,
"timestamp": 1742602242,
"base": "USD",
"date": "2025-03-22",
"rates": {
"XAU": {
"bid": 0.000481,
"ask": 0.000483,
"spread": 2.0e-6
},
"XAG": {
"bid": 0.0381,
"ask": 0.0382,
"spread": 0.0001
},
"XPT": {
"bid": 0.000911,
"ask": 0.000913,
"spread": 2.0e-6
}
},
"unit": "per troy ounce"
}
The bid/ask endpoint provides current bid and ask prices for metals, which is essential for understanding market liquidity and making informed trading decisions.
Conclusion
In conclusion, the Metals-API is an invaluable resource for developers looking to retrieve historical prices for the iShares Gold Trust (IAU) and other precious metals. With its comprehensive suite of endpoints, the API empowers users to access real-time data, analyze market trends, and make informed trading decisions. By leveraging the capabilities of the Metals-API, developers can build innovative applications that enhance the trading experience and provide valuable insights into the precious metals market.
For more information on how to get started with the Metals-API, visit the Metals-API Website and explore the extensive Metals-API Documentation for detailed guidance on implementation and usage. Don't forget to check the Metals-API Supported Symbols page for a complete list of available metals and currencies.