DeFi Risks Part 1

your definitely right about using bots do do the grunt work for you. especially on arbitrage. personally i dont like the stress of having to check my tokens esch day to hopefully that they didnt crash this is where the bot come sin. in a simple implementation youd just write a worker to fetch prices ever 5 minutes and deise a simple algorithm to sell if the price goes down by a certain X percent your comforable with. opposite is true for buying. this implementation wouldnt be for making gains but for just making sure u dont get done by unexpected price deops

arbitrage is your option to make money. see defi has flashloans so if you spot a price difference of 0.0000001 eth youd need a lot of upfront capital to capitalise on that. so just take a loan of like one hundredthousand ether and boom your making money

now thats the theory to write a good bot you need a really lightning quick price feed, so in web3 your best option is to write your own price oracle. using uniswp TWAP and cumulative price windowing formulae u can do this. this is much more reliable than relying on blockupdates of pair reserves offered by a lot of the exchange on the marketsā€™ SDKā€™s.

then theres also other things like flashbts to pay miners to process your tx first. usually in this case if you made a profit theyd take a large cut like 90% and u get left with the rest.

and then lastly your bot if u want it to be competitive should be able to trade and watch for price mismatches over multiple routes not just a two token pair bc u will rarely find a price mistmatch here that every other bot and their mother hasnt already spooted. so like imagine you wrote a scritpt that could spot a price difference between like usdt on univ2 and dai on univ3, then your bot should route USDT => ETH (univ2) => ETH=> WETH => (UNIV3) WETH => DAI (UNIV3) so thats what i mean about going multiple trades deep. this is where the challegne is devising an algotihm that is able to spot opportunityes this many levels (or more) deep.

if you cursiou of a decent defi bot i wrote last year u can see my repo below you know your stuff so mayb eit would be of intrest to you. ive been on an off doing a V2 of this which i plan to actually use which im developing out all of the concepts i mentioned above and optimising my flash swap contract.
https://github.com/mcgraneder/Defi-Trading-Arbitrage-Bot

A high capital commitment from the founder is always welcome. I think itā€™s also important to be involved in marketing.

1 Like

beside the supply and demand explanation.
i would add that there is some tokenomics to consider and it would depend on each protocol (aave, joe, etc; )
depending on the number of tokens printed or burn could affect the price (inflation/deflation/)

how much tokens are in supply and would be provided any given time (supply APY)
how many already have tokens available to lend ( usually 1.5 times the value of lending)
how many are interested to borrow ( most of the times to borrow you have to put other token as collateral and no more than 75%)
if it is compounding ( and how often is compounded and automated)
all added in a smart contract model
knowing all this then:
it can be mathematical model ( like aave example)
U = total borrow / total liquidity
where U should be below 100% and optimal value is 50%
then it would be some static and variable rates that it can be determined by the protocol:
since itā€™s so dynamic and there are more people pulling their investment or asking to borrow; a need of variable and static rate should be set.
for a better description i found this link https://ciaranmcveigh5.medium.com/math-behind-the-magic-defi-yield-c1db2f0d216c
here is how aave set their rates: https://docs.aave.com/risk/liquidity-risk/borrow-interest-rate
not sure how celsius get it or traderjoe to compare their calculations (but i guess mostly are all the same)
i was trying to understand MakerDao rate Module but it is going on top of my head; anyone can share a digested model of it?
https://docs.makerdao.com/smart-contract-modules/mkr-module

best video so far to understand :slight_smile: https://www.youtube.com/watch?v=aTp9er6S73M

5 Likes

In my opinion the different rates for crypto will be based on supply and demand, also the tried and true protocols that have been around for a while such as Maker, Aave, and compound would tend to deal with a much larger pool of lenders and borrowers. So the much lesser known financially riskier protocols will probably not see the same traffic as the more established and verified ones.

2 Likes

Rates have decreased significantly since the video was released. For example, on compound, USDC went from 3.53% to 0.63%, and Dai went from 2.44% to 1.13%. Rates have also decreased on Aave, but less drastically than on compound. The main reason is basic supply/ demand between barrowers and lenders. Toward the end of 2021, there were enough barrowers to justify higher yields, but now, the TVL has decreased dramatically. Since prices have tanked, many barrowers have been liquidated, so they are weary of using defi platforms due to fear that prices can drop much lower (causing more liquidations). Of course, this has lowered demand, driving yields down. Also, maybe investors are buying US treasuries instead.

3 Likes

I think they are different rates because each protocol has people working on it to make it better, and some have better use cases than the others.

2 Likes

augmented finance, i saw the numbers. 30 percent for bitcoin seems super high. in comparison i usually see 2-5 percent. im not sure of the details but probably similiar to what anchor protocol was doing.to me its a red flag

1 Like

The lending rates right now for AAVE for excample are much lower copared to whats shown in the video. As the rates are dependant on supply and demand the down trend in the market could have something to do with it.

2 Likes

yeah, most are sitting on stables or using them as collateral so I think we have excess supply , especially during this horrendous bear market.
give it a few months and we ought to see ppl withdrawing stables and buying the dip IMO

1 Like

That does seem fishy. Anchor was bad enough at 19% before the yield correction later on prior to the collapse so its probably unsustainable; short-term game imo

1 Like

Different yields depend on different supply/demand. The lending and borrowing on each protocol determine liquidity

Rate in video for AAVE- 2.91

Current rate for AAVE- 1.77

1 Like

Yield rates are determined by supply and demand.
Currently on Compound DAI has a deposit yield rate of 0.61% vs the rate at the time of the video being 2.44%.

2 Likes

I think why the rates are different has a lot to do with the risks. If it is a new protocoll it is not so liquid and may have some undiscovered hickups so that protocoll might offer higher yield to get more liquid.

I agree with your thinking and I am also a bit curious about BlockFi.

True, usecases probably differ in popularity.

True, good point!

I suppose my concern is that at least banks are FDIC insured while these crypto lenders arenā€™t, so if something happens like what happened with the Anchor protocol, I wouldnā€™t get my money back.

I agree that there is no replacement for practical experience and that itā€™s not a bad idea to risk a small amount that Iā€™m willing to lose just to learn. This is what I am doing now.

Thereā€™s a good article on BlockFi by one of my favourite investors, Lyn Alden:
https://www.lynalden.com/blockfi/

It talks about BlockFi and its risks.

1 Like

Rates are different depending on the Crypto. This is mainly driven by the supply and demand for the different coin and the risk associated with it.

The different yields depend on the difference in supply/demand, and the tokenomics of the differents projects.

And the rates are much lower because being in bear market, the supply is greater than the demand. More people asking for money than people willing to lend it

Probably true, good point.