TWAP
The Time-Weighted Average Price (TWAP) algorithm is a strategy for gradually executing orders over a predefined time window. This approach aims to achieve an average price closer to the overall market movement within that timeframe.
Here's how it works:
- Spreading the Load: TWAP breaks down a large order into smaller chunks and distributes them throughout a specified time period (e.g., seconds, hours, or days).
- Predictable Approach: This method offers a simple and predictable way to execute an order, particularly for those seeking to minimize short-term price impact.
Market Chasing with TWAP:
It's important to note that TWAP can involve "market chasing." As market prices fluctuate, TWAP orders may continuously adjust to buy or sell at the prevailing price to fill the order within the timeframe.
Benefits of TWAP:
- Reduced Market Impact: By distributing the order, TWAP helps minimize the potential for a single large order to significantly influence the market price.
- Improved Order Certainty: The pre-defined timeframe offers greater certainty about the order's completion time.
Who Uses TWAP?
TWAP is often favored by institutional investors or those managing large portfolios seeking to execute sizeable orders with less market disruption.
import { TwapOrder } from '@botmain/execution';
const twapOrder = new TwapOrder({
symbol: 'ETHUSD',
side: 'sell',
totalQuantity: 100,
duration: 3600 // One hour
});
await this.tradingApi.sendOrder(twapOrder);