20 Comments

Thanks this is very well written. Any reason why you would approach it as an optimization problem rather than a graph problem?

Expand full comment
Aug 24, 2022Liked by noxx

yeah, its a graph problem one can choose starting state based on starting inventory. I am also surprised why it needs to be optimisation problem

Expand full comment
author
Aug 25, 2022·edited Aug 25, 2022Author

Hey indeed there are many ways to resolve this problem and definitely not saying this is the best approach, was reading through the routing paper found it interesting and wanted do a breakdown

If you wanted to do a graph problem example as an article I'll be first in line to read it!

Expand full comment

Currently working in risk analysis on tradFI (I'm a mathematician). Is convex opt. a way into a position in DeFi? Engineer or analyst, doesn't matter.

Expand full comment
author

There's loads of ways into DeFi, If you come from a tradFi background you should be fine I'd just start reaching to projects you're interested in, helping out where you can and seeing if your skills match up with what they're looking for

Expand full comment
Aug 24, 2022Liked by noxx

Thanks for the article, really appreciate this.

My question practically why would you take this approach rather than trying all different path possible based on your actual initial inventory and then executing most profitable path?

Expand full comment
Aug 23, 2022Liked by noxx

You're so good at explaining things!

Expand full comment

Amazing article!

Expand full comment

Learnt so much from you, thanks a ton!

Expand full comment

Hey! Thanks a lot for your work and efforts you put into it!

I am wondering how can I modify this code to calculate arbitrage trades (only Uniswap v2 pools) like this: Token 1->Token 2->Token 3->Token 4->Token1 also add limitations on input amount of Token 1?

Expand full comment

https://arxiv.org/pdf/2204.05238.pdf Chapter 3 Linear utility:

"can solve the optimal routing problem by solving m single CFMM problems independently"

However, in this case, five different pools are used, three of which provide negative utility.

This seems strange, does anyone know why?

Expand full comment
Dec 21, 2022·edited Dec 21, 2022

Should we use this algorithm only for optimization of profit after found opportunity OR should we use this for even finding opportunity(profit pairs) ??, I have tried 2nd one but somehow it's failed on large data-set or least probably of my mistake while programming.

Expand full comment

It's not obvious to me that the objective function is convex. Isn't the “Net Network Trade” linear? Not sure about the indicator function part though. Anybody can shed some light?

Expand full comment

Correct if I'm wrong, but I'm assuming delta and lambda values are updated once the Convex Optimization Solver concludes it's processing on line 93 "cp.Solve()" and that's why we can use their values when evaluating each permutation right?

Expand full comment

I changed the value in Reserves list in your code about 100m+ in number,and run code.But it seems failed.it tell me "Certificate of dual infeasibility found".How can i solve it?because in practice the number of coins would be in the hundreds of millions.If u have solution i will be appreciate it.

Expand full comment

everything looks very cool

Expand full comment

According to the info on www.etherium.org "DEX arbitrage, liquidations, and sandwich trading are all very well-known MEV opportunities and are unlikely to be profitable for new searchers."

Are your python scripts really able to profit? Maybe etherium was strictly talking about trading ETH?

Expand full comment

Thanks for the great explanation!

I wonder why the constraints from swap is expressed with inequality

"cp.geo_mean(new_reserves[1]) >= cp.geo_mean(reserves[1])"

rather than equality "cp.geo_mean(new_reserves[1]) == cp.geo_mean(reserves[1])"

I guess CPMM (xy=k) means "geo_mean(new) == geo_mean(old)" ?

Expand full comment

because every transaction will increase k,so new>=old

Expand full comment