{"id":17822,"date":"2023-06-13T14:00:00","date_gmt":"2023-06-13T06:00:00","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=17822"},"modified":"2026-02-25T12:04:36","modified_gmt":"2026-02-25T04:04:36","slug":"%e3%80%90quant%e3%80%91pe-ratio-analyzing","status":"publish","type":"insight","link":"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/%e3%80%90quant%e3%80%91pe-ratio-analyzing\/","title":{"rendered":"\u3010Quant\u3011PE ratio Analyzing"},"content":{"rendered":"\n<p id=\"69e8\">Using PE ratio to assess current stock price<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/2_0DOp7XJF7laojnm39.jpg\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Photo by&nbsp;<a href=\"https:\/\/unsplash.com\/@bash__profile?utm_source=medium&amp;utm_medium=referral\" rel=\"noreferrer noopener\" target=\"_blank\">Nicholas Cappello<\/a>&nbsp;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-6a11a3d585a70\" 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-6a11a3d585a70\"  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\/%e3%80%90quant%e3%80%91pe-ratio-analyzing\/#Keywords_PE_ratio_EPS_visualization\" >Keywords: PE ratio, EPS, visualization<\/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\/%e3%80%90quant%e3%80%91pe-ratio-analyzing\/#Highlights\" >Highlights:<\/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\/%e3%80%90quant%e3%80%91pe-ratio-analyzing\/#Preface\" >Preface:<\/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\/%e3%80%90quant%e3%80%91pe-ratio-analyzing\/#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-5\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/%e3%80%90quant%e3%80%91pe-ratio-analyzing\/#Database\" >Database<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/%e3%80%90quant%e3%80%91pe-ratio-analyzing\/#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-7\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/%e3%80%90quant%e3%80%91pe-ratio-analyzing\/#Constructing_the_Diagram_of_Price-earnings_Ratio_and_Empirical_Analysis\" >Constructing the Diagram of Price-earnings Ratio and Empirical Analysis<\/a><\/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\/%e3%80%90quant%e3%80%91pe-ratio-analyzing\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"94da\"><span class=\"ez-toc-section\" id=\"Keywords_PE_ratio_EPS_visualization\"><\/span>Keywords: PE ratio, EPS, visualization<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"e3d8\"><span class=\"ez-toc-section\" id=\"Highlights\"><\/span><strong>Highlights:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Difficulty: \u2605\u2606\u2606\u2606\u2606<\/li>\n\n\n\n<li>Via line chart to visualize the fluctuation of stock price and PE ratio.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"f2f2\"><span class=\"ez-toc-section\" id=\"Preface\"><\/span>Preface:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"9542\">The PE ratio is a typical indicator that evaluates the reasonability of the stock\u2019s price. The formula is PE ratio = (Price Per Share) \/ (Earning Per Share). The higher PE ratio indicates the overestimated price of the stock, which means the company\u2019s current profit can not support such a high stock price. It will probably drop in the near future. On the other hand, the lower PE ratio conversely implies the underestimated price of the stock, meaning that current stock price doesn\u2019t comprehensively reflect the company\u2019s profit and the probability of the price\u2019s rising is high.<\/p>\n\n\n\n<p id=\"182c\">In the 1970s and 1980s, Ball(1978) and Basu(1983) proved that the PE ratio could effectively explain the return of the stock\u2019s price in the US market. Moreover, Chen\u2019s (2011) Multi-factor Performance Analysis of the Taiwan Stock Market also showed a better performance of the PE ratio investment strategy. As a result of theory and implementation, the PE ratio is suitable as a reference for investment.<\/p>\n\n\n\n<p id=\"b9b6\">In the world of the investment, \u201cbuy low and sell high\u201d is the permanent law, there are two aspects to realize it &#8211; cross section and time series.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Cross Section: \u201cBuy low PE ratio targets and sell(short) high PE ratio targets\u201d is the most stable and appropriate strategy because it could diversify the risk with the portfolio and gain an outstanding performance. However, For general investors, some issues need to be considered when constructing a portfolio, such as the adequacy of the finance or the limitation of shorting a target. These kinds of problems are the barriers to implementation.<\/li>\n\n\n\n<li>Time Series: \u201cBuy shares when the price is at a relatively low point and sell at a relatively high price\u201d is another strategy. Though it doesn\u2019t diversify the risk, it genuinely is an easier way for general investors to fulfill the \u201cbuy low and sell high\u201d strategy. The line chart of the PE ratio below draw lines of different PE ratio at the Candlestick Chart, so it can be clearly seen current price is close to which ratio\u2019s line and whether it is higher or lower compared to the past period.<\/li>\n<\/ul>\n\n\n\n<p id=\"7255\">Based on the info mentioned above, the PE ratio line chart is a convenient investment tool. Today\u2019s article will specifically focus on how to use TEJ API and visualization tools to draw the graph.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"c102\"><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=\"15ab\">This article uses Mac OS as a system and VScode as an editor.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import tejapi\nimport matplotlib.pyplot as plt<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a0e1\"><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:\/\/eshop.tej.com.tw\/E-Shop\/Edata_case_detail\/3?item_id=TWN%2FEWIFINQ\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">TWN\/EWIFINQ<\/a>(Quarterly Financial Information Sheet)<\/li>\n\n\n\n<li><a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/Edata_case_detail\/3?item_id=TWN%2FEWPRCD\" rel=\"noreferrer noopener\" target=\"_blank\">TWN\/EWPRCD<\/a>(Securities Transaction Data Sheet)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1f55\"><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=\"df26\">Use tejapi to set the securities code to be queried, the starting (gte), and ending date (lte) parameters, and the column for earnings per share. Optional fields include security code (coid), financial data date (mdate), and earnings per share (ac_3990).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>company = '2330'\r\nprice_data = tejapi.get('TWN\/EWIFINQ', # tej \u8ca1\u52d9\u8cc7\u6599\u5eab\r\n                coid = company,\r\n                mdate={\r\n                    # \u8d77\u59cb\u65e5\u671f    \r\n                    'gte':'2022-01-01', \r\n                    # \u7d50\u675f\u65e5\u671f\r\n                    'lte':'2022-12-31'}, \r\n                opts={'columns': &#91;'coid','mdate','ac_3990']}, \r\n                paginate=True\r\n            )<\/code><\/pre>\n\n\n\n<p>Use the tejapi function to substitute 3 parameters: set the security code to be queried and the starting date (gte), ending date (lte), and closing price (close_d) parameters.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>company_data = tejapi.get(\r\n        'TWN\/EWPRCD',  # \u8cc7\u6599\u5eab\r\n        coid=company,  # \u80a1\u7968\u4ee3\u78bc\r\n        mdate={\r\n                    # \u8d77\u59cb\u65e5\u671f    \r\n                    'gte':'2018-01-01', \r\n                    # \u7d50\u675f\u65e5\u671f\r\n                    'lte':'2018-12-31'}, \r\n        paginate=True,  \r\n        opts={'columns': &#91;'mdate', 'close_d']},\r\n    )<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6d57\"><span class=\"ez-toc-section\" id=\"Constructing_the_Diagram_of_Price-earnings_Ratio_and_Empirical_Analysis\"><\/span>Constructing the Diagram of Price-earnings Ratio and Empirical Analysis<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"2aaa\">To calculate the price-to-earnings ratio, use the daily closing stock price to divide the quarterly earnings per share to get the current day\u2019s price-to-earnings ratio. In the previous section, the tejapi.get() function was used to obtain financial-related data (df). In this section, the plot function in matplotlib.pyplot was used to draw the price-earnings ratio river graph, and further empirical analysis was carried out. The following are the operation steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Print out EPS and closing price data to observe the data type and quantity.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>print(price_data&#91;'ac_3990'])\r\nprint(company_data&#91;'close_d'])<\/code><\/pre>\n\n\n\n<p id=\"d650\">We can see the EPS data for the four quarters of the year (four transactions) and the closing data for the entire year (247 transactions).<\/p>\n\n\n\n<p id=\"4ae6\">2. Store the opening days of each quarter into the \u201cquarter\u201d parameter, and divide the closing price of that day by the corresponding EPS in the loop.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>close = company_data&#91;'close_d']\r\n\r\n\r\nPrice_to_Earnings_Ratio = &#91;]\r\nquarter = &#91;60,63,63,61]\r\nquarter_count = 0\r\nseason_days = 0\r\ninit_day = 0\r\n\r\n\r\nwhile quarter_count&lt;4:\r\n    season_days = quarter&#91;quarter_count] # \u6bcf\u5b63\u6709\u5e7e\u5929\r\n    print(init_day+season_days)\r\n    for i in range(init_day, int(init_day+season_days)):\r\n        Price_to_Earnings_Ratio.append(round(company_data&#91;'close_d']&#91;i]\/price_data&#91;'ac_3990']&#91;quarter_count]))\r\n    init_day = init_day + season_days\r\n    quarter_count += 1<\/code><\/pre>\n\n\n\n<p>3. Set the multiple to draw the price-to-earnings ratio.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>x = &#91;x for x in range(0, len(close))]\r\nPrice_to_Earnings_Ratio_30 = &#91;ratio * 30 for ratio in Price_to_Earnings_Ratio]\r\nPrice_to_Earnings_Ratio_35 = &#91;ratio * 35 for ratio in Price_to_Earnings_Ratio]\r\nPrice_to_Earnings_Ratio_40 = &#91;ratio * 40 for ratio in Price_to_Earnings_Ratio]\r\nPrice_to_Earnings_Ratio_45 = &#91;ratio * 35 for ratio in Price_to_Earnings_Ratio]\r\nPrice_to_Earnings_Ratio_50 = &#91;ratio * 50 for ratio in Price_to_Earnings_Ratio]<\/code><\/pre>\n\n\n\n<p>4. Draw the price-to-earnings ratio graph.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plt.plot(x, Price_to_Earnings_Ratio_30, label='Ratio=30', color='blue') \r\nplt.plot(x, Price_to_Earnings_Ratio_35, label='Ratio=35', color='blue') \r\nplt.plot(x, Price_to_Earnings_Ratio_40, label='Ratio=40', color='yellow')\r\nplt.plot(x, Price_to_Earnings_Ratio_45, label='Ratio=45', color='brown')\r\nplt.plot(x, Price_to_Earnings_Ratio_50, label='Ratio=50', color='purple')\r\n\r\n\r\nplt.plot(x, close.tolist(), label='K line', color='red') # \u756b\u51fa\u6536\u76e4\u50f9\u66f2\u7dda\r\nplt.title('Price_to_Earnings_Ratio')  # \u8a2d\u5b9a\u5716\u5f62\u6a19\u984c\r\nplt.xlabel('Days')  # \u8a2d\u5b9aX\u8ef8\u6a19\u7c64\r\n\r\nplt.ylabel('Ratio')  # \u8a2d\u5b9aY\u8ef8\u6a19\u7c64\r\nplt.legend()  # \u6dfb\u52a0\u5716\u4f8b\r\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1_09eo86lzGWEqCuXoh.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">price-to-earnings ratio graph<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>As shown in the TSMC (2330) price-to-earnings ratio river graph above, After the P\/E ratio of Q3 exceeded 40 times in 2018, TSMC maintained a P\/E ratio of more than 40 times most of the time, and the data shows that the P\/E ratio of more than 40 times has already exceeded 40 times. It is the recent market investor\u2019s evaluation benchmark for TSMC\u2019s reasonable stock price. After Q3, it rose to around 250 yuan and remained at more than 40 times. Based on this information, we can conclude that market investors have given a relatively high valuation to TSMC\u2019s stock price, believing it has high-profit potential and investment value. It reflects the market\u2019s confidence and optimism toward TSMC as a well-known chip manufacturer.<\/li>\n\n\n\n<li>The example of TSMC shows that the PE ratio river chart is a handy investment tool for judging the relative position of the current stock price and for \u201cbuy low, sell high.\u201d It should be noted that calculating the price-to-earnings ratio has limitations. The stock price reflects investors\u2019 expectations for the future. Still, the most commonly used price-to-earnings ratio is the company\u2019s latest earnings (already occurred), which sometimes leads to a high price-to-earnings ratio. The valuation is not that the stock price deviates from a reasonable price but that the current price reflects the company\u2019s future earnings growth expectations. Therefore, when investors use the price-to-earnings ratio river chart as a tool, they need to consider the company\u2019s future expectations or use the expected earnings per share to calculate the price-to-earnings ratio to more reasonably evaluate whether the current stock price deviates from a reasonable price.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"b297\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"3b66\">This article introduces how to use the TEJ API to present the price-to-earnings ratio river graph with a visualization kit. Investors can judge the current relative position of the stock by observing the price-to-earnings ratio river graph of individual stocks and carrying out the \u201cbuy low, sell high\u201d operation. Taking TSMC\u2019s price-to-earnings ratio river chart as an example in this article, users can easily observe the reasonable price-to-earnings ratio given to TSMC by market investors and judge whether the current stock price of TSMC is reasonable or not. Suppose you want to use the P\/E ratio river graph to accurately evaluate a reasonable stock price. In that case, you must consider the company\u2019s future expectations or use the expected earnings per share to calculate the P\/E ratio.<\/p>\n\n\n\n<p id=\"c5b7\">Lastly, please note that the \u201c<strong>Stocks this article mentions are just for the discussion. Please do not consider it to be any recommendations or suggestions for investment or products.\u201d<\/strong>\u00a0Hence, if you are interested in Creating Trading Strategy, Performance Backtesting, and Evidence-based research, please purchase the plans offered in\u00a0<a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/index\" target=\"_blank\" rel=\"noreferrer noopener\">TEJ E-Shop<\/a>\u00a0and use the well-complete database to find the potential event.<\/p>\n\n\n\n<p id=\"c5b7\">Source Code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import tejapi\r\nimport matplotlib.pyplot as plt\r\n\r\ntejapi.ApiConfig.api_key = \"your_api_key\"\r\n\r\ncompany = '2330'\r\nprice_data = tejapi.get('TWN\/EWIFINQ', # tej \u8ca1\u52d9\u8cc7\u6599\u5eab\r\n                coid = company,\r\n                mdate={\r\n                    # \u8d77\u59cb\u65e5\u671f    \r\n                    'gte':'2022-01-01', \r\n                    # \u7d50\u675f\u65e5\u671f\r\n                    'lte':'2022-12-31'}, \r\n                opts={'columns': &#91;'coid','mdate','ac_3990']}, \r\n                paginate=True\r\n            )\r\n\r\ncompany_data = tejapi.get(\r\n        'TWN\/EWPRCD',  # \u8cc7\u6599\u5eab\r\n        coid=company,  # \u80a1\u7968\u4ee3\u78bc\r\n        mdate={\r\n                    # \u8d77\u59cb\u65e5\u671f    \r\n                    'gte':'2018-01-01', \r\n                    # \u7d50\u675f\u65e5\u671f\r\n                    'lte':'2018-12-31'}, \r\n        paginate=True,  \r\n        opts={'columns': &#91;'mdate', 'close_d']},\r\n    )\r\n\r\nprint(price_data&#91;'ac_3990'])\r\nprint(company_data&#91;'close_d'])\r\nclose = company_data&#91;'close_d']\r\n\r\nPrice_to_Earnings_Ratio = &#91;]\r\nquarter = &#91;60,63,63,61]\r\nquarter_count = 0\r\nseason_days = 0\r\ninit_day = 0\r\n\r\nwhile quarter_count&lt;4:\r\n    season_days = quarter&#91;quarter_count] # \u6bcf\u5b63\u6709\u5e7e\u5929\r\n    print(init_day+season_days)\r\n    for i in range(init_day, int(init_day+season_days)):\r\n        Price_to_Earnings_Ratio.append(round(company_data&#91;'close_d']&#91;i]\/price_data&#91;'ac_3990']&#91;quarter_count]))\r\n    init_day = init_day + season_days\r\n    quarter_count += 1\r\n\r\n# print(Price_to_Earnings_Ratio)\r\n# \u8a2d\u5b9a\u756b\u51fa\u672c\u76ca\u6bd4\u500d\u6578\r\nx = &#91;x for x in range(0, len(close))]\r\nPrice_to_Earnings_Ratio_30 = &#91;ratio * 30 for ratio in Price_to_Earnings_Ratio]\r\nPrice_to_Earnings_Ratio_35 = &#91;ratio * 35 for ratio in Price_to_Earnings_Ratio]\r\nPrice_to_Earnings_Ratio_40 = &#91;ratio * 40 for ratio in Price_to_Earnings_Ratio]\r\nPrice_to_Earnings_Ratio_45 = &#91;ratio * 35 for ratio in Price_to_Earnings_Ratio]\r\nPrice_to_Earnings_Ratio_50 = &#91;ratio * 50 for ratio in Price_to_Earnings_Ratio]\r\n\r\n# \u756b\u51fa\u672c\u76ca\u6bd4\r\nplt.plot(x, Price_to_Earnings_Ratio_30, label='Ratio=30', color='blue') \r\nplt.plot(x, Price_to_Earnings_Ratio_35, label='Ratio=35', color='blue') \r\nplt.plot(x, Price_to_Earnings_Ratio_40, label='Ratio=40', color='yellow')\r\nplt.plot(x, Price_to_Earnings_Ratio_45, label='Ratio=45', color='brown')\r\nplt.plot(x, Price_to_Earnings_Ratio_50, label='Ratio=50', color='purple')\r\nplt.plot(x, close.tolist(), label='K line', color='red') # \u756b\u51fa\u6536\u76e4\u50f9\u66f2\u7dda\r\n\r\nplt.title('Price_to_Earnings_Ratio')  # \u8a2d\u5b9a\u5716\u5f62\u6a19\u984c\r\nplt.xlabel('Days')  # \u8a2d\u5b9aX\u8ef8\u6a19\u7c64\r\nplt.ylabel('Ratio')  # \u8a2d\u5b9aY\u8ef8\u6a19\u7c64\r\nplt.legend()  # \u6dfb\u52a0\u5716\u4f8b\r\nplt.show()<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using PE ratio to assess current stock price Keywords: PE ratio, EPS, visualization Highlights: Preface: The PE ratio is a typical indicator that evaluates the reasonability of the stock\u2019s price. The formula is PE ratio = (Price Per Share) \/ (Earning Per Share). The higher PE ratio indicates the overestimated price of the stock, which [&hellip;]<\/p>\n","protected":false},"featured_media":17824,"template":"","tags":[3444],"insight-category":[690,50],"class_list":["post-17822","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-stock-price-2","insight-category-data-analysis","insight-category-fintech"],"acf":[],"_links":{"self":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/17822","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":1,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/17822\/revisions"}],"predecessor-version":[{"id":43944,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/17822\/revisions\/43944"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/media\/17824"}],"wp:attachment":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/media?parent=17822"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/tags?post=17822"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight-category?post=17822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}