Get SPDR Gold Shares (GLD) Historical Prices with Metals-API

Get SPDR Gold Shares (GLD) Historical Prices with Metals-API
The world of precious metals trading has undergone a significant transformation in recent years, driven by advancements in technology and data analytics. One of the most notable developments in this space is the emergence of APIs that provide real-time and historical data for metals like gold, silver, platinum, and palladium. Among these, the Metals-API stands out as a powerful tool for developers looking to access historical prices for SPDR Gold Shares (GLD) and other metal assets. In this blog post, we will explore how to leverage the Metals-API to obtain historical prices for gold and other metals, while also delving into the broader implications of digital transformation in the precious metals market.
Metals-API Information
Metals-API is a comprehensive data service that provides real-time and historical pricing information for various metals. It empowers developers to build applications that can analyze market trends, track price fluctuations, and make informed trading decisions. The API offers a wide range of endpoints, each designed to cater to specific data needs, from the latest rates to historical data and beyond. You can access the Metals-API Website for more information.
About Gold (XAU)
Gold, represented by the symbol XAU, has long been regarded as a safe-haven asset and a hedge against inflation. Its value is influenced by various factors, including geopolitical events, economic indicators, and market sentiment. In the digital age, the integration of technology into gold trading has opened up new avenues for investors and traders alike. The ability to access real-time data and historical prices through APIs like Metals-API allows for enhanced data analytics and market insights.
As the trading landscape evolves, the importance of innovation in price discovery becomes paramount. The Metals-API not only provides accurate pricing data but also enables developers to create digital asset solutions that can adapt to changing market conditions. By harnessing the power of data analytics, traders can gain valuable insights into market trends and make more informed decisions.
API Description
The Metals-API is designed to be user-friendly and highly functional, making it an ideal choice for developers looking to integrate metals data into their applications. The API provides a variety of endpoints that cater to different data requirements. For instance, the Latest Rates Endpoint allows users to retrieve real-time exchange rate data for metals, updated at intervals depending on the subscription plan. This feature is crucial for traders who need to stay informed about current market conditions.
Another key feature is the Historical Rates Endpoint, which provides access to historical rates for most currencies dating back to 2019. This endpoint is particularly useful for those looking to analyze past price movements and trends. By appending a specific date to the API request, users can obtain historical data that can inform their trading strategies.
The Bid and Ask Endpoint is another powerful feature that enables users to retrieve real-time bid and ask prices for metals. This information is essential for traders who need to understand the market's current buying and selling prices. Additionally, the Convert Endpoint allows users to convert amounts between different metals or from/to USD, facilitating seamless transactions.
For those interested in tracking price fluctuations, the Fluctuation Endpoint provides valuable insights into how metal prices change over time. Users can specify a date range to analyze fluctuations, helping them identify trends and make informed decisions. Furthermore, the Time-Series Endpoint allows users to query daily historical rates between two chosen dates, providing a comprehensive view of price movements over time.
Another notable feature is the Open/High/Low/Close (OHLC) Price Endpoint, which provides detailed price data for a specific time period. This information is crucial for traders looking to analyze market performance and make predictions based on historical data. Additionally, the Lowest/Highest Price Endpoint allows users to query the API for the lowest and highest prices within a specified date range, offering further insights into market trends.
The Metals-API also includes a News Endpoint, which allows users to retrieve the latest news articles related to various metals. Staying informed about market developments is essential for traders, and this feature ensures that users have access to relevant information that could impact their trading decisions.
Key Features and Endpoints
To summarize, here are some of the key features and endpoints available through the Metals-API:
- Latest Rates Endpoint: Provides real-time exchange rates for metals, updated based on the subscription plan.
- Historical Rates Endpoint: Access historical rates dating back to 2019 by appending a specific date to the API request.
- Bid and Ask Endpoint: Retrieve real-time bid and ask prices for metals.
- Convert Endpoint: Convert amounts between different metals or from/to USD.
- Time-Series Endpoint: Query daily historical rates between two chosen dates.
- Fluctuation Endpoint: Analyze price fluctuations over a specified date range.
- Open/High/Low/Close (OHLC) Price Endpoint: Get detailed price data for a specific time period.
- Lowest/Highest Price Endpoint: Query for the lowest and highest prices within a specified date range.
- News Endpoint: Retrieve the latest news articles related to various metals.
API Endpoint Examples and Responses
Understanding how to interact with the Metals-API is crucial for developers looking to integrate its capabilities into their applications. Below are examples of API responses for various endpoints, showcasing the structure and information provided.
Latest Rates Endpoint
{
"success": true,
"timestamp": 1745539866,
"base": "USD",
"date": "2025-04-25",
"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 includes a success flag, a timestamp, the base currency (USD), the date of the rates, and the rates for various metals. Each metal's rate is expressed in terms of troy ounces, which is the standard measurement for precious metals.
Historical Rates Endpoint
{
"success": true,
"timestamp": 1745453466,
"base": "USD",
"date": "2025-04-24",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This response provides historical rates for a specific date, allowing users to analyze past price movements. The rates are again expressed in troy ounces.
Time-Series Endpoint
{
"success": true,
"timeseries": true,
"start_date": "2025-04-18",
"end_date": "2025-04-25",
"base": "USD",
"rates": {
"2025-04-18": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2025-04-20": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2025-04-25": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
The time-series response provides rates for specific dates within the chosen range, allowing for detailed analysis of price trends over time.
Convert Endpoint
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1745539866,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response illustrates how to convert an amount from one currency to another. In this case, it shows the conversion of 1000 USD to gold (XAU), resulting in 0.482 troy ounces.
Fluctuation Endpoint
{
"success": true,
"fluctuation": true,
"start_date": "2025-04-18",
"end_date": "2025-04-25",
"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 response details the changes in rates over the specified date range, providing both absolute and percentage changes for each metal.
OHLC (Open/High/Low/Close) Price Endpoint
{
"success": true,
"timestamp": 1745539866,
"base": "USD",
"date": "2025-04-25",
"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 endpoint provides a comprehensive view of the price movements for a specific date, including the opening, highest, lowest, and closing prices for each metal.
Bid/Ask Endpoint
{
"success": true,
"timestamp": 1745539866,
"base": "USD",
"date": "2025-04-25",
"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 response provides current bid and ask prices for metals, along with the spread, which is crucial for traders looking to execute trades at the best possible prices.
Conclusion
The Metals-API is a transformative tool for developers and traders in the precious metals market. By providing real-time and historical data for metals like gold, silver, platinum, and palladium, it empowers users to make informed trading decisions based on accurate and timely information. The various endpoints offered by the API cater to a wide range of data needs, from tracking price fluctuations to converting currencies and analyzing historical trends.
As the digital transformation in precious metals continues to evolve, the importance of data analytics and technology integration cannot be overstated. The Metals-API not only facilitates access to critical market data but also enables the development of innovative applications that can adapt to changing market conditions. For developers looking to harness the power of metals data, the Metals-API Documentation provides comprehensive guidance on how to effectively utilize the API's capabilities.
For a complete list of supported symbols and their specifications, refer to the Metals-API Supported Symbols page. By leveraging the capabilities of the Metals-API, traders can stay ahead of the curve in the dynamic world of precious metals trading.