In this post, we describe a new reserve, namely, an on-chain market making algorithm, that we developed for the YOLO decentralized exchange (DEX). This new reserve combines two approaches which we currently use in our Ethereum DEX, and the implementation is possible on YOLO thanks to the specific properties of the EOS blockchain.

Background — on chain market making

For over a year Kyber Network team is market making Ethereum ERC20 tokens over the KyberSwap DEX. On-chain market making dictates that at any point of time, a smart contract should provide ask and bid price quotes for its inventory. Over Ethereum network we implemented such market making system using two different approaches:

External price discovery — in this approach we query the price from centralized exchanges and periodically relay it to the smart contract. Inventory based exponential price discovery — in this approach the price is determined uniquely by the size of the current inventory according to a fixed exponential formula. Given an initial inventory threshold T, the formula increases the token price (more expensive) when the contract has less than T tokens (to boost supply), and decreases the price when there are more than T tokens (to boost demand).

Each one of the approach has its own advantages and pitfalls. The external price discovery can support small inventory size while making sure that token is not traded with losses, however due to blockchain tx latency the external price discovery cannot react in real time (e.g., During high volatility situations, price discovery needs to quickly update sudden changes in price) and in addition the price injection has a cost in the form of transaction fees. As a result an additional spread must be introduced to compensate on the uncertainty in the period between price updated. The inventory based price discovery reacts to changes in inventory in real time, however requires relatively big inventory and in addition it underperforms in terms of profits as the price calculation primarily depends upon inventory size as opposed to mark to market pricing.

More efficient on-chain market making over EOS

The sub-second block time and the flexible transaction fee model in EOS allows us to improve the external price discovery by relaying prices more frequently and thus reduce the uncertainty time interval. However it is still far from real time behavior due to network latency and the possibility that multiple trades will occur in the same block.

The exponential liquidity reserve

The exponential liquidity reserve combines our two previous approaches.

Not only it supports small inventory by enabling external price discovery but also adjusts the price based on the internal inventory and thus react in real time to changes in the inventory size.

This allows the market maker to send external price updates less frequently, when there are big changes in market price, while the exponential formula adjust the price during small changes in price.

Current state and future plans

The external price discovery reserve is used by Kyber on Ethereum blockchain for over a year and generated profits to market makers who used it, however we often get feedback from them about the sub-optimal way it price big quantities and one-sided volume. Due to the strict transaction fees model we were forced to introduce an ad-hoc linear step function, which cannot fully capture the desired change of price for a given quantity.

In addition, the inventory based pricing is being used for over 8 month by over 10 projects. This reserve is very popular as it requires very little maintenance. However the minimal inventory requirements are in the order of $30,000.

The YOLO network will offer the unified solution, namely, the exponential liquidity reserve, which support relatively small inventory size while still allowing real time on chain reaction to big changes in inventory. Initially the external price discovery will be done infrequently by manual operations, however we are excited to see how the full system work in couple of month time when the development of a supporting backend is completed.