{"id":30748,"date":"2024-11-15T16:30:00","date_gmt":"2024-11-15T08:30:00","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=30748"},"modified":"2025-01-02T14:21:23","modified_gmt":"2025-01-02T06:21:23","slug":"analyzing-factor-performance-with-alphalens","status":"publish","type":"insight","link":"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/","title":{"rendered":"Analyzing Factor Performance with Alphalens: Foreign Capital Factor Edition"},"content":{"rendered":"\n<figure class=\"wp-block-image aligncenter size-large caption-align-center\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"681\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\/behnam-norouzi-P4WNwqaen7o-unsplash-1-1024x681.jpg\" alt=\"Alphalens\" class=\"wp-image-29446\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/behnam-norouzi-P4WNwqaen7o-unsplash-1-1024x681.jpg 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/behnam-norouzi-P4WNwqaen7o-unsplash-1-300x200.jpg 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/behnam-norouzi-P4WNwqaen7o-unsplash-1-150x100.jpg 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/behnam-norouzi-P4WNwqaen7o-unsplash-1-768x511.jpg 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/behnam-norouzi-P4WNwqaen7o-unsplash-1-1536x1022.jpg 1536w, https:\/\/www.tejwin.com\/wp-content\/uploads\/behnam-norouzi-P4WNwqaen7o-unsplash-1-2048x1363.jpg 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Photo by<a href=\"https:\/\/unsplash.com\/@lealea_leaa\" target=\"_blank\" rel=\"noreferrer noopener\"> <strong>Behnam Norouzi<\/strong><\/a> on<a href=\"https:\/\/unsplash.com\/photos\/black-leather-zip-up-jacket-on-white-textile-nsRBbE6-YLs?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash\" target=\"_blank\" rel=\"noreferrer noopener\"> Unsplash<\/a>&nbsp;<\/figcaption><\/figure>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69f10acb8416e\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69f10acb8416e\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#Key_Highlights_of_This_Article\" >Key Highlights of This&nbsp;Article<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#Preface\" >Preface<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#What_is_Foreign_Capital_Factor\" >What is Foreign Capital&nbsp;Factor<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#Introduction_to_Alphalens\" >Introduction to Alphalens<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#Single_Factor_Analysis\" >Single Factor&nbsp;Analysis<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#Factor_Synthesis\" >Factor Synthesis<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#Calculating_Factor_Weights\" >Calculating Factor&nbsp;Weights<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#Factor_Synthesis_Methodology\" >Factor Synthesis Methodology<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#Analysis_of_Composite_Factors\" >Analysis of Composite Factors<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#Extended_Reading\" >Extended Reading<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.tejwin.com\/en\/insight\/analyzing-factor-performance-with-alphalens\/#Relevant_Links\" >Relevant Links<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading caption-align-center\"><span class=\"ez-toc-section\" id=\"Key_Highlights_of_This_Article\"><\/span>Key Highlights of This&nbsp;Article<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Basic Introduction to Alphalens<\/li>\n\n\n\n<li>Overview of Foreign Capital Factors<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Preface\"><\/span>Preface<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You\u2019ll inevitably encounter numerous factor strategies, whether you are an experienced trader or a beginner. By selecting factors that closely correlate with market performance, investors can more effectively predict asset returns and find stable sources of income in uncertain market environments. The essence of factor strategies lies in simplifying complex market phenomena into a few quantifiable drivers, helping us understand capital flows and risk distribution. These factors reveal the roots of market volatility and provide practical decision-making tools for investors.<\/p>\n\n\n\n<p>This series of articles will use Alphalens to explore several key factors, gradually analyzing their impact on market performance. The first article focuses on \u201cforeign capital,\u201d examining the effects of foreign capital flows into the market. Next, we\u2019ll delve into \u201cvalue factors,\u201d studying how they reflect a company\u2019s intrinsic value. Finally, the last article will analyze \u201cprice-volume factors,\u201d uncovering the interplay between price and trading volume.<\/p>\n\n\n\n<p>If you\u2019re interested in conducting similar factor analyses, you can use the <em>alphalens-tej<\/em> tool in TQuant Lab. By seamlessly integrating TEJ data and eliminating the need for complex data processing, this tool enables you to quickly evaluate factor performance and further support the development of your investment strategies.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Foreign_Capital_Factor\"><\/span>What is Foreign Capital&nbsp;Factor<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In China\u2019s A-share market, \u201cnorthern-bound funds,\u201d entering the Chinese market through the Shanghai-Hong Kong Stock Connect and Shenzhen-Hong Kong Stock Connect, are regarded as direct indicators of foreign investors\u2019 sentiment toward the Chinese market. These capital flows are often used to monitor market trends and have demonstrated significant influence in related studies. Consequently, northern-bound factors receive considerable attention and application in the Chinese market.<\/p>\n\n\n\n<p>When analyzing northern-bound factors in Taiwan\u2019s stock market, we can observe the changes in foreign holdings across different industries or individual stocks. Foreign investors account for a relatively high proportion of trading volume in the Taiwan market and have a notable impact on market movements. Due to the substantial scale of foreign capital, their buying and selling activities often drive short-term market fluctuations. This is particularly evident in specific industries or leading stocks, where these activities better reflect foreign investors\u2019 preferences and capital flows. By tracking the changes in foreign capital factors, we can more accurately identify trends for asset allocation and even capture early warning signals of market risks.<\/p>\n\n\n\n<p><strong>Factors Used in This Article:<\/strong><\/p>\n\n\n\n<p><strong>5-Day Change in Foreign Ownership Ratio<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Formula:<\/strong> The change in \u201cforeign ownership ratio\u201d over the past 5 days.<\/li>\n<\/ul>\n\n\n\n<p><strong>5-Day Net Inflows<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Formula:<\/strong> The total \u201cforeign buying amount\u201d over the past 5 days.<\/li>\n<\/ul>\n\n\n\n<p><strong>Data Source:<\/strong><\/p>\n\n\n\n<p>The data used in this article is sourced from the TEJAPI \u201cTransaction Data\u200a\u2014\u200aChip Data (Daily)\u201d table (TWN\/APISHRACT). The fields utilized are \u201cforeign ownership ratio\u201d and \u201cforeign buying amount (in TWD).\u201d<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Introduction_to_Alphalens\"><\/span>Introduction to Alphalens<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The Alphalens-tej package in TQuant Lab is a Python toolkit for factor analysis. Its core functionality assists investors in reviewing and evaluating factor performance, thereby formulating more effective factor strategies. For detailed instructions, refer to <a href=\"https:\/\/github.com\/tejtw\/TQuant-Lab\/blob\/main\/lecture\/Alphalens%20.ipynb\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>Alphalens. ipynb<\/strong><\/a>.<\/p>\n\n\n\n<p>In quantitative investing, factors are indicators used to explain and predict asset returns. Common factors include the price-to-earnings ratio (P\/E), price momentum, trading volume, etc.<\/p>\n\n\n\n<p>Alphalens provides a series of powerful visualization tools and metrics, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Mean Period Wise Return by Factor Quantile<\/strong><\/li>\n\n\n\n<li><strong>Information Coefficient (IC)<\/strong><\/li>\n\n\n\n<li><strong>Cumulative Returns by Quantile<\/strong><\/li>\n<\/ul>\n\n\n\n<p>These features help investors better understand a factor\u2019s predictive power and stability. With Alphalens, investors can quickly analyze the performance of various factors under different market conditions and identify the factor combinations or strategies most suitable for them.<\/p>\n\n\n\n<p>Furthermore, Alphalens integrates seamlessly with TEJ data, making it ideal for conducting factor backtesting and visualization analysis using TQuant Lab. This integration dramatically enhances the convenience and efficiency of factor research.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Single_Factor_Analysis\"><\/span>Single Factor&nbsp;Analysis<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Due to space constraints, this section focuses only on calculating the factor\u2019s IC (Information Coefficient) and IR (Information Ratio, i.e., risk-adjusted IC) and plotting bar charts of the average returns for each factor quantile.<\/p>\n\n\n\n<p>The data sample period used in this article spans from 2014 to 2024, and the stock pool consists of the top 100 market-cap stocks among all listed companies.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/0EMVETWEFgo-SJh1d.png\" alt=\"IC, IR Values, and Average Returns for Each Factor (Holding Period: 1 Month)\"\/><figcaption class=\"wp-element-caption\">IC, IR Values, and Average Returns for Each Factor<br>(Holding Period: 1&nbsp;Month)<\/figcaption><\/figure>\n\n\n\n<p><strong>Mean Return<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This column shows the average return for each factor.<\/li>\n\n\n\n<li>A negative value indicates that the factor\u2019s overall performance during the holding period resulted in a negative return.<\/li>\n<\/ul>\n\n\n\n<p><strong>IC Mean<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Represents the average Information Coefficient (IC), reflecting the correlation between the factor values and asset returns.<\/li>\n\n\n\n<li>A positive IC Mean indicates a positive correlation, while a negative value indicates an inverse correlation.<\/li>\n\n\n\n<li>Generally, the higher the absolute value of IC Mean, the stronger the factor\u2019s predictive power.<\/li>\n<\/ul>\n\n\n\n<p><strong>IC Std<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Refers to the standard deviation of IC values, indicating the volatility of IC.<\/li>\n\n\n\n<li>A higher IC Std suggests lower stability in the factor\u2019s predictions, whereas a lower IC Std indicates more consistent predictive performance.<\/li>\n<\/ul>\n\n\n\n<p><strong>IR (Information Ratio)<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Calculated as the ratio of IC Mean to IC Std, representing the risk-adjusted performance of the factor.<\/li>\n\n\n\n<li>The higher the absolute value of IR, the more stable and reliable the factor is in predicting asset returns.<\/li>\n<\/ul>\n\n\n\n<p><strong>IC &gt; 0.03<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This column represents the proportion of times the factor\u2019s absolute IC value exceeds 0.03.<\/li>\n\n\n\n<li>A higher proportion indicates a greater likelihood of the factor demonstrating stable correlations over time, confirming its predictive effectiveness across various periods.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/4_0J816e9i7GgtjCMoZ.png\" alt=\"Average Returns By Factor Quantile (5-Day Change in Foreign Ownership Ratio)\"\/><figcaption class=\"wp-element-caption\">Average Returns By Factor Quantile (5-Day Change in Foreign Ownership Ratio)<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/4_0ktkWRCCxj01xws_x.png\" alt=\"Average Returns By Factor Quantile (5-Day Net Inflow)\"\/><figcaption class=\"wp-element-caption\">Average Returns By Factor Quantile (5-Day Net&nbsp;Inflow)<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Horizontal Axis:<\/strong> The horizontal axis represents the factor groups (Quantiles), which are divided into ten groups based on the size of the factor values. Group 1 contains the stocks with the lowest factor values, while Group 10 contains those with the highest.<\/li>\n\n\n\n<li><strong>Vertical Axis:<\/strong> The vertical axis represents the average return of each group, measured in basis points (bps), which is one ten-thousandth of a percent. This value reflects the average return over a specific holding period (in this case, 1 day).<\/li>\n\n\n\n<li><strong>Explanation:<\/strong> This chart illustrates the average return for each group during a one-day holding period. If the factor has predictive power, we generally expect the returns to show a monotonic trend, with Group 10 having higher average returns and Group 1 having lower average returns. This pattern can be used to construct a long-short portfolio.<\/li>\n<\/ul>\n\n\n\n<p>Based on the table \u201cIC, IR Values, and Average Returns for Each Factor,\u201d neither of these factors demonstrates strong IC or IR values. Generally, a good factor should have an IC greater than 0.05 and an IR greater than 0.3. Therefore, these two factors show a low correlation with asset returns and need more stable predictive ability.<br>The \u201cAverage Returns by Factor Quantile Bar Chart \u201c also shows that these two factors are unable to effectively predict or indicate asset return trends. Typically, in the bar chart, we aim to see monotonicity in the factor, meaning that larger factor values correlate with higher returns or smaller factor values correlate with lower returns. Factors with this characteristic can support the construction of investment strategies with more stable and consistent returns.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Factor_Synthesis\"><\/span>Factor Synthesis<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In the previous section, we observed that the predictive effectiveness of the \u201c5-day holding proportion change\u201d and \u201c5-day net inflow\u201d factors was suboptimal. Therefore, this section will attempt to synthesize these two factors and examine whether the predictive power improves after synthesis.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Calculating_Factor_Weights\"><\/span>Calculating Factor&nbsp;Weights<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>When synthesizing multiple factors, assigning appropriate weights to each factor is crucial due to their varying explanatory power for future returns. Proper weighting enhances both the predictive performance and stability of the composite factor.<\/p>\n\n\n\n<p>In this article, <strong>rank IC_IR<\/strong> is used to calculate factor weights. The <strong>rank IC_IR<\/strong> is determined by dividing the IR ratio of an individual factor (calculated over the past month) by the sum of the IR ratios for all factors. This provides the relative weight of each factor. Based on risk-adjusted IC, this weighting method assigns greater weight to factors with higher predictive power and stability.<\/p>\n\n\n\n<p>To simulate the delay of factor signals in real-world trading, the final weight data is <strong>lagged<\/strong> (shifted) by one day. This ensures that only data from the previous period is used, thereby avoiding the use of future information in the model.<\/p>\n\n\n\n<p>This approach aligns the synthesized factor with practical trading scenarios, improving its robustness and applicability in real-world investment strategies.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/4_0Ouc-QNI5PT8yx-AN.png\" alt=\"Daily Factor Weight\"\/><figcaption class=\"wp-element-caption\">Daily Factor&nbsp;Weight<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Factor_Synthesis_Methodology\"><\/span>Factor Synthesis Methodology<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Calculating the composite factor involves generating a single composite factor by taking a weighted average of each factor based on its assigned weight, representing the overall effect of all aspects.<\/p>\n\n\n\n<p>Detailed Steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Align Data: <\/strong>First, align the raw factor data with the index of the weight data. Fill any missing values with 0 to ensure data completeness.<\/li>\n\n\n\n<li><strong>Weight Factors: <\/strong>Calculate each factor\u2019s weighted value by multiplying its raw value by the corresponding pre-computed weight.<\/li>\n\n\n\n<li><strong>Compute the Weighted Average: <\/strong>Specifically, the weighted average is calculated by multiplying each factor\u2019s original value by its corresponding weight and then summing these values to produce the composite factor.<\/li>\n\n\n\n<li><strong>Resulting Composite Factor: <\/strong>The composite factor generated through this process accounts for the relative importance of each factor, providing a more stable predictive effect in multi-factor strategies.<\/li>\n<\/ol>\n\n\n\n<p>Using this method, the composite factor reflects the relative significance of the individual factors and their collective predictive power, enhancing stability and effectiveness in multi-factor strategies.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/01TgzO4X7J5KAxo3i.png\" alt=\"Raw Factor Data\"\/><figcaption class=\"wp-element-caption\">Raw Factor&nbsp;Data<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/0c3tHf631193IQDlz.png\" alt=\"Composite Factor Data\"\/><figcaption class=\"wp-element-caption\">Composite Factor&nbsp;Data<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Analysis_of_Composite_Factors\"><\/span>Analysis of Composite Factors<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Similar to single-factor analysis, we will also import the new composite factor data into <strong>Alphalens<\/strong> for evaluation.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/3_0v8JzQkDUcyEUCBVQ.png\" alt=\"Average Returns By Composite Factor Quantile\"\/><figcaption class=\"wp-element-caption\">Average Returns By Composite Factor&nbsp;Quantile<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Horizontal Axis:<\/strong> Represents the quantiles (1 to 10), where higher quantiles indicate larger composite factor values.<\/li>\n\n\n\n<li><strong>Vertical Axis:<\/strong> Represents the average return for each quantile in basis points (bps).<\/li>\n\n\n\n<li><strong>Color Labels:<\/strong> Different colors indicate the holding periods, showing how the composite factor\u2019s performance varies over time.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/3_0RL0Rpl50S1IWFNjU.png\" alt=\"Cumulative Returns By Holding Period\"\/><figcaption class=\"wp-element-caption\">Cumulative Returns By Holding&nbsp;Period<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Horizontal Axis:<\/strong> Represents the years, showing the time evolution of cumulative returns.<\/li>\n\n\n\n<li><strong>Vertical Axis:<\/strong> Displays the log cumulative returns, where higher values indicate greater accumulated returns.<\/li>\n\n\n\n<li><strong>Color Labels:<\/strong> Different colored lines represent the cumulative returns for specific quantiles (e.g., Quantile 1, Quantile 5, Quantile 10).<\/li>\n<\/ul>\n\n\n\n<p>Due to the calculation method of cumulative returns in Alphalens, only the cumulative returns for a 1-day holding period are presented in the line chart. These charts show that the composite factor\u2019s predictive power significantly surpasses that of the individual factors before synthesis.<br>The results show that the 10th quantile achieves the highest returns, while the 1st quantile has the lowest returns. Furthermore, the returns across quantiles exhibit a clear monotonic increasing trend.<br>Based on these findings, we can further explore constructing a long-short hedge portfolio by going long on stocks in the 10th and shorting stocks in the 1st quantile. This approach aims to maximize returns through effective portfolio hedging.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Through the analysis in this article, we demonstrated how to use Alphalens to evaluate factor performance and apply it in practical investment strategies. Initially, the IC and IR analyses of single factors revealed that the \u201c5-day holding proportion change\u201d and \u201c5-day net inflow\u201d factors performed poorly in predicting asset returns. The quantitative results also indicated a need for more stable monotonicity, making constructing effective long-short hedge strategies challenging. However, we observed a significant improvement in predictive power by synthesizing these factors into a composite factor.<br>In the composite factor analysis, a clear monotonic relationship between factor values and asset returns was evident, with higher quantiles achieving higher average returns. This monotonicity makes the composite factor well-suited for long-short hedge strategies, enhancing investment portfolios\u2019 stability and return potential. Overall, this article illustrated the process from single-factor analysis to composite factor construction and backtesting, strengthening factor predictive power while reducing strategy risk to some extent.<br>In the future, practical applications could explore more advanced factor integration methods and alternative weight calculation approaches. Additionally, incorporating considerations such as slippage and transaction costs would further assess the strategy\u2019s real-world feasibility. With these refinements, multi-factor strategies will be better equipped to adapt to market volatility and consistently create value in dynamic market environments!<\/p>\n\n\n\n<div style=\"border: 1px black; border-style: solid none; text-align: center; border-color: #296580; padding: 24px; margin-top: 24px; margin-bottom: 24px;\">\n<p style=\"margin: 0px; font-size: 24px; font-weight: bold; line-height: 1.5;\">Start Building Portfolios That Outperform the Market!<\/p>\n<div style=\"margin-top: 32px;\"><strong><a style=\"border: none; border-radius: 4px; background-color: #296580; color: white; font-size: 20px; width: fit-content; text-decoration: none; padding: 12px 30px 12px 30px;\" href=\"https:\/\/www.tejwin.com\/en\/databank-solution\/market-data\/\">TEJ Market Databank<\/a><\/strong><\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Extended_Reading\"><\/span>Extended Reading<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.tejwin.com\/en\/insight\/seeking-alpha\/\" target=\"_blank\" rel=\"noreferrer noopener\">Seeking Alpha<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.tejwin.com\/en\/insight\/stock-selection-factors-research-combining-insider-ownership-and-momentum-factors\/\" target=\"_blank\" rel=\"noreferrer noopener\">Stock Selection Factors Research: Combining Insider Ownership and Momentum Factors<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Relevant_Links\"><\/span>Relevant Links<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/tejtw\/TQuant-Lab\" target=\"_blank\" rel=\"noreferrer noopener\">TQuant Lab Github<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/tquant.tejwin.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">TQuant Lab<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This series of articles will use Alphalens to explore several key factors, gradually analyzing their impact on market performance. The first article focuses on &#8220;foreign capital,&#8221; examining the effects of foreign capital flows into the market. Next, we&#8217;ll delve into &#8220;value factors,&#8221; studying how they reflect a company&#8217;s intrinsic value. Finally, the last article will analyze &#8220;price-volume factors,&#8221; uncovering the interplay between price and trading volume.<\/p>\n","protected":false},"featured_media":29447,"template":"","tags":[3063,2988,3166],"insight-category":[3509,50,1356],"class_list":["post-30748","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-backtesting-2","tag-quantitative-analysis","tag-tquant-lab-2","insight-category-fintech-en","insight-category-fintech","insight-category-tquant-lab-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/30748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight"}],"about":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/types\/insight"}],"version-history":[{"count":19,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/30748\/revisions"}],"predecessor-version":[{"id":31996,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/30748\/revisions\/31996"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media\/29447"}],"wp:attachment":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media?parent=30748"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/tags?post=30748"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight-category?post=30748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}