Turning 4y of data to 1000y: lessons from our AMM simulator
ETHCC 6 · July 2023 · 15:53
Cyrille Pastour shares lessons from an automated-market-maker simulator, examining the idea of extending four years of data into a much longer simulated history.
Speakers
Topics
From ETHCC 6, hosted by Ethereum France.
Transcript
foreign hi everyone um so impermanent loss stablecoin Deepak liquidations what do these terms evoke to you to me there's a symptom of a big problem that we have in D5 we are unable to properly assess the performance and the risks of the Primitive we use this is a big problem because our goal is to onboard one billion person people sorry in the next bull market and if we don't solve this problem we're not going to be able to do so
so my name is Cyril Pastor I'm the co-founder of swap an amm engineered for LPS and today I'm going to present you how we made some research to better assess the performance and the risks of one of the largest Primitives in D5 which is amms so in this presentation I'm first going to remind you of why it's key to study the performance and the risks of such primitive then I will share with you a framework to better understand what kind of methodology we can Implement to better assess such metrics and last but not least I will share with you the
learnings of our own simulator so um emms are one of the largest D5 Primitives in fact they were with the largest until up until last month where they were overtaken by staking so over 17 billion liquidity is locked into amms in this stock I'm going to assume uh that you know how an amm Works um so I mean just quick reminder essentially there are two use cases for Traders to be able to trade on chain and for liquidity providers to benefit from the revenues of the market making activity
um where amms are a huge Innovation is that they solve um some of the biggest problems arising with um Market making in centralized Finance um so the properties associated with amms and Compass accessibility to anyone it's a from the point of view of the lp you have access to Market making strategies which in traditional Finance are only for hindquest individuals and institutions um second there are transparents which means anyone can assess their properties and how they work and how they behave
which is key of course when you compare to centralized actors and all the Black Swan events we had over the past year three hours Capital Alameda research all of these events are linked with an absence of transparency third they are non-custodial which means that you don't have to trust those I mean you don't have to trust anyone and you can recover your funds at any time and last but not least there are interable interoperable with D5 so the main questions remain around the performances which are quite uncertain due to the infamous impermanent loss and we can see that it's it's really key to
understand better those performances to see if amms are really like the silver bullets that we need to solve Market making in our financial system so this is what I'm going to Deep dive on in the next few minutes so first maybe um before like diving into the actual results and how um how like performance amms are and how risky they are we need to better understand how to evaluate a financial primitive um so there are two main indicators that you need to consider if you want to evaluate eventual products returns and risks um so returns is a very easy to assess indicator
um and I think the industry is doing a poor job today at actually displaying uh which value uh people can extract when they deposit liquidity anyway so um returns and Compass like they should always be a net um there's it's not about like trading apy minus impermanent loss or whatever return is really straightforward it's you deposit one thousand what you get at the end of the year is it 990 is it uh 101 1100 it's it's a very clear indicator um so yeah and essentially I believe that as an industry we should make an
effort to be much more transparent on this issue and especially in the AMF space risk on the other hand is a bit more Technical and hard to evaluate so a first methodology to evaluate risk is to compute the variability of the returns um so suppose you have for instance a product that yields you a five percent APR net APR um a product that yields it like on a consistent basis so year one five percent year two five percent year three five percent um would be much less risky and much more desirable than a product which would yield the same return at different uh with much more viability why is that it's because
um eliminating risk enables you to plan um so for instance um if you know that you're going to get a five percent apy all the time you know that you can for instance uh buy a house or whatever take a mortgage also it's much easier to use your capital in different instances um when you have a less risky product because uh it's treated as a much better collateral for instance um so that's that's also one of the reasons that you want a less risky products another way to assess risk is also to understand what happens in case of extreme scenarios so for instance there's another indicator which is frequently used in traffic actually which is called value at risk so it's like like what are you going to lose in
the most extreme scenarios so that's another way to measure risk the second question that you need to ask yourself when you want to assess the financial performance of a product is what Benchmark are using against what are you comparing the performance of the underlying uh primitive so in the case of amms in my opinion we should use a huddle Benchmark so essentially we should compare the performance of amms against someone who would just hold the tokens that are deposited in the pool and last but not least the question is what kind of methodology should we use so of course realized data is probably the best way to understand if a product is working or
not because I mean life just gives you like what happens right um so uh the only issue with realized data is that out of the 1000 potential uh like things that can happen in a market you only get one so um it's it's not perfect to properly assess risks notably one example of that is UST so for instance if you had only used past realized data to understand how risky UST is you would have thought okay it's a stable coin up until the day before it depict um and that's why simulations are key
because simulations allow you to understand what can happen in a wide variety of scenarios um and so they are especially useful to understand risks so the main drawback of a simulation obviously is that you cannot anticipate like it's a closed environment so if you haven't anticipated something that happens in real life you will not mobilize this phenomenon so that's why you should always Encompass both simulated data and realize data in order to properly assess the performance and risks of a primitive so um regarding to amms we have some first indications around realized performance so what we can see several Studies have shown that essentially helping in
uncorrelated asset pairs so pairs like East usdc is actually not profitable for LPS so there was a study done by bancor which showed that 50 of LP's reported negative Returns on univ3 then another study by a Twitter account yeah Twitter is often a really good source of information in D5 named symmetor Capital which essentially showed that the unrealized pnl of LPS on univ3 on the five basis points is usdc pull was below was in the red by 100 million so here we can see where the first indication that realized performance are not good and there comes our amm simulator so it's a tool that we built with
researchers um mathematicians and Market making researchers that allows us to test any amm strategy in thousands of market conditions so the way the tool works is that we in we have several parameters we have a price trajectory we have a trading demand which is how many transactions what size of the transactions uh what is the price elasticity as well of the Traders willing to trade and we run amm strategies on thousands of market conditions that are randomly attribute like given and this allows us to essentially test any amm strategy and
modelize its risks so how do we compute the results essentially in the end we have a matrix with two Dimensions we have the returns which is the average of the returns in each of the market conditions and we have the risk which is the viability of the returns so from that essentially we can Define like two zones um so first we have like the kind of work me Zone this is where you want to be right uh so with high returns and low variability of those returns and then you have what I call like the gambling Zone which is actually the Zone where you would see Casino products like the roulette casino game um with negative expected returns but very high risk so in other words you
have significant chances to win a lot of money but even higher chances to lose a lot of money and I have bad news amms actually are gambling products so what you can see here is uh the returns of um different implementations of uni swipe V2 and curve V2 on an East usdc pair so as you can see we have negative returns overall with super high risks then we try to conduct some experiments to see how we could improve the model so first we run a model which uses oracles as a base solution so what we can see is
that a very naive strategy based on up so what we call a perfect Oracle which is an oracle with no delay strongly outperforms amms um and then um we try to modalize our own solution which is uh swap so we have swap B1 and swap V2 um so swap V1 is a solution that has been live for a year with a wrap BTC rap ease and usdc pair on polygon um so it's a triple and 12v2 has just been launched a week ago so what you can see is that actually we found a model which is more much more efficient and which allows us to strongly improve the returns um of of LPS on a risk adjusted basis so um
if we if we use realized data we realize that so so everyone has been live for a year and if we use realized data it's actually confirmed by what we see on the simulated outputs so swap V1 had a it's like a loris gloriton strategy it has less than 0.1 percent uh in impermanent loss of a year with 1.3 net APR and 10x low lowest lower volatility than Unity curve for instance um and what's interesting is that if you look at the graph so it's very uh coherent with the results that we found um and with swap V2 we should be able to up to 9x those returns by allowing more risk essentially
um so um yeah I think I'm running out of time um so maybe just one last thing to tell you uh we are running a special offer uh for ECC so essentially um if you flash the secure code and you deposit liquidity by uh end of next week you'll be able to benefit from a boost on our token incentives so if you want to try it out just flash this QR code thank you so I don't know if we have time for maybe one or two questions so here it's um so it's much I mean I
guess you're talking about more unib3 so here it's around Unity um because as you said like on Univision three different LPS have different behaviors um I would say that overall like the overall p l is um is negative um I would say also that univ3 probably has some structural flows that mean that um it's much harder to profit as an LP um and mainly there are two flows uh the first one is that you have to use a consult proc formula even though you concentrate your liquidity as an LP on univ3 and the constant point formula is not adapted to um Market making profitably and with low risks and the second thing is
um like there's a reason why insider trading is forbidden it's like you always lose when you're trading against someone who's more informed than you and in the case of amms the issue is that they are not even using public information so they don't know what the price is on binance and essentially LPS always get um kind of front-run by arbitragers who know what the prices are and so you start with so much structural disadvantage that first if you're an uniform LPS for sure in the long run you're losing and then if you are very sophisticated maybe you can win but probably this is not the most efficient way to do it okay um thank you very much for your
attention I think we're out of time um if you have any other questions I'll be out so don't hesitate to to come and ask me more questions thank you [Applause] foreign [Music]