/* Model: Capital Asset Pricing Model (CAPM) © Copyright: Discounting Cash Flows Inc. (discountingcashflows.com) 8 The Green, Dover, DE 19901 */ Input( { _MARKET_PREMIUM: '', _RISK_FREE_RATE: '', BETA: '', } ); $.when( get_profile(), get_treasury(), get_fx(), get_risk_premium()).done( function($profile, $treasury, $fx, $risk_premium){ var response = new Response({ profile: $profile, treasury: $treasury, risk_premium: $risk_premium, }); // +---------------- ASSUMPTIONS SECTION -----------------+ setAssumption('_MARKET_PREMIUM', response.risk_premium.totalEquityRiskPremium ); // Set beta (used in calculating the discount rate) if(response.profile.beta){ setAssumption('BETA', response.profile.beta); } else{ setAssumption('BETA', 1); } // Risk free rate is the yield of the 10 year treasury note setAssumption('_RISK_FREE_RATE', response.treasury.year10); // Expected Return var expectedReturn = getAssumption('_RISK_FREE_RATE') + getAssumption('BETA')*getAssumption('_MARKET_PREMIUM'); // If we are calculating the value per share for a watch, we can stop right here. if(_StopIfWatch(toP(expectedReturn), '%')){ return; } print(expectedReturn, "Cost of Equity", '%'); }); Description(`
Read more: GitHub Documentation
`);