How to Get Real-Time Gold Turkey 24k (XAUTUR24) Prices with JavaScript and Metals-API
How to Get Real-Time Gold Turkey 24k (XAUTUR24) Prices with JavaScript and Metals-API
In the world of precious metals trading, having access to real-time data is crucial for making informed decisions. This blog post will guide you through the process of accessing real-time Gold (XAU) prices using the Metals-API. We will explore the capabilities of the API, its endpoints, and how you can leverage this technology to enhance your trading strategies.
Metals-API Information
About Gold (XAU)
Gold has long been considered a safe haven asset, especially during times of economic uncertainty. With the digital transformation in precious metals trading, developers can now utilize data analytics and market insights to create innovative applications that provide real-time pricing information. The integration of technology in trading has revolutionized how investors access and analyze market data, leading to more informed decision-making.
The Metals-API is at the forefront of this transformation, offering developers a powerful tool to access real-time and historical data for various metals, including Gold (XAU). By utilizing this API, developers can build next-generation applications that provide users with up-to-date market insights and price discovery.
API Description
The Metals-API provides a comprehensive suite of features that empower developers to access real-time metals data. With its user-friendly interface and extensive documentation, the API allows for seamless integration into various applications. The API supports multiple endpoints, each designed to cater to specific needs, from retrieving the latest rates to accessing historical data.
One of the key advantages of the Metals-API is its ability to deliver real-time exchange rate data, which is updated frequently based on the subscription plan. This ensures that users have access to the most current market prices, enabling them to make timely trading decisions.
Key Features and Endpoints
The Metals-API offers a variety of endpoints that cater to different use cases. Here are some of the most notable features:
- Latest Rates Endpoint: This endpoint provides real-time exchange rate data for various metals, updated based on your subscription plan. You can access the latest Gold (XAU) prices and other metals in a matter of seconds.
- Historical Rates Endpoint: If you need to analyze past market trends, this endpoint allows you to retrieve historical rates dating back to 2019. Simply append a date to your query to access the data you need.
- Bid And Ask Endpoint: This powerful feature enables you to retrieve real-time bid and ask prices for Gold and other metals, providing insight into market liquidity and pricing dynamics.
- Convert Endpoint: The Metals-API includes a currency conversion endpoint, allowing you to convert amounts between different metals or to/from USD, facilitating easier trading and analysis.
- Time-Series Endpoint: This endpoint allows you to query daily historical rates between two dates of your choice, making it easier to analyze trends over time.
- Fluctuation Endpoint: Track how prices fluctuate over a specified period, providing insights into market volatility and helping you make informed trading decisions.
- Carat Endpoint: 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 allows you to query the API for the lowest and highest prices of Gold over a specified period, helping you identify market extremes.
- Open/High/Low/Close (OHLC) Price Endpoint: Access detailed OHLC data for Gold prices, which is essential for technical analysis and trading strategies.
- Historical LME Endpoint: For those interested in LME symbols, this endpoint provides historical rates dating back to 2008, allowing for comprehensive market analysis.
- API Key: Your unique API key is essential for accessing the Metals-API. It must be included in your API requests to authenticate your access.
- API Response: The API delivers exchange rates relative to USD, ensuring consistency in data presentation.
- Available Endpoints: The Metals-API features 14 different endpoints, each designed to provide specific functionalities tailored to your needs.
- Supported Symbols Endpoint: This constantly updated endpoint returns all available currencies and metals, ensuring you have the latest information at your fingertips.
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.
API Endpoint Examples and Responses
Latest Rates Endpoint
To get real-time exchange rates for all available metals, you can use the Latest Rates Endpoint. Here’s an example response:
{
"success": true,
"timestamp": 1784852378,
"base": "USD",
"date": "2026-07-24",
"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, you can see the current price of Gold (XAU) along with other metals, all expressed in terms of USD per troy ounce.
Historical Rates Endpoint
Accessing historical exchange rates is straightforward. Here’s an example response for a historical query:
{
"success": true,
"timestamp": 1784765978,
"base": "USD",
"date": "2026-07-23",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This response provides the historical price of Gold (XAU) for a specific date, allowing you to analyze past trends.
Time-series Endpoint
The Time-series Endpoint allows you to get exchange rates for a specific time period. Here’s an example response:
{
"success": true,
"timeseries": true,
"start_date": "2026-07-17",
"end_date": "2026-07-24",
"base": "USD",
"rates": {
"2026-07-17": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-07-19": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-07-24": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
This response provides a time series of Gold prices, allowing you to visualize trends over the specified period.
Convert Endpoint
The Convert Endpoint is useful for converting amounts between different metals or to/from USD. Here’s an example response:
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1784852378,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response shows the conversion of 1000 USD to Gold (XAU), providing the equivalent amount in troy ounces.
Fluctuation Endpoint
To track rate fluctuations between two dates, you can use the Fluctuation Endpoint. Here’s an example response:
{
"success": true,
"fluctuation": true,
"start_date": "2026-07-17",
"end_date": "2026-07-24",
"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 Gold prices have fluctuated over the specified period, which can be critical for traders looking to capitalize on market movements.
OHLC (Open/High/Low/Close) Endpoint
For those interested in detailed price data, the OHLC Endpoint provides essential information. Here’s an example response:
{
"success": true,
"timestamp": 1784852378,
"base": "USD",
"date": "2026-07-24",
"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 the open, high, low, and close prices for Gold, which are essential for technical analysis and trading strategies.
Bid/Ask Endpoint
Lastly, the Bid/Ask Endpoint allows you to get current bid and ask prices for metals. Here’s an example response:
{
"success": true,
"timestamp": 1784852378,
"base": "USD",
"date": "2026-07-24",
"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 the current bid and ask prices for Gold, which are essential for understanding market dynamics and making informed trading decisions.
Conclusion
Accessing real-time Gold (XAU) prices using the Metals-API is a straightforward process that can significantly enhance your trading strategies. By leveraging the various endpoints offered by the API, you can obtain the latest rates, historical data, and detailed market insights. This empowers you to make informed decisions based on accurate and timely information.
Whether you are a developer looking to integrate real-time metals data into your applications or a trader seeking to analyze market trends, the Metals-API provides the tools you need. For more information, visit the Metals-API Website and explore the Metals-API Documentation for detailed guidance on implementation.
In summary, the Metals-API is a powerful resource for accessing real-time Gold prices and other metals data. By understanding its features and capabilities, you can unlock the potential of real-time data in your trading strategies.