New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Riding the Unicorn Uniswap v3 as a Perpetual Option Primitive Guillaume Lambert

Ethereum DenverSun, Oct 9, 2022, 12:00 AM

Transcript

hi everyone my name is guillaume lambert um today i'm going to tell you about a product i'm working with in collaboration with advanced blockchain we call it panoptic and um this is based on the title of my talk we're creating a perpetual option primitive based on uni swap v3 and just to uh laid out just i'm giving you the executive summary of what panoptic is first in panoptic options are created by created by relocating liquidity within any univ3 pool so any any universal that exists you could create an option on top of it eat dye e3dc or eat ribbon whichever token you want pricing itself is also a problem that we saw where pricing is path dependent and unlike regular options the price of an option starts at zero and goes up as opposed to being fixed and maybe going down and finally we're bringing back fungible liquidity to univ3 so liquidity providers or market makers will be able to provide liquidity at any ratio at any range in the pool and the users will be the one that will be handling uh the liquidity relocation um and this is a brief outline of the talk uh just before also going moving forward thanks very much alexis for describing options i realized i was gonna i didn't cover this super well uh and hopefully now you know everything about options so it's gonna be much easier to explain uh and one question is why trade options and i personally trade options and as alexis said you can buy options but i find it more interesting to sell them you can sell them because that allows you to control your delta a little bit more we all know about delta neutral strategies these are strategies that are resilient to price fluctuations you can have a swing of 10 20 your capital doesn't decrease as much you can have negative delta this is similar to shorting you can buy a put if the price goes down you profit more you can also be positive delta but you can also do it in any funky way as you can see here the profit zones are in green the the lost zones are in red but in the end you can create any type of um of a payoff curve you want and then for more deeper point of view it's very easy to understand options for the math perspective you can understand the expected move the probability of profit of any option you create you can also uh be a lot a lot more capital efficient if you were to try options on the uh traditional exchange or tradify exchange you can be from 2x to 15x more capital efficient than buying the asset or the stock outright and finally i hinted at that what i like the most about options that you can create any type of payoff you want it can be very simple like a straddle or a strangle or it can be very funky like a bat signal or a zebra i have a saying why buy a stock when you can create a zebra for a fifth of the price and this is true all of these options uh may be complex com they may contain one two three even six legs but overall they allow you to be a lot more nimble and capital efficient so first let's describe how we implement options on in panoptix so for those that know unusual v3 uh unison v3 allowed users to deploy liquidity at specific ranges so it's not full range from zero to infinity like new swap v2 but rather you can specific specify which range you want to use a key point is that if the price leaves the range if the price goes below the lower limit your 100 percent each for instance in an east dipole if your price is b above the upper tick you're 100 die so you only accrue fees when you're within that range and the payoff kind of looks like a straight line here if it's below and then it plateaus and it's constant as the price keeps on increasing and again this is something that i've written about somewhat but this is very similar to a covered call option uh the payoff is very similar you have a region where it's flat where it's just cache that you're holding a region where it's a slope at 45 degrees that tells you you have a a stock holding so the link between the payoff curves of univ3 lp positions and those of a covered call were enough to kind of entice me and do a little bit more research on that so if you go out right now launch univ3 you can supply liquidity and if the liquidity is supplied below the current price you'll be creating a short put you would be selling a put and this is what the payoff you would like you have a large likelihood of losing a good likelihood of winning but you won't win much the amount that you win will be or your your positive is your fees that you are accumulating so overall this is something you can do right now uh in the decentralized manner you can sell puts in any pool but what's interesting and what people want to be able to do is buying options what about buying a put so naively you can think of buying a put as an insurance policy that if say there's a protocol hack or a rug pool some market collapse or some dubious tokenomics you maybe want to be protected on the downside so that when the price collapses you'll be benefiting so one naive way of thinking about this maybe you do the opposite of a short port instead of supplying liquidity you borrow it or you remove it from the pool and if you look at the payoff curve of removing liquidity you would have exactly the mirror image i guess the flip on the along the y axis and if you were to do that that's it that's fine you would have to create exchanges you would have to manage liquidations and overall you have to trust the users to pay back what they borrowed uh you don't want to have the protocol be left out with bad debt so having entrusting that fund to the user causes some problems so one solution we came up with is not even give it to the user but then assign it to them so what happens that when you purchase a put you remove liquidity but you store it within the uniso v3 smart contract but you store it at the minimum tick that's available so this one is 10 to the negative 30. it's never going to reach that price but it's there it's ready to be used or moved back if need be so that whenever it's time to exercise the user will just have to interact with a smart contract and say okay i want to exercise my put i just have to relocate that liquidity either to the strike or to some other way some other places so i'm gonna walk through what happens concretely when you buy a put and store liquidity at the minimum tick first you borrow liquidity at a strike k you move it back to negative and to zero basically in price and then you hold it this is a perpetual option there's no expiration you just hold it for as long as you want and at the end of the day uh if the price is still above your strike you just take the die that you move there pay back the debt that you incurred no profit no loss really except you may have collected some fee now you have may have to pay some fees at the board i'll describe this and this is kind of the boring alternative if instead the price goes down and crosses that little debt uh well the debt which used to be k die will become one e exactly so the user is entitled to get back the kdi that they stored at zero and at the time of exercise they keep this k die they supply one eat so effectively they sell one eat for k-die regardless of the price of eat currently and since they can buy one eat much lower in price than k the actual profit is k minus s and you actually recover this exact payoff curve so here the key point is that you can store the liquidity in the pool and just have the users move it back and forth without really accessing it and they make the profit by just um selling it at a fixed price regardless of the current price of eat and you can be a bit more uh general in the way you create those you can have a wider liquidity that you borrow you put it to plus infinity bring it back you can have cap payoff you can have something that's a little bit smoother here this is actually limiting gamma of your option typically when you have a regular option as you approach expiry there's a gamma risk or you can actually have a gum explosion where you can be very sensitive to small price moves here by widening your option you can be a bit more resilient and again this is uh something i've been kind of writing about and overall as long as you can move liquidity so that means that the pan optic protocol will have to own and manage that liquidity but the users will have access to that liquidity they could create any payoff they want so that's how you can create the green regions the red regions are just moving liquidity at different locations one key point is the price how do you price those instruments and again we uh were thinking about this for a long time we came up to that oracle less black scholes pricing so black scholes is uh kind of the standard state-of-the-art way of pricing options uh but just before we go there let's look at how fees are collected in a position so you have a user that deplores liquidity at a fixed range that's above the current price for instance sometimes the price is these are simulations but the price may never touch the point where you deploy liquidity you collect zero fee even though you stayed in the position for months sometimes it does cross but then it leaves it far away so you collect a slight amount of fee and then the sweet spot is when the price does hover back and forth near your strike it can collect back and forth many times and you can collect you can be quite profitable that way so if you do this can we find a way to link the fees that are collected to the shows premium that would normally be predicted or you would find say on a trading platform so um to do this we have to rethink a little bit the type of option that exists here we have an option that expires every block so it's it's technically perpetual but that's because it's renewed every block so that every block you have to pay a premium if you hold the option and um the key point is that you will only pay if you're near the range that you're deploying for instance this is like taking a loan but the interest rate depends on the price if your strike is 3 000 the price of it at 3 500 you only pay a high interest rate where it's near that area if it's above you pay zero if it's below you pay zero so you're accumulating small fees incrementally every block by creating this so you have to find the price at the end as the sum of all of these tiny increments we call them the small increment theta so how can we find theta i'm going to review this i'm a physics professor so i'm going to be going back to uh my roots of teaching so if we go back to black souls model this was a model described by merton scholes and fisher black they were able to describe what the price of an option would be given any time to expiration again options expire in the future you know that at expiration they should have a very sharp payoff you get paid nothing if it's above the strict price you get paid or you make money if it's below but any days from expiration you were able to extract what the value was it's a fairly complex expression you have logs and uh exponentials but overall it's something you can write down you can analyze it's not a black box it's actually very easy to process so what we do is that if we find theta as the time derivative of the cost of an option can we recover the cost by integrating theta dot dt so this is the fundamental theorem of calculus dx dt equals f then you can find x as the integral of f d y so this is what happens here and if you remember every time you have it expiration we add up these tiny theta so here it's taking a continuous solution to this but then we have to integrate this over the price path so some price paths can be very complex they can go to zero and back to very high so it's not clear whether it's going to converge to the right rear price but you just have to solve this equation for any price path that's stochastic in nature and that should give you a cost of the option and hopefully this is going to converge to what unit swap v3 fees are so again the theta this is the time derivative if i were to play this movie you would stay at a fixed strike and the price would decay over time so here from 125 days to 45 to zero the value goes to z goes decreases until it reaches zero so if you take the derivative of this expression it's a again an expression it's a gaussian basically and you can uh expre express it very simply so now if you take this expression which is a gaussian with all uh known parameters and integrate it you can plot as you make it tighter tighter it looks like a very sharply defined gaussian and if you're physicists like me the closer you are every block is every 15 seconds this will be very very very pointy so very high very narrow this looks like a delta function for those that like it that know about it so you can estimate this instead of having this weird gaussian shape you can say aha this is a square a rectangle of a fixed width and a fixed height so that whenever the price crosses that uh point or the threshold you just multiply you just add this k times sigma squared over to to uh to the value add the small theta that we were describing is given by this uh expression and we cannot make it as as narrow as we can we actually make it the tiniest we can be which is a single tick in most pools so it could be one percent or point three percent or 0.05 percent or even the 0.1 so here we're limited as to how narrow we can be that limits also how high that has to be but if we do this and now we have a different equation for the premium we can find that the path that i described before this one never touched the price it's cost nothing so you buy a call option you hope that it's going to go to the moon the price tanks normally in traditional fines you have to pay for the option upfront here you don't have to pay because it never touched it you you purchased insurance for for flood you never got flooded you don't pay it's only when you actually are needed in water that you have to pay the premium so most options will have zero price and that's fine some of them will have a price that's very close 85 of black shoals some unlucky options will be very expensive many times more but if you do millions of simulations this is a monte carlo simulations millions of simulations and you look at the distribution the average price of all of these million possible price paths converged exactly to the black trolls model so here we don't know the future but if we use this expression we can find that the average premium someone will have to pay will be black shows exactly so this is again a non-trivial result and if you look at the two ways to come to extract option premium on one side which is what i just described by having this delta function like uh uh pricing and the liquidity that's accumulated from uni swap we actually make them equal now so we say the price is what the pool has generated in fees this was a long-winded way to say this is what we assign as being the price and as long as you were careful with the bookkeeping the idea is that you compensate the option seller exactly the fees they would collect but instead of getting the fees by trading the option buyer will pay the fee at exercise and it's the same thing when you sell an option so in the end the option sellers and the options buyers will get fees that would normally be collected but it's not going to be their funds it's not going to be their equity that's going to be liquidity of the pool so that's why you can have some leverage you can control more liquidity than you actually possess so one key point is the volatility of this expression this is a the iv of an option is very very difficult to extract uh in one of my posts i do derive unchained measures of volatility it depends on the daily volume and the tick liquidity the liquidity at the currently treated tick if you do this for most assets for instance eat usdc the eiv is 48 percent btc is 21 so here what happens is that the ivs are fairly low if you go on there a bit or centralized exchanges the iv would be 100 sometimes here it's very low so i don't see this as a failure of the model but rather as the consequence of the fact that we can only sell options now if you sell sell sell sell the price is going to go down the iv is going to go down if we introduce some way to buy an option bring up the price in panoptic this is what we'll be able to enable buyers will be able to come in buy options that are underpriced and remove liquidity and the denominator will be smaller the iv will be higher and hopefully balance would be restored so that's kind of one way of trusting the market to make the right decision right now someone would make a killing buying options because the iv are so low compared to the realized volatility so finally i'm going to complete in the last few minutes uh how this is actually bringing back fungible liquidity to univ3 so again liquidity providers would provide funds to the min and max ticks not in range they won't collect fees they provide them as far away from the current price but it's going to be the users that will move this liquidity bringing into play sell options to bring it close to the price by them to bring in a far away and they would have to deploy some liquidity themselves as collateral for instance the price increases at some point you'll have to pay for it so you have to have some funds available but in basically the two roles options buyer upstairs sellers will be distinct from the market maker which is gonna again lp provider but the market maker will be handling the liquidity and be paid a fixed commission for instance so by the end of the day even though you start with liquidity all at a minute max the act of buying and selling options will shape the uh liquidity profile from something that's now dictated by the market of selling sending and buying options as opposed to the lp liquidity provider is kind of um in prediction of where the the price is going to be so that's a different role the option buyers will be the one shaping the liquidity and not the lps and yeah so i guess i would i would just conclude by trying to draw inspiration from uni swap and you want to have something that's permissionless that doesn't necessarily need governance or some ways to dictate which options are we are going to be available if you can deploy this contract on any univ3 pool then anybody can uh be an option seller and this is a model for my from cornell university i would found a protocol where any person can trade options on any asset and also from a like defy moving forward perspective ether delta came in and tried to do an on-chain order book it didn't work until uni swap came in and simplified everything for everybody put the token you want to sell get the one you want to buy want to do something similar if you don't know anything about options but you have a td ameritrade account for instance you log into the account it's very very very opaque and obscure and it's hard to understand you can spend weeks just to learn how each one of those numbers work it looks like a spreadsheet but uh it's very difficult to handle so what one do at panoptic is have something that's also as simple streamlined and perhaps easy to use as uni swap in the sense that we can have a more visual representation of the payoff as opposed to just say a bunch of numbers on the spreadsheet so to conclude um i want to thank advanced blockchain jasper and max from advanced blockchain uh sir firm and matt from euler finance that uh also helped me with some of the pricing models the uni grants program and the big brains behind units of b3 and also the ethereum community and eat and then for organizers so thanks very much everyone

Automatic transcript — names and jargon may be misspelled.