Hi everyone, was wondering if you had any recommendations/guidance for building a connector for a automated reserve such as kyber (seems like uniswap is similar). I’m looking at the connector documentation, and it seems that much of it is revolved around an orderbook (e.g. OrderBookDatasource, ActiveOrderTracker, OrderBookTracker…) However, in these systems there is not really an orderbook. You can basically buy whatever amount of tokens you want at the ‘rate’ of the reserve (which dynamically adjusts). I have an api where I can enter the token amount and get a quote price for that amount. I’m having trouble implementing this in the standard connector format, and any help/guidance would be appreciated.
Since some users have asked about building a connector for Uniswap and similar venues, I wanted to provide some guidance. As mentioned in this blog post, we are big fans of decentralized exchanges that utilize automatic market makers like Uniswap, Bancor, and Kyber Network. We think that a Uniswap connector for Hummingbot makes a lot of sense, but currently our engineering bandwidth is tied up integrating with regular exchanges that support market making. You may also want to read this post about different exchange types.
Rather than an order book, Uniswap uses a constant function to determine the price for a given order amount. The function is a “constant product formula”: it solves for the price such that the value of the combined reserve is equivalent before and after the trade. I think of it as replacing a non-linear order book (assembled by aggregating a set of orders) with a synthetic order book defined by a simple linear function in which only the order quantity and the current reserve amounts are hyper-parameters.
Therefore, the order book components of a Hummingbot connector can be greatly simplified by replicating Uniswap’s constant product formula inside the connector, so that the connector can compute the price for any order quantity. Then, assuming that you know the amount and type (bid or ask) of an order, you can create a synthetic order book using the formula.
Note that Hummingbot’s market making strategies can’t be used with Uniswap, but the arbitrage strategy should be viable.