Contents

# Strategy Library

## ROA Effect within Stocks

### Introduction

Return on Equity(ROE) is defined as the ratio of net income over shareholders equity, where shareholdersâ€™ equity is the difference between a company's total assets and total liabilities. Shareholders' equity is often referred to as the book value of the company. ROE is a measure of how efficiently a company uses its assets to produce earnings. It can explain many anomalies related to earnings and profitability. This algorithm will build a long-short portfolio with ROE factor.

### Method

The investment universe contains all stocks on NYSE and AMEX and Nasdaq. In CoarseSelectionFunction, we eliminated ETFs which does not have fundamental data.

def CoarseSelectionFunction(self, coarse):
if self.monthly_rebalance:
self.coarse = True
filteredCoarse = [x.Symbol for x in coarse if x.HasFundamentalData]
return filteredCoarse
else:
return []


In FineSelectionFunction, stocks with sales greater than 10 milion USD are selected. Then we calculate the market cap for those stocks and sort them into two groups: Big size group with the higher market cap and small size group with the lower market cap. Each half is then divided into deciles based on Return on assets (ROA).

def FineSelectionFunction(self, fine):
if self.monthly_rebalance:
fine =[i for i in fine if i.EarningReports.BasicAverageShares.ThreeMonths != 0
and i.EarningReports.BasicEPS.TwelveMonths != 0
and i.ValuationRatios.PERatio != 0
# sales is greater than 10 million
and i.ValuationRatios.SalesPerShare*i.EarningReports.DilutedAverageShares.Value > 10000000
and i.OperationRatios.ROA.Value != 0]
for i in fine:
i.MarketCap = float(i.EarningReports.BasicAverageShares.ThreeMonths * (i.EarningReports.BasicEPS.TwelveMonths*i.ValuationRatios.PERatio))
# sort into 2 halfs based on market capitalization
sorted_market_cap = sorted(fine, key = lambda x:x.MarketCap, reverse=True)
top = sorted_market_cap[:int(len(sorted_market_cap)*0.5)]
bottom = sorted_market_cap[-int(len(sorted_market_cap)*0.5):]
# each half is then divided into deciles based on Return on Assets (ROA)
sortedTopByROA = sorted(top, key = lambda x: x.OperationRatios.ROA.Value, reverse = True)
sortedBottomByROA = sorted(bottom, key = lambda x: x.OperationRatios.ROA.Value, reverse = True)
# long top decile from each market capitalization group
long = sortedTopByROA[:int(len(sortedTopByROA)*0.1)] + sortedBottomByROA[:int(len(sortedTopByROA)*0.1)]
self.longStocks = [i.Symbol for i in long]
# short bottom decile from each market capitalization group
short = sortedTopByROA[-int(len(sortedTopByROA)*0.1):] + sortedBottomByROA[-int(len(sortedTopByROA)*0.1):]
self.shortStocks = [i.Symbol for i in short]

return self.longStocks+self.shortStocks
else:
return []


The algorithm goes long the top decile from each market capitalization group and short the bottom decile. The strategy is rebalanced monthly and stocks are equally weighted.

  def OnData(self, data):
if not (self.monthly_rebalance and self.coarse): return
self.coarse = False
self.monthly_rebalance = False
stocks_invested = [x.Key for x in self.Portfolio if x.Value.Invested]
for i in stocks_invested:
if i not in self.longStocks+self.shortStocks:
self.Liquidate(i)

long_weight = 0.5/len(self.longStocks)
for i in self.longStocks:
self.SetHoldings(i, long_weight)

short_weight = 0.5/len(self.shortStocks)
for i in self.shortStocks:
self.SetHoldings(i, -short_weight)


### Source

You can also see our Documentation and Videos. You can also get in touch with us via Chat.