{"id":20056,"date":"2023-12-28T16:39:21","date_gmt":"2023-12-28T08:39:21","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=20056"},"modified":"2024-01-05T14:08:34","modified_gmt":"2024-01-05T06:08:34","slug":"election-market-trend","status":"publish","type":"insight","link":"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/","title":{"rendered":"Is There an Election Market Trend ? Research on Presidential Elections Using TEJ API"},"content":{"rendered":"\n<figure class=\"wp-block-image aligncenter size-large caption-align-center\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\/element5-digital-T9CXBZLUvic-unsplash-1024x683.jpg\" alt=\"Election Market Trend\" class=\"wp-image-19999\" style=\"aspect-ratio:1.5;object-fit:cover\" srcset=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/element5-digital-T9CXBZLUvic-unsplash-1024x683.jpg 1024w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/element5-digital-T9CXBZLUvic-unsplash-300x200.jpg 300w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/element5-digital-T9CXBZLUvic-unsplash-150x100.jpg 150w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/element5-digital-T9CXBZLUvic-unsplash-768x512.jpg 768w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/element5-digital-T9CXBZLUvic-unsplash-1536x1024.jpg 1536w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/element5-digital-T9CXBZLUvic-unsplash-2048x1366.jpg 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Photo by <a href=\"https:\/\/unsplash.com\/@element5digital\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Element5 Digital<\/a> on <a href=\"https:\/\/unsplash.com\/\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">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-6a112638c1c39\" 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-6a112638c1c39\"  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:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#Highlight\" >Highlight<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#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:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#Editing_Environment_and_Module_Requirements\" >Editing Environment and Module Requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#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-5\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#Create_Election_Event_Points\" >Create Election Event Points<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#Extract_closing_price_and_time_series\" >Extract closing price and time series<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#Mark_the_election_date_and_plot\" >Mark the election date and plot<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#Backtesting_Returns_on_Taiwan_Weighted_Stock_index_on_previous_presidential_elections\" >Backtesting Returns on Taiwan Weighted Stock index on previous presidential elections<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#Election_Market_Trend_Analysis\" >Election Market Trend Analysis<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#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:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#Github_Source_Code\" >Github Source Code<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#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-13\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/election-market-trend\/#Related_Links\" >Related Links<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Highlight\"><\/span>Highlight<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Article Difficulty\uff1a\u2605\u2606\u2606\u2606\u2606<\/li>\n\n\n\n<li>Analyzing the existence of election market trend on Taiwan Weighted Stock Index over the past presidential elections.<\/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>January 2024 is the time for the presidential election in Taiwan. During this period, the internet is full of election-related news; some even make relevant expectations on the stock market, affecting investor&#8217;s sentiment. However, does the so-called &#8220;election market trend&#8221; really exist? In this article, we will conduct a quantitative analysis on Taiwan stock index in previous presidential elections using TEJ API.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Editing_Environment_and_Module_Requirements\"><\/span><strong>Editing Environment and Module Requirements<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This article uses the Mac operating system and VScode as the editor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Data_Import\"><\/span>Data Import<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Data period from January 5, 1971, to December 22, 2023, fetching adjusted closing prices of Taiwan Weighted Stock Index (Y9999) for analysis and comparison.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import tejapi\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport matplotlib.dates as mdates<code>\n<\/code>tejapi.ApiConfig.api_key = \"Your Key\"\ntejapi.ApiConfig.ignoretz = True\n\ndata = tejapi.get('TWN\/APRCD1',\n                coid = 'Y9999',\n                paginate = True,\n                )\ndata.reset_index(inplace=True, drop=True)\ndata<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"492\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\/data-1024x492.png\" alt=\"Election Market Trend\" class=\"wp-image-20087\" srcset=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/data-1024x492.png 1024w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/data-300x144.png 300w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/data-150x72.png 150w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/data-768x369.png 768w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/data-1536x737.png 1536w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/data-2048x983.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>And then we recorded the election dates of previous presidential elections.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>election_date = &#91;pd.Timestamp('1972-03-21', tz = 'UTC'),\n                 pd.Timestamp('1978-03-21', tz = 'UTC'),\n                 pd.Timestamp('1984-03-21', tz = 'UTC'),\n                 pd.Timestamp('1990-03-21', tz = 'UTC'),\n                 pd.Timestamp('1996-03-23', tz = 'UTC'),\n                 pd.Timestamp('2000-03-18', tz = 'UTC'),\n                 pd.Timestamp('2004-03-20', tz = 'UTC'),\n                 pd.Timestamp('2008-03-22', tz = 'UTC'),\n                 pd.Timestamp('2012-01-14', tz = 'UTC'),\n                 pd.Timestamp('2016-01-16', tz = 'UTC'),\n                 pd.Timestamp('2020-01-11', tz = 'UTC')]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Create_Election_Event_Points\"><\/span>Create Election Event Points<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We extracted the Taiwan stock index&#8217;s closing prices and time series and then combined them to create a chart. Furthermore, we mark the election date on the chart to see whether the &#8220;election market trend&#8221; exists during the election period.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Extract_closing_price_and_time_series\"><\/span>Extract closing price and time series<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>close = data.loc&#91;:,'close_adj']\nclose_d = close.to_frame()\ntime = data.loc&#91;:, 'mdate']\ntimeline = time.to_frame()\nclose_d, timeline<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"544\" height=\"688\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/price-time.png\" alt=\"Election Market Trend\" class=\"wp-image-20089\" style=\"object-fit:cover\" srcset=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/price-time.png 544w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/price-time-237x300.png 237w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/price-time-119x150.png 119w\" sizes=\"(max-width: 544px) 100vw, 544px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Mark_the_election_date_and_plot\"><\/span>Mark the election date and plot<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Plotting the above closing prices and election dates together, we can get the chart below. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full caption-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"2210\" height=\"582\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53483.02.14.png\" alt=\"Election Market Trend\" class=\"wp-image-19993\" style=\"aspect-ratio:3.7925925925925927;object-fit:cover\" srcset=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53483.02.14.png 2210w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53483.02.14-300x79.png 300w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53483.02.14-1024x270.png 1024w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53483.02.14-150x40.png 150w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53483.02.14-768x202.png 768w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53483.02.14-1536x405.png 1536w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53483.02.14-2048x539.png 2048w\" sizes=\"(max-width: 2210px) 100vw, 2210px\" \/><figcaption class=\"wp-element-caption\">Taiwan Weighted Stock Index<\/figcaption><\/figure>\n\n\n\n<p>We can tell from this chart that there is no apparent election market trend after the election, and it seems inconsistent. For example, the post-election performance in 1996 and 2016 was better, while the performance in 2000, 2008, and 2020 was poor. However, the declines in these three years are actually caused by the technology bubble, financial crisis, and the outbreak of COVID-19. Because those severe recessions coincidently happened in the election year. It&#8217;s hard to find the particular impact of the election on the stock market.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Backtesting_Returns_on_Taiwan_Weighted_Stock_index_on_previous_presidential_elections\"><\/span>Backtesting Returns on Taiwan Weighted Stock index on previous presidential elections<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If we want to know whether a specific period before and after the election date has been affected by the election, we can use the &#8216;<em><strong>count_return<\/strong><\/em>&#8216; function provided below. <\/p>\n\n\n\n<p>The &#8216;<em><strong>count_return<\/strong><\/em>&#8216; function will determine whether the time window(<em>n<\/em>) we want is positive or negative. If <em>n<\/em> is positive, it means counting forwards (defaulted <em>n<\/em> is 90). If n is negative, it means counting backward. Finally, it will return the rate of return between each election date and our target period.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def count_return(time, n = 90):\n  if n &lt; 0:\n    test = tejapi.get('TWN\/APRCD1',\n                    coid = 'Y9999',\n                      mdate = {'gte': time - pd.Timedelta(days = abs(n)), 'lte': time})\n    if len(test) == 0 or (test&#91;'mdate'].iloc&#91;-1]!= time):\n      test = tejapi.get('TWN\/APRCD1',\n                  coid = 'Y9999',\n                    mdate = {'gte': time - pd.Timedelta(days = abs(n) + 1), 'lte': time + pd.Timedelta(days = 2)})\n    first_value = test&#91;'close_adj'].iloc&#91;0]\n    last_value = test&#91;'close_adj'].iloc&#91;-1]\n  else:\n    test = tejapi.get('TWN\/APRCD1',\n                coid = 'Y9999',\n                  mdate = {'gte': time, 'lte': time + pd.Timedelta(days = n)})\n    if len(test) == 0 or (test&#91;'mdate'].iloc&#91;0]!= time):\n      test = tejapi.get('TWN\/APRCD1',\n                  coid = 'Y9999',\n                  mdate = {'gte': time - pd.Timedelta(days = 2), 'lte': time + pd.Timedelta(days = n + 1)})\n    first_value = test&#91;'close_adj'].iloc&#91;0]\n    last_value = test&#91;'close_adj'].iloc&#91;-1]\n  final = ((last_value - first_value) \/ first_value) * 100\n  return round(final, 2)<\/code><\/pre>\n\n\n\n<p>We can obtain the return performances on each election year by setting various time window(<em>n<\/em>) before (or after) the election date in the &#8216;<strong><em>count_return<\/em><\/strong>&#8216; function.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>data_last_90 = &#91;]\ndata_last_60 = &#91;]\ndata_last_30 = &#91;]\ndata_last_7 = &#91;]\ndata_7 = &#91;]\ndata_30 = &#91;]\ndata_60 = &#91;]\ndata_90 = &#91;]\ndata_180 = &#91;]\n\nfor i in range(7):\n    data_last_90.append(count_return(election_date&#91;i], n = -90))\n    data_last_60.append(count_return(election_date&#91;i], n = -60))\n    data_last_30.append(count_return(election_date&#91;i], n = -30))\n    data_last_7.append(count_return(election_date&#91;i], n = -7))\n    data_7.append(count_return(election_date&#91;i], n = 7))\n    data_30.append(count_return(election_date&#91;i], n = 30))\n    data_60.append(count_return(election_date&#91;i], n = 60))\n    data_90.append(count_return(election_date&#91;i], n = 90))\n    data_180.append(count_return(election_date&#91;i], n = 180))<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Election_Market_Trend_Analysis\"><\/span>Election Market Trend Analysis<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>By setting different time windows(7, 30, 60, 90, 180) in the &#8216;<strong><em>count_return<\/em><\/strong>&#8216; function, and combining the multiple results together in a chart, we can further discuss the election market trend.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large caption-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"256\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\/return-change-1024x256.png\" alt=\"Election Market Trend\" class=\"wp-image-20091\" style=\"object-fit:cover\" srcset=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/return-change-1024x256.png 1024w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/return-change-300x75.png 300w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/return-change-150x38.png 150w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/return-change-768x192.png 768w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/return-change-1536x384.png 1536w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/return-change.png 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Return rates in different periods before (and after) election day<\/figcaption><\/figure>\n\n\n\n<p>The chart above illustrates the percentage change in the stock market for a specific number of days before and after the election date. Within the first 30 days after the election, there is a short-term upward election market trend, reaching its peak around the 30th day. Subsequently, the stock market weakens, experiencing a continuous decline for up to 180 days after the election. Even on the 200th day, declines are expected to exceed 10%. The author speculates that this trend is because elections are concentrated in Q1, coinciding with the peak season for consumption and a bullish trend during the Chinese New Year. On the other hand, historical economic recessions, such as those in 2000 and 2008, occurred around Q3 and overlapped with election years, thus contributing to the above phenomenon.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large caption-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"787\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\/\u622a\u5716-2023-12-27-\u4e0b\u53484.44.22-1024x787.png\" alt=\"Election Market Trend\" class=\"wp-image-20001\" style=\"aspect-ratio:1.301143583227446;object-fit:cover\" srcset=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53484.44.22-1024x787.png 1024w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53484.44.22-300x230.png 300w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53484.44.22-150x115.png 150w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53484.44.22-768x590.png 768w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53484.44.22-1536x1180.png 1536w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\u622a\u5716-2023-12-27-\u4e0b\u53484.44.22.png 1820w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Except for the year 1996, the other three election years coincided with recessionary periods, <br>leading to a half-year bearish trend following the elections.<\/figcaption><\/figure>\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>The data shows that the stock market has a short-term rise after the elections. However, the timing to enter the market becomes crucial. Moreover, even with more detailed statistical data, it is insufficient to improve our win rate significantly. Thus, relying solely on election market trend to make significant market decisions is not advisable. On a long-term basis, an election is merely a single event that occurs within a holding period, and its impact on the Taiwan stock market is minimal. Considering company fundamentals and moats when making strategic decisions is still preferable.<\/p>\n\n\n\n<p>This implementation utilizes TEJ API to analyze presidential election market trends. Simply using the data provided by TEJ API, we can implement various types of analysis as far as we can imagine. This approach not only saves time and effort but also furnishes investors with a more diversified evaluation method. Explore more related solutions in&nbsp;<a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/index\" target=\"_blank\" rel=\"noreferrer noopener\">TEJ E Shop<\/a>. Construct your trading strategy with the high-quality database.<\/p>\n\n\n\n<p>Reminder: <strong>The strategy is only for reference and does not represent recommendations or advice on any financial products and investments.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Github_Source_Code\"><\/span>Github Source Code<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/tejtw\/TEJAPI_Python_Medium_Quant\/blob\/f39e540098a3d068a564a75f6455fb9c263e13db\/%E7%B8%BD%E7%B5%B1%E5%A4%A7%E9%81%B8%E8%A1%8C%E6%83%85%E4%BA%8B%E4%BB%B6%E7%A0%94%E7%A9%B6.ipynb\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Research on Presidential Election Market Trend<\/a><\/p>\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:\/\/tejwin20260323.j.webweb.today\/en\/insight\/national-stabilization-fund-performances\/\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">National Stabilization Fund Performances<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/performance-of-taiex-during-chinese-new-year\/\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">Performance of TAIEX during Chinese New Year<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><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\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">TEJ API HomePage<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/Edata_intro\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">TEJ E-Shop Purchase<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>During the election period, the internet is full of election-related news; some even make relevant expectations on the stock market, affecting investor&#8217;s sentiment. However, does the so-called &#8220;election market trend&#8221; really exist? In this article, we will conduct a quantitative analysis on Taiwan stock index in previous presidential elections using TEJ API.<\/p>\n","protected":false},"featured_media":20014,"template":"","tags":[2904,2371,2989,2640],"insight-category":[690,50],"class_list":["post-20056","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-beginners-guide","tag-python","tag-quantitive-analysis","tag-tej-api","insight-category-data-analysis","insight-category-fintech"],"acf":[],"_links":{"self":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/20056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight"}],"about":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/types\/insight"}],"version-history":[{"count":20,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/20056\/revisions"}],"predecessor-version":[{"id":20099,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/20056\/revisions\/20099"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/media\/20014"}],"wp:attachment":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/media?parent=20056"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/tags?post=20056"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight-category?post=20056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}