{"id":12840,"date":"2023-06-27T14:00:00","date_gmt":"2023-06-27T06:00:00","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=12840"},"modified":"2023-07-12T10:56:16","modified_gmt":"2023-07-12T02:56:16","slug":"survivorship-bias","status":"publish","type":"insight","link":"https:\/\/www.tejwin.com\/en\/insight\/survivorship-bias\/","title":{"rendered":"Survivorship Bias"},"content":{"rendered":"\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/0MFG1_aDL-kOAtyDh.jpg\" alt=\"Survivorship Bias\"\/><figcaption class=\"wp-element-caption\">Photo by <a href=\"https:\/\/unsplash.com\/es\/@linkhoang?utm_source=medium&amp;utm_medium=referral\" rel=\"noreferrer noopener\" target=\"_blank\">Link Hoang<\/a> on&nbsp;<a href=\"https:\/\/unsplash.com?utm_source=medium&amp;utm_medium=referral\" rel=\"noreferrer noopener\" target=\"_blank\">Unsplash<\/a><\/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-69f7e192d415e\" 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-69f7e192d415e\"  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\/survivorship-bias\/#Highlights\" >Highlights<\/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\/survivorship-bias\/#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\/survivorship-bias\/#Programming_environment_and_Module_required\" >Programming environment and Module required<\/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\/survivorship-bias\/#Database\" >Database<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.tejwin.com\/en\/insight\/survivorship-bias\/#Data_Import\" >Data Import<\/a><\/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\/survivorship-bias\/#Preprocessing\" >Preprocessing<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.tejwin.com\/en\/insight\/survivorship-bias\/#Trading_Strategy\" >Trading Strategy<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.tejwin.com\/en\/insight\/survivorship-bias\/#Trading_Backtesting\" >Trading Backtesting<\/a><\/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\/survivorship-bias\/#Conclusion\" >Conclusion<\/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\/survivorship-bias\/#Source_Code\" >Source Code<\/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\/survivorship-bias\/#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\/survivorship-bias\/#Related_Links\" >Related Links<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"176f\"><span class=\"ez-toc-section\" id=\"Highlights\"><\/span>Highlights<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Difficulty\uff1a\u2605\u2605\u2606\u2606\u2606<\/li>\n\n\n\n<li>Using long-term and short-term moving average for automatic trading strategy.<\/li>\n\n\n\n<li>Introduce survivorship bias with the use of listed stock price data.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6fed\"><span class=\"ez-toc-section\" id=\"Preface\"><\/span>Preface<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"e682\">Survivorship bias refers to a type of error in research or observation where only the successful or surviving entities or events are considered, while the failures or disappearances are ignored or excluded. This bias can lead to a misunderstanding of the overall situation because observing only the successful or surviving entities may not represent the characteristics or true conditions of the entire population.<\/p>\n\n\n\n<p id=\"5a66\">Survivorship bias often occurs in situations such as sample selection, study design, or retrospective analysis. A typical example is the research on aircraft defense reinforcement during World War II. Researchers primarily observed the damage to the aircraft that returned to base and then proposed defense recommendations based on these observations. However, this observation ignored the aircraft that were shot down and unable to return, leading to conclusions that may not apply to the entire group of aircraft.<\/p>\n\n\n\n<p id=\"bf5a\">Survivorship bias can also affect stock selection. During the stock selection process, investors tend to focus on stocks that perform well and generate profits while ignoring those that perform poorly or fail. This observation only considers examples of successful stocks, resulting in a bias in understanding the overall market or stock population.<\/p>\n\n\n\n<p id=\"9ee4\">Survivorship bias can lead investors to mistakenly believe that the outstanding stocks are representative or universally applicable and attribute their success to specific factors or strategies. Investors may be inclined to chase these successful stocks while overlooking market risks, industry trends, and other important stock selection factors. This exercise will use a simple trading strategy to illustrate the concept of survivorship bias.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3043\"><span class=\"ez-toc-section\" id=\"Programming_environment_and_Module_required\"><\/span>Programming environment and Module required<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"bdbe\">This article uses Mac OS as a system and Jupyter Notebook as an editor.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>import pandas as pd \nimport numpy as np \nimport tejapi\n\napi_key = 'your_api_key'\ntejapi.ApiConfig.api_key = api_key\ntejapi.ApiConfig.ignoretz = True<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"30db\"><span class=\"ez-toc-section\" id=\"Database\"><\/span>Database<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/api.tej.com.tw\/columndoc.html?subId=107\" rel=\"noreferrer noopener\" target=\"_blank\">Securities Attribute Dataset (TWN\/ANPRCSTD)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/api.tej.com.tw\/columndoc.html?subId=33\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">Listed Adjusted Daily Stock Price Dataset \u2014 (mean) (TWN\/AAPRCDA)<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"ff3c\"><span class=\"ez-toc-section\" id=\"Data_Import\"><\/span>Data Import<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"5eb1\">The sampling period is from January 1, 2020, to December 31, 2022. Taking the biotechnology and healthcare companies as an example, stock price information was gathered as the analytical data.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>comp_data = tejapi.get('TWN\/ANPRCSTD',\n                   paginate = True,\n                  opts = {\"columns\":[\"coid\", \"mdate\", \"mkt\", \"stype\", \"list_date\", \"delis_date\", \"tseind\"]}\n                  )\n\n#\u53d6\u5f97\u751f\u6280\u91ab\u7642\u985e\u80a1\u4ee3\u865f\uff0c\u985e\u5225\u4ee3\u78bc\u70ba22\ncoid_lst = list(comp_data.loc[(comp_data[\"stype\"] == \"STOCK\") &amp; (comp_data[\"tseind\"] == \"22\")][\"coid\"])\n\ngte, lte = \"2020-01-01\", \"2022-12-31\"\nprice_data = tejapi.get('TWN\/AAPRCDA',\n                        paginate = True,\n                        coid = coid_lst,\n                        mdate = {\"gte\":gte, \"lte\":lte},\n                        opts = {\"columns\":[\"coid\", \"mdate\", \"fld014\", \"cls60\", \"close_d\"]}\n                  )<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"38e5\"><span class=\"ez-toc-section\" id=\"Preprocessing\"><\/span>Preprocessing<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"4bd9\"><a href=\"https:\/\/api.tej.com.tw\/columndoc.html?subId=107\" rel=\"noreferrer noopener\" target=\"_blank\">Securities Attribute Dataset<\/a>&nbsp;displays the current status of the underlying securities, whether it is listed or delisted. On the other hand,&nbsp;<a href=\"https:\/\/api.tej.com.tw\/columndoc.html?subId=33\" rel=\"noreferrer noopener\" target=\"_blank\">Listed Adjusted Daily Stock Price Dataset \u2014 (mean)<\/a>&nbsp;contains stock price for all companies that have been listed and delisted on the market.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>price_data[\"coid\"] = price_data[\"coid\"].astype(str)\ninter_coid = list(set(coid_lst).intersection(set(price_data[\"coid\"].unique())))\nprice_data[price_data[\"coid\"].isin(inter_coid)]<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized caption-align-center\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1QaFblvbwIR5AYaOI70_Sww.png\" alt=\"Table (1)\n\" width=\"435\" height=\"468\"\/><figcaption class=\"wp-element-caption\">Table (1)<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"fa6e\"><span class=\"ez-toc-section\" id=\"Trading_Strategy\"><\/span>Trading Strategy<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"842c\">In this experiment, we will use the simplest moving average backtesting method, comparing the short-term moving average with the long-term moving average. When the short-term moving average break through the long-term moving average, it is known as a \u201cGolden Cross\u201d and is considered as a buy signal. Conversely, when the short-term moving average falls below the long-term moving average, it is referred to as a \u201cDeath Cross\u201d and is considered a sell signal. For ease of calculation, this trading strategy only trades one unit of stock whenever a trading signal is triggered unless it is the last day of the target price information, in which case the position will be closed. In this exercise, we will use a 10-day moving average as the short-term moving average and a 60-day moving average as the long-term moving average.<\/p>\n\n\n\n<p id=\"e405\">First, we will group the stock price data according to the stock symbols.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>fltr_price_data = price_data[price_data[\"coid\"].isin(inter_coid)]\ngroup = fltr_price_data.groupby(\"coid\")<\/code><\/pre>\n\n\n\n<p>Next, we will define the function for the moving average trading strategy. This function will ultimately return two pieces of data. First, it will provide a data table of the trading history, which includes the trading date, stock symbol, buy\/sell indication, trade price, trade units, remaining cash, and position holdings. Second, it will provide the remaining cash balance after the completion of all trades.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>def MA_strategy(df, principal):\n    position = 0 \n    lst = []\n    \n    for i in range(len(df)):\n        if df[\"fld014\"].iloc[i] &gt; df[\"cls60\"].iloc[i] and principal &gt;= float(df[\"close_d\"].iloc[i])*1*1000:\n            principal -= float(df[\"close_d\"].iloc[i])*1*1000\n            position += 1\n            lst.append({\n                \"\u65e5\u671f\": df[\"mdate\"].iloc[i],\n                \"\u6a19\u7684\": df[\"coid\"].iloc[i],\n                \"\u8cb7\u5165\/\u8ce3\u51fa\": \"\u8cb7\u5165\",\n                \"\u55ae\u50f9\": float(df[\"close_d\"].iloc[i]),\n                \"\u55ae\u4f4d\": 1,\n                \"\u5269\u9918\u73fe\u91d1\": principal,\n                \"\u90e8\u4f4d\" : position\n            })\n\n        elif df[\"fld014\"].iloc[i] &lt; df[\"cls60\"].iloc[i] and position &gt; 0:\n            principal += float(df[\"close_d\"].iloc[i])*1*1000\n            position -= 1\n            \n            lst.append({\n                \"\u65e5\u671f\": df[\"mdate\"].iloc[i],\n                \"\u6a19\u7684\": df[\"coid\"].iloc[i],\n                \"\u8cb7\u5165\/\u8ce3\u51fa\": \"\u8ce3\u51fa\",\n                \"\u55ae\u50f9\": float(df[\"close_d\"].iloc[i]),\n                \"\u55ae\u4f4d\": 1,\n                \"\u5269\u9918\u73fe\u91d1\": principal,\n                \"\u90e8\u4f4d\" : position\n            })\n            \n        elif i == len(df)-1 and position &gt; 0:\n            principal += float(df[\"close_d\"].iloc[i])*position*1000\n            position -= position\n            lst.append({\n                \"\u65e5\u671f\": df[\"mdate\"].iloc[i],\n                \"\u6a19\u7684\": df[\"coid\"].iloc[i],\n                \"\u8cb7\u5165\/\u8ce3\u51fa\": \"\u8ce3\u51fa\",\n                \"\u55ae\u50f9\": float(df[\"close_d\"].iloc[i]),\n                \"\u55ae\u4f4d\": position,\n                \"\u5269\u9918\u73fe\u91d1\": principal,\n                \"\u90e8\u4f4d\" : position\n            })\n\n    df_output = pd.DataFrame(lst)\n    \n    return (df_output, principal)<\/code><\/pre>\n\n\n\n<p>Since the main objective of this exercise is to demonstrate the presence of survivorship bias in the stock market, the trading strategy in this case does not focus on completely realistic operations and allocations. Instead, the entire trading strategy is treated as an independent variable, the portfolio configuration is treated as a control variable, and the reflected investment returns are treated as the dependent variable. Here, we assume that each stock has the same initial capital, which is set at 1 million dollars.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"0eb3\"><span class=\"ez-toc-section\" id=\"Trading_Backtesting\"><\/span>Trading Backtesting<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"73cc\">We will consider all healthcare and biotechnology companies that were listed or listed on the market at any time point between January 1, 2020, and December 31, 2022, as the investment portfolio.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>print(f'2020\u201301\u201301 \u81f3 2022\u201312\u201331\u72c0\u614b\u66fe\u7d93\u70ba\u4e0a\u5e02\u6ac3\u7684\u516c\u53f8\u6578\u91cf\uff1a{len(list(comp_data.loc[(comp_data[\"coid\"].isin(inter_coid))][\"coid\"]))}')<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1aEz3WcZjEvbsE8CHGlbfuA.png\" alt=\"Amount of Companies ever Listing Cabinet during 2020\u201301\u201301 ~ 2022\u201312\u201331\" width=\"760\" height=\"46\"\/><figcaption class=\"wp-element-caption\">Amount of Companies ever Listing Cabinet during 2020\u201301\u201301 ~ 2022\u201312\u201331<\/figcaption><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>principal = 1000000\ntotal_return_1 = 0\ndf = pd.DataFrame(columns = [\"\u65e5\u671f\", \"\u6a19\u7684\", \"\u8cb7\u5165\/\u8ce3\u51fa\", \"\u55ae\u50f9\", \"\u55ae\u4f4d\", \"\u5269\u9918\u73fe\u91d1\", \"\u90e8\u4f4d\"])\n\nfor g in group.groups.keys():\n    reuslt = MA_strategy(group.get_group(g), principal)\n    total_return_1 += round(reuslt[1], 2)\n    df = pd.concat([df, reuslt[0]], ignore_index=True)<\/code><\/pre>\n\n\n\n<p>Next, we will calculate the ROI (Return on Investment) by summing up the final remaining cash amount for each stock and dividing it by the initial amount, which is 1 million multiplied by the number of stocks in the portfolio.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>total_return = (total_return_1\/(1000000*len(group.groups.keys())) - 1) *100\nprint(f\"ROI : {total_return}%\")<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1OJmYB0qluVrXShlJT__LXQ.png\" alt=\"ROI of All Companies ever Listing Cabinet during 2020\u201301\u201301 ~ 2022\u201312\u201331\" width=\"630\" height=\"78\"\/><figcaption class=\"wp-element-caption\">ROI of All Companies ever Listing Cabinet during 2020\u201301\u201301 ~ 2022\u201312\u201331<\/figcaption><\/figure>\n\n\n\n<p>The calculated overall performance is -14%. Next, we will exclude nine companies that were delisted between January 1, 2020, and December 31, 2022. In the&nbsp;<a href=\"https:\/\/api.tej.com.tw\/columndoc.html?subId=107\" target=\"_blank\" rel=\"noreferrer noopener\">Securities Attribute Dataset<\/a>, the column \u201cmkt\u201d represents the market status, and if it is \u201cDIST,\u201d it indicates that the company is currently delisted. We will use this as the basis for filtering the data.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized caption-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1dHlc4VAiFt5Ca0c_tpp-Gw.png\" alt=\"DIST companies\u2019 code\" width=\"110\" height=\"356\"\/><figcaption class=\"wp-element-caption\">DIST companies\u2019 code<\/figcaption><\/figure>\n\n\n\n<p>Following the previous steps, we will group the filtered stock price data based on the stock symbols.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>without_dist_coid = comp_data.loc[(comp_data[\"coid\"].isin(inter_coid)) &amp; (comp_data[\"mkt\"] != \"DIST\")][\"coid\"].unique()\nfltr_price_data = price_data[price_data[\"coid\"].isin(without_dist_coid)]\ngroup = fltr_price_data.groupby(\"coid\")<\/code><\/pre>\n\n\n\n<p id=\"89a6\">Next, we will execute the trading strategy as before.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>principal = 1000000\ntotal_return_2 = 0\ndf_without_dist = pd.DataFrame(columns = [\"\u65e5\u671f\", \"\u6a19\u7684\", \"\u8cb7\u5165\/\u8ce3\u51fa\", \"\u55ae\u50f9\", \"\u55ae\u4f4d\", \"\u5269\u9918\u73fe\u91d1\", \"\u90e8\u4f4d\"])\nfor g in group.groups.keys():\n    reuslt = MA_strategy(group.get_group(g), principal)\n    total_return_2 += round(reuslt[1], 2)\n    df = pd.concat([df_without_dist, reuslt[0]], ignore_index=True)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>return_without_dist = (total_return_2\/(1000000*len(group.groups.keys())) - 1) *100\nprint(f\"ROI : {return_without_dist}%\")<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized caption-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1ttzFdjm4lEU-Gxqkms3SqQ.png\" alt=\"ROI of Companies Listing Cabinet during 2020\u201301\u201301 ~ 2022\u201312\u201331\" width=\"566\" height=\"73\"\/><figcaption class=\"wp-element-caption\">ROI of Companies Listing Cabinet during 2020\u201301\u201301 ~ 2022\u201312\u201331<\/figcaption><\/figure>\n\n\n\n<p>According to the calculations, the performance after excluding delisted companies is indeed slightly better compared to the original performance. Although both performances are negative, we can clearly observe the difference in returns through the program implementation.<\/p>\n\n\n\n<p>Typically, when conducting performance backtesting, investors tend to select companies that survived within the sampling period and overlook the inclusion of delisted companies during the testing period. The surviving companies are objectively considered to have better fundamentals, resulting in better investment returns for the model. However, such results are not accurate or comprehensive as the inclusion of delisted company stock price information is necessary for a more accurate reflection of the market conditions at that time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"0192\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"4960\">Survivorship bias can lead to the over-optimization of stock selection strategies. If investors only base their stock selection on specific factors of past successful stocks and ignore the overall market changes and uncertainties, they may fail to adapt to market fluctuations, thus affecting investment outcomes. To avoid the negative impact of survivorship bias on stock selection, investors should adopt a comprehensive research approach that includes considering both successful and unsuccessful stocks. They should focus on factors such as overall market trends, industry developments, company fundamentals, and risk management, rather than relying solely on the performance of past successful stocks. Additionally, investors should have a long-term investment perspective, avoid excessive focus on short-term stock performance, and establish their own investment strategies that align with their individual investment goals and risk tolerance.<\/p>\n\n\n\n<p id=\"dfdb\"><strong>Please note that this strategy and the mentioned stocks are for reference purposes only and do not constitute any commodity or investment advice.<\/strong>&nbsp;We will also introduce the use of the TEJ database to construct various indicators and backtest their performance. Therefore, readers who are interested in various trading backtests are welcome to purchase related packages from the&nbsp;<a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/index\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ E-Shop<\/a>, using high-quality databases to build their own suitable trading strategies.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"0c72\"><span class=\"ez-toc-section\" id=\"Source_Code\"><\/span>Source Code<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/gist.github.com\/tej87681088\/994cb3e8f05700a8569ed435ecfcecd1\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Click here to go Github<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"dd26\"><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:\/\/medium.com\/tej-api-financial-data-anlaysis\/application-bollinger-bands-trading-strategy-23f023f686a9\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Bollinger Bands Trading Strategy<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/medium.com\/tej-api-financial-data-anlaysis\/application-herding-indicators-3cd7dbf575b5\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Herding indicators<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"08ce\"><span class=\"ez-toc-section\" id=\"Related_Links\"><\/span>Related Links<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/api.tej.com.tw\/index.html\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ API<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/Edata_intro\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ E-Shop<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Highlights Preface Survivorship bias refers to a type of error in research or observation where only the successful or surviving entities or events are considered, while the failures or disappearances are ignored or excluded. This bias can lead to a misunderstanding of the overall situation because observing only the successful or surviving entities may not [&hellip;]<\/p>\n","protected":false},"featured_media":11294,"template":"","tags":[2987,2997,2636,2428],"insight-category":[690,50],"class_list":["post-12840","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-quant","tag-stock-picking","tag-survival-bias","tag-2428","insight-category-data-analysis","insight-category-fintech"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/12840","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":0,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/12840\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media\/11294"}],"wp:attachment":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media?parent=12840"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/tags?post=12840"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight-category?post=12840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}