uni-sushi-flashloaner
uni-sushi-flashloaner copied to clipboard
Why the "spread"in the index.js need subtract 0.6 ?
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 !
"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
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]),
));
- spread is in percentage, right?
- 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 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.