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

Loading player…

DeFi Calculus 102: Building Derivatives | Terence An, Itos Finance | ETHTaipei 2024

ETHTaipeiWed, Oct 9, 2024, 12:00 AM

DeFi Calculus 102: Building Derivatives | Terence An, Itos Finance | ETHTaipei 2024

Transcript

nice uh Hey guys so I got a little bit of food poisoning last night so I'm going to just please bear with me uh if I need to take a pause that's what I'm doing not contemplating about life for anything um cool so this talk is about defi math 102 just a little step up from the things that you might be familiar with in Di and uh particularly we'll be talking about how to construct token derivatives whichever one you want so quick background is I used to work at an hft at Hudson River Trading um so my background is lot in thinking about Market micr structure and not so much the macroeconomics but that makes me really suitable to speak about how we design these small uh defi systems right now I'm building EOS Finance with two other people and we specialize in creating these things called token derivatives where you can think of it like this engine that you put in a token and then you get out a separate payoff that is derived off of that token so for example I can put in normal BTC and L I might get like an option on BTC or a future on BTC and those are the two basic ones but we can go crazy with it we can start guaranteeing token floor values we can prevent liquidations reduce volatility um really get some nasty stuff that maybe you've never even heard of unless you are in wealth management or are very wealthy yourselves I don't know maybe you are um I hope you are uh so the reason that this is different than previous attempts at structure products is the previous attempts all use an on offchain underwriter and they Bridge the asset overover and so users buy it from a vault it's usually priced by sophisticated underwriter and that really means you're just getting adverse filled like from day one you have negative expectancy and that's not great you have lockups you have an xir and you have manager risk like all these things make vaults a terrible experience what happens now if you derive your structured product entirely on chain your counterparty are defin native money markets defin native amms anyone Can Build Mint and use it within seconds there's no one you have to talk to nothing you have to worry about there's no lockups no managers one smart contract trans transaction and you're good cool um so just to be clear this is a 102 talk which means I won't go through the uh it won't be too advanced there's no you know you don't need to worry about Finance or whatever background there is uh it's mostly just going to be pictures which is great everyone loves pictures there is no pricing information here because honestly once you get into stochastic calculus it's very hard to come back uh and that's just not what this talk is trying to do but feel free to talk to me about it afterwards and especially once you get more advanced the theory in reality really breaks down so I didn't want to do talk about things that have a lot of qualifications to it rest assured everything we go over today is 100% true you can rely on it um to build your own protocol to invest whatever it won't be too basic at the same time I think Josh did a really good job covering amm so I'll be super quick about that there's plenty of defi users here there's so much existing material um I'll do a super fast recap like the fastest you've ever seen and um I can't do oneone because taipe already has a oneone you know like who can compete with that uh so today's lineup we're going to be talking about five techniques you can do to build a structured product entirely on chain what this new version of Structured Products is going to look like they're going to be rotation reflection composition scaling and Integrations and with each of them you have a different type of payoff we can make so before we begin you know here's my quick quick recap of amm and LPS it doesn't matter about the market making it doesn't matter about the range forget all of that the simplest explanation of an LP a liquidity provision position is you sell the token upside for yield that's it over in the future you know we might design new amms like Josh has different curves all of them have one fundamental property and that is you are selling your upside for yield what this looks like is you know here is a regular token payoff if the price goes up you profit the price goes down you lose and once you L you get capped profit on the upside and you still have your unlimited downside potential so that's no fun because you're missing out on a lot of these profits and we'll be talking about how to fix exactly those things things before we move on from this though I do want to mention one property that the capped upside comes from the negative curvature here and we'll call that concavity and one fundamental property of all Finance doesn't matter if it's defi or trafi is the moment you have negative concavity you earn fees negative gamma they might call it a billion different things but there is fee earning or a yield whenever you have negative uh curvature so one very natural question is we have this LP position can we kind of flip the side right maybe I think the token is going to go up so why am I selling or maybe I think the token is going to go down so I don't want that downside risk so instead let me rotate the position so I only have upside risk and no losses when the price goes down very natural position and the way you do that is just with simply a short that once we short the in this example eth token into usdc the combination of the two gives us this type of payoff we still make fees in the same range uh but we just have a slightly different exposure and you know we can also short everything in between one end or the other and so we can make a delta neutral position just by shorting less nothing crazy here the one caveat though is you don't want to overshort in this scenario we shorted the 90° Rotation by uh understanding the Unis swap V3 paper you know I don't want to get into that but it's a pretty straightforward formula once you overshore past 90 degrees though the short dominates the position and you pretty much botch whatever you were trying to do before and you just essentially have a short position so yeah that's a simple technique of rotation and it gets more exciting once we start talking about reflection now how do we create the opposing curve right maybe you're just sick of downsides why do we always have to have a downside with LP positions what if I just want a position that is all upside you know safe on one end and only profits on the other and mathematically there's no reason you can't do that right anything we create in code means anything we can describe with math and clearly we can describe this with math so how do we do this well the answer is pretty simple actually we just have to reflect over the intermediary line and so you can just draw the line and say I want to short the lp position in return for these assets that are denominated by the line and all of a sudden I have my liquidity taking position that is only positive exposure this is fantastic and it doesn't have to be that line in the middle you can use different lines and so maybe you want something with more of a negative exposure uh and with all of these there is some floor value so why don't we just subtract that floor value add in some more Capital efficiency and voila we suddenly have these options payoffs and so we've already arrived at a pretty big step you don't need ssvs you don't need offchain Underwriters you don't need a limit order book to create options in defi you just have to do a bit of math and boom you have your option payoff the downside is you know nothing comes for free if you want all upside there has to be a downside and the downside really just comes from shorting that LP position because unlike shorting a token this time shorting a position means you have to do the entire opposite so whenever the lp position would earn fees you have to pay fees uh and that's a pretty fair tradeoff because there I'm sure there's more than one person here who's LP for like six months and the yield was definitely not worth the impermanent loss you got and what if you could just take the opposite position right it's like that Wall Street bets thing I keep losing money well just do the opposite of whatever you're doing literally that um so if you ever feel like the yield is too low heck take a liquidity taking position and once we start combining this reflection and rotation Technique we can start doing some crazier things I narrowed down the market making range to be really small right at the current price rotated it by 22 degrees and all of a sudden you have a bidirectional per meaning whichever way the price moves you profit the exact same way a price uh per would but now you pay a slightly higher funding rate as long as you're sitting in the middle so that's a pretty good deal when you're just trying to bet on volatility and you have no idea which way the price is going to move probably like right now um and it gets even crazier once we start adding cross margin into it this is really where we start touching on Insanity because we have all these positions before and we can combine them into insane things um this is just a random position I decided to create because I could and uh Mr bones' Wild Ride is made by all these different positions underneath it and the way to construct this thing the way I went about it was I just thought about where do I want positive and negative curvature that is where I'm going to create my market making Market taking ranges and then on either end what do I want the first derivative to look like depending on that I can short or rotate accordingly and boom within five positions I created a roller coaster of a payoff but you can make more useful things it doesn't have to just be like meme payoffs or whatever uh if I want to fix lping one of the worst parts of liquidity providing Unis swap V3 is that once you go out of range you stop earning fees but you still continue your losses right if the token is just going down you come back in a week and you're eating all of those losses without earning anything so a very natural thing is the moment I go out of range let me hedge out my position not worry about it I can come back in a month I can come back in a year there's no risk to me um so it's a much more userfriendly version to LP and we don't have to stop there you know we can make a delta neutral version of this applying the same techniques we already have uh heck we can even start doing more djen things where we're like I want to make money in the extremes I don't even just want to hedge and we can ramp up the two liquidity taking positions on either end as much as we like we can compose it however we like really at this point the possibilities are endless literally whatever type of curve you want to create doable entirely onchain no permissions needed um forget about Trad five we don't need them my personal favorite though is actually this one which is the token converging LP this construction makes it so that in the short term if you're just worried about the price right now and you want to earn yield right now you can it sells curvature at the current price but if you're if you don't worry about the token going up 1. 5 or 1.7 you're holding until that token goes to 2x to 10x the liquidity taking is structured in a way such that you reconverge back to the tokens line if it ever 2xs a 10 x's and honestly that's like what a lot of people are holding for um so in a way this is kind of what people originally thought lping was going to be I can just hold a token and earn yield on top of it I don't have to think about impermanent loss great so that's composition um what we did in composition was create a really safe way to LP but let's be honest like DG don't get out of bed for safety no one is like I want to be safe with my investments let me go to Def right they want something exciting and so how do we turn this into something exciting and obviously the answer is leverage the answer is always leverage but what is leverage really doing it is scaling our position so the first thing we're going to do is notice we have a floor price and that floor price means our position will will never go below that value um so this is kind of capital inefficient right if the floor is that high what if I just deposit less to translate the whole thing down just like we did with those option payoffs and we can uh in this scenario we're not just depositing less we're actually depositing the whole LP position and then borrowing which is effectively the same thing and we suddenly have a way more Capital efficient way to LP but it's not just Capital efficiency because we can scale this baby up to roughly 300X LP depending on the pair it just comes down to what is the granularity of your amm and if your granularity is small enough you can just keep raising that leverage uh and at 300X LP like you can beat impermanent loss by just lping for a single day right if you think the price is not because like fed Powell isn't talking today you're just like adding liquidity today and nowhere else and you've already earned a year Year's worth of yield just by doing that um so we're super happy with this we think this is like the most degenerate way to liquidity provide we can go even more insane though and that's not just with payoffs once we start integrating this with other protocols we get some really beautiful properties in those other protocols for example if we want to add this to a borrow lending Market we can create liquidation free borrow lending with a single button you can say hey I think volatility is too high open up all the positions all the convex positions I need to make sure I never get liquidated I can borrow and lend any token as collateral for any other token because again I can just use these convex positions to hedge that uh Divergence risk so like this utterly changes both the payoffs that we're interested in and the other protocols you know like we could have nonliquidating perss and the list really goes on like these are just some of the things I thought about but I'm sure like there are plenty of things I haven't thought about um and the list goes on and on digitals roulette wheels LST convertibles yeah I won't even try to read all of them but what really excites me is the implication of this like from a broader perspective looking at the forest for the first time in history it's not a trafi institution that is underwriting something for defi right every time defi tries to do something more advanced we have to go to trafi and be like hey can you help us out with this all of a sudden it's not that trafi and defi are creating the same Structured Products on par with each other it's that defi creates more more advanced more flexible uh more assets than trafi like all of a sudden the best place to go if you ever want a structured product is defi right and I don't think you can say that about a lot of markets and the beauty of it is it just comes from math um one of my friends works at Goldman Sachs and you know his desk regularly underwrites about $2 billion worth of Structured Products every month and the only thing they're really doing is is um floor valued spy floor valued Nvidia floor valued Tesla and that is so easy to make on chain if you ever had an rwa for any of those things you know you don't have to go through an account manager you don't pay them commission you don't pay fees you don't make six phone calls just to make sure you have the approvals for do it to do it one transaction boom um cool so this is not just theoretical we actually went out and built these things and uh today is the first day we started uploading a lot of this onto tesn and so you could go yourself to um oh no where's my mouse uh bear with me as I struggle to yeah so what we can do is you can go to OS right now and get your I hedge position your real hedge position it feels a lot like Unis Swap and we really just wanted to make a very degenerate version of Unis swap don't worry the leverage bar is right here for this pool you can only go up to 20 but it depends on the pool maybe we'll redeploy at some time and you can see that once you jack up this leverage let's say to 10 you know you get 210 APR instead of whatever but of course the I risk is higher so nothing comes from free we're not trying to make any shcks we're just trying to do a bunch of math and the flexibility that comes with it cool um this is permissioned right now but you can go mint yourself test tokens today just on the website test net. window. and I want to be clear that it's not as simple as just doing these equations we had a lot more to solve and honestly these were much harder than the things that I talked about today and so unfortunately we don't have time to go through it but there's you have to think about ideas of what is the fair trading fee rate and that gives you an implied volatility premium um the hardest one is by far how do you implement a fair liquidity borrowing rate like what is the corresponding time premium from you can d from options and translate that over into what liquidity taking should be uh honestly everyone knows the right answer to that everyone in finance knows the right answer to that because you can create a box spread and you would know what the implied lending rate of these things should be what is a box spread in Defi and how do you implement that corresponding um interest rate finally you know we have to make some really safe and user Centric cross margining that is not a simple deal at all and how do we present it in such a way that you know most of defi is not as experienced as you guys so how do we keep it simple and relatable cool so we're nearing the end um what else is there to solve we don't want to pretend that we have all the answers there's still a lot more to do with just the math for defi is utterly unsolved continuous xpre offerings how do I recover the xre ideas from options because those are indeed useful in a lot of scenarios um how do we make conditional liquidity providing like only providing when the yield is sufficiently high how do we butterfly the yield curve the list really goes on and if you're interested in these things or interested about building those things like please talk to us um so finally you know we are os Finance we launched a lot of things on our testnet deploy today it is still private for now so you should follow our Twitter you know go on our website join our Discord and keep in touch for updates we are now raising a and so if you're a builder developer def user investor like come talk to us cool I hope that was helpful um any questions if no questions you do have their Twitter and you can also find terance at the after his talk I guess thank you very much um I guess I will mention that this also happens to be the proof of why like the composition aspect is the proof of why the uni V3 curve in my opinion is all you need because every other payoff curve can be replicated as just a combination of univ V3 positions um so I think that's an interesting property but there is value to having the entire curve be preset for you so that users don't have to think about it um yeah it's an interesting homomorphism between like all yield curves thank you [Applause]

Automatic transcript — names and jargon may be misspelled.