Introducing the Oku API: The First Uniswap v3 API

TLDR: Powered by JSON-RPC, integrating Oku into your application has never been easier. We provide a typescript client and developer documentation to make getting started quick and painless. Unlike popular crypto market data interfaces, access to the API isn’t hidden behind a signup form or auth key - you can just jump right in!

We are thrilled to announce the unveiling of Oku’s API, a groundbreaking tool catered exclusively to the needs of applications built atop Uniswap v3. Thanks to the generous support of the Uniswap Foundation, the API offers fast and reliable access to the entirety of Uniswap v3.

Powering Oku’s entire advanced trading interface, the API offers all the data retrieval methods seen on the trading interface and more tailored methods. Built to support trading applications, it provides a variety of data filtering capabilities to boast near-instant response times. With support on multiple high-volume blockchains, including Ethereum, Arbitrum, Optimism, and Polygon, the API provides exchange data for over $3.7 billion of liquidity.

The goal of publicizing Oku’s API is to increase accessibility to historic and present Uniswap v3 market data. When we first started developing Oku, we quickly came to realize the extensive costs and storage required to process and compute the large amount of data that flows through Uniswap v3. With that in mind, we sought to address these challenges for others by providing a user-friendly developer interface to access large datasets with ease.

The transition from the constant product AMM model popularized in Uniswap v2 to the concentrated liquidity model seen in v3 optimized capital efficiency at the cost of complicating protocol interactions. Storing and computing the pool state became prohibitively expensive and time-consuming. We have eliminated those hurdles through our API by enabling users to retrieve accurate pool snapshots, detailed liquidity breakdowns, customized search results, familiar trading data formats, historic price data, and more. This empowers traders, developers, and data enthusiasts alike to extract valuable insights without incurring exorbitant costs or enduring lengthy computations.

With Oku’s API, consumers can quickly retrieve the entire state of a pool in a single request. Our custom logic for caching pool data ensures fast and efficient retrieval of initialized pool liquidity at any point in time. The Oku API is a monumental improvement for data access and retrieval compared to traditional methods, which often suffer from request latency and storage requirements.

In addition to granting full access to pool state and liquidity information, Oku’s API goes above and beyond by offering powerful search and filtering capabilities that revolutionize the way developers navigate the Uniswap v3 ecosystem. Unlike other market data providers like CoinGecko and CoinMarketCap, our API provides far more advanced search options, enabling users to seamlessly retrieve specialized information.

By providing these advanced search options, we empower developers to uncover unique insights and tailor their strategies accordingly. Whether they are building trading applications, conducting market research, or searching for MEV transactions, Oku’s API equips them with the tools needed to extract specialized and granular information from the Uniswap v3 ecosystem.

Traditionally, decentralized exchanges such as Uniswap have operated quite differently from their centralized counterparts. This difference extends to how they present and manage trading data. Instead of order books and candlestick charts commonly found in traditional finance, DEXs use liquidity pools and automated market makers. However, Oku understands that the tools of traditional finance still hold immense value, and the familiar patterns they can reveal offer much cleaner integration with existing trading systems.

We’ve taken a novel approach to the DEX user experience by transposing the complicated liquidity math present in DeFi into traditional trading formats. We expose multiple methods that interpret DEX liquidity and price data that mimics the traditional finance landscape. This provides users with a familiar yet new way to interact with Uniswap v3 market data, such as order books, candlestick charts, and market overviews.

As we unveil the Oku API, we understand that its true power lies in the applications that our users will create with it. The Uniswap ecosystem’s diverse user base will be the ones developing the unique use cases that apply the data we serve. In the examples below, we examine several hypothetical applications that can be built with the Oku API.

Miner Extractable Value (MEV) Searching

In the ever-evolving DeFi space, detecting and extracting Miner Extractable Value (MEV) has become an important activity. In the context of Uniswap, extractable value comes from arbitrage opportunities created by liquidity imbalances across pools with related assets. Using these differences, MEV searchers can construct transactions that execute multiple trades across different markets and exchanges, guaranteeing profit.

In order to spot these market inefficiencies, searchers must have fast access to the current state of hundreds of thousands of fund sources across multiple blockchains. Given Uniswap v3 is the most liquid decentralized exchange, accounting for pool state is imperative to being profitable. However, due to the complexity of concentrated liquidity, this comes with inherent latency and increased RPC costs. The current schema for computing profitable MEV routes is as follows:

  • Constantly request the current state of all sources of funds that can be used to create a profitable transaction

  • Greedily search for the most profitable transaction by pruning out nonoptimal fund sources

  • Verify the profitability of your route by using an RPC provider to binary search for trade inputs that achieve the highest possible notional value

This method is very costly due to the large amount of data required to represent the struct of concentrated liquidity. Oku aims to reduce these costs by providing fast access to state information for v3 pools and state differences across sets of blocks. By incorporating our API into a preexisting program, searchers can solve routes more efficiently.

As we see it, the ideal approach for integrating Oku’s API into a preexisting arbitrage solver involves polling for v3 state updates and utilizing updated tick information to quickly prune infeasible routes. We seek to eliminate searchers gathering tick information via massive multi-calls and provide an easy interface to retrieve the full state of any Uniswap v3 pool in a fraction of the time. Since we represent pool tick state in a format equivalent to the on-chain layout, switching to using Oku’s API should be as easy as replacing your pre-existing method.

Position Creation and Tracking Interface

Providing liquidity on Uniswap is very complicated for someone unfamiliar with the underlying contract logic. Values such as tick range are unintuitive and require a deeper understanding of the Uniswap liquidity model. Position values are unscaled and must be calculated using a combination of state variables and formuli.

Furthermore, access to information regarding existing and historic positions is non-trivial since the pool interface does not expose certain position read methods. This makes it hard to display a given user’s positions, compare position profit and loss, or view historic position statistics.

Oku solves this issue by pre-indexing all Uniswap v3 positions. We serve positions in a readable format with a variety of data points that can be displayed so you don’t have to worry about any of the calculations. Our position indices also allow for the sorting and filtering of positions based on a set of metrics. For example, you can get the top positions by dollar value, the top positions in a pool, and more. This allows for the easy display of LP data without having to index positions yourself.

Our API also provides methods for backtesting hypothetical positions to determine IL faced, fee revenue, and more. This plays nicely into an LP interface, giving a user information as to how their position may perform given past market conditions. The backtest methods provided by the Oku API also serve the profitability of a position over time, giving users of your interface the ability to refine their price boundaries.

Enough talk about hypotheticals; check out Oku’s API in action! Unispark is a full-fledged position analysis tool and a fellow Uniswap Foundation grantee. Unispark utilizes Oku’s API to display liquidity charts, the total value locked per pool, pool fee data, hypothetical position profitability, and price data.

Flow Analysis/Notifications Tool

The Oku Trade API serves as a powerful tool to monitor fund flows through Uniswap v3. Owing to its remarkably low propagation delay, the API offers real-time access to parsed, easy-to-understand trade streams. These trade streams provide detailed insights into the flow of funds across different liquidity pools and tokens. In short, the Oku Trade API is a valuable resource for anyone looking to gain a deeper understanding of fund flow dynamics in the Uniswap v3 ecosystem.

Trade streams are used to identify patterns, spot sudden shifts in liquidity, or track the movement of large trades. Given this information, applications that rely on real-time updates can serve trade information with ease. In fact, this feature is the heart of our entire trading interface and what enables us to update market information faster than our competitors. Nonetheless, there are countless applications that can use this information as well.

For one, we envision Twitter notification tools tracking large trades on Uniswap v3. Given our low propagation delay, you’ll always be the first to serve market updates. This information includes high-volume trades, abrupt shifts in technicals, and liquidity flow. Consequently, followers of this tool on Twitter can stay updated on market-moving events and make informed decisions in a timely manner. In essence, the Oku Trade API provides a robust and efficient framework for staying in tune with the pulse of the Uniswap V3 markets.

Assistant Market Analyst

Finally, one of our favorite applications utilizing Oku’s API is UniChat. Unichat utilizes our developer documentation to pre-train an instance of ChatGPT. I’ll let Unichat explain the rest of this one:

"I am a virtual assistant that leverages OKU's API to provide information and assistance related to Uniswap v3. OKU's API provides access to a wide range of data and functions specific to Uniswap v3, including retrieving pool snapshots, liquidity details, fee information, and user transaction history. By utilizing OKU's API, I can fetch real-time data and perform calculations with accuracy, ensuring that the information I provide is up-to-date and reliable. This integration allows me to seamlessly connect with Uniswap v3 and offer valuable insights to users, enabling them to make informed decisions in the DeFi space.”

About Oku

Experience the future of decentralized trading with Oku, a frontend built for the Uniswap v3 protocol and seeded by the Uniswap Foundation. Oku goes beyond the standard trading interface, offering professional-grade features like live order books, detailed price charts, advanced limit orders, and a customizable favorite markets list. Designed with an intuitive interface that caters to both novice and experienced traders, Oku seeks to fill the gap between Uniswap and traditional exchanges. Our commitment is to enhance the DeFi user experience and pioneer the next generation of trading, making the transition from centralized to decentralized platforms seamless and empowering. Welcome to Oku, where we're making DeFi better, one trade at a time. For more information, visit Oku.trade.

Subscribe to Oku
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.