Skip to content

Commit c21f803

Browse files
authored
Merge pull request #1 from jingwu74/Algorithm26-BookToMarketAnomaly
Add new algorithm Book-to-Market Value Anomaly
2 parents 1033cc4 + b46d6b4 commit c21f803

File tree

6 files changed

+57
-0
lines changed

6 files changed

+57
-0
lines changed

04 Strategy Library/00 Strategy Library/01 Strategy Library.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@
198198
],
199199
'description' => 'Buys each month the 20% of commodities with the highest roll-returns and shorts the 20% of commodities with the lowest roll-returns and holds the long-short positions for one month.'
200200
],
201+
[
202+
'name' => 'Book-to-Market Value Anomaly',
203+
'link' => 'strategy-library/book-to-market-value-anomaly',
204+
'sources' => [
205+
'Quantpedia' => 'https://www.quantpedia.com/Screener/Details/26'
206+
],
207+
'description' => 'Quintile portfolios are formed based on the Book-to-Market ratio and the highest quintile is held for one year.'
208+
],
201209
];
202210

203211
?>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<p>
2+
Book-to-market ratio is used to find the value of a company by comparing the book value of a firm to its market value. The definition of the book-to-market ratio is
3+
\[Book\ to\ Market \ Ratio=\frac{Common\ Shareholders \ Equity}{Market \ Cap}=\frac{book \ value \ per \ share}{Market \ price \ per \ share}\]
4+
Book value represents a company's assets minus its liabilities and sometimes is referred to as shareholders' equity.
5+
Price-to-Book Ratio is defined as
6+
\[Price \ to \ Book\ Ratio=\frac{Market \ price \ per \ share}{book \ value \ per \ share}\]
7+
Therefore, we can see the Book-to-market ratio is the inverse of the P/B ratio.
8+
The book-to-market ratio suggests how much investors are paying against each dollar of book value in the balance sheet.
9+
The bigger the ratio is, the more fundamentally cheap is the investigated company. This algorithm will create the portfolio with this factor.
10+
</p>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<p>
2+
To construct the universe, first we eliminate stocks which don't have fundmental data. In <code>FineSelectionFunction</code>,
3+
we calculate the market cap with PE ratio, earning per shares and shares outstanding and assign the property <code>MarketCap</code>
4+
to each fine fundamental object. The universe is narrowed to top 20% companies with the highest market cap.
5+
</P>
6+
<p>
7+
According to the algorithm, the portfolio is weighted based on market cap. We calculte the weight in <code>FineSelectionFunction</code> and save
8+
them in <code>self.weights</code>.
9+
</P>
10+
<div class="section-example-container">
11+
<pre class="python">
12+
fine = [x for x in fine if (x.ValuationRatios.PBRatio > 0)]
13+
for i in fine:
14+
i.MarketCap = float(i.EarningReports.BasicAverageShares.ThreeMonths * (i.EarningReports.BasicEPS.TwelveMonths*i.ValuationRatios.PERatio))
15+
top_market_cap = sorted(fine, key = lambda x:x.MarketCap, reverse=True)[:int(len(fine)*0.2)]
16+
top_bm = sorted(top_market_cap, key = lambda x: 1 / x.ValuationRatios.PBRatio, reverse=True)[:int(len(top_market_cap)*0.2)]
17+
self.sorted_by_bm = [i.Symbol for i in top_bm]
18+
total_market_cap = np.sum([i.MarketCap for i in top_bm])
19+
self.weights = {}
20+
for i in top_bm:
21+
self.weights[str(i.Symbol)] = i.MarketCap/total_market_cap
22+
return self.sorted_by_bm
23+
</pre>
24+
</div>
25+
<p>
26+
In the next step, we sort the stocks with the inverse of P/B ratio by descending order. Quintile portfolios are then formed based on the Book-to-Market ratio and the highest quintile is held for one year.
27+
</p>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div class="qc-embed-frame" style="display: inline-block; position: relative; width: 100%; min-height: 100px; min-width: 300px;">
2+
<div class="qc-embed-dummy" style="padding-top: 56.25%;"></div>
3+
<div class="qc-embed-element" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;">
4+
<iframe class="qc-embed-backtest" height="100%" width="100%" style="border: 1px solid #ccc; padding: 0; margin: 0;" src="https://www.quantconnect.com/terminal/index.php?key=processCache&request=embedded_backtest_d8cd05d85b47eea4381d2ca20abf2f74.html"></iframe>
5+
</div>
6+
</div>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul>
2+
<li>
3+
<a href="https://quantpedia.com/Screener/Details/26" rel="nofollow">Quantpedia - Value (Book-to-Market) Anomaly</a>
4+
</li>
5+
</ul>

quantpedia.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@
1616
21: "203a6729604c80a71b5c3b2baa2b3f69",
1717
22: "d7285b5353d51cd5bd033f205e5faf44",
1818
25: "da3bf5ee608fb8b7dc952372dd925542",
19+
26: "d8cd05d85b47eea4381d2ca20abf2f74",
1920
}

0 commit comments

Comments
 (0)