Access Brunei Dollar (BND) Exchange Rate API Examples in JSON Format
Access Brunei Dollar (BND) Exchange Rate API Examples in JSON Format
In the rapidly evolving landscape of financial technology, the ability to retrieve real-time exchange rates is paramount for developers and businesses alike. The Metals-API provides a robust solution for accessing exchange rates for various metals, including the Brunei Dollar (BND). This blog post will explore how to retrieve exchange rates in JSON format using the Metals-API, complete with sample API responses and integration tips.
Understanding Metals-API
The Metals-API is designed to empower developers with real-time and historical data on metal prices and currency conversions. With its innovative architecture, the API allows for seamless integration into applications, enabling businesses to leverage data analytics and insights for informed decision-making. The API supports a wide range of functionalities, making it an essential tool for anyone working in the financial sector.
Key Features of Metals-API
The Metals-API offers a variety of endpoints that cater to different needs, including:
- Latest Rates Endpoint: This endpoint provides real-time exchange rate data updated every 60 minutes, 10 minutes, or even more frequently, depending on your subscription plan. It allows developers to access the most current rates for metals like Gold (XAU), Silver (XAG), and others.
- Historical Rates Endpoint: Access historical exchange rates dating back to 2019. By appending a specific date in the YYYY-MM-DD format, developers can retrieve past rates for analysis and reporting.
- Bid and Ask Endpoint: This feature enables users to retrieve real-time bid and ask prices for metals, providing insights into market dynamics and pricing strategies.
- Convert Endpoint: The conversion endpoint allows for the conversion of any amount from one metal to another or to/from USD, facilitating transactions and financial calculations.
- Time-Series Endpoint: Query the API for daily historical rates between two dates of your choice, enabling trend analysis and forecasting.
- Fluctuation Endpoint: Track how currencies fluctuate on a day-to-day basis, providing valuable insights into market volatility.
- Open/High/Low/Close (OHLC) Price Endpoint: Retrieve OHLC data for a specific time period, which is crucial for technical analysis and trading strategies.
- Historical LME Endpoint: Access historical rates for LME symbols dating back to 2008, allowing for comprehensive market analysis.
- News Endpoint: Stay updated with the latest news articles related to various metals, providing context and insights into market movements.
Sample API Responses
To illustrate the capabilities of the Metals-API, let's explore some sample API responses for different endpoints.
Latest Rates Endpoint
{
"success": true,
"timestamp": 1773371259,
"base": "USD",
"date": "2026-03-13",
"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 above response shows the latest exchange rates for various metals, with the base currency set to USD. Each metal symbol corresponds to its respective rate per troy ounce.
Historical Rates Endpoint
{
"success": true,
"timestamp": 1773284859,
"base": "USD",
"date": "2026-03-12",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This response provides historical rates for a specific date, allowing developers to analyze trends over time.
Time-Series Endpoint
{
"success": true,
"timeseries": true,
"start_date": "2026-03-06",
"end_date": "2026-03-13",
"base": "USD",
"rates": {
"2026-03-06": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-03-08": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-03-13": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
The time-series response provides daily rates for a specified period, which is essential for trend analysis and forecasting.
Convert Endpoint
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1773371259,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response shows how to convert an amount from one currency to another, providing both the conversion rate and the result.
Fluctuation Endpoint
{
"success": true,
"fluctuation": true,
"start_date": "2026-03-06",
"end_date": "2026-03-13",
"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 rates have changed over a specified period, which is crucial for understanding market dynamics.
OHLC (Open/High/Low/Close) Price Endpoint
{
"success": true,
"timestamp": 1773371259,
"base": "USD",
"date": "2026-03-13",
"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 the open, high, low, and close prices for a specific date, which is essential for traders and analysts.
Bid/Ask Endpoint
{
"success": true,
"timestamp": 1773371259,
"base": "USD",
"date": "2026-03-13",
"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, which are critical for making informed trading decisions.
Integration Tips
Integrating the Metals-API into your application can significantly enhance its functionality. Here are some tips to ensure a smooth integration:
- Authentication: Each request to the Metals-API requires an API key, which you can obtain by signing up on the Metals-API Website. Ensure that your API key is kept secure and not exposed in client-side code.
- Rate Limiting: Be aware of the rate limits associated with your subscription plan. Implement caching strategies to minimize API calls and optimize performance.
- Error Handling: Implement robust error handling to manage potential issues such as network errors, invalid requests, or exceeded rate limits. This will enhance the user experience and reliability of your application.
- Data Validation: Always validate the data returned by the API to ensure its accuracy and integrity before using it in your application.
- Performance Optimization: Consider using asynchronous requests to improve the responsiveness of your application when fetching data from the API.
Conclusion
The Metals-API provides a powerful and flexible solution for accessing real-time and historical exchange rates for metals, including the Brunei Dollar (BND). With its comprehensive set of endpoints, developers can build applications that leverage real-time data for informed decision-making. By following the integration tips outlined in this post, you can ensure a seamless experience when working with the Metals-API.
For further exploration, refer to the Metals-API Documentation for detailed information on each endpoint and its capabilities. Additionally, you can find a complete list of supported symbols at the Metals-API Supported Symbols page. Embrace the power of real-time metals data and transform your applications today!