Time-Weighted Average Price (TWAP) Orders

Spot trading on KuCoin allows several advanced order types. This guide will teach you how to set up a Time-Weighted Average Price (TWAP) order.

Contents (Click to navigate)
1. What‘s a TWAP Order?
2. Setting Up TWAP Orders

 

1. What's a TWAP Order?

A Time-Weighted Average Price (TWAP) order helps you split large orders into smaller ones, and execute them in batches. For example, when you place a buy order and the market price is below your specified price, the system will create smaller sub-orders at prices slightly higher than the current best selling price. These sub-orders are smaller Immediate-Or-Cancel (IOC) buy orders, each placed at a specified interval or percentage.

 

2. Setting Up TWAP Orders

i. Parameters
Assume you wish to quickly buy 10 BTC at a cost no higher than 71,500 USDT per BTC without significantly affecting the market price. To do this, you would use a TWAP order for swift execution.

Your setup would be as follows:
Direction: Buy

Total Order Amount: 10 BTC (The total you wish to trade for.)

Amount per Order: 0.05 BTC (The amount of each sub-order after splitting orders.)

Order Distance: 10 USDT (For a buy order, each sub-order is placed at slightly higher intervals of 10 USDT above the best asking price. The larger the price gap or percentage, the higher the likelihood of quicker execution, but this also increases the cost of the trade.)

Total Order Duration: 24 hours (This is the total time over which the order will be executed. The max duration is 99 hours and 59 minutes. The longer your duration, the higher the likelihood that your order will be fully executed.

Protection Price: 71,500 USDT per BTC (The trigger condition for a limit order. For example, a buy order will only be filled if the best asking price plus order distance are both below this protection price. If the protection price is set too far from the current market price, the order may not be filled quickly.)
TWAP 1.png

 

ii. Order Execution
After placing the order, your sub-orders will automatically be batched and executed. Assuming the current order book is as shown below:
TWAP 2.png

The time interval for each sub-order is calculated by dividing the total order duration in seconds by (total order amount / amount per order) and then multiplying by a random ratio. This continues until the total filled matces the total order amount, or until the order’s duration runs out.

Based on the above settings, the highest buy price will be the current best selling price of 71,479.7 USDT/BTC plus 10 USDT, totaling 71,489.7 USDT/BTC. The total sell orders below 71,489.7 USDT/BTC then amount to 0.529589261 BTC (0.01166415 + 0.234482111 + 0.21350000 + 0.06994300), which is more than your amount per order. Since this total is greater than your specified single order amount of 0.05 BTC, the system will only place limit orders based on your set amount (0.05 BTC) and price (71,489.97 USDT/BTC).

If the sub-order is not fully filled, it will be immediately canceled, meaning all sub-orders are IOC (Immediate or Cancel) orders. When the latest market price exceeds the protection price (71,500 USDT/BTC), the order pauses. Once the latest fill price falls below 71,500 USDT/BTC, it resumes. When the total filled amount equals the total order amount, the entire order is considered complete and stops running.

Artikel Berkaitan