Get Accurate Historical Prices for Sprott ESG Gold ETF (SESG) Using This API

Get Accurate Historical Prices for Sprott ESG Gold ETF (SESG) Using This API
In the world of investment, having access to accurate historical prices is crucial for making informed decisions. For those interested in the Sprott ESG Gold ETF (SESG), understanding how to retrieve historical prices is essential. One of the most effective ways to achieve this is through the Metals-API, a powerful tool that provides real-time and historical data on precious metals, including gold (XAU). This blog post will delve into the capabilities of the Metals-API, focusing on how developers can leverage its features to obtain accurate historical prices for SESG and other precious metals.
About Gold (XAU)
Gold has long been a symbol of wealth and stability, making it a popular choice for investors. With the digital transformation in the precious metals market, the way we trade and analyze gold has evolved significantly. The integration of data analytics and technology in trading has opened new avenues for market insights and innovation in price discovery.
As the demand for digital asset solutions grows, understanding the historical prices of gold becomes increasingly important. Investors can utilize this data to identify trends, make predictions, and optimize their trading strategies. The Metals-API provides a comprehensive solution for accessing this vital information, allowing developers to create next-generation applications that can analyze and visualize gold price movements effectively.
Metals-API Overview
The Metals-API is designed to empower developers with real-time and historical data on various metals, including gold, silver, platinum, and palladium. With its robust capabilities, the API enables users to build applications that can track market trends, perform currency conversions, and analyze price fluctuations. The API is particularly valuable for those looking to integrate metals data into their trading platforms or financial applications.
One of the standout features of the Metals-API is its ability to provide historical rates dating back to 2019. This allows developers to query the API for specific dates and retrieve accurate historical prices for gold and other metals. The API's endpoints are designed to be user-friendly, making it easy for developers to access the data they need.
Key Features of Metals-API
The Metals-API offers a variety of endpoints that cater to different needs. 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 or every 10 minutes. This feature is essential for traders who need the most current market data.
- Historical Rates Endpoint: This endpoint allows users to access historical rates for most currencies dating back to 2019. By appending a specific date to the API request, developers can retrieve historical prices for gold and other metals.
- Bid and Ask Endpoint: This powerful feature enables users to retrieve real-time bid and ask prices for metals, providing insights into market liquidity and pricing.
- Convert Endpoint: The Metals-API includes a currency conversion endpoint, allowing users to convert any amount from one metal to another or to/from USD. This is particularly useful for traders dealing with multiple currencies.
- Time-Series Endpoint: This endpoint allows users to query the API for daily historical rates between two dates of their choice, making it easy to analyze price trends over time.
- Fluctuation Endpoint: Users can retrieve information about how currencies fluctuate on a day-to-day basis, providing valuable insights into market volatility.
- Carat Endpoint: This feature allows users to retrieve information about gold rates by carat, which is essential for jewelers and those in the jewelry industry.
- Lowest/Highest Price Endpoint: This endpoint enables users to query the API to get the lowest and highest price for a specified date, helping traders identify price extremes.
- Open/High/Low/Close (OHLC) Price Endpoint: This endpoint provides users with the open, high, low, and close prices for a specific date, which is crucial for technical analysis.
- Historical LME Endpoint: This endpoint allows users to access historical rates for LME symbols dating back to 2008, providing a comprehensive view of market trends.
- API Key: Users must pass their unique API key into the API base URL's access_key parameter to authenticate their requests.
- API Response: The Metals-API delivers exchange rates relative to USD by default, ensuring consistency in data interpretation.
- Available Endpoints: The API comes with multiple endpoints, each providing different functionalities tailored to various user needs.
- Supported Symbols Endpoint: This constantly updated endpoint returns all available currencies, ensuring users have access to the latest symbols.
- Gold Price India Endpoint: Users can retrieve the latest gold price in India using this dedicated endpoint, which is particularly useful for investors in the Indian market.
- News Endpoint: The Metals-API allows users to retrieve the latest news articles related to various metals, keeping them informed about market developments.
API Endpoint Examples and Responses
Understanding how to interact with the Metals-API is crucial for developers. Below are examples of how to use some of the key endpoints, along with explanations of the responses.
Latest Rates Endpoint
The Latest Rates Endpoint provides real-time exchange rates for all available metals. Here’s an example response:
{
"success": true,
"timestamp": 1749960063,
"base": "USD",
"date": "2025-06-15",
"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"
}
In this response, the "rates" object contains the current exchange rates for various metals, with gold (XAU) priced at 0.000482 per troy ounce.
Historical Rates Endpoint
The Historical Rates Endpoint allows users to access historical exchange rates for any date since 1999. Here’s an example response:
{
"success": true,
"timestamp": 1749873663,
"base": "USD",
"date": "2025-06-14",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This response shows the historical rates for gold and other metals on a specific date, allowing developers to analyze past market performance.
Time-Series Endpoint
The Time-Series Endpoint provides exchange rates for a specific time period. Here’s an example response:
{
"success": true,
"timeseries": true,
"start_date": "2025-06-08",
"end_date": "2025-06-15",
"base": "USD",
"rates": {
"2025-06-08": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2025-06-10": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2025-06-15": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
This response provides a time series of exchange rates for gold over a specified period, enabling developers to visualize trends and fluctuations.
Convert Endpoint
The Convert Endpoint allows users to convert any amount from one metal to another or to/from USD. Here’s an example response:
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1749960063,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response indicates that 1000 USD is equivalent to 0.482 troy ounces of gold, providing a straightforward conversion for users.
Fluctuation Endpoint
The Fluctuation Endpoint tracks rate fluctuations between two dates. Here’s an example response:
{
"success": true,
"fluctuation": true,
"start_date": "2025-06-08",
"end_date": "2025-06-15",
"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"
}
This response provides insights into how the price of gold and other metals fluctuated over the specified period, which is crucial for traders looking to capitalize on market movements.
OHLC (Open/High/Low/Close) Price Endpoint
The OHLC Price Endpoint provides open, high, low, and close prices for a specific time period. Here’s an example response:
{
"success": true,
"timestamp": 1749960063,
"base": "USD",
"date": "2025-06-15",
"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 critical data for technical analysis, allowing traders to assess market trends based on historical price movements.
Bid/Ask Endpoint
The Bid/Ask Endpoint provides current bid and ask prices for metals. Here’s an example response:
{
"success": true,
"timestamp": 1749960063,
"base": "USD",
"date": "2025-06-15",
"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"
}
This response provides valuable information about market liquidity and pricing, which is essential for traders looking to execute orders effectively.
Common Developer Questions
As developers begin to integrate the Metals-API into their applications, they may have several questions regarding its functionality and best practices. Here are some common queries:
How do I authenticate my API requests?
To authenticate your requests, you must include your unique API key in the access_key parameter of the API base URL. This key is essential for accessing the API's features and ensuring secure communication.
What are the rate limits for API requests?
The Metals-API has specific rate limits based on your subscription plan. It is crucial to monitor your usage to avoid exceeding these limits, which could result in temporary access restrictions.
How can I handle errors in API responses?
The API provides error codes and messages in its responses. Developers should implement error handling to manage these scenarios effectively, ensuring that their applications can recover gracefully from issues.
What are the best practices for optimizing API performance?
To optimize performance, developers should consider caching frequently accessed data, minimizing the number of API calls, and using batch requests where applicable. Additionally, monitoring response times and adjusting requests based on usage patterns can enhance overall efficiency.
Conclusion
In conclusion, the Metals-API is an invaluable resource for developers looking to access accurate historical prices for the Sprott ESG Gold ETF (SESG) and other precious metals. With its comprehensive range of endpoints and real-time data capabilities, the API empowers users to build sophisticated applications that can analyze market trends and optimize trading strategies.
By leveraging the features of the Metals-API, developers can gain insights into the precious metals market, enabling them to make informed decisions based on historical data and current market conditions. Whether you are a seasoned trader or a developer looking to integrate metals data into your applications, the Metals-API provides the tools you need to succeed.
For more information on how to get started, refer to the Metals-API Documentation and explore the Metals-API Supported Symbols to find the data you need. Visit the Metals-API Website to learn more about its capabilities and how it can enhance your trading experience.