Sometimes it makes sense to not buy tokens all at once but instead split up the total amount over time and make smaller purchases e.g. every day.
Reason 1)
Avoiding slippage. Especially for small cap tokens a large buy order can cause significant price movement. It might be better to buy every day a smaller amount.
Reason 2)
“Dollar-cost averaging” - even if slippage is not the issue (e.g. on a liquid ETH/DAI market) you might not want to try to “time” the market. Prices fluctuate and it might be a better strategy to just spend e.g. $1000 every week/day for some time instead of trying to time a $10,000 ETH investment.
An example app for this is here:
This uses uniswap and a relay service to trigger the purchases. Issues here are: fairly high costs for the realy service, specifically at todays gas costs. Specifically for larger amount the relay service could frontrun/sandwich your transaction. (take flashloan, bloat uniswap pool with half the flashlaon, move price with other half (so that you earn most of the trading fees yourself because you are a big liquidity contributor; move the price of uniswap with the other part of the flashloan; let the user buy into uniswap at a totally overpriced price; move price back; take money out; profit
On Gnosis protocol this can be done much more elegant and cost efficient. GP simply allows you to schedule orders.
A dapp could let the user chose:
token to invest with (sell), token to invest in (buy)
total amount to invest;
How frequently (daily, every h, very week, …)
How often.
What is the maximum price to pay each time.
Under the hood the app would do:
- set allowance for token
- deposit token
- place sell orders (Gnosis Chain | Gnosis Chain)
At any time the user could cancel/ withdraw.
The easiest way to build this would be as a Gnosis Safe app: