Shrimpy executes a Dollar-Cost Averaging strategy by following these steps:

- Detect a deposit.
- Determine the funds which were deposited.
- Use ONLY these funds to calculate the trades we need to execute to bring the portfolio as close as possible to the target allocations for this portfolio.
- Execute trades.

#### Example

To provide an example of how DCA works, let’s walk through a portfolio simulation.

Imagine you have a portfolio worth $100. This portfolio currently holds an even distribution of 5 different assets such that each asset has a value of $20 in the portfolio. Therefore, we could also say the portfolio has currently allocated 5 assets at 20% each.

- $20 BTC
- $20 LTC
- $20 ETH
- $20 XRP
- $20 BCH

Each asset in the portfolio holds an initial value of $20 or %20 of the total portfolio value.

Now, let’s imagine the owner of this portfolio is depositing $100 more into this portfolio and wants the funds to be dollar-cost averaged into his portfolio. If the target allocations for the portfolio are 30% BTC, 25% LTC, 20% ETH, 15% XRP, 10% BCH, then the result of the dollar-cost averaging after the deposit would be the following portfolio:

- $60 BTC
- $50 LTC
- $40 ETH
- $30 XRP
- $20 BCH

We see most of the funds are distributed to BTC to make up for the amount required to reach it’s target allocation of 30%. At the same time, no BCH was bought during this operation because it was already at its target allocation.

Notice how we didn’t simply take the target allocations and use these percentages to distribute the funds (such that BTC would get 30% of the new funds, LTC would get 25%, and so on). Instead, the funds were added such that** at the end of the operation**, the portfolio was as close as possible to the target allocations.