From c507e60e1d3e80f558c2579b29ecfd9ee9091caa Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 11 Jan 2017 23:57:32 +0100 Subject: [PATCH] Market share calculation --- Math/Finance/FinanceFormulas.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Math/Finance/FinanceFormulas.php b/Math/Finance/FinanceFormulas.php index e180935f9..e9496f292 100644 --- a/Math/Finance/FinanceFormulas.php +++ b/Math/Finance/FinanceFormulas.php @@ -1397,4 +1397,36 @@ class FinanceFormulas return $P * $r * $t; } + /** + * Relative market share by share + * + * @param float $ownShare Own market share + * @param float $competitorShare Largest competitor market share + * + * @return float + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public static function getRelativeMarketShareByShare(float $ownShare, float $competitorShare) : float + { + return $ownShare / $competitorShare; + } + + /** + * Relative market share by sales + * + * @param float $ownSales Own sales + * @param float $competitorSales Largest competitor sales + * + * @return float + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public static function getRelativeMarketShareBySales(float $ownSales, float $competitorSales) : float + { + return $ownSales / $competitorSales; + } + }