From BlockFi to Mt. Gox, the three largest crypto exchange hacks that every trader needs to know
Spot Trading – What is a Time-weighted average price (TWAP)?
Time-weighted average price (TWAP) is the average price of an instrument over a specified time. TWAP is a strategy that will attempt to execute an order which trades in slices of order quantity at regular intervals of time as specified by users. The purpose of TWAP is to minimize the market impact on basket orders.
Example 1: User would like to buy 1000 BTC and place an order as TWAP.
Assuming the order book as below:
Assuming the user set the Price Variance as 1%, the Max Buy Limit Price is thus set as $18,726.93 * (1 + 1.00%) = $18,914.19. System would then compute the current aggregated sell quantities posted in the order in which the price is lower than mentioned $18,914.19 (which is 156+100+8+1+1=266). Subsequently the system would take a reference on user-defined sweep ratio so to determine the sliced order size, in this case, which is 13.3BTC (266*5%).
The sliced limit buy order would be posted at $18914.19 for 13.3 BTC.
All unfilled order quantities would not be posted as pending order but would be cancelled. Order would be resent according to user-defined time intervals with an updated price and quantities.
In case the sliced order price reaches the max/min price limit defined by the user, the order would be sent at the max/min price as defined. Said order would be automatically cancelled should there be no matched price in the market.
In case the sliced order quantities reaches the max/min order quantity defined by the user, the order would be sent at the user-defined quantity accordingly.