Display GraniteShares Gold Trust (BAR) prices on your website using this API

Introduction
In the ever-evolving landscape of financial markets, the GraniteShares Gold Trust (BAR) stands out as a pivotal player in the precious metals sector. With the increasing demand for gold as a hedge against inflation and economic uncertainty, developers and investors alike are seeking innovative ways to access real-time data on gold prices. One of the most effective methods to achieve this is through the Metals-API, a powerful tool that provides comprehensive data on various metals, including gold (XAU). This blog post will delve into the capabilities of the Metals-API, explore the significance of gold in today's digital economy, and provide insights into how you can integrate this API into your applications.
Understanding Gold (XAU) in Today's Market
Gold has long been regarded as a safe haven asset, especially during times of economic volatility. The digital transformation in precious metals trading has opened new avenues for investors. With the rise of data analytics and market insights, traders can now leverage technology to make informed decisions. The integration of advanced trading technologies has revolutionized price discovery, allowing for more accurate and timely valuations of gold and other precious metals.
Moreover, the emergence of digital asset solutions has made it easier for investors to access gold markets. The ability to track real-time prices and historical data through APIs like Metals-API empowers developers to create applications that cater to the needs of modern investors. This API not only provides current market rates but also offers insights into market trends, enabling users to make data-driven decisions.
API Description
The Metals-API is designed to provide developers with real-time and historical data on precious metals. With its robust features, the API allows users to build next-generation applications that can track market fluctuations, analyze trends, and convert currencies seamlessly. The API is structured to support various endpoints, each catering to specific data needs, making it a versatile tool for developers in the financial sector.
For detailed information on how to utilize the API, refer to the Metals-API Documentation. This resource provides comprehensive guidance on the API's capabilities, including how to authenticate, manage requests, and interpret responses.
Key Features of Metals-API
The Metals-API offers a variety of endpoints that serve different purposes. Here are some of the key features:
Latest Rates Endpoint
The Latest Rates Endpoint provides real-time exchange rate data for precious metals, updated based on your subscription plan. Depending on the plan, updates can occur every 60 minutes, every 10 minutes, or even more frequently. This feature is crucial for traders who need the most current market information to make timely decisions.
{
"success": true,
"timestamp": 1758758453,
"base": "USD",
"date": "2025-09-25",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912,
"XPD": 0.000744
},
"unit": "per troy ounce"
}
Historical Rates Endpoint
Accessing historical rates is essential for analyzing market trends over time. The Historical Rates Endpoint allows users to query data dating back to 2019. By appending a specific date to the request, developers can retrieve past rates, which can be invaluable for backtesting trading strategies or conducting market analysis.
{
"success": true,
"timestamp": 1758672053,
"base": "USD",
"date": "2025-09-24",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"unit": "per troy ounce"
}
Bid and Ask Endpoint
The Bid and Ask Endpoint is a powerful feature that provides real-time bid and ask prices for metals. This information is crucial for traders looking to execute orders at the best possible prices. The bid price represents the maximum price that a buyer is willing to pay, while the ask price is the minimum price a seller is willing to accept.
{
"success": true,
"timestamp": 1758758453,
"base": "USD",
"date": "2025-09-25",
"rates": {
"XAU": {
"bid": 0.000481,
"ask": 0.000483,
"spread": 2.0e-6
}
},
"unit": "per troy ounce"
}
Convert Endpoint
The Convert Endpoint allows users to convert any amount from one metal to another or to/from USD. This feature is particularly useful for investors who deal in multiple currencies and need to quickly assess the value of their holdings.
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1758758453,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
Time-Series Endpoint
The Time-Series Endpoint allows users to query the API for daily historical rates between two dates of their choice. This feature is essential for analyzing trends over specific periods and can help traders identify patterns that may influence future price movements.
{
"success": true,
"timeseries": true,
"start_date": "2025-09-18",
"end_date": "2025-09-25",
"base": "USD",
"rates": {
"2025-09-18": {
"XAU": 0.000485
},
"2025-09-25": {
"XAU": 0.000482
}
},
"unit": "per troy ounce"
}
Fluctuation Endpoint
The Fluctuation Endpoint provides information about how metal prices fluctuate on a day-to-day basis. This feature is particularly useful for traders looking to understand market volatility and make informed decisions based on price movements.
{
"success": true,
"fluctuation": true,
"start_date": "2025-09-18",
"end_date": "2025-09-25",
"base": "USD",
"rates": {
"XAU": {
"start_rate": 0.000485,
"end_rate": 0.000482,
"change": -3.0e-6,
"change_pct": -0.62
}
},
"unit": "per troy ounce"
}
Open/High/Low/Close (OHLC) Price Endpoint
The OHLC Price Endpoint allows users to retrieve open, high, low, and close prices for a specific time period. This data is essential for traders who rely on candlestick patterns and other technical analysis methods to make trading decisions.
{
"success": true,
"timestamp": 1758758453,
"base": "USD",
"date": "2025-09-25",
"rates": {
"XAU": {
"open": 0.000485,
"high": 0.000487,
"low": 0.000481,
"close": 0.000482
}
},
"unit": "per troy ounce"
}
Historical LME Endpoint
The Historical LME Endpoint provides access to historical rates for LME symbols dating back to 2008. This endpoint is particularly useful for users interested in the London Metal Exchange prices and trends.
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.
Conclusion
In conclusion, the GraniteShares Gold Trust (BAR) represents a significant opportunity for investors in the precious metals market. By leveraging the capabilities of the Metals-API, developers can create innovative applications that provide real-time data, historical insights, and advanced analytics on gold and other metals. The API's extensive features, including the Latest Rates, Historical Rates, Bid and Ask, and various conversion endpoints, empower users to make informed trading decisions.
As the financial landscape continues to evolve, integrating real-time data solutions like Metals-API will be crucial for staying competitive. For more information on how to get started, visit the Metals-API Website and explore the Metals-API Documentation for detailed guidance on implementation.