The Easiest Way to Get Pakistani Rupee (PKR) Historical Rates Using API Calls
The Easiest Way to Get Pakistani Rupee (PKR) Historical Rates Using API Calls
In today's fast-paced financial landscape, accessing historical currency rates is crucial for developers and analysts alike. The Metals-API provides a seamless way to retrieve historical rates for the Pakistani Rupee (PKR) and other currencies through its robust API. This blog post will guide you through the process of obtaining PKR historical prices using the Metals-API, detailing the various endpoints, parameters, and data formats available. Whether you're building a financial application or conducting market analysis, understanding how to leverage this API will empower you to make informed decisions.
Understanding Metals-API
The Metals-API is a powerful tool designed for developers seeking real-time and historical data on metal prices and currency exchange rates. With its innovative architecture, the API allows users to access a wealth of information, including the latest rates, historical data, and conversion capabilities. By integrating this API into your applications, you can harness the power of real-time data analytics, enabling smarter decision-making and enhanced user experiences.
About Nickel (NI)
Nickel is one of the many metals tracked by the Metals-API, and its market dynamics are influenced by various factors, including digital transformation in metal markets and technological advancements. As industries evolve, the integration of smart technologies and data analytics becomes increasingly important. The Metals-API not only provides current pricing but also offers insights into future trends and possibilities, making it an invaluable resource for developers and analysts alike.
API Description
The Metals-API is designed to provide developers with the tools necessary to build next-generation applications that require real-time and historical metals data. The API supports a wide range of functionalities, allowing users to query for the latest rates, historical prices, and even perform conversions between different currencies. By utilizing the API, developers can create applications that are not only responsive but also capable of delivering insights based on historical trends.
For more detailed information, you can refer to the Metals-API Documentation.
Key Features and Endpoints
The Metals-API offers a variety of endpoints that cater to different needs. Here are some of the key features:
- Latest Rates Endpoint: This endpoint provides real-time exchange rate data, updated based on your subscription plan. You can access the latest rates for PKR and other currencies, ensuring you have the most current information at your fingertips.
- Historical Rates Endpoint: With this feature, you can retrieve historical rates for PKR dating back to 2019. By appending a specific date in the format YYYY-MM-DD, you can access the historical exchange rate for any given day.
- Bid and Ask Endpoint: This powerful feature allows you to retrieve real-time bid and ask prices for metals, providing insights into market conditions and helping you make informed trading decisions.
- Convert Endpoint: The conversion endpoint enables you to convert any amount from one currency to another, including PKR. This is particularly useful for applications that require currency conversion functionalities.
- Time-Series Endpoint: This endpoint allows you to query for daily historical rates between two dates of your choice, making it easier to analyze trends over time.
- Fluctuation Endpoint: Track how currencies fluctuate on a day-to-day basis with this endpoint, which provides valuable insights into market volatility.
- Carat Endpoint: Retrieve information about gold rates by carat, which is essential for applications focused on jewelry and precious metals.
- Lowest/Highest Price Endpoint: This feature allows you to query for the lowest and highest prices of metals on a specific date, providing insights into market extremes.
- Open/High/Low/Close (OHLC) Price Endpoint: Access detailed OHLC data for a specific time period, which is crucial for technical analysis.
- Historical LME Endpoint: Access historical rates for LME symbols dating back to 2008, which is essential for comprehensive market analysis.
- API Key: Your unique API key is required to access the API, ensuring secure and authorized usage.
- API Response: The API delivers exchange rates relative to USD by default, with all data returned in a structured JSON format.
- Available Endpoints: The Metals-API includes 14 different endpoints, each providing unique functionalities tailored to various user needs.
- Supported Symbols Endpoint: This endpoint returns a constantly updated list of all available currencies and metals, ensuring you have the latest information.
- News Endpoint: Stay updated with the latest news articles related to various metals, which can provide context for market movements.
For a complete list of supported symbols, visit the Metals-API Supported Symbols page.
Example Endpoints and Responses
To illustrate how to use the Metals-API effectively, letβs explore some example endpoints and their corresponding JSON responses.
Latest Rates Endpoint
To get real-time exchange rates for all available metals, you can use the following endpoint:
GET https://metals-api.com/api/latest?access_key=YOUR_API_KEY
Example Response:
{
"success": true,
"timestamp": 1778162862,
"base": "USD",
"date": "2026-05-07",
"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"
}
Historical Rates Endpoint
To access historical exchange rates for any date since 1999, use the following endpoint:
GET https://metals-api.com/api/historical?access_key=YOUR_API_KEY&date=2026-05-06
Example Response:
{
"success": true,
"timestamp": 1778076462,
"base": "USD",
"date": "2026-05-06",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
Time-Series Endpoint
To get exchange rates for a specific time period, you can use the time-series endpoint:
GET https://metals-api.com/api/timeseries?access_key=YOUR_API_KEY&start_date=2026-04-30&end_date=2026-05-07
Example Response:
{
"success": true,
"timeseries": true,
"start_date": "2026-04-30",
"end_date": "2026-05-07",
"base": "USD",
"rates": {
"2026-04-30": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-05-02": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-05-07": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
Convert Endpoint
To convert any amount from one metal to another or to/from USD, use the convert endpoint:
GET https://metals-api.com/api/convert?access_key=YOUR_API_KEY&from=USD&to=XAU&amount=1000
Example Response:
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1778162862,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
Fluctuation Endpoint
To track rate fluctuations between two dates, you can use the fluctuation endpoint:
GET https://metals-api.com/api/fluctuation?access_key=YOUR_API_KEY&start_date=2026-04-30&end_date=2026-05-07
Example Response:
{
"success": true,
"fluctuation": true,
"start_date": "2026-04-30",
"end_date": "2026-05-07",
"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"
}
OHLC (Open/High/Low/Close) Price Endpoint
To get OHLC data for a specific time period, use the following endpoint:
GET https://metals-api.com/api/open-high-low-close?access_key=YOUR_API_KEY&date=2026-05-07
Example Response:
{
"success": true,
"timestamp": 1778162862,
"base": "USD",
"date": "2026-05-07",
"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"
}
Bid/Ask Endpoint
To get current bid and ask prices for metals, use the following endpoint:
GET https://metals-api.com/api/bid-ask?access_key=YOUR_API_KEY
Example Response:
{
"success": true,
"timestamp": 1778162862,
"base": "USD",
"date": "2026-05-07",
"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"
}
Conclusion
In conclusion, the Metals-API offers a comprehensive solution for accessing historical rates for the Pakistani Rupee (PKR) and other currencies. By leveraging its various endpoints, developers can build powerful applications that provide real-time insights and historical data analysis. From retrieving the latest rates to analyzing fluctuations and performing conversions, the API is designed to meet the needs of technically proficient developers.
For further exploration, visit the Metals-API Website to learn more about its capabilities and how it can enhance your financial applications. With the right implementation strategies and a thorough understanding of the API's features, you can unlock the full potential of real-time metals data.