Obtain SPDR Gold Shares (GLD) Historical Prices via this API

Obtain SPDR Gold Shares (GLD) Historical Prices via this API
In the world of finance, obtaining accurate and timely data is crucial for making informed investment decisions. For those interested in precious metals, particularly gold, the SPDR Gold Shares (GLD) represents a significant investment vehicle. This blog post will delve into how to obtain historical prices for GLD using the Metals-API. We will explore the capabilities of this API, its innovative features, and how it can empower developers to create next-generation applications that leverage real-time metals data.
Metals-API Information
About Gold (XAU)
Gold, represented by the symbol XAU, has been a cornerstone of wealth preservation and investment for centuries. With the digital transformation sweeping across various sectors, the precious metals market is no exception. The integration of technology in trading has revolutionized how investors access and analyze gold prices. Data analytics plays a pivotal role in providing market insights, allowing traders to make data-driven decisions.
Moreover, the innovation in price discovery mechanisms has enabled more accurate and timely pricing of gold. Digital asset solutions are emerging, allowing for seamless transactions and enhanced security. As the demand for gold continues to rise, understanding its historical prices becomes essential for investors looking to navigate the complexities of the market.
API Description
The Metals-API is a powerful tool designed for developers seeking to access real-time and historical data on precious metals. This API provides a comprehensive suite of endpoints that allow users to retrieve various types of data, including the latest rates, historical prices, and fluctuations. With its focus on innovation and technological advancement, Metals-API empowers developers to build applications that can analyze and visualize metals data effectively.
One of the key advantages of using Metals-API is its ability to deliver real-time data, which is crucial for traders and investors who need to make quick decisions based on market movements. The API's capabilities extend beyond mere data retrieval; it enables developers to create sophisticated applications that can analyze trends, forecast prices, and optimize trading strategies.
Key Features and Endpoints
The Metals-API offers a variety of endpoints that cater to different data needs. Here are some of the most significant features:
- Latest Rates Endpoint: This endpoint provides real-time exchange rate data for precious metals. Depending on your subscription plan, the API can return data updated every 60 minutes, every 10 minutes, or even more frequently. This feature is essential for traders who need the most current pricing information.
- Historical Rates Endpoint: Users can access historical rates for most metals dating back to 2019. By appending a specific date to the API request, developers can retrieve historical pricing data, which is invaluable for trend analysis and forecasting.
- Bid And Ask Endpoint: This feature allows users to retrieve real-time bid and ask prices for metals. Understanding the bid-ask spread is crucial for traders looking to execute orders at the best possible prices.
- Convert Endpoint: The API includes a currency conversion feature, enabling users to convert amounts from one metal to another or to/from USD. This is particularly useful for investors dealing with multiple currencies.
- Time-Series Endpoint: This endpoint allows users to query the API for daily historical rates between two specified dates. It is ideal for analyzing price movements over time.
- Fluctuation Endpoint: Users can track how metal prices fluctuate on a day-to-day basis. This endpoint provides insights into market volatility and helps traders make informed decisions.
- Carat Endpoint: This feature allows users to retrieve gold rates by carat, which is essential for jewelers and buyers interested in specific gold purity levels.
- Lowest/Highest Price Endpoint: This endpoint enables users to query the API for the lowest and highest prices of metals over a specified period, providing insights into market extremes.
- Open/High/Low/Close (OHLC) Price Endpoint: Users can access open, high, low, and close prices for a specific time period, which is crucial for technical analysis.
- 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 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 offers a constantly updated list of all available endpoints, ensuring users have access to the latest features.
- Gold Price India Endpoint: This dedicated endpoint retrieves 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 Metals-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 how to interact with the Metals-API is crucial for developers. Below are examples of API responses for various endpoints, showcasing the structure and data provided.
Latest Rates Endpoint
Get real-time exchange rates for all available metals.
{
"success": true,
"timestamp": 1752897617,
"base": "USD",
"date": "2025-07-19",
"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, the date of the rates, and a list of rates for various metals. Each rate is expressed in terms of troy ounces, which is the standard measurement for precious metals.
Historical Rates Endpoint
Access historical exchange rates for any date since 1999.
{
"success": true,
"timestamp": 1752811217,
"base": "USD",
"date": "2025-07-18",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This endpoint allows developers to retrieve historical rates, which can be used for analysis and reporting. The response structure is similar to the latest rates endpoint, providing a clear view of past pricing data.
Time-series Endpoint
Get exchange rates for a specific time period.
{
"success": true,
"timeseries": true,
"start_date": "2025-07-12",
"end_date": "2025-07-19",
"base": "USD",
"rates": {
"2025-07-12": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2025-07-14": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2025-07-19": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
The time-series endpoint provides a detailed view of how prices have changed over a specified period, allowing for trend analysis and forecasting.
Convert Endpoint
Convert any amount from one metal to another or to/from USD.
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1752897617,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This endpoint is particularly useful for investors who need to convert between different metals or currencies. The response includes the conversion rate and the result of the conversion.
Fluctuation Endpoint
Track rate fluctuations between two dates.
{
"success": true,
"fluctuation": true,
"start_date": "2025-07-12",
"end_date": "2025-07-19",
"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 specific period, which is essential for understanding market volatility.
OHLC (Open/High/Low/Close) Price Endpoint
Get OHLC data for a specific time period.
{
"success": true,
"timestamp": 1752897617,
"base": "USD",
"date": "2025-07-19",
"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"
}
The OHLC endpoint is crucial for traders who rely on technical analysis to make informed decisions. It provides a comprehensive view of price movements within a specified timeframe.
Bid/Ask Endpoint
Get current bid and ask prices for metals.
{
"success": true,
"timestamp": 1752897617,
"base": "USD",
"date": "2025-07-19",
"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 is essential for traders looking to execute orders at the best prices. Understanding the spread can help in making strategic trading decisions.
Conclusion
In conclusion, the Metals-API provides a robust and comprehensive solution for developers seeking to access historical prices and real-time data for precious metals like gold. With its innovative features and user-friendly endpoints, this API empowers developers to create applications that can analyze market trends, forecast prices, and optimize trading strategies.
By leveraging the capabilities of Metals-API, developers can gain insights into the precious metals market, enabling them to make informed decisions and stay ahead of the competition. Whether you are looking to retrieve the latest rates, historical prices, or fluctuations, the Metals-API is an invaluable resource for anyone involved in the precious metals market.
For more information on how to get started, refer to the Metals-API Documentation and explore the various endpoints available. Understanding the full range of capabilities offered by this API will allow you to harness the power of real-time metals data effectively.