Analyzing Factor Performance with Alphalens: Price and Volume Factors

Key Highlights of This Article

Introduction to Alphalens and Price-Volume Factors

Synthesizing Price-Volume Factors and Analyzing Their Performance with Alphalens

Preface

In investment decision-making, price-volume factors are essential for investors to gain insights into market behavior. The relationship between price and trading volume supply and demand dynamics of an asset also reveals capital flows and shifts in market sentiment. These factors play a crucial role in capturing short-term opportunities and identifying potential risks in asset allocation.

This article focuses on price-volume factors, exploring how these factors reflect the dynamic changes in assets and leveraging the Alphalens tool to analyze their performance and practical applications in the market. We will first introduce the concept and design logic of price-volume factors and then use alphabets-tej for analysis to evaluate their explanatory power and stability in predicting asset returns.

In this series of articles, we have previously analyzed foreign capital and value factors, discussing the impact of foreign capital flows on the market and how valuation-related indicators affect long-term returns. This article serves as the final part of the series, further enhancing our comprehensive understanding of factor strategies and helping investors effectively utilize price-volume factors to capture market trends.

To conduct similar factor analyses, you can leverage the alphabets-tej tool in TQuant Lab. This tool not only integrates TEJ data but also eliminates the cumbersome data processing steps, allowing you to efficiently examine factor performance and further support the development of investment strategies.

What Are Price-Volume Factors?

In the investment market, price-volume factors are essential for uncovering the relationship between asset prices and trading volume. They are often associated with key market dynamics indicators, such as trading volumevolume change rate, and price momentum. These indicators reflect the intensity of market demand for an asset, capital flows, and overall market sentiment.

Price-volume factors are widely used to identify short-term opportunities and assess the persistence of trends. When applied to investment strategies, they allow investors to analyze the interaction between price and trading volume across different assets. By capturing assets with high trading volume or strong price momentum, investors can achieve excess returns and improve investment efficiency.

Factors Used in This Study

1-Month Turnover Rate

Calculation formula:

  • Calculate the cumulative trading volume over the past 20 days:
    • Based on the trading volume of each stock, compute the total trading volume over the past 20 trading days using a rolling window calculation.
  • Turnover rate calculation:
    • Divide the cumulative trading volume by the number of outstanding shares of the stock to obtain the 1-month turnover rate.

1-Month Price Change

Calculation formula:

  • Calculate the change in closing price over 20 days:
    • Based on the closing price of each stock, compute the difference between the current closing price and the closing price from 20 trading days ago.
  • Price change formula:
    • Divide the price change by the closing price from 20 trading days ago and express the result as a percentage.

The closing price and trading volume data used in this study are sourced from the TEJAPI “Trading Data – Stock Price Data” table (TWN/APIPRCD), specifically from the “Closing Price” and “Trading Volume (in thousand shares)” columns.

Introduction to Alphalens

The Alphalens-tej package in TQuant Lab is a Python toolkit for factor analysis. Its core functionality is to help investors examine and evaluate factor performance, enabling them to develop more effective factor strategies. For a detailed introduction, you can refer to Alphalens.ipynb.

In quantitative investing, factors are indicators used to explain and predict asset returns. Common factors include price-to-earnings ratio (P/E ratio)price momentum, and trading volume.

Alphalens provides a set of visualization tools and performance metrics, including:

  • Mean Period Wise Return by Factor Quantile
  • Information Coefficient (IC)
  • Cumulative Returns by Quantile

These tools help us better understand the predictive power and stability of factors. Using Alphalens, investors can quickly analyze the performance of various factors under different market conditions and identify the most suitable factor combinations for their strategies. Additionally, Alphalens is well integrated with TEJ data, making it particularly useful for conducting factor backtesting and visualization within TQuant Lab, thus enhancing the efficiency and convenience of factor research.

Single-Factor Analysis

Due to space limitations, this section will focus only on calculating the Information Coefficient (IC) and information Ratio (IR, which is the risk-adjusted IC) and plotting bar charts of the mean return by factor quantile.

The sample period used in this study spans from 2014 to 2024, and the stock universe consists of the top 100 most extensive market-cap stocks listed on the exchange.

The IC and IR values for each factor and the weighted average return of factor values for holding periods of 1 day, 5 days, 10 days, and 21 days.
Alphalens
Bar chart of the mean return by factor quantile for the 1-month turnover rate factor.
Alphalens
Bar chart of the mean return by factor quantile for the 1-month price change factor.

Explanation of the Factor Quantile Bar Chart

X-Axis:

The x-axis represents the factor quantiles, where stocks are grouped into 10 categories based on their factor values. Quantile 1 represents the group with the lowest factor values, while Quantile 10 represents the group with the highest.

Y-Axis:

The y-axis represents the mean return for each quantile, measured in basis points (bps) (1 bps = 0.01%). This value indicates the average return over different holding periods (1 day, 5 days, 10 days, and 21 days).

Interpretation:

This chart illustrates the average returns for different holding periods across various quantiles. If a factor possesses predictive power, we generally expect a monotonic relationship in the returns, where higher quantile groups (e.g., Quantile 10) yield higher average returns, while lower quantile groups (e.g., Quantile 1) yield lower returns. Such a pattern indicates that the factor can effectively construct long-short portfolios.

Factor Performance Analysis

From the IC, IR values, and the weighted mean return of factor values, the performance of the 1-month turnover rate and 1-month price change factors did not meet the expected stability standards. Generally, a factor is considered to have strong predictive ability when its IC value is more significant than 0.03 and its IR value exceeds 0.5.

  • The 1-month turnover rate factor shows IC and IR values that only approach or slightly exceed the threshold in more extended holding periods (e.g., 21 days). This suggests that the factor has some explanatory power for asset returns over longer horizons.
  • However, for short-term holding periods (such as 1 day or 5 days), the factor’s performance is highly volatile, and its correlation with asset returns is less clear, indicating limited short-term predictive ability.

Comparison of Factor Quantile Bar Charts

  • The 1-month turnover rate factor exhibits a monotonic trend in short-term (1-day, 5-day) and long-term (10-day, 21-day) holding periods.
  • In contrast, the 1-month price change factor lacks a consistent monotonic pattern in its quantile returns, particularly in the middle quantiles, where the performance appears more erratic. Additionally, its performance varies significantly across holding periods, suggesting insufficient stability in capturing asset returns.

Conclusion

  • The 1-month turnover rate factor consistently demonstrates a strong monotonic trend across all holding periods, making it a reliable predictor of asset returns, especially in distinguishing between high-return and low-return assets.
  • On the other hand, the 1-month price change factor shows inconsistent performance, particularly in short-term holding periods, where both its predictive power and monotonicity are weak.

To improve the 1-month price change factor, future optimizations could be considered. Alternatively, combining these two factors with complementary factors may enhance the overall predictive ability and stability.

Factor Synthesis

In the previous section, we observed that the 1-month turnover rate factor exhibited stable predictive ability and a strong monotonic trend across different holding periods, while the 1-month price change factor showed greater volatility in short-term holding periods and lacked sufficient monotonicity. This section will combine these two factors to evaluate whether the synthesized factor can effectively enhance overall predictive ability and stability.

Calculating Factor Weights

When synthesizing multiple factors, it is essential to assign appropriate factor weights, as different factors have varying explanatory power for future returns. Proper weighting helps improve both prediction accuracy and stability.

This study uses the rank IC_IR method to calculate factor weights. The rank IC_IR is computed by dividing each factor’s one-month IR ratio by the sum of the IR ratios of both factors. This risk-adjusted IC-based weighting method assigns higher weights to factors demonstrating more extraordinary predictive ability and stability.

To simulate the signal delay effect in actual trading, we apply a lagging shift to the final weight data. Specifically, we shift the weights by one day, ensuring that only previous-period data is used, thereby avoiding the use of future information in the model.

Alphalens
Daily Factor Weights

Factor Synthesis Method

The composite factor is calculated by taking the weighted average of individual factors based on their respective weight, resulting in a single factor representing the overalleffect.

Detailed Method:

Alphalens
Raw Factor Data
Alphalens
Composite Factor Data

Composite Factor Analysis

Similar to the single-factor analysis, we import the new composite factor data into Alphalens.

Alphalens
Bar Chart of Mean Return by Quantile

X-Axis: Represents the factor quantiles (1 to 10), where higher quantiles indicate higher factor values.

Y-Axis: Represents the mean return for each quantile, measured in basis points (bps).

Alphalens
Cumulative Return Line Chart

X-Axis: Represents the years, showing the time variation of cumulative returns.

Y-Axis: Represents the logarithmic cumulative return, where higher values indicate higher cumulative returns.

Color Legend: Different colored lines represent the cumulative returns of different quantiles.

Alphalens
IC and IR Values of the Composite Factor and the Weighted Average Return of Factor Values (Holding Periods: 1 Day, 5 Days, 10 Days, 21 Days)

From the IC, IR values, and the weighted average return of the composite factor, we can see that the composite factor outperforms the 1-month price change factor in all holding periods in terms of IC, IR, and average return. However, it still falls slightly behind the 1-month turnover rate factor. Additionally, it is observed that the longer the holding period, the better the performance of the composite factor.

Furthermore, the bar chart of mean return by quantile shows that the composite factor exhibits a relatively stable monotonic increasing trend across quantiles, outperforming the 1-month price change factor. However, compared to the 1-month turnover rate factor, the composite factor still shows some gaps in monotonicity and stability. Overall, by integrating the characteristics of both factors, the composite factor balances predictive power and stability. However, further optimization is required to match the performance of the best-performing factor.

Conclusion

Through this analysis, we demonstrated how to use Alphalens to evaluate the performance of price-volume factors and apply them to practical investment strategies. The two price-volume factors analyzed in this study are the 1-month turnover rate and the 1-month price change.

From the single-factor IC and IR analysis, we found that:

  • The 1-month turnover rate factor exhibits strong predictive ability and a clear monotonic trend across all holding periods, particularly in more extended holding periods (e.g., 21 days), where it performs relatively better.
  • However, the 1-month price change factor has limited predictive power, showing insufficient monotonicity and stability.

We synthesized the two price-volume factors using weighted averaging. The results indicate that:

  • The composite factor outperforms the 1-month price change factor in terms of IC, IR, and monotonicity.
  • However, it slightly underperforms the 1-month turnover rate factor.
  • The best performance of the composite factor occurs at the 21-day holding period, but it is not significantly better than other holding periods. This suggests that while the composite factor maintains a certain level of stability across different holding periods, the factor synthesis method did not yield powerful improvements. Future research could explore alternative synthesis methods to construct a more effective composite factor.

Important Reminder: This analysis is for reference only and does not constitute any product or investment advice.

We welcome readers interested in various trading strategies to consider purchasing relevant solutions from Quantitative Finance Solution. With our high-quality databases, you can construct a trading strategy that suits your needs.

“Taiwan stock market data, TEJ collect it all.”

The characteristics of the Taiwan stock market differ from those of other European and American markets. Especially in the first quarter of 2024, with the Taiwan Stock Exchange reaching a new high of 20,000 points due to the rise in TSMC’s stock price, global institutional investors are paying more attention to the performance of the Taiwan stock market. 

Taiwan Economical Journal (TEJ), a financial database established in Taiwan for over 30 years, serves local financial institutions and academic institutions, and has long-term cooperation with internationally renowned data providers, providing high-quality financial data for five financial markets in Asia. 

  • Complete Coverage: Includes all listed companies on stock markets in Taiwan, China, Hong Kong, Japan, Korea, etc. 
  • Comprehensive Analysis of Enterprises: Operational aspects, financial aspects, securities market performance, ESG sustainability, etc. 
  • High-Quality Database: TEJ data is cleaned, checked, enhanced, and integrated to ensure it meets the information needs of financial and market analysis. 

With TEJ’s assistance, you can access relevant information about major stock markets in Asia, such as securities market, financials data, enterprise operations, board of directors, sustainability data, etc., providing investors with timely and high-quality content. Additionally, TEJ offers advisory services to help solve problems in theoretical practice and financial management!

This study presents a workflow from single-factor analysis to composite factor construction and backtesting. In future applications, we can consider:

  • Introducing additional complementary factors to enhance factor interactions.
  • Exploring different weighting methods to optimize the performance of composite factors.
  • Incorporating actual trading costs such as slippage and transaction fees to evaluate the actual feasibility of the strategy.

By implementing these enhancements, multi-factor strategies can become more adaptive and robustsupportinginvestment decision-making in dynamic markets.

Further Reading

Analyzing Factor Performance with Alphalens: Foreign Capital Factors

Seeking Alpha

Related Links

TQuant Lab Github

TQuant Lab 首頁

Back
Procesing