Get GraniteShares Gold Trust (BAR) Historical Prices using this API

Get GraniteShares Gold Trust (BAR) Historical Prices using this API
In the world of precious metals trading, having access to accurate and timely data is crucial for making informed decisions. The GraniteShares Gold Trust (BAR) is a popular investment vehicle for those looking to gain exposure to gold without the complexities of physical ownership. To effectively track the historical prices of BAR, developers can leverage the powerful Metals-API. This API provides a comprehensive suite of tools for accessing real-time and historical data on various metals, including gold (XAU), silver (XAG), platinum (XPT), and palladium (XPD).
Metals-API Information
About Gold (XAU)
Gold has long been regarded as a safe haven asset, especially during times of economic uncertainty. Its value is influenced by a myriad of factors, including market demand, geopolitical events, and currency fluctuations. With the digital transformation in precious metals trading, the integration of data analytics and technology has revolutionized how investors approach gold trading. The Metals-API plays a pivotal role in this transformation by providing developers with the tools necessary to access real-time market insights and historical data.
By utilizing the Metals-API, developers can create applications that not only track gold prices but also analyze trends and make predictions based on historical data. This capability is essential for traders looking to optimize their strategies and capitalize on market movements. The API's innovative features enable seamless integration into trading platforms, allowing for enhanced price discovery and improved decision-making processes.
API Description
The Metals-API is designed to empower developers to build next-generation applications that require real-time metals data. With its robust infrastructure, the API offers a variety of endpoints that cater to different data needs. Whether you are looking for the latest rates, historical prices, or even bid and ask prices, the Metals-API has you covered. The API's capabilities extend beyond simple data retrieval; it provides a transformative potential for developers to create sophisticated trading applications.
For detailed information on how to utilize the API, developers can refer to the Metals-API Documentation. This resource provides comprehensive guidance on the various endpoints, including their functionalities and usage examples.
Key Features and Endpoints
The Metals-API offers a variety of endpoints that cater to different data retrieval 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, every 10 minutes, or even more frequently. This allows traders to stay informed about the latest market movements.
- Historical Rates Endpoint: Historical rates are available for most currencies dating back to 2019. By appending a specific date to the API request, developers can query historical prices for gold and other metals, enabling them to analyze trends over time.
- 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 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 operating in different currencies.
- Time-Series Endpoint: Developers can query the API for daily historical rates between two dates of their choice, facilitating in-depth analysis of price movements over specific periods.
- Fluctuation Endpoint: This endpoint provides information about how metal prices fluctuate on a day-to-day basis, allowing traders to assess volatility and make informed decisions.
- Carat Endpoint: Users can retrieve information about gold rates by carat, which is essential for jewelers and those involved in the jewelry market.
- Lowest/Highest Price Endpoint: This endpoint allows users to query the API to get the lowest and highest price for a specified date, providing insights into market extremes.
- Open/High/Low/Close (OHLC) Price Endpoint: Users can access open, high, low, and close prices for a specific date, which is crucial for technical analysis.
- Historical LME Endpoint: This endpoint provides access to historical rates for LME symbols dating back to 2008, offering a wealth of data for analysis.
- API Key: Each user is assigned a unique API key that must be included in requests to authenticate and authorize access to the API.
- API Response: The Metals-API delivers exchange rates relative to USD by default, ensuring consistency in data interpretation.
- Supported Symbols Endpoint: This endpoint returns all available currencies, allowing developers to stay updated on the latest symbols supported by the API.
- Gold Price India Endpoint: Users can retrieve the latest gold price in India using this dedicated endpoint, catering to regional market needs.
- News Endpoint: The API allows users to retrieve the latest news articles related to various metals, keeping traders 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 interpret API responses is crucial for developers. Below are examples of various API endpoints and their corresponding JSON responses:
Latest Rates Endpoint
{
"success": true,
"timestamp": 1745816498,
"base": "USD",
"date": "2025-04-28",
"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"
}
This response indicates that the latest exchange rates for various metals are provided, with gold (XAU) priced at 0.000482 per troy ounce.
Historical Rates Endpoint
{
"success": true,
"timestamp": 1745730098,
"base": "USD",
"date": "2025-04-27",
"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 developers to analyze past price movements.
Time-series Endpoint
{
"success": true,
"timeseries": true,
"start_date": "2025-04-21",
"end_date": "2025-04-28",
"base": "USD",
"rates": {
"2025-04-21": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2025-04-23": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2025-04-28": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
This time-series response provides daily rates for gold and other metals over a specified period, enabling trend analysis.
Convert Endpoint
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1745816498,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response illustrates how to convert an amount from USD to gold (XAU), showing the result in troy ounces.
Fluctuation Endpoint
{
"success": true,
"fluctuation": true,
"start_date": "2025-04-21",
"end_date": "2025-04-28",
"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 metal prices have fluctuated over a specified period, which is essential for assessing market volatility.
OHLC (Open/High/Low/Close) Price Endpoint
{
"success": true,
"timestamp": 1745816498,
"base": "USD",
"date": "2025-04-28",
"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 open, high, low, and close prices for a specific date, which is crucial for traders conducting technical analysis.
Bid/Ask Endpoint
{
"success": true,
"timestamp": 1745816498,
"base": "USD",
"date": "2025-04-28",
"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 current bid and ask prices for metals, which is essential for understanding market liquidity and making trading decisions.
Conclusion
In conclusion, the Metals-API offers a powerful suite of tools for developers looking to access historical prices and real-time data for precious metals, including the GraniteShares Gold Trust (BAR). By leveraging the API's various endpoints, developers can create sophisticated applications that provide valuable insights into market trends and price movements. The ability to access historical data, real-time rates, and fluctuations empowers traders to make informed decisions and optimize their trading strategies.
For more information on how to get started with the Metals-API, visit the Metals-API Website and explore the Metals-API Documentation for detailed guidance on implementation and usage. With the right tools and data, developers can harness the full potential of precious metals trading and stay ahead in a competitive market.