> For the complete documentation index, see [llms.txt](https://docs.bullpen.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bullpen.fi/trading/order-types/twap.md).

# TWAP

Time-Weighted Average Price. Splits a large order into smaller pieces executed every 30 seconds.

## Use When

Executing large orders without moving the market.

## Parameters

* **Asset**: The token or contract you want to trade
* **Total Size**: Complete order size to execute over time
* **Direction**: Buy/Sell
* **Duration**: How long to spread the order (in minutes)
* **Reduce Only** (optional): Only reduces existing position

## How It Works

1. You specify total size and duration
2. Bullpen/Hyperliquid calculates suborder size and frequency
3. Every 30 seconds, a small market order executes
4. Process continues until duration expires or full size is filled
5. Final average execution price is calculated

## Execution Details

* **Suborder frequency**: Every 30 seconds
* **Suborder slippage**: Max 3% per suborder
* **Catch-up mechanism**: If suborders don't fill (wide spread, low liquidity), TWAP tries to catch up
* **Catch-up size cap**: Catch-up suborders capped at 3x normal size
* **Early completion**: Can complete before duration if all size fills efficiently

## Example

**TWAP Order**

* Total size: 100 BTC
* Duration: 60 minutes
* Suborders: \~120 suborders (one every 30 seconds)
* Size per suborder: \~0.83 BTC

Each suborder executes as a market order with 3% max slippage. Final execution price is the weighted average of all fills.

## Benefits

### Reduced Market Impact

* Avoids dumping large orders that move price
* Blends into natural market flow
* Better average price on large positions

### Predictable Execution

* Systematic, emotionless execution
* No timing decisions
* Reduces trader stress

### Slippage Control

* 3% max per suborder (vs unlimited on single market order)
* Total slippage often much lower than one large market order

## Drawbacks

### Price Risk

* Exposure to price movement during duration
* If price trends against you, later fills are worse
* No guarantee of execution at current price

### Not Instant

* Takes time to complete
* Not suitable for urgent entries/exits

### Visible on Chain

* Sophisticated actors may detect TWAP patterns
* In thin markets, still creates predictable flow

## When to Use

✅ **Good for:**

* Large position entries (>$100k)
* Building positions over time
* Reducing slippage on illiquid assets
* Accumulation/distribution phases

❌ **Not good for:**

* Urgent exits
* Stop losses
* Small positions
* Highly time-sensitive trades

## Best Practices

* **Size threshold**: Use for orders >5% of orderbook depth
* **Duration selection**:
  * Short (5-15 min): Normal liquidity
  * Medium (30-60 min): Thinner liquidity or very large orders
  * Long (>1 hour): Extremely large positions or quiet markets
* **Monitor execution**: Watch suborder fills in case you need to cancel
* **Combine with limit orders**: For non-urgent large positions, scale in with limit orders instead
* **Market conditions**: TWAP works best in stable markets; avoid during high volatility

## TWAP vs Market Order vs Limit Ladder

| Factor        | TWAP         | Market Order     | Limit Ladder         |
| ------------- | ------------ | ---------------- | -------------------- |
| Speed         | Slow         | Instant          | Variable             |
| Slippage      | Low-Medium   | High             | Lowest               |
| Certainty     | High         | Guaranteed       | Low                  |
| Market impact | Low          | High             | Lowest               |
| Best for      | Large orders | Urgent execution | Patient accumulation |


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.bullpen.fi/trading/order-types/twap.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
