Stock selection with the mad CAPM and liquidity filtering

Published on September 2020 | Categories: Documents | Downloads: 2 | Comments: 0 | Views: 70
of x
Download PDF   Embed   Report

Comments

Content

 

Stock selection with the mad CAPM and liquidity filtering  Ivan Idris Idris

The Capital Asset Pricing Model ( Model ( CAPM ) usually uses variance or standard deviation as a risk metric. I invented a slight modification of the model, which I call the mad CAPM ( well OK maybe I did not invent it, but I don’t know if anyone else did ). M.A.D here is median absolute deviation  deviation  not to be confused with mutual assured destruction or destruction or the other thing. It should be a more robust statistical measure of risk. The liquidity filter works almost the same way as the CAPM, but instead of trying to maximize expected return, the goal is to maximize liquidity. Liquidity is after all a good thing. So the plan for today is: 1. Screen stocks with the the mad mad CAPM. CAPM. 2. Screen stocks stocks with with the liquidi liquidity ty filter. filter. 3. Pr Prof ofit it!!

The mad CAPM The median absolute deviation  deviation of a sample is calculated by: 1. 2. 3. 4.

Fi Find ndin ing g tthe he median. median. Subtracting Subtracting the median median in the previous previous step from each element. element. Taking the the absolute absolute value of each differ difference. ence. Determining Determining the the median median of the absolut absolutee values.

The code. 1 def mad( arr ): 2   mdn = median( arr ) 3   4 return median( abs( arr - mdn ) )

and unit test. 1 2 3 4

...     ...

actual = mad( [ 1, 1, 2, 2, 4, 6, 9 ] ) assert actual == 1, 'incorrect mad' + str(actual)

Liquidity filter mean of  of the daily volumes. So I apply the mad CAPM The liquidity is estimated by the geometric mean with this liquidity figure instead of the expected returns. 1 2 3 4

...   ev = geomean( returns[ 0 ] )   evs.append( ev )

5 6 7

   

madC = mad( returns[ 0 ] ) mads.append( mads.append ( madC )

 

8 9 10 11 12 13 14 15 16 17 18

 

19 20 21 22 23 24 25 26 27 28 29

 

liq = geomean( v ) liqs.append( liq )   beforeLastReturn = c[ len( c ) - 2 ] / c[ len( c ) - 3 ] - 1        

if beforeLastReturn > 0: continue t = file.replace('.csv', file.replace('.csv', ''), ev, madC, liq records.append( records.app end( t )

( a,b,residuals ) = fitline( mads, evs ) ( aLiq, bLiq, residuals ) = fitline( mads, liqs )   for t in records:   symbol, evC, madC, liq = t   if evC > a * madC + b:   if liq > aLiq * madC + bLiq: ...

Guidee by yours If you liked this post and are interested in NumPy check out NumPy out  NumPy Beginner’s Guid truly.

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close