> For the complete documentation index, see [llms.txt](https://docs.brahma.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.brahma.fi/brahma-accounts/strategies-and-agents/automation-and-agents/twap-or-dca-automation.md).

# TWAP | DCA Automation

The TWAP Automation is tailored for users aiming to optimise their token trading strategies execution. This feature is suitable for those who wish to mitigate the impact of large trades on market price, offering a strategic, automated approach based on predefined intervals, with privacy of automation parameters as well as added randomisation of timing and sizing.

Brahma Automations are fully self custodial. The user retains the assets on their Safe during the whole automation process, with no deposits in any contract by Brahma. The user grants permission to an automation SubAccount owned by their Safe to trigger the execution of the automated orders with the selected input token and amount on the preselected swap routes. Brahma automations execute batched automated transactions able to complete multiple steps in a single transaction.

### **Automation Overview**

TWAP, or Time-Weighted Average Price Automation, is a trading strategy that divides a large order into smaller orders, which are then executed at regular intervals over a specified period. Its primary goal is to minimise the trade's market impact on liquidity pools, selling or buying an asset over the span of a predefined time, getting a more homogeneous price.

* Supported Chains: Ethereum and Arbitrum
* Balance Requirements: Users must ensure they have sufficient balance of the chosen input token within their Brahma wallet to cover the total trade amount for the duration of the TWAP automation.
* Supported Tokens: ETH is not supported as an input token due to restrictions in the multi-call process. Any ERC20 is supported, as long as a swap route between the two selected tokens can be found. Users can search for token name or paste contract addresses to add a token.
* Automation Size Threshold: The automation will alert the user in case the predicted execution gas cost is larger than 30% of the total input token size

### **How It Works?**

#### **Automation Initiation**

TWAP Initiation requires the signature of a single multicall transaction, which performs the following actions:

1. **Sub-Account Configuration:**

   * For new users implementing their first automation, the transaction creates their Brahma Automation Sub-Account, a segregated Safe owned by their Main Brahma Safe—and introduces a Custom Policy that restricts its operations to the user-specified automation parameters.
   * For users with previous automations, the existing Automation SubAccount is assigned to the new task.

   *The Automation Sub-Account is capable of managing multiple automations and benefits from a one-time gas cost incurred at the initial creation. This segregates protocol interaction risks for swapping to the Automation Sub-Account, with multisig approval thresholds required for policy and automation changes, offering strong security.*
2. **Token Approval and Transaction Authorisation:**
   * On-chain approval is provided to the Automation Sub-Account, allowing it to handle the specific token amount necessary for the automation. This enables the SubAccount to seamlessly pull the input token, execute the swap, and return the output token to the Main Brahma Safe within a single transaction.
3. **Automation Parameters Registration:**
   * Automation settings, including the minimum price threshold, randomization settings, and maximum slippage, are detailed and registered. These parameters play a pivotal role in monitoring and triggering the automated order execution, managed privately off-chain.

*Dynamic Order Management*\*:\*\* The automation evenly spaces out the orders over the chosen time frame, maintaining adherence to the user's strategy while managing market conditions.\*

#### **Features:**

* Randomised Execution: Adjusts order execution timing and size variably to prevent pattern detection.
* Multi-swap route. Swaps are automatically routed through 7 swap venues and aggregators including: Matcha, Uniswap, 1inch, Odos.
* Minimum Price: Set a floor price, below which the orders won’t execute
* Automatic Slippage: Slippage is fine-tuned automatically for optimal execution, increased incrementally after sequential retries, handled by the Brahma relayer.

### **Risks**

Automation comes with risks that should be acknowledged:

* Swap Execution Fulfillment: There's a potential risk that not all orders can be fulfilled if market liquidity becomes insufficient during the automation period or swap routes are unavailable at time of order. Multiple swap venues and integrations for redundancy minimise this risk.
* Gas Cost Fluctuation: Gas cost can fluctuate during the TWAP execution period. While this isn’t a concern on L2, it can be on L1 for smaller order sizes.

### **Execution Fee**

* Automation Setup Fee: Setting up TWAP automation may incur a one-time gas fee for the creation of a new Automation SubAccount on the Ethereum mainnet (this is gas cost for the deployment of the Sub-Account Safe wallet, no fee is levied by Brahma).
* Execution Fee: A **0.30% fee** is charged for successful TWAP orders **(0.25% on Berachain)**. This fee is strictly associated with successful order completions.

### **In Summary**

The TWAP Automation feature from Brahma is an advanced, user-friendly tool designed for traders who prefer a systematic approach to executing orders over time. While striving for efficiency and security, it's important for users to comprehend the potential risks and costs involved. Our team is dedicated to offering support and ensuring optimal user experience.

For more detailed information, additional inquiries, or support regarding LRT Automation, please refer to our comprehensive documentation, consult the [FAQs section](https://docs.brahma.fi/other/other/faqs), or contact our support team through the chat bubble in your Brahma.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.brahma.fi/brahma-accounts/strategies-and-agents/automation-and-agents/twap-or-dca-automation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
