How to Fetch Uniswap (UNI) Historical Prices using this API
Introduction
In the world of cryptocurrency and digital assets, fetching historical prices is crucial for traders and developers alike. One of the most popular decentralized exchanges, Uniswap, allows users to trade various tokens, including its native token, UNI. To effectively analyze the price trends of UNI, developers can leverage the capabilities of the Metals-API. This API provides comprehensive access to real-time and historical price data for various metals, which can be creatively adapted to fetch and analyze cryptocurrency prices. In this blog post, we will explore how to utilize the Metals-API to fetch historical prices, focusing on its features, endpoints, and practical applications.
Understanding the Metals-API
The Metals-API is a powerful tool designed to provide real-time and historical data on metal prices and currency conversions. It is particularly useful for developers looking to integrate metal price data into their applications. The API is built with a focus on technological innovation and advancement, enabling users to access data analytics and insights that can drive decision-making processes.
About Nickel (NI)
Nickel, represented by the symbol NI, is one of the many metals tracked by the Metals-API. As industries evolve, the demand for nickel is expected to grow, particularly in the context of digital transformation in metal markets. The integration of smart technology and data analytics is revolutionizing how businesses interact with metal markets, providing real-time insights that were previously unattainable. Developers can harness these insights to build applications that not only track prices but also predict future trends based on historical data.
API Features and Endpoints
The Metals-API offers a variety of endpoints that cater to different data needs. Each endpoint is designed to provide specific functionalities that can be utilized in various applications. Here are some of the key features:
Latest Rates Endpoint
The Latest Rates Endpoint provides real-time exchange rate data for metals. Depending on your subscription plan, this endpoint can return data updated every 60 minutes or even more frequently. This feature is essential for applications that require up-to-the-minute pricing information.
{
"success": true,
"timestamp": 1783815320,
"base": "USD",
"date": "2026-07-12",
"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
For developers interested in analyzing trends over time, the Historical Rates Endpoint is invaluable. It allows users to access historical rates for most currencies dating back to 2019. By appending a specific date to the API request, developers can retrieve historical data that can be used for trend analysis.
{
"success": true,
"timestamp": 1783728920,
"base": "USD",
"date": "2026-07-11",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
Bid and Ask Endpoint
The Bid and Ask Endpoint is a powerful feature that enables developers to retrieve real-time bid and ask prices for metals. This information is crucial for traders who need to make informed decisions based on current market conditions.
{
"success": true,
"timestamp": 1783815320,
"base": "USD",
"date": "2026-07-12",
"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"
}
Convert Endpoint
The Convert Endpoint allows users to convert any amount from one metal to another or to/from USD. This feature is particularly useful for applications that require currency conversion functionalities.
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1783815320,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
Time-Series Endpoint
The Time-Series Endpoint allows developers to query the API for daily historical rates between two dates of their choice. This feature is essential for applications that require detailed historical analysis over specific time frames.
{
"success": true,
"timeseries": true,
"start_date": "2026-07-05",
"end_date": "2026-07-12",
"base": "USD",
"rates": {
"2026-07-05": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-07-07": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-07-12": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
Fluctuation Endpoint
The Fluctuation Endpoint provides information about how currencies fluctuate on a day-to-day basis. This endpoint is useful for understanding market volatility and making informed trading decisions.
{
"success": true,
"fluctuation": true,
"start_date": "2026-07-05",
"end_date": "2026-07-12",
"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"
}
Open/High/Low/Close (OHLC) Price Endpoint
The OHLC Price Endpoint allows users to query the API for the open, high, low, and close prices for a specific time period. This data is essential for traders who want to analyze price movements and make informed decisions.
{
"success": true,
"timestamp": 1783815320,
"base": "USD",
"date": "2026-07-12",
"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"
}
Historical LME Endpoint
The Historical LME Endpoint provides access to historical rates for LME symbols dating back to 2008. This endpoint is particularly useful for developers working with metals traded on the London Metal Exchange.
API Key and Authentication
To access the Metals-API, developers must obtain an API key, which is passed into the API base URL's access_key parameter. This key is essential for authentication and ensures that only authorized users can access the data.
API Response and Data Structure
The API responses are structured in a JSON format, providing data that is easy to parse and integrate into applications. By default, all exchange rates are relative to USD, allowing for straightforward comparisons and calculations.
Practical Use Cases
Developers can leverage the Metals-API in various applications, including:
- Trading Platforms: Integrate real-time and historical price data into trading platforms to provide users with up-to-date information.
- Market Analysis Tools: Build tools that analyze price trends and fluctuations, helping traders make informed decisions.
- Financial Applications: Create applications that require currency conversion functionalities, enhancing user experience.
Conclusion
In conclusion, the Metals-API offers a robust solution for developers looking to fetch historical prices and real-time data for metals, including applications related to cryptocurrency like Uniswap (UNI). By utilizing its various endpoints, developers can create innovative applications that provide valuable insights into market trends and price fluctuations. Whether you are building a trading platform, a market analysis tool, or a financial application, the Metals-API provides the necessary data and functionalities to enhance your project. For more information, refer to the Metals-API Documentation and explore the Metals-API Supported Symbols for a comprehensive list of available data.