uni-sushi-flashloaner icon indicating copy to clipboard operation
uni-sushi-flashloaner copied to clipboard

Why the "spread"in the index.js need subtract 0.6 ?

Open crackeeer opened this issue 3 years ago • 3 comments

HI , When I read your Code( uni-sushi-flashloaner/index.js ), I have a problem that I don't understand in Line 68 : Why the "spread" need subtract 0.6 ? How can I get the result 0.6 ? Thanks !

crackeeer avatar Jun 24 '21 05:06 crackeeer

"I'm not involved with this project at all, but My guess is that the -0,6 comes from the UniSwap and SushiSwap fees (0.3% each). So we want the profit spread to be more than 0.6%.

Jackson"

Maybe?

https://github.com/pedrobergamini/uni-sushi-flashloaner/issues/1#issuecomment-842568293

hauzlife avatar Jun 25 '21 20:06 hauzlife

I really don't understand this:

const spread = Math.abs((priceSushiswap / priceUniswap - 1) * 100) - 0.6;

  const shouldTrade = spread > (
    (shouldStartEth ? ETH_TRADE : DAI_TRADE)
     / Number(
       ethers.utils.formatEther(uniswapReserves[shouldStartEth ? 1 : 0]),
     ));
  1. spread is in percentage, right?
  2. why in shouldTrade formula, we divide ETH_TRADE for DAI reserves (if shouldStartEth is true) and we divide DAI_TRADE for ETH reserve elsewhere?

please help

xale76 avatar Jun 28 '21 09:06 xale76

@xale76 had the same question as well.... not sure what the relationship between spread and the calculation. It seems that we should trade if the ratio of the ETH_TRADE (or DAI_TRADE) in to the reserve in uniswap is less than the spread. But then that spread comparison seems arbitrary.

  • so spread = ratio of price difference
  • should trade = ratio of price difference > ratio of ETH_TRADE / uniswap ETH reserve

yea, i guess i'm not seeing this connection.

frankandrobot avatar Jun 16 '22 05:06 frankandrobot