Guide to Getting SPDR Gold Shares (GLD) Historical Prices through this API
Guide to Getting SPDR Gold Shares (GLD) Historical Prices through this API
In the ever-evolving landscape of financial markets, obtaining accurate and timely historical prices for precious metals like gold is crucial for investors and developers alike. The SPDR Gold Shares (GLD) is one of the most popular exchange-traded funds (ETFs) that track the price of gold, making it essential for market participants to access reliable historical data. This guide will explore how to retrieve historical prices for GLD using the Metals-API, a powerful tool that provides real-time and historical data for various metals.
Metals-API Information
The Metals-API is a robust platform that offers a comprehensive suite of features for accessing metals data. It empowers developers to build innovative applications that leverage real-time and historical data for metals trading, analysis, and investment strategies. With its user-friendly interface and extensive documentation, the Metals-API is designed to meet the needs of technically proficient API developers.
About Gold (XAU)
Gold, represented by the symbol XAU, has long been regarded as a safe-haven asset and a hedge against inflation. In recent years, the digital transformation in precious metals has opened new avenues for data analytics and market insights. The integration of technology in trading has revolutionized how investors access and analyze gold prices. With the rise of digital asset solutions, the importance of accurate price discovery has never been more critical.
The Metals-API plays a pivotal role in this transformation by providing developers with the tools needed to access real-time and historical gold prices. By utilizing data analytics, traders can gain insights into market trends, enabling them to make informed decisions. The API's capabilities allow for innovative applications that can track price fluctuations, analyze historical trends, and convert currencies seamlessly.
API Description
The Metals-API is designed to deliver real-time metals data with a focus on innovation and technological advancement. It offers a variety of endpoints that cater to different needs, from retrieving the latest rates to accessing historical data dating back to 2019. This API empowers developers to build next-generation applications that can analyze and visualize metals data effectively.
For more detailed information about the API's capabilities, you can refer to the Metals-API Documentation. This resource provides comprehensive guidance on how to utilize the API effectively, including endpoint descriptions, parameter details, and example responses.
Key Features and Endpoints
The Metals-API offers a variety of endpoints that provide different functionalities, each designed to cater to specific use cases. Here are some of the key features:
- 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 essential for traders who need up-to-the-minute pricing information.
- Historical Rates Endpoint: Historical rates are available for most currencies dating back to 2019. You can query the Metals-API for historical rates by appending a date to the endpoint. This is particularly useful for analyzing past performance and trends in gold prices.
- Bid And Ask Endpoint: This powerful feature allows you to retrieve real-time bid and ask prices for metals, providing insight into the current market conditions and helping traders make informed decisions.
- Convert Endpoint: The API includes a currency conversion endpoint, enabling users to convert any amount from one currency to another. This is particularly useful for traders who operate in multiple currencies.
- Time-Series Endpoint: This endpoint allows you to query the API for daily historical rates between two dates of your choice, making it easy to analyze trends over specific periods.
- Fluctuation Endpoint: With this endpoint, you can retrieve information about how currencies fluctuate on a day-to-day basis, providing valuable insights into market volatility.
- Carat Endpoint: This feature allows you to retrieve information about gold rates by carat, which is particularly useful for jewelers and those in the jewelry industry.
- Lowest/Highest Price Endpoint: This endpoint enables you to query the API to get the lowest and highest price for a specific date, helping traders identify price extremes.
- Open/High/Low/Close (OHLC) Price Endpoint: This endpoint provides the open, high, low, and close prices for a specific date, which is essential for technical analysis.
- Historical LME Endpoint: This endpoint allows you to access historical rates for LME symbols dating back to 2008, providing a comprehensive view of market trends.
- API Key: Your API Key is the unique key that is passed into the API base URL's access_key parameter, ensuring secure access to the API.
- API Response: Exchange rates delivered by the Metals-API are by default relative to USD, and all data is returned in a structured JSON format.
- Available Endpoints: The Metals-API comes with 14 API endpoints, each providing different functionalities to cater to various needs.
- Supported Symbols Endpoint: This endpoint returns all available currencies, ensuring you have access to the latest symbols and their specifications.
- News Endpoint: This feature allows you to retrieve the latest news articles related to various metals, keeping you 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 metals data into their applications.
API Endpoint Examples and Responses
Understanding the API responses is crucial for effective integration. Below are examples of various endpoints and their corresponding JSON responses:
Latest Rates Endpoint
Get real-time exchange rates for all available metals.
{
"success": true,
"timestamp": 1768781826,
"base": "USD",
"date": "2026-01-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"
}
Historical Rates Endpoint
Access historical exchange rates for any date since 1999.
{
"success": true,
"timestamp": 1768695426,
"base": "USD",
"date": "2026-01-18",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
Time-series Endpoint
Get exchange rates for a specific time period.
{
"success": true,
"timeseries": true,
"start_date": "2026-01-12",
"end_date": "2026-01-19",
"base": "USD",
"rates": {
"2026-01-12": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-01-14": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-01-19": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
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": 1768781826,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
Fluctuation Endpoint
Track rate fluctuations between two dates.
{
"success": true,
"fluctuation": true,
"start_date": "2026-01-12",
"end_date": "2026-01-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"
}
OHLC (Open/High/Low/Close) Endpoint
Get OHLC data for a specific time period.
{
"success": true,
"timestamp": 1768781826,
"base": "USD",
"date": "2026-01-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"
}
Bid/Ask Endpoint
Get current bid and ask prices for metals.
{
"success": true,
"timestamp": 1768781826,
"base": "USD",
"date": "2026-01-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"
}
Conclusion
In conclusion, the Metals-API offers a comprehensive solution for accessing historical prices of SPDR Gold Shares (GLD) and other precious metals. With its array of endpoints, developers can retrieve real-time data, analyze historical trends, and integrate this information into their applications seamlessly. The API's focus on innovation and technological advancement makes it a valuable resource for anyone looking to navigate the complexities of the metals market.
For further exploration of the API's capabilities, be sure to check out the Metals-API Documentation and the Metals-API Supported Symbols page. By leveraging these resources, you can unlock the full potential of the Metals-API and enhance your trading strategies.