/ TERMS & FAQS

Time-Weighted Average Price (TWAP): Defined

Time-weighted average price (TWAP) calculates the weighted average price of the security over a particular time period. VWAP is often implemented as an order execution strategy to execute massive trades by breaking them into equal parts over a trading period to minimize slippage and signaling.

Key Takeaways

  • Time-weighted Average Price (TWAP) determines the weighted average price over a specific time frame.
  • Traders mainly use TWAP for executing large trade orders by breaking them down into small parts to lower the price impact.
  • TWAP is very simple to calculate and doesn’t involve complex mathematical equations. Traders can easily plot it into Python and Excel.
  • The time-weighted average price is only suitable for short-term orders and poses significant signaling risks from fellow traders due to its predictability.

Table of Contents

What Is TWAP?

TWAP or Time-weighted Average Price is a calculation that defines the weighted average price over a specified time period. Traders use TWAP as a trading strategy, or more specifically, an execution strategy, to place large orders without excessively impacting the market price. They break down the large orders into several sets of small orders priced near TWAP.

For example, if a trader wants to purchase 20,000 shares of a company, they could choose to buy 1,000 shares every 20 mins for 6 hours and 20 minutes depending upon timing needs.

See the chart below displaying TWAP.

TWAP Example

The Time-weighted average price is similar to Volume -weighted average price (VWAP). However, it differs from it because there isn’t a volume element in its calculation. TWAP is one of the most straightforward execution strategies for disseminating trades over a specific time and lowering its impact in the broader market.

Why Use TWAP?

Traders use TWAP as an execution algorithm to break down large, market-impacting orders into smaller digestible chunks. By doing so, traders can minimize the impact of a large order on the market price.

TWAP can be used as an alternative to VWAP, but it has certain drawbacks for intraday execution. Volume isn’t linear. Typically, volume is most substantial near the open and close. Spreading order flow evenly across the day isn’t optimal. Depending upon the order size, it may signal to other traders that an institution is likely taking a prominent position. Even if the large order goes unnoticed, it may execute at suboptimal prices. Hence, TWAP is best used on higher-volume securities or over multiple days.

Typically VWAP is a better order execution algorithm, except when you expect adverse market price momentum.

TWAP Formula

To calculate TWAP, we have to take the average “typical price” for n periods. For daily prices with lots of after-hours movement, use the open, high, low, and close when factoring the typical price. For intraday prices on liquid stocks where the close and open are similar, use the open, high and low.

$% tp = (Low +Close + High) / 3 $%

$% TWAP = \frac{TP_1 + TP_2 + TP_n}{n} $%

It’s a simple calculation without any complex mathematical equations. After arriving at the TWAP, the order price is compared to determine if the security is overvalued or undervalued. If the order price is below the TWAP, it is considered undervalued, while if it is more than the TWAP, it is considered overvalued.

Calculating VWAP in Python

The following function calculates the VWAP for each session period and the group by groups the session into a single dataframe.

# Get imports
import datetime
import pandas as pd

# Create example dataframe
df = pd.DataFrame(
index=[datetime.datetime(2021,1,1,1),
datetime.datetime(2021,1,1,2),
datetime.datetime(2021,1,1,3),
datetime.datetime(2021,1,1,4)],
data={'low':[9,10,11,12],
'close':[10,11,12,13],
'high':[11,12,13,14],
'volume':[1000,750,500,250]
}
)
df.index.rename(date, inplace=True)
                    low  close  high  volume
date                                         
2021-01-01 01:00:00    9     10    11    1000
2021-01-01 02:00:00   10     11    12     750
2021-01-01 03:00:00   11     12    13     500
2021-01-01 04:00:00   12     13    14     250
# Create VWAP function
def twap(df, period):
tp = (df['low'] + df['close'] + df['high']).divide(3)
return df.assign(twap=(tp.rolling(period).sum().divide(period))

twap(df, 2).dropna()
                     low  close  high  volume  twap
date                                               
2021-01-01 02:00:00   10     11    12     750  10.5
2021-01-01 03:00:00   11     12    13     500  11.5
2021-01-01 04:00:00   12     13    14     250  12.5
# Verify VWAP
## Can use close price as it’s the same as tp
(10 + 11) / 2
10.5 # correct, matches our dataframe!

Pros & Cons of TWAP

Benefits

When appropriately executed, TWAP proves to be a straightforward and beneficial execution strategy. Some of its significant advantages are:

Simplicity

The main advantage of TWAP is the simplicity of the execution algorithm. It wouldn’t be a challenge for a discretionary trader to manually execute a TWAP strategy on a single or a few exchanges.

Risk Mitigation

Like all execution algorithms that reduce large orders into multiple smaller orders, TWAP reduces both slippage and signaling risk.

Drawbacks

The primary drawback of TWAP is a linear execution model as intraday volume isn’t linear. This incongruence causes two significant risks.

Signaling Risk

Trading in a predictable trading pattern may lead to signaling risk for orders that take up a noticeable daily volume percentage.

Suboptimal Intraday Execution

Intraday TWAP execution breaks up orders into multiple similar amounts spread throughout the day; however, for low volume securities where volume isn’t consistent during the day, this can lead to order execution as suboptimal prices and potentially signaling risk.

To see this clearly, look at the volume profile on the SPY chart below. You’ll see it peaks at the open and the close.

SPY VWAP vs. TWAP

TWAP FAQs

TWAP vs. VWMA

  TWAP VWMA
Meaning TWAP is the calculation that defines the weighted average price of an asset over a period. VWMA stands for Volume Weight Moving Average. VWMA is a moving average; that assigns a different weight to each closing price.
Component TWAP doesn’t take volume into account. It only focuses on price and time. The indicator calculates the average of closing prices with respect to the volume.
Objective TWAP is instrumental in disseminating trades over a specific time period and lower its impact in the broader market. VWMA is instrumental in discovering emerging trends and confirming existing trends by studying the price and volume pattern.
Formula The average of the opening, high, low, and close price, also known as the typical price, is divided by the number of trading days.
tp = (Low +Close + High) / 3
TWAP= ((TP1+TP2+….TPn)/n)
The indicator calculates the average of closing prices with respect to the volume.
(C1V1 + C2V2 + C3*V3) / (V1+ V2+ V3)

TWAP vs. VWAP

  TWAP VWAP
Meaning TWAP or Time-weighted Average Price is a trading algorithm defining the weighted average price over a specified period. VWAP or Volume Weighted Average price computes the average based on the number of shares traded at different prices throughout the trading day divided by the total number of shares transacted.
Component TWAP is weighted based on time VWAP is weighted based on time and volume.
Objective Traders use TWAP for the execution of large orders without excessively impacting the market price. Traders use the VWAP strategy to determine an attractive price and profitable entry and exit points.
Formula The average of the opening, high, low, and close price, also known as the typical price, is divided by the number of trading days.
tp = (Low +Close + High) / 3
TWAP= ((TP1+TP2+….TPn)/n)
The summation of the typical price and the volume is divided by the cumulative volume.
VWAP = (Typical Price x Volume) / cumulative volume.

The Bottom Line

Time-weighted price (TWAP) is a simple order execution strategy. The main objective of the TWAP trading strategy is to prevent slippage and not signal to other traders what move you’re making in the markets.

When execution price is predictable, volume-weighted average price may be a better intraday trading algorithm due to the non-linear volume properties of a typical trading day.

leo

Leo Smigel

Based in Pittsburgh, Analyzing Alpha is a blog by Leo Smigel exploring what works in the markets.