High Frequency Trading and DeFi Ideas, Strategies, Building Blocks and Things You Should Know About
Ethereum Denver·Sun, Oct 9, 2022, 12:00 AM
Transcript
uh what the heck happened is up cold all right guys so we have about 20 minutes to talk a lot about defy and hft i'm not going to talk about my project at all other than the first uh one minute that i'm going to bring watch you a little bit just a little bit about me and the ceo of this company going to the blog i'm gonna tell you about traction both on analytics and quant trading i used to be a distinguished engineer microsoft used to lead the quant infrastructure team at the rw couple of exits as an entrepreneur i teach a playa colombia and i taught a d5 class at worthon this year so not all these loss for mbas are worth on um there is hope there is hope and i write this super i also semi popular ai newsletter called the sequence with over 120 000 subscribers or so so itv i'll say is relatively well known in the market as an analytics provider we have over 250 of the top brands in crypto as customers they use our analytics platform the thing that not many people know about into the blog is we have a division that i started last year called the that is what we call the defect one platform and we're gonna show you a few of the all the mistakes we make right and essentially we're trying to do quant trading on d5 protocols and that went from a few million to over a billion in just a year with all the top brands in crypto so we're sitting between d5 protocols and the biggest balance sheets in crypto i'm not going to talk about into a blog at also two things if you're a hacker passionate about machine learning and defy let's talk because we're hiring across the board and if you have cool d5 protocols that you think can benefit from institutional capital inves you know flowing into those protocols our clients are sort of you know think about the biggest lenders the biggest exchanges the biggest market makers are going through d5 through our portfolio of strata is today in the first year we put in 50 something production core and 25d5 protocol deprecated a bunch so i made a ton of mistakes but somehow made it so what we're going to talk about is a d5 perspective of high frequency trading how is this different i i recently published an article in coindesk about this and got a ton of hey mail and uh and some of the key building blocks that you think you can build and some stupid ideas at the very end some more futuristic stuff for you guys to to think about so speed on trading always gone uh together famous example right during the battle of waterloo nathan roach helped uh faithfully uh you know uh propagated the rumor that napoleon was gonna was gonna win the battle was able to buy a ton of bonds from the british government and sell it on the on the news that that napoleon has lost but it was always a dark area of the market so it was popularized with michael lewis book about flash flashbots this book came out the week that berto stream was supposed to be go public and they actually there was some hate in the market for this so they had to postpone the ipo for about six months uh there is a ton of classical strategies in hft uh index arbitrage things like event based arbitrage with there is m a's and things like that what stock do you go along which one do you go short basic statistical arbitrage uh things are low latency strategies but the market traditional capital markets have become so efficient that it's just hard to discover alpha and as hft so hft in traditional capital markets it's all about a speed which is sad i mean it's boring as hell or it used to be before machine learning sort of you know came back with a with a renaissance but if you're working in hft i hope i'm not offending anyone but if you're working in h15 traditional capital markets it was all about being faster and having better uh better infrastructure defy is the first technological movement in over 20 years that just challenges that right that brings a new infrastructure that you need to build from the ground up so if you're doing hft in coinbase with bitcoin and doing hft for oil futures is pretty much the same thing from a quant perspective to so the models they don't look that different but when you look at d5 that's a brand new infrastructure you cannot reuse any any of those models and that's why we got excited about working in this space because we don't get too excited about working in in the traditional uh in traditional coin models so when you think a good analogy about this um that that is is one that that we think sort of works so when the markets became electronic in the early 2000s there was what today is known as a chicago school there were a bunch of hackers that figure out how to connect to exchanges how to understand those protocols at the time was really low level and really really difficult and that from there you have jump trading drw hudson river trading two sigma came a little bit later but sort of the same uh mindset since then every single technology movement in capital markets have been incremental nothing has been completely transformational not even bitcoin or ethereum right so defy is the first thing that in which you cannot use infrastructure for traditional hft trading you need to build from the ground up so the um since um so when you think about other technology movements so things like dark pools and all that that was basic increments over uh traditional infrastructure and defy sort of is the the first movement that challenges that and the opportunities in d5 because so is is growing so fast is so inefficient and so asymmetric in terms of information the opportunities for alpha and hft are are massive that's going to go away eventually but today are are tremendous so the thing that you need to know about bfi is that it's not about a speed anymore and when we start working on this we we try to come up with a friend or try to understand like why is it really different in d5 that in traditional hft and we came up with a number of factors that we think tried to summarize that and and i want to submit those to to your consideration so the the the fact that you cannot go faster than the block time uh the fact that everything is visible what you do and what your competition do the fact that there is cost in the form of gas and things like that the fafsa miners are a hidden participant in the ecosystem and then the dependencies that you take on protocols so let's look at each one of those so in traditional hfts you can go as fast as as your infrastructure uh allows you to to do right you you can have better networking capabilities and things like that and be super fast in in d fire shifty you have a factor that is a block time that doesn't allow you to go that fast so that means that if you're formulating a trade and you do your calculations in milliseconds well your competition still has a few seconds to figure it out because you cannot go faster than a block time so that's what faster blockchains are very good for preventing mev because you know the speed is a factor that sort of mitigates that so this is one that drives drives me crazy right transparency is great in d5 but when you think about it from an hft perspective it's super cool that you can see what your competition is doing which in traditional markets you can because market makers hide that from you but your competition can also see what you're doing which kind of sucks so it's a it's a game of perfect information now so you submit a trade somebody can see it try to replicate it and because it's not like super fast they have time to formulate trade so it's complete different dynamics from a game theoretic perspective than traditional uh traditional hft there is also this thing called this cost factor that is not very common so in in traditional hft your cost is pretty much fixed you can extrapolate you know how much you're going to pay for networking the connectivity to the exchange and all that and that's going to change it doesn't matter what trade you formulate it's very easy to forecast but in term in traditional in in defy you know the cost of gas particularly in the ethereum blockchain is crazy right so you have trades we have stories of trades that we were formulating the perfect trade we have one competitor so nobody else was competing with us but one party and block by block we were losing money because we were beating each other so high in so many tr in so many trades in a single block that we end up losing money so you have this factor that is variable and is different difficult to account for and then finally the mev factor so this again is something that you don't deal with in traditional capital markets you have the miners that obviously they have a lot of control in terms of how do they order transactions into in a blog and if they become very active participants they they can affect the outcome of any trade meaning you can have the perfect trade submitted but if you're not positioned in the right place in the blog you're does that make sense so a way to think about this is traditional hft you have a good idea you're fast you're good in d5 sft you have a good trade you still need to deal with all this other crap right you need to do in minors with cause with the fact that everybody's seeing what what you're doing another way to compare this is from the information perspective traditional hft is imperfect right so you don't see what market makers are doing you don't see parties of the system indeed fire chef t is near perfect so hd5 is i go traditional market is like poker in terms of cost traditional hft is fixed you can extrapolate how much you're going to pay for trades and fees and all that indeed hft is completely variable a speed you're talking on one market about nanoseconds i hear multiple seconds and you're fine to formulate a trade and then you're taking external dependencies in hst a minor on protocols and and other things so what we learned in the last year is that better infrastructure trumps better trades in d5hft by a mile so you give me a good infrastructure with some components i'm going to show you now and you can formulate strategies upon strategies upon a strategy rather than having the perfect strategies and a very mediocre infrastructure so one of the key some of the key building blocks that we learned that we had to build and put a ton of a ton of work on this and made made a ton of mistakes so obviously monetary mempos right so the idea that the the more things that you can do at the mempool level for hft strategy forecasts in the state of transactions and things like that technologies like block native and things like that help a lot in this in this space particularly for the ethereum blockchain if you go into our blockchains uh different uh different game heuristics for accumulating gas we actually that's a heat map that we actually publish in in itv so this idea that you can accumulate gas when it's cheap because when you really need it to beat in a in a gas world you you better you need to be able to spend that gas so having being able to accumulate gas on a specific times a day when you know that the cost is less expensive is super important this is particularly important in gas beating um in front to get rid of front runners and things like that if you're doing trade in amms you're gonna get front run or or at least some bots are gonna attempt to so there is a lot of mediocre front runners in defy hope i'm not offending anyone but and it's very simple so you bit twice and you get rid of all of them so essentially you post a transaction and there are a couple of bots are always going to try to front run you but if you get aggressive on the beating side most of what we have encountered they don't have sophisticated logic to keep bidding and all that except the parties that are doing hft for real that those are the ones that you end up competing very aggressively there is a trade that i'm gonna show you um at the very end that does an ama an arbitrage between different amms and we encounter this situation we have one party that before we got in was clear clearing about a million a week a little bit south of that and we're like this is perfect that we have the perfect strategy and our math was we're gonna do split it in two right we're gonna make 500k a week well we end up making zero a week both of us because when we what happened is that we were beating each other all the way to lost money multiple times during a block so you need to factor in all those things and what fixed that trade for us was integrated with private pools so at some point we started going to private pools directly and this is what archer that was starting with the flashback guys uh was starting so we started working with them and we figured out a couple of things there that actually made that trade uh work before doing that we tried things like obfuscating transaction inputs so again talking about transparency we were submitting a trade and he said look these guys are doing exactly what we're doing i'm putting more gas and we will put more gas and they will cancel we'll cancel and so at some point one of our engineers was well let's obfuscate the inputs of the transactions and now they're not going to be able to read what we're doing we did that and they were still reading what what we're doing and then we figure out that they were doing replaying the transactions of chain which is another building block that is necessary so you use clients like open ethereum you can take transactions on them and pull replay forecast state of the blockchain a few seconds before it happened and tried to formulate trades uh according according to that so other relevant building blocks there is a lot of things that you can derive from centralized exchanges particularly with options and and things like that that are interesting pro i didn't put protocol integration because it's sort of trivial but integrations with a total of ton of protocols because many of the best opportunities in d5 hft are combinations of of several protocols as well as across several blockchains so let me show you several trades that some of them are are not very viable anymore but still the idea is super cool so this trade this amm arbitrage trade essentially you're monitoring mempools and you're forecasting you're replaying the transactions and forecasting the state of different pools and trying to to identify imbalances but instead of trying to arbitrage imbalance in a single pool like most front runners would try to do what you do is you find a path across different amn it's a graph algorithm essentially across different mm's that tells you the optimal path to maximize again and minimize the slippage you submit that trade you start monitoring and pull again there it comes the front runners you do your couple of bits get rid of them and if anybody else sophisticated have seen that trade they're gonna try to compete with you and that's sort of the this is the one that we lost a ton of money until we figure it out there is um this idea of uh in unib3 because it changed from from passage to active uh market making their ideas of um trying to to to supply liquidity so one of the challenges of hft in d5 is that we didn't we haven't found many opportunities that you can deploy hundreds of millions of dollars it's all like a small amount this is one that has ton of capacity so if you have a large pool of capital you can monitor them in pools in unison b3 if you're able to forecast this is an open secret if you're able to forecast what's the volatility of the pairs that you're playing with you can try to supply liquidity within within that threshold the problem is is that if you miss it the impermanent loss will kill you so the model that we found that works the best is we have a volatility forecasting mode that uses some deep learning and stuff and it tells you volatility on the pair plus minus certain percentage not direction no it's gonna go up or down it's just it's gonna vary by three percent and then using that you supply liquidity on different ticks so you say well between this price and this price i'll put 20 million between this one and this one i'll put 10 between so to try to spread the surface a little bit that seems to work then another one that is kind of cool i hope that none of you guys are have any of you guys built a d5 index in the past they all suck and uh because they all suck there is a ton of arbitrage opportunities so this is the stupidest trade ever this is a traditional etf to underlying asset trade that doesn't work anywhere but in d5 so essentially you monitor a mempool you forecast the state of the transaction and then you're gonna see based on that which default indices are mispriced there is always one of those that is mispriced because they all suck so you buy one sell the other and that arbitrage kind of work and that's not going to go away when the indices get get better and then there is a ton of opportunities if i defy arps today it's just hard to build like you did you know a ton of connectivity uh and uh a lot of things uh to to build that so now this is what you can do today i wanna leave you with two ideas of what what how the future of this could look like there is one that is uh that is an obsession of mine that is it goes like this so in in machine learning in deep learning in the last few in like the last decade we have seen techniques like in start with techniques like reinforcement learning that is what the mind used to build alpha god a bit lysido in in go and then evolve with techniques like self-supervised learning that have been pioneered at facebook essentially techniques that can look at a bunch of data that is not labeled it's not super high quality and infer knowledge from it in the case of reinforcement learning trial and error in the case of self-supervised learning is developing representations of the world either or in defy everything is visible and today we formulated strategies by the traditional way of our data scientist and team coming up with ideas and back testing and all the wbs could we have algorithms that looks at everything on the blockchain and learn strategies organically this doesn't happen in traditional capital markets because you don't see the market making lag and a bunch of things but in defy at least seems to be theoretically possible we try a bunch of stuff there and nothing works if not i wouldn't be calling future and then there is this idea of tokenization strategy so we have pros at white iron that have tokenized passive strategy so why don't tokenize active strategies so there are prioritized coin flex i have created stable coins that do the basis trading behind the scenes so same idea but for hft strategy i'll supply to to australia i get some tokens back and that ready it's going to go in and out and i'm done uh hold on yes i'm done so d5 you see so d5 as a takeaway d5 represents a new playground for hft infrastructure is key uh for uh for this an hft is a feature not a bug of inefficiencies in device part of the ecosystem is not going away i published this uh silly article about in condes a few months ago about this idea so you can go there and disagree with it and that's um that's my contact info and now do i have time for questions
Automatic transcript — names and jargon may be misspelled.