{"id":2685,"date":"2021-08-17T02:41:55","date_gmt":"2021-08-17T02:41:55","guid":{"rendered":"https:\/\/www.tejwin.com\/en\/insights\/warren-e-buffetts-value-investing\/"},"modified":"2021-08-17T02:41:55","modified_gmt":"2021-08-17T02:41:55","slug":"warren-e-buffetts-value-investing","status":"publish","type":"insight","link":"https:\/\/www.tejwin.com\/en\/insights\/warren-e-buffetts-value-investing\/","title":{"rendered":"Warren E. Buffett\u2019s Value Investing"},"content":{"rendered":"<p class=\"wp-block-paragraph\">Stock screening from Buffett\u2019s investing principles.<\/p>\n<figure class=\"wp-block-image aligncenter is-resized caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1wWm5YjabWxKtaGLNdqOwTQ.jpg\" style=\"width:852px;height:624px\"\/><figcaption class=\"wp-element-caption\">Photo Creds:\u00a0<a href=\"https:\/\/www.flickr.com\/\" rel=\"noreferrer noopener\" target=\"_blank\">Flickr<\/a><\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\" id=\"141e\"><strong>Preface<\/strong><\/h2>\n<p class=\"wp-block-paragraph\" id=\"cff7\">Warren E. Buffett is the person who has made the most money from stocks in the history of the world. He returned to Omaha in 1956 and started with $100. As of August 1999, his total personal assets have reached $36 B, becoming the second richest person in U.S. in that time. Buffet\u2019s investment principles are very simple. First, ignore the daily rise and fall of stock prices. Second, do not worry about changes in the overall economics situation. Third, invest with the mentality of buying a company instead of investing in stocks.<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Company\uff1a<br \/><\/strong>a. Is this company simple and understandable\uff1f<br \/>b. Is operating history of this company stable\uff1f<br \/>c. Is the company\u2019s long-term development prospects promising\uff1f<\/li>\n<li><strong>Operation\uff1a<br \/><\/strong>a. Whether the operator is rational\uff1f<br \/>b. Whether the operator is honest and frank with his shareholders\uff1f<br \/>c. Whether the operator will blindly follow the action of other legal entites \uff1f<\/li>\n<li><strong>Finance\uff1a<br \/><\/strong>a. Focus on Return on Equity (ROE) rather than earnings per share (EPS).<br \/>b. Calculate discounted free cash flow (DCF).<br \/>c. Looking for high gross margin (GM).<br \/>d. For each dollars of retained earnings make sure that the company has created at least on dollar of market value.<\/li>\n<li><strong>Market\uff1a<br \/><\/strong>a. What is the value of this company?<br \/>b. Whether we can buy stocks at a significant value discount, that is, obtain a margin of safty.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"10c9\"><strong>The Editing Environment and Modules Required<\/strong><\/h2>\n<p class=\"wp-block-paragraph\" id=\"fea8\">We use Windows OS and Jupyter Notebook in this article.<\/p>\n<pre class=\"wp-block-preformatted\">import tejapi<br\/>import pandas as pd<br\/>import numpy as np<br\/>tejapi.ApiConfig.api_key = 'Your Key'<br\/>tejapi.ApiConfig.ignoretz = True<\/pre>\n<p class=\"wp-block-paragraph\" id=\"3679\"><em>Note: Remember to replace \u2018Your key\u2019 with the one you applied for. The last line indicates that we ignore the time zone.<\/em><\/p>\n<h2 class=\"wp-block-heading\" id=\"2326\"><strong>The highlights of the article<\/strong><\/h2>\n<ul class=\"wp-block-list\">\n<li>Quantify investment principles<\/li>\n<li>Database search<\/li>\n<li>Data filtering:\u00a0<code><em>loc<\/em><\/code>\u00a0,\u00a0<code><em>groupby<\/em><\/code>\u00a0,\u00a0<code><em>pivot_table<\/em><\/code><\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"05e9\"><strong>Quantitative Indicators<\/strong><\/h2>\n<p class=\"wp-block-paragraph\" id=\"0284\">Due to part of principles cannot be quantified. Therefore, we choose only quantifiable principles. The basis of principles is to evaluate earning ability of company.<\/p>\n<ol class=\"wp-block-list\">\n<li>Most recent year ROE &gt; Industry average ROE\uff1asave to\u00a0<code><em>set_1<\/em><\/code><\/li>\n<li>Three-year average ROE \uff1e 15%\uff1asave to\u00a0<code><em>set_2<\/em><\/code><\/li>\n<li>Most recent year Gross margin \uff1e Industry average GM\uff1asave to\u00a0<code><em>set_3<\/em><\/code><\/li>\n<li>Increase in market value within 7 years \/ Increase in retained earnings within 7 years &gt; 1\uff1asave to\u00a0<code><em>set_4<\/em><\/code><\/li>\n<li>(Most recent year FCF \/ FCF 7 year ago ) -1 &gt; 1\uff1asave to\u00a0<code><em>set_5<\/em><\/code><\/li>\n<li>Current market value \/ The discounted value of FCF in next 10 years &lt; 1 \uff1asave to\u00a0<code><em>set_6<\/em><\/code><\/li>\n<\/ol>\n<h2 class=\"wp-block-heading\" id=\"499e\"><strong>Investing Strategy<\/strong><\/h2>\n<p class=\"wp-block-paragraph\" id=\"4a09\">We choose the stocks which are eligible, and buy on 2020\/1\/1, hold until 2020\/12\/31. Each condition will make a set to save eligible stocks. Finally, make the intersection to get portfolio.<\/p>\n<p class=\"wp-block-paragraph\" id=\"56c8\">When we comparing whether each dollar of retained earnings creates a dollar of market value, it involves whether the company has been listed for long enough. Therefore we selected the companies which are alive in 2020 and listed for more than 7 years. Due to the formula of ROE, we can improved by borrowing, so we exclude the industries with high debt ratio such as banking and finance holding.<\/p>\n<h2 class=\"wp-block-heading\" id=\"2b62\"><strong>Stock Pool<\/strong><\/h2>\n<h4 class=\"wp-block-heading\" id=\"3d48\"><strong>Step 1.\u00a0Search listed company database<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">tejapi.search_table(\"\u4e0a\u5e02\u65e5\")<\/pre>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1oGuKRuUpCvY8rSpeRslpTQ.png\"\/><figcaption class=\"wp-element-caption\">Results<\/figcaption><\/figure>\n<h4 class=\"wp-block-heading\" id=\"cf14\"><strong>Step 2.\u00a0We use TWN\/AIND database. Filter choose listed before 2013 and exclude industry (28 &amp; 29).<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">comp_data = tejapi.get('TWN\/AIND',<br\/>                   elist_day1 ={'lt':'2013-01-01'},<br\/>                   ind = {'ne':('28', '30')},<br\/>                   mkt = 'TSE',<br\/>                   opts = {'columns':['coid', 'elist_day1', <br\/>                           'ind']},<br\/>                   chinese_column_name=True,<br\/>                   paginate=True<br\/>                  )<\/pre>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/11wwxP92mU6CaQfHYsqH9QQ.png\"\/><figcaption class=\"wp-element-caption\">comp_data<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\" id=\"3078\">Obtain a list eligible companies and use it to create industry average data later.<\/p>\n<pre class=\"wp-block-preformatted\">comp_list = list(comp_data['\u516c\u53f8\u7c21\u7a31'])<\/pre>\n<h4 class=\"wp-block-heading\" id=\"4402\"><strong>Step 3.\u00a0Make industry dictionary<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">industry_list = comp_data[\"TEJ \u7522\u696d\u5225\"].unique().tolist()<\/pre>\n<p class=\"wp-block-paragraph\" id=\"5fdf\">Create ROE\u00a0<code><em>dict<\/em><\/code>\u00a0of all companies in industry.<\/p>\n<pre class=\"wp-block-preformatted\">industry_data = tejapi.get('TWN\/AIND',<br\/>                    ind = industry_list,<br\/>                    mkt = 'TSE',<br\/>                    opts = {'columns':['coid', 'ind']},      <br\/>                    chinese_column_name=True,<br\/>                    paginate=True<br\/>                   ).reset_index(drop=True)<\/pre>\n<p class=\"wp-block-paragraph\" id=\"03e8\">The dict of\u00a0<code><em>key<\/em><\/code>\u00a0is industry and\u00a0<code><em>value<\/em><\/code>\u00a0is list of companies.<\/p>\n<pre class=\"wp-block-preformatted\">industry_dict = {}<br\/>for i in industry_list:<br\/>    industry_dict[i] = industry_data[industry_data['TEJ \u7522\u696d\u5225'] == <br\/>    i]['\u516c\u53f8\u7c21\u7a31'].tolist()<\/pre>\n<p class=\"wp-block-paragraph\" id=\"efd6\">For example, search the companies in industry 13.<\/p>\n<pre class=\"wp-block-preformatted\">industry_dict[\"13\"]<\/pre>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1-s_HTWsQ9DEeifFV4OAK7w.png\"\/><\/figure>\n<h2 class=\"wp-block-heading\" id=\"612a\"><strong>Most recent year ROE &gt; Industry average ROE<\/strong><\/h2>\n<ul class=\"wp-block-list\">\n<li>Database TWN\/AIM1A<\/li>\n<\/ul>\n<p class=\"wp-block-paragraph\" id=\"34b1\">The following stock selection methods are similar to this. This content will be more complicated. Readers can check the\u00a0<a href=\"https:\/\/gist.github.com\/tommy780507\/3b58d38522b4b3cccf499416a823295c#file-ipynb\" rel=\"noreferrer noopener\" target=\"_blank\">complete code<\/a>\u00a0if you do not understand.<\/p>\n<h4 class=\"wp-block-heading\" id=\"23c2\"><strong>Step 1.\u00a0Obtain the ROE data.<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">ROE_data = tejapi.get('TWN\/AIM1A',<br\/>                  coid = comp_list,<br\/>                  mdate= '2019-12-01',<br\/>                  opts={'pivot':True,<br\/>                        'columns':['coid', 'mdate', 'R103']},<br\/>                  chinese_column_name=True,<br\/>                  paginate=True)<\/pre>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1hZtZQ4i6Uf6JyHA3QQZ6-w.png\"\/><\/figure>\n<h4 class=\"wp-block-heading\" id=\"3777\"><strong>Step 2.\u00a0\u8fed For loop to turn industry into dictionary. Create 2019 industry average dict.<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">industry_roe = {}<br\/>for i in industry_list:<br\/>    data = tejapi.get('TWN\/AIM1A',<br\/>                  coid = industry_dict[i],<br\/>                  mdate='2019-12-01',<br\/>                  opts={'pivot':True,<br\/>                        'columns':['coid', 'mdate', 'R103']},<br\/>                  chinese_column_name=True,<br\/>                  paginate=True).reset_index(drop=True)<br\/>    industry_roe[i] = data.groupby('\u516c\u53f8\u4ee3\u78bc').mean().mean()[0]<\/pre>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1hAc4pVZf0Tj3Zz6OjER9gQ.png\"\/><\/figure>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1D72sWPrW9YXu90RTcNN7pQ.png\"\/><\/figure>\n<h4 class=\"wp-block-heading\" id=\"485d\"><strong>Step 3.\u00a0\u5c07 Mapping the industry average dict to get average ROE.<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">ROE_data['\u7522\u696d\u6de8\u503c\u5831\u916c%'] = ROE_data['TEJ \u7522\u696d\u5225'].apply(lambda x: industry_roe[x])<\/pre>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1lBF0kuokbXfhDe2gRVsi9A.png\"\/><\/figure>\n<h4 class=\"wp-block-heading\" id=\"50c3\"><strong>Step 5.\u00a0Save eligible companies to\u00a0<code><em>set_1<\/em><\/code>\u00a0.<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">set_1 = set(ROE_data[ROE_data['ROE(A)\uff0d\u7a05\u5f8c'] &gt; ROE_data['\u7522\u696d\u6de8\u503c\u5831\u916c%']]['\u516c\u53f8\u7c21\u7a31'])<\/pre>\n<h2 class=\"wp-block-heading\" id=\"cafe\">Three-year average ROE \uff1e 15%<\/h2>\n<p class=\"wp-block-paragraph\" id=\"e62e\">Choose 3-year data and operate like point 1method\u00a0<code><em>groupby<\/em><\/code>. Then get averaged number<code><em>mean<\/em><\/code>\u00a0and save to<code><em>set_2<\/em><\/code>\u00a0.<\/p>\n<pre class=\"wp-block-preformatted\">ROE_data_3Y = tejapi.get('TWN\/AIM1A',<br\/>                      coid=comp_list,<br\/>                      mdate=['2017-12-01','2018-12-01','2019-12-<br\/>                              01'],<br\/>                      opts={'pivot':True,<br\/>                            'columns':['coid', 'mdate', 'R103']},<br\/>                      paginate=True,<br\/>                      chinese_column_name=True,<br\/>                     )<\/pre>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_12AItuY3aISFpmV_y183SlA.png\"\/><\/figure>\n<h2 class=\"wp-block-heading\" id=\"3c91\">Most recent year Gross margin \uff1e Industry average GM<\/h2>\n<p class=\"wp-block-paragraph\" id=\"ad88\">The operation method is similar to point 1. We save eligible companies into\u00a0<code><em>set_3<\/em><\/code>\u00a0.<\/p>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1aE3NRQUQXQshbmbsLNoq9A.png\"\/><\/figure>\n<h2 class=\"wp-block-heading\" id=\"0c65\">Increase in market value within 7 years \/ Increase in retained earnings within 7 years &gt; 1<\/h2>\n<h4 class=\"wp-block-heading\" id=\"c8dc\"><strong>Step 1.\u00a0Obtain market value and retained earnings data.<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">MV_RE_data = tejapi.get('TWN\/AIM1A',<br\/>                coid = comp_list,<br\/>                mdate= ['2019\/12\/01','2013\/03\/01'],<br\/>                opts={'pivot':True,<br\/>                        'columns':['coid', 'mdate','MV','2341']},<br\/>                chinese_column_name=True,<br\/>                paginate=True<br\/>               ).reset_index(drop=True)<\/pre>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1btrn7EKU9GY2TyFerj8i5g.png\"\/><\/figure>\n<h4 class=\"wp-block-heading\" id=\"c717\"><strong>Step 2.\u00a0<code><em>pivot_table<\/em><\/code><\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">MV_RE_data.pivot_table(index='\u516c\u53f8\u4ee3\u78bc', columns='\u8ca1\u5831\u5e74\u6708').reset_index()<\/pre>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1xbuoQK9rGKW_8ZMmz2f_lw.png\"\/><\/figure>\n<h4 class=\"wp-block-heading\" id=\"0d0c\"><strong>Step 3.\u00a0Subtract the two columns to get the added value.<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">MV_RE_data['\u4fdd\u7559\u76c8\u9918\u589e\u52a0\u503c'] = MV_RE_data.iloc[:,2] - MV_RE_data.iloc[:,1]MV_RE_data['\u5e02\u503c\u589e\u52a0\u503c'] = MV_RE_data.iloc[:,4] - MV_RE_data.iloc[:,3]<\/pre>\n<h4 class=\"wp-block-heading\" id=\"6386\"><strong>Step 4.\u00a0Calculate the signal.<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">MV_RE_data['\u6307\u6a19'] = MV_RE_data['\u5e02\u503c\u589e\u52a0\u503c'] \/ MV_RE_data['\u4fdd\u7559\u76c8\u9918\u589e\u52a0\u503c']<\/pre>\n<h4 class=\"wp-block-heading\" id=\"711d\"><strong>Step 5.\u00a0Save eligible companies into\u00a0<code><em>set_4<\/em><\/code>\u00a0.<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">set_4 = set(MV_RE_data[MV_RE_data['\u6307\u6a19']&gt;1]['\u516c\u53f8\u4ee3\u78bc'])<\/pre>\n<h2 class=\"wp-block-heading\" id=\"4679\">(Most recent year FCF \/ FCF 7 year ago ) -1 &gt; 1<\/h2>\n<h4 class=\"wp-block-heading\" id=\"74f1\"><strong>Step 1.\u00a0Obtain FCF data.<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">cash_data = tejapi.get('TWN\/AIM1A',<br\/>                  coid= comp_list,<br\/>                  mdate=['2013-12-01', '2019-12-01'],<br\/>                  opts={'pivot':True,<br\/>                        'columns':['coid', 'mdate', 'R69B']},<br\/>                  paginate=True,<br\/>                  chinese_column_name=True,<br\/>                 )<\/pre>\n<h4 class=\"wp-block-heading\" id=\"5f3f\"><strong>Step 2.\u00a0The operation method is similar to point 4. Use\u00a0<code><em>pivot_table<\/em><\/code>\u00a0and Subtract the two columns.<\/strong><\/h4>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1rMDR-uNBvPb8snUqvBEv6g.png\"\/><\/figure>\n<h4 class=\"wp-block-heading\" id=\"74d4\"><strong>Step 3.\u00a0Save to<code><em>set_5<\/em><\/code><\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">set_5 = set(cash_data[cash_data['\u6307\u6a19'] &gt; 1].index)<\/pre>\n<h2 class=\"wp-block-heading\" id=\"2a83\">Current market value \/ The discounted value of FCF in next 10 years. Database: TWN\/AIM1A, code: R69B<\/h2>\n<ul class=\"wp-block-list\">\n<li>Calculate present and future value. We can import useful module\u00a0<code><em>numpy_financial<\/em><\/code>\u00a0. Its documentation is\u00a0<a href=\"https:\/\/numpy.org\/numpy-financial\/latest\/\" rel=\"noreferrer noopener\" target=\"_blank\">here<\/a>. Type\u00a0<code><em>pip install numpy_financial<\/em><\/code>\u00a0in terminal.<\/li>\n<\/ul>\n<pre class=\"wp-block-preformatted\">import numpy_financial as npf<\/pre>\n<p class=\"wp-block-paragraph\" id=\"2244\">For instance, a company 4-year FCF are 100 \/ -150 \/ -200 \/ 400. We can use NPV method to calculate its present value by setting discount rate 10%.<\/p>\n<pre class=\"wp-block-preformatted\">cash_flows = np.array([100, -150, -200, 400])<br\/>npf.npv(0.1, cash_flows)<\/pre>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1kXrtKPMzNQyVUoNRh8VJlg.png\"\/><figcaption class=\"wp-element-caption\">example NPV<\/figcaption><\/figure>\n<ul class=\"wp-block-list\">\n<li>We use two-stage discount model. The growth rate of the first stage is 15% ( first 3 years) and 5% in stage two. Assuming that the discount rate remains unchanged which is 9%. The following defines the cash flow for the next 10 years, and y0 is the 2019 cash flow.<\/li>\n<\/ul>\n<pre class=\"wp-block-preformatted\">def Cashflows(y0):<br\/>    y1 = y0 * 1.15<br\/>    y2 = y1 * 1.15<br\/>    y3 = y2 * 1.15<br\/>    y4 = y3 * 1.05<br\/>    y5 = y4 * 1.05<br\/>    y6 = y5 * 1.05<br\/>    y7 = y6 * 1.05<br\/>    y8 = y7 * 1.05<br\/>    y9 = y8 * 1.05<br\/>    y10 = y9 * 1.05<br\/>    <br\/>    cashflows = np.array([y1,y2,y3,y4,y5,y6,y7,y8,y9,y10])<br\/>    <br\/>    return cashflows<\/pre>\n<h4 class=\"wp-block-heading\" id=\"1b79\"><strong>Step 1.\u00a0Obtain 2019 FCF and market value.<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">MV_cash_data = tejapi.get('TWN\/AIM1A',<br\/>                  coid= comp_list,<br\/>                  mdate='2019-12-01',<br\/>                  opts={'pivot':True,<br\/>                        'columns':['coid', 'mdate', 'R69B', <br\/>                                   'MV']},<br\/>                  paginate=True,<br\/>                  chinese_column_name=True,<br\/>                 ).reset_index(drop=True)<\/pre>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1E7UaKDWi_8ekUrYlYnFIKw.png\"\/><\/figure>\n<h4 class=\"wp-block-heading\" id=\"3e12\"><strong>Step 2.\u00a0Present value of 10-year FCF<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">MV_cash_data['\u81ea\u7531\u73fe\u91d1\u6d41\u91cf(D)'].apply(lambda x: npf.npv(0.09, Cashflows(x)))<\/pre>\n<h4 class=\"wp-block-heading\" id=\"6c56\"><strong>Step 3.\u00a0Calculate the signal.<\/strong><\/h4>\n<pre class=\"wp-block-preformatted\">MV_cash_data['\u6307\u6a19'] = MV_cash_data['\u5b63\u5e95\u666e\u901a\u80a1\u5e02\u503c'] \/ MV_cash_data['\u81ea\u7531\u73fe\u91d1\u6d41\u91cf(D)'].apply(lambda x: npf.npv(0.09, Cashflows(x)))<\/pre>\n<p class=\"wp-block-paragraph\" id=\"478f\"><strong>Step 3.\u00a0<\/strong>Save to\u00a0<code><em>set_6<\/em><\/code><\/p>\n<pre class=\"wp-block-preformatted\">set_6 = set(MV_cash_data[(MV_cash_data['\u6307\u6a19']&lt;1) &amp; (MV_cash_data['\u6307\u6a19']&gt;0)]['\u516c\u53f8\u4ee3\u78bc'])<\/pre>\n<h2 class=\"wp-block-heading\" id=\"d378\"><strong>Review portfolio performane<\/strong><\/h2>\n<p class=\"wp-block-paragraph\" id=\"20f8\">Coming to the final stage we are most looking forward to, take the intersection of each set to get our portfolio.<\/p>\n<pre class=\"wp-block-preformatted\">set_1 &amp; set_2 &amp; set_3 &amp; set_4 &amp; set_5 &amp; set_6<\/pre>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1iz8_NJ1BKnb2QxtnEtcz2g.png\"\/><\/figure>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1a27KT5oEfuPAcEjm_r2NWg.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"52ad\">Refer to\u00a0<a class=\"ek-link\" href=\"https:\/\/medium.com\/tej-api-financial-data-anlaysis\/application-5-modular-backtesting-system-ecfbe883899e\" rel=\"noopener\" target=\"_blank\">\u3010Application(5)\u3011Modular Backtesting System<\/a>. We put this list into the system. Because the price gap of the stock is too large, we use equal weight to buy and hold. Obtain the return rate is<\/p>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1ngfxsBkFXgTX5-Pv6LElXQ.png\"\/><figcaption class=\"wp-element-caption\">ROI on Portfolio<\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\" id=\"78cf\"><strong>Conclusion<\/strong><\/h2>\n<p class=\"wp-block-paragraph\" id=\"58d0\">More proficient in operating database, more able to design personalized stock selection. You can also test various stock selection stratigies. The content of this article is more complicated and requires more effort to study. If you have interest on this topic, you can go to our\u00a0<a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/Edata_caseIntro\/2\" rel=\"noreferrer noopener\" target=\"_blank\">official website<\/a>. It provides various financial data to help you make better strategy.<\/p>\n<p class=\"wp-block-paragraph\" id=\"543d\">The content of this webpage is not an investment device and does not constitute any offer or solicitation to offer or recommendation of any investment product. It is for learning purposes only and does not take into account your individual needs, investment objectives and specific financial circumstances. Investment involves risk. Past performance is not indicative of future performance. Readers are requested to use their personal independent thinking skills to make investment decisions on their own. If losses are incurred due to relevant suggestions, it will not be involved with author.<\/p>\n<h2 class=\"wp-block-heading\" id=\"b7a9\"><strong>Related Link<\/strong><\/h2>\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<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>Stock screening from Buffett\u2019s investing principles. Preface Warren E. Buffett is the person who has made the most money from stocks in the history of the world. He returned to Omaha in 1956 and started with $100. As of August 1999, his total personal assets have reached $36 B, becoming the second richest person in [\u2026]<\/p>\n","protected":false},"featured_media":2667,"template":"","tags":[50,65,70,71],"insight_category":[13],"class_list":["post-2685","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-market-data","tag-python","tag-tej-api","tag-quantitative-strategy","insight_category-quant-research"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/2685","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"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media\/2667"}],"wp:attachment":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media?parent=2685"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/tags?post=2685"},{"taxonomy":"insight_category","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight_category?post=2685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}