# [PYTHON] Joel Greenblatt's Magic formula

It is common to buy a stock of a valuable company when the stock price is low, and then sell it when the stock price rises to make a profit. Identifying "wonderful stocks" at bargain price "</ b> So how do you screen for valuable stocks? One of the screening methods is Joel Greenblatt's Magic formula, but I would like to write how to handle it.

# 2 What is Joel Greenblatt's Magic formula?

① EBIT = Net income before tax + Interest expense-Interest income ② EV = Market capitalization (stock price x number of issued shares) + Interest-bearing debt-Non-business (Source: here % BC% 89% E3% 81% AF% E4% BC% 81% E6% A5% AD% E4% BE% A1% E5% 80% A4% E3% 81% A7% E3% 81% AF% E3% 81 % AA% E3% 81% 84 /)) ③ Net Fixed Asset = Net Fixed Asset ④ Net Working Capital = Current assets (excluding cash) --Current liabilities (excluding interest-bearing liabilities) (Source: here ) ⑤ ROI = EBIT / Investment amount (= shareholders' equity + total liabilities) ・ ・ ・ ・ Return on investment </ b> ⑥ ROA = Net income / Total assets ・ ・ ・ ・ Return on total assets </ b>

EV: Enterprise Value Net Working Capital

# 2-2 Earning Yield

Earning Yield: The reciprocal of PER. Earning Yield means that the higher the stock, the cheaper the stock is for its value.

Earning Yield=\frac{EBIT}{EV}= \frac{Net income per share}{Stock price}


# 2-3 ROIC (Return on Invested Capital)

Evaluate how efficiently a company makes a profit by using the funds invested for business activities (invested capital). (Source: here)

ROIC=\frac{EBIT}{Net Fixed Asset + Net Working Capital}


2-4 Magic formula

Consider the portfolio Q of a stock.

Q=\left\{Q_{i} | 1≦i≦n ,n is the number of brands\right\}


### (1) Ranking by Earning Yield

First, calculate the Earning Yield for each stock $Q_ {i}$, and rank $RankEV (Q_ {i})$ in descending order.

RankEV(Q_{i})= k_{1}


However, $1 ≤ k_ {1} ≤ n$.

### (2) Ranking by ROIC (return on invested capital)

Next, calculate ROIC (return on invested capital) for each stock $Q_ {i}$ and rank them in descending order.

RankROIC(Q_{i})= k_{2}


However, $1 ≤ k_ {2} ≤ n$

### (3) Integrated ranking (Magic formula)

Add $RankEV (Q_ {i})$ and $RankROIC (Q_ {i})$ to get $MF (Q_ {i})$. The stocks are listed in ascending order of $MF (Q_ {i})$.

MF(Q_{i})=RankEV(Q_{i}) + RankROIC(Q_{i})


The following is an example of calculating $MF (Q_ {i})$.

#### text


------------------------------------------------
Value stocks based on Greenblatt's Magic Formula
EarningYield       ROC            MF(Q_{i})
PFE       0.064923  1.568456               1.0
CSCO      0.073785  0.762107               2.0
MRK       0.073066  0.762207               3.0
INTC      0.096065  0.395849               4.0
WBA       0.073070  0.602746               5.0
JNJ       0.054940  0.799281               6.0
VZ        0.094883  0.292956               7.0
KO        0.047607  2.493686               8.0
CAT       0.090941  0.292432               9.0
IBM       0.062117  0.622170              10.0
MMM       0.070541  0.509469              11.0
PG        0.048131  1.168062              12.0
V         0.036646  1.525756              13.0
DOW       0.090799  0.122963              14.0
HD        0.052903  0.520940              15.0
AAPL      0.038936  0.694292              16.0
WMT       0.054583  0.208220              17.0
MCD       0.050439  0.230028              18.0
UNH       0.057999 -1.831291              19.0
MSFT      0.033030  0.345854              20.0
NKE       0.020799  0.151520              21.0
------------------------------------------------


### (4) How to invest using Magic formula

We are in the process of investing in stocks with $MF (Q_ {i})$ in the top 20. It is also recommended to recalculate and refresh $MF (Q_ {i})$ about once a year.

3 Coming Soon How much return can you get if you take the Magic formula strategy for Japanese stocks? I would like to do coding in Python and verify it.

Recommended Posts