tradingstrategy-ai/web3-ethereum-defi

Three-way trades

Closed this issue · 0 comments

For DeFi trading

  • Most of quote tokens are in the blockchain native token (ETH, BNB, MATIC)
  • Most of trading happens in US dollar and stablecoins (USDC, BUSD)

To trade more pairs, we need to be able to execute three-way trades and price estimations.

Update

  • Price estimation logic to handle trades through three pools e.g. USDC -> ETH -> AAVE
  • Buy and selll through three pools e.g. USDC -> ETH -> AAVE

Make sure the MEV slippage is still prevented by setting price change tolerance to high value e.g. 99%. This can be tested by preparing a trade, then going to some of the pool and changing its content by trading and after pool has been unbalanced, trying to broadcast the transaction. It should revert.