# Dollar-Cost Averaging (DCA)

The goal of this function is to periodically buy a fixed amount of a token using slippage-protected swaps.

For example, suppose the inputs are:

* Token In: USDC
* Token Out: WETH

And the cron trigger schedule is `30 19 * * 0`, meaning:

* `30` -> minute
* `19` -> hour UTC
* `*` -> every day of the month
* `*` -> every month
* `0` -> 0 = Sunday, 1 = Monday, etc

Then the function will buy 100 USDC worth of WETH every Sunday at 7:30 PM UTC.

### Function

{% @github-files/github-code-block url="<https://github.com/mimic-protocol/examples/blob/main/examples/12-dollar-cost-averaging/src/function.ts>" visible="false" %}

[Github link](https://github.com/mimic-protocol/examples/blob/main/examples/12-dollar-cost-averaging/src/function.ts)

### Manifest

{% @github-files/github-code-block url="<https://github.com/mimic-protocol/examples/blob/main/examples/12-dollar-cost-averaging/manifest.yaml>" visible="false" %}

[Github link](https://github.com/mimic-protocol/examples/blob/main/examples/12-dollar-cost-averaging/manifest.yaml)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mimic.fi/use-cases/dollar-cost-averaging-dca.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
