How to Get Real-Time Gold Bid (XAU-BID) Prices with Metals-API and Integrate with Python
How to Get Real-Time Gold Bid (XAU-BID) Prices with Metals-API and Integrate with Python
In the world of finance, having access to real-time market data is crucial for making informed decisions. For those interested in precious metals, particularly gold (symbol: XAU), the Metals-API provides a powerful solution for accessing real-time bid prices and other valuable data. This blog post will guide you through the process of accessing real-time XAU-BID prices using Metals-API, integrating it with Python, and exploring the innovative features that this API offers.
About Gold (XAU)
Gold has long been a symbol of wealth and stability, often seen as a safe haven during economic uncertainty. As digital transformation sweeps through the financial sector, the trading of precious metals like gold is becoming increasingly integrated with technology. The rise of data analytics and market insights allows traders to make better decisions based on real-time data. The Metals-API is at the forefront of this transformation, providing developers with the tools to create next-generation applications that leverage real-time metals data.
By utilizing the Metals-API, developers can build applications that not only track gold prices but also analyze market trends, perform currency conversions, and access historical data. This API empowers users to innovate in price discovery and create digital asset solutions that can enhance trading strategies.
API Description
The Metals-API is a comprehensive JSON API that provides access to real-time and historical prices for various metals, including gold, silver, platinum, and palladium. With a focus on innovation and technological advancement, this API enables developers to create applications that can respond to market changes in real-time.
For detailed information about the API's capabilities, you can refer to the Metals-API Documentation. The API supports a wide range of functionalities, including:
- Latest Rates Endpoint: Access real-time exchange rate data updated at intervals based on your subscription plan.
- Historical Rates Endpoint: Retrieve historical rates dating back to 2019 for most currencies.
- Bid And Ask Endpoint: Get real-time bid and ask prices for metals.
- Convert Endpoint: Convert amounts between different metals or to/from USD.
- Time-Series Endpoint: Query daily historical rates between two dates.
- Fluctuation Endpoint: Track how currencies fluctuate on a day-to-day basis.
- Carat Endpoint: Retrieve information about gold rates by carat.
- Lowest/Highest Price Endpoint: Get the lowest and highest price for a specified date.
- Open/High/Low/Close (OHLC) Price Endpoint: Access OHLC data for a specific time period.
- Historical LME Endpoint: Access historical rates for LME symbols dating back to 2008.
- API Key: Your unique key for accessing the API.
- API Response: Understand the structure of the data returned by the API.
- Available Endpoints: Explore the 14 different API endpoints available.
- Supported Symbols Endpoint: Get a constantly updated list of all available currencies.
- News Endpoint: Retrieve the latest news articles related to various metals.
Key Features and Endpoints
Letβs delve deeper into some of the key features and endpoints of the Metals-API that are particularly relevant for accessing real-time gold prices.
Latest Rates Endpoint
The Latest Rates Endpoint allows you to fetch real-time exchange rates for all available metals. Depending on your subscription plan, this endpoint can return data updated every 60 minutes, every 10 minutes, or even more frequently. This feature is essential for traders who need to make quick decisions based on the most current market conditions.
{
"success": true,
"timestamp": 1762736698,
"base": "USD",
"date": "2025-11-10",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912,
"XPD": 0.000744
},
"unit": "per troy ounce"
}
In this response, the "rates" field provides the current price of gold (XAU) in terms of USD per troy ounce, which is crucial for traders looking to assess the value of their investments.
Historical Rates Endpoint
The Historical Rates Endpoint allows you to access historical exchange rates for any date since 1999. This is particularly useful for analyzing trends over time and making data-driven decisions based on past performance.
{
"success": true,
"timestamp": 1762650298,
"base": "USD",
"date": "2025-11-09",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"unit": "per troy ounce"
}
Here, the response includes the historical price of gold for a specific date, allowing users to track price movements and identify patterns.
Bid And Ask Endpoint
The Bid And Ask Endpoint is a powerful feature that enables you to retrieve real-time bid and ask prices for metals. This is essential for traders who need to know the current market spread to make informed buying or selling decisions.
{
"success": true,
"timestamp": 1762736698,
"base": "USD",
"date": "2025-11-10",
"rates": {
"XAU": {
"bid": 0.000481,
"ask": 0.000483,
"spread": 2.0e-6
}
},
"unit": "per troy ounce"
}
The response provides the current bid and ask prices for gold, along with the spread, which is the difference between the two prices. Understanding the spread is crucial for traders as it impacts their potential profit margins.
Convert Endpoint
The Convert Endpoint allows you to convert any amount from one metal to another or to/from USD. This feature is particularly useful for traders who deal with multiple metals and need to quickly assess their value in different currencies.
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1762736698,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response shows how much 1000 USD is worth in gold (XAU), providing traders with the necessary information to make conversion decisions.
Time-Series Endpoint
The Time-Series Endpoint allows you to query the API for daily historical rates between two dates of your choice. This is particularly useful for analyzing trends over specific periods.
{
"success": true,
"timeseries": true,
"start_date": "2025-11-03",
"end_date": "2025-11-10",
"base": "USD",
"rates": {
"2025-11-03": {
"XAU": 0.000485
},
"2025-11-10": {
"XAU": 0.000482
}
},
"unit": "per troy ounce"
}
The response provides daily rates for gold over the specified period, allowing users to visualize trends and fluctuations.
Fluctuation Endpoint
The Fluctuation Endpoint enables you to track rate fluctuations between two dates. This is essential for understanding market volatility and making informed trading decisions.
{
"success": true,
"fluctuation": true,
"start_date": "2025-11-03",
"end_date": "2025-11-10",
"base": "USD",
"rates": {
"XAU": {
"start_rate": 0.000485,
"end_rate": 0.000482,
"change": -3.0e-6,
"change_pct": -0.62
}
},
"unit": "per troy ounce"
}
This response provides insights into how the price of gold has changed over the specified period, including the percentage change, which is crucial for traders looking to capitalize on market movements.
Open/High/Low/Close (OHLC) Price Endpoint
The OHLC Price Endpoint allows you to get the open, high, low, and close prices for a specific time period. This data is essential for technical analysis and understanding market trends.
{
"success": true,
"timestamp": 1762736698,
"base": "USD",
"date": "2025-11-10",
"rates": {
"XAU": {
"open": 0.000485,
"high": 0.000487,
"low": 0.000481,
"close": 0.000482
}
},
"unit": "per troy ounce"
}
The response provides the OHLC data for gold, which traders can use to analyze market behavior and make predictions about future price movements.
Integrating Metals-API with Python
Integrating the Metals-API with Python is straightforward and allows developers to create powerful applications that leverage real-time gold pricing data. Below are the steps to get started:
- Sign Up for Metals-API: Create an account on the Metals-API Website and obtain your unique API key.
- Install Required Libraries: Ensure you have the necessary libraries installed in your Python environment. You can use libraries like
requeststo make API calls. - Make API Calls: Use the API key to authenticate your requests and access the desired endpoints. For example, to get the latest gold prices, you would call the Latest Rates Endpoint.
- Process API Responses: Handle the JSON responses returned by the API to extract the relevant data for your application.
- Implement Business Logic: Use the retrieved data to implement your trading strategies, analytics, or any other business logic.
By following these steps, you can effectively integrate the Metals-API into your Python applications and leverage real-time gold pricing data to enhance your trading strategies.
Conclusion
Accessing real-time gold bid prices using the Metals-API is a powerful way to enhance your trading strategies and make informed decisions in the precious metals market. With features like the Latest Rates Endpoint, Historical Rates Endpoint, and Bid And Ask Endpoint, developers can create applications that respond to market changes in real-time.
The integration of technology in trading, particularly through APIs like Metals-API, is transforming the way traders interact with the market. By utilizing the comprehensive features offered by the Metals-API, developers can build innovative applications that provide valuable insights and enhance trading performance.
For more information on the capabilities of the Metals-API, refer to the Metals-API Documentation and explore the Metals-API Supported Symbols for a complete list of available metals. Embrace the future of trading with real-time data and unlock new opportunities in the precious metals market.