Fetch daily GraniteShares Gold Trust (BAR) prices using this API

Fetch Daily GraniteShares Gold Trust (BAR) Prices Using This API
In today's fast-paced financial landscape, the ability to access real-time data is crucial for traders and investors alike. 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 performance of BAR and other precious metals, developers can leverage the Metals-API, a powerful tool designed to provide real-time and historical data on various metals, including gold (XAU), silver (XAG), platinum (XPT), and palladium (XPD).
Metals-API Information
The Metals-API is a comprehensive solution that empowers developers to build applications that require accurate and timely metals pricing data. With its robust features, the API enables users to integrate real-time market insights into their applications, facilitating informed decision-making in trading and investment strategies.
About Gold (XAU)
Gold has long been regarded as a safe-haven asset, especially during times of economic uncertainty. The digital transformation in precious metals trading has revolutionized how investors access and analyze gold prices. By utilizing data analytics and market insights, traders can make more informed decisions based on real-time data rather than relying solely on historical trends.
Technology integration in trading platforms has also enhanced the price discovery process. With the rise of digital asset solutions, investors can now trade gold more efficiently, utilizing APIs to access live market data and execute trades seamlessly. This innovation has made it easier for both institutional and retail investors to participate in the gold market.
API Description
The Metals-API offers a suite of features that cater to the needs of developers looking to integrate metals pricing into their applications. Its capabilities include real-time exchange rates, historical data access, and various endpoints designed to provide comprehensive market insights. The API's transformative potential lies in its ability to deliver accurate data that can drive innovation in trading strategies.
For developers, the Metals-API is not just a data source; it is a gateway to building next-generation applications that can analyze and visualize metals data in real-time. By harnessing the power of this API, developers can create tools that provide users with actionable insights, enhancing their trading experience.
Key Features and Endpoints
The Metals-API comes equipped with several key features that enhance its functionality:
- 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 ensures that users have access to the most current pricing information.
- Historical Rates Endpoint: Users can access historical rates for most currencies dating back to 2019. By appending a specific date to the API call, developers can retrieve past pricing data, which is essential for trend analysis and forecasting.
- 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 API includes a currency conversion feature, enabling users to convert any amount from one metal to another or to/from USD. This is particularly useful for traders operating in multiple currencies.
- Time-Series Endpoint: Developers can query the API for daily historical rates between two dates of their choice, allowing for in-depth analysis of price movements over time.
- Fluctuation Endpoint: This endpoint provides information about how metals fluctuate on a day-to-day basis, helping traders understand market volatility.
- 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 feature allows users to query the API to get the lowest and highest price for a specified date range, providing insights into market extremes.
- Open/High/Low/Close (OHLC) Price Endpoint: This endpoint provides open, high, low, and close prices for a specific time period, which is crucial for technical analysis.
- Historical LME Endpoint: Users can access historical rates for LME symbols dating back to 2008, which is beneficial for those trading in industrial metals.
- API Key: Each user is provided with a unique API key that must be included in API requests to authenticate access.
- API Response: The API delivers exchange rates relative to USD by default, ensuring consistency in data interpretation.
- Available Endpoints: The Metals-API offers a variety of endpoints, each providing different functionalities tailored to user needs.
- Supported Symbols Endpoint: This constantly updated endpoint returns all available currencies, allowing developers to stay informed about the latest offerings.
- 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.
API Endpoint Examples and Responses
Understanding how to interact with the Metals-API is essential for developers. Below are examples of various endpoints along with their JSON responses:
Latest Rates Endpoint
{
"success": true,
"timestamp": 1753416064,
"base": "USD",
"date": "2025-07-25",
"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 indicates a successful request, providing the latest exchange rates for various metals against USD. Each rate is expressed in terms of troy ounces, which is the standard measurement for precious metals.
Historical Rates Endpoint
{
"success": true,
"timestamp": 1753329664,
"base": "USD",
"date": "2025-07-24",
"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 users to analyze past market performance. Each rate is again provided in troy ounces, ensuring consistency with the latest rates.
Time-Series Endpoint
{
"success": true,
"timeseries": true,
"start_date": "2025-07-18",
"end_date": "2025-07-25",
"base": "USD",
"rates": {
"2025-07-18": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2025-07-20": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2025-07-25": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
The time-series response provides daily rates over a specified period, allowing for trend analysis and performance evaluation. Developers can utilize this data to create visualizations or alerts based on price movements.
Convert Endpoint
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1753416064,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This endpoint allows users to convert a specified amount from one currency to another. In this case, it converts 1000 USD to gold (XAU), resulting in 0.482 troy ounces. This feature is particularly useful for traders who need to quickly assess the value of their holdings in different metals.
Fluctuation Endpoint
{
"success": true,
"fluctuation": true,
"start_date": "2025-07-18",
"end_date": "2025-07-25",
"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 specified period. This information is vital for traders looking to capitalize on market movements and adjust their strategies accordingly.
OHLC (Open/High/Low/Close) Price Endpoint
{
"success": true,
"timestamp": 1753416064,
"base": "USD",
"date": "2025-07-25",
"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 endpoint provides open, high, low, and close prices for a specific date, which is essential for traders conducting technical analysis. Understanding these price points helps traders identify market trends and make informed decisions.
Bid/Ask Endpoint
{
"success": true,
"timestamp": 1753416064,
"base": "USD",
"date": "2025-07-25",
"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 provides current bid and ask prices for metals, along with the spread. This information is crucial for traders looking to execute orders at the best possible prices.
Conclusion
The Metals-API is an invaluable resource for developers seeking to integrate real-time metals pricing into their applications. With its extensive features, including the latest rates, historical data, and various endpoints, the API empowers users to make informed trading decisions based on accurate and timely information.
By leveraging the capabilities of the Metals-API, developers can create innovative applications that enhance the trading experience for users. Whether it's analyzing price fluctuations, converting currencies, or accessing historical data, the Metals-API provides the tools necessary to succeed in the dynamic world of precious metals trading.
For more information on how to get started with the Metals-API, visit the Metals-API Documentation and explore the Metals-API Supported Symbols to understand the full range of available data. Embrace the future of trading with the Metals-API and unlock the potential of real-time metals data.