$r Rate of return * * @return float * * @since 1.0.0 */ public static function getHoldingPeriodReturn(array $r) : float { $hpr = 1.0; foreach ($r as $value) { $hpr *= 1 + $value; } return $hpr - 1; } /** * Net Asset Value * * @param float $assets Fund assets * @param float $liabilities Fund liabilities * @param int $shares Outstanding shares * * @return float * * @since 1.0.0 */ public static function getNetAssetValue(float $assets, float $liabilities, int $shares) : float { return ($assets - $liabilities) / $shares; } /** * Price to Book Value * * @param float $market Market price per share * @param float $book Book value per share * * @return float * * @since 1.0.0 */ public static function getPriceToBookValue(float $market, float $book) : float { return $market / $book; } /** * Price to Earnings (P/E Ratio) * * @param float $price Price per share * @param float $earnings Earnings per share * * @return float * * @since 1.0.0 */ public static function getPriceEarningsRatio(float $price, float $earnings) : float { return $price / $earnings; } /** * Price to Sales (P/S Ratio) * * @param float $price Price per share * @param float $sales Sales per share * * @return float * * @since 1.0.0 */ public static function getPriceToSalesRatio(float $price, float $sales) : float { return $price / $sales; } /** * Stock - PV with Constant Growth * * @param float $dividend Estimated dividends for next period * @param float $r Required rate of return * @param float $g Growth rate * * @return float * * @since 1.0.0 */ public static function getPresentValueOfStockConstantGrowth(float $dividend, float $r, float $g = 0.0) : float { return $dividend / ($r - $g); } /** * Tax Equivalent Yield * * @param float $free Tax free yield * @param float $tax Tax rate * * @return float * * @since 1.0.0 */ public static function getTaxEquivalentYield(float $free, float $tax) : float { return $free / (1 - $tax); } /** * Total Stock Return * * @param float $P0 Initial stock price * @param float $P1 Ending stock price * @param float $D Dividends * * @return float * * @since 1.0.0 */ public static function getTotalStockReturn(float $P0, float $P1, float $D) : float { return ($P1 - $P0 + $D) / $P0; } /** * Yield to Maturity * * @param float $C Coupon/interest payment * @param float $F Face value * @param float $P Price * @param int $n Years to maturity * * @return float * * @since 1.0.0 */ public static function getYieldToMaturity(float $C, float $F, float $P, int $n) : float { return ($C + ($F - $P) / $n) / (($F + $P) / 2); } /** * Zero Coupon Bond Value * * @param float $F Face value * @param float $r Rate or yield * @param int $t Time to maturity * * @return float * * @since 1.0.0 */ public static function getZeroCouponBondValue(float $F, float $r, int $t) : float { return $F / \pow(1 + $r, $t); } /** * Zero Coupon Bond Effective Yield * * @param float $F Face value * @param float $PV Present value * @param int $n Time to maturity * * @return float * * @since 1.0.0 */ public static function getZeroCouponBondEffectiveYield(float $F, float $PV, int $n) : float { return \pow($F / $PV, 1 / $n) - 1; } }