# TWAP

The Time-Weighted Average Price (TWAP) algo attempts to spread out an order evenly throughout a period of time. Using a TWAP execution is one way to achieve an average price that matches the market and can help minimize slippage and reduce costs.&#x20;

<br>

<figure><img src="/files/3sYAJYayCI35h5qKkDjP" alt=""><figcaption><p>In this TWAP example, the algo will buy 10 Bitcoin (BTC) for USD on Coinbase between now and 04/01/2024 14:37 PM (that is, 1 hour from now). To execute, the algo will send orders every 15 seconds at a price that is 10bp above the BTC/USD offer on Coinbase. The algo estimates a total cost of ~$656k USD, and each individual child order will be ~0.042 BTC in size. </p></figcaption></figure>

We can choose the parameters based on the trading goals.&#x20;

<table><thead><tr><th width="213">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>Buy/Sell</td><td>Direction of the order</td></tr><tr><td>Market</td><td>Symbol &#x26; price currency of the market, and the exchange</td></tr><tr><td>Quantity</td><td>Total quantity that will execute, measured in token units or contracts</td></tr><tr><td>Time Interval</td><td>Amount of time to wait between orders</td></tr><tr><td>Take Through Fraction</td><td>At what price to send the order, relative to the opposite side market.  For example on a buy order, a take through fraction of 0 would send bids at a price equal to the best offer at the time, and a take through fraction of 0.0005 would send bids 0.05% (5 basis points) above the current offer. Increasing this parameter above 0 reduces the chance of missing out on trades in a fast moving market, but has a higher risk of price slippage. </td></tr><tr><td>Reject Lockout</td><td>If an order is rejected, wait this amount of time before trying again</td></tr><tr><td>Time</td><td>End time of the algo, in your local timezone</td></tr></tbody></table>

The algo is not guaranteed to fill its full size by the end time, and will cancel any remainder size. Notably, it will not attempt to "catch-up" if orders are unfilled (e.g. due to rejects).


---

# 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.architect.co/algos-book/twap.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.
