fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

P/E Comparable Valuation

Install and import#

bash
npm install fintech-algorithms
ts
import { pEComparableValuation } from "fintech-algorithms/fundamental-analysis-and-valuation/relative-valuation/p-e-comparable-valuation";

Signature#

pEComparableValuation(rawInputs)

Values a target company off its peer group by dividing each peer's price by its earnings per share, taking the median of those P/E ratios, and multiplying that median by the target's own earnings per share.

Parameters#

NameTypeNotes
rawInputsunknownDeclared unknown and narrowed at runtime. It must be a plain object with a target object and a peers array. target supplies a positive earnings_per_share and an optional current_price. peers holds at least three objects, each with a nonempty and unique string id, a positive price and a positive earnings_per_share.

Returns#

Record<string, unknown>

model, peer_count, peer_multiples (one row per peer carrying id, price, earnings_per_share and pe_ratio), multiple_summary with minimum, median, maximum and range, selected_multiple which is that median, target_earnings_per_share, implied_price, premium_discount_to_current (implied price divided by target.current_price minus one, or null when no current price was given) and state, always valuation-complete.

Errors#

  • When rawInputs, target or a peer row is not a plain object, or a numeric field is not a finite number — throws TypeError
  • When peers is not an array of at least three rows, or a peer id is missing, blank or duplicated — throws RangeError
  • When target.earnings_per_share, a peer price, a peer earnings_per_share or target.current_price is not greater than zero — throws RangeError

Complexity: time O(n log n), space O(n).

Worked example#

verified This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.

Input#

rawInputs
{
  "target": {
    "earnings_per_share": 2.4,
    "current_price": 40
  },
  "peers": [
    {
      "id": "P1",
      "price": 28,
      "earnings_per_share": 2
    },
    {
      "id": "P2",
      "price": 48,
      "earnings_per_share": 3
    },
    {
      "id": "P3",
      "price": 63,
      "earnings_per_share": 3.5
    }
  ]
}

Call#

pEComparableValuation(rawInputs)

Returns#

object with 9 fields: model, peer_count, peer_multiples, multiple_summary, selected_multiple, target_earnings_per_share, implied_price, premium_discount_to_current, …

{
  "model": "median-positive-eps-peer-pe",
  "peer_count": 5,
  "peer_multiples": [
    {
      "id": "P1",
      "price": 28,
      "earnings_per_share": 2,
      "pe_ratio": 14
    },
    {
      "id": "P2",
      "price": 48,
      "earnings_per_share": 3,
      "pe_ratio": 16
    },
    {
      "id": "P3",
      "price": 63,
      "earnings_per_share": 3.5,
      "pe_ratio": 18
    }
  ],
  "multiple_summary": {
    "minimum": 14,
    "median": 18,
    "maximum": 22,
    "range": 8
  },
  "selected_multiple": 18,
  "target_earnings_per_share": 2.4,
  "implied_price": 43.199999999999996,
  "premium_discount_to_current": 0.07999999999999985,
  "state": "valuation-complete"
}

Other exports#

This module also exports calculate, evEbitdaComparableValuation, priceToBookValuation, pegRatio, peerMultipleRegression. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams#

P/E Comparable Valuation — article hero
P/E Comparable Valuation — decision boundaries
P/E Comparable Valuation — method selection
P/E Comparable Valuation — system map

How it works#

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References#

The rest of the Relative Valuation family#