ccyanxyz / uniswap-arbitrage-analysis

Uniswap arbitrage problem analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get optimal value considering different fee rate for pairs?

PauloAMFaria opened this issue · comments

Hey, would appreciate some insight to this variant, having some issues getting to the solution...

Considering some pairs would have different fees, like 0.3% for the first two and 0.2% the other two.

For Ea and Eb, if we have access to the pairs fee, we can just use them, 997 and 998 instead of always 997.

what about optimal value?

eg.
pairsFees = [997,998,997,998]
f = parseFloat( ( ( sum(pairsFees)/pairs.lenght ).toFixed(2) ) * 100
( sqrt( Ea * Eb * f * 100000 ) - Ea * 100000 ) / f
?

I think the current model cannot solve the optimal arbitrage amount problem if the fees are different across different pairs, because you cannot abstract(haven't try, maybe you can, but with an extra layer of complexity) the 'virtual pool' model for A-C if A-B, B-C have different fees.
For simplicity, you can just assume all the pools have the same fee rate r, r = max(Fee_AB, Fee_BC, ...) , this way you can employ the current model to calculate the optimal amount. But using the max fee rate you will miss some small arbitrage opportunities.