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!

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

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?

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?

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.

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?

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?

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.

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?

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

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

edited Aug 25, 2022Hey 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!

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.

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

www.clearstar.xyz

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?

You're so good at explaining things!

Amazing article!

Learnt so much from you, thanks a ton!

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?

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?

edited Dec 21, 2022Should 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.

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?

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?

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.

everything looks very cool

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?

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)" ?

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