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

PEG Ratio

Install and import#

bash
npm install fintech-algorithms
ts
import { pegRatio } from "fintech-algorithms/fundamental-analysis-and-valuation/relative-valuation/peg-ratio";

Signature#

pegRatio(rawInputs)

Divides forward P/E by expected EPS growth measured in percentage points for the target and for every peer, compares the target's PEG against the peer median, and re-prices the target at that median PEG when a forward EPS is supplied.

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 forward_pe and a positive expected_eps_growth_percent (percentage points, not a decimal), plus an optional positive forward_earnings_per_share and an optional current_price. peers holds at least three objects, each with a nonempty and unique string id, a positive forward_pe and a positive expected_eps_growth_percent.

Returns#

Record<string, unknown>

model, growth_unit fixed at percentage-points, peer_count, peer_ratios (per peer: id, forward_pe, expected_eps_growth_percent, peg_ratio), peg_summary with minimum, median, maximum and range, target_forward_pe, target_growth_percent, target_peg_ratio, selected_peer_peg which is the peer median, relative_peg (target PEG over that median), implied_forward_pe (median peer PEG times the target's growth), forward_earnings_per_share, implied_price — both null when no forward EPS was supplied — premium_discount_to_current, and state, either valuation-complete or ratio-only.

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 a target or peer forward_pe or expected_eps_growth_percent, or a supplied forward_earnings_per_share or 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": {
    "forward_pe": 24,
    "expected_eps_growth_percent": 12,
    "forward_earnings_per_share": 2.5,
    "current_price": 60
  },
  "peers": [
    {
      "id": "G1",
      "forward_pe": 18,
      "expected_eps_growth_percent": 15
    },
    {
      "id": "G2",
      "forward_pe": 21,
      "expected_eps_growth_percent": 15
    },
    {
      "id": "G3",
      "forward_pe": 24,
      "expected_eps_growth_percent": 15
    }
  ]
}

Call#

pegRatio(rawInputs)

Returns#

object with 15 fields: model, growth_unit, peer_count, peer_ratios, peg_summary, target_forward_pe, target_growth_percent, target_peg_ratio, …

{
  "model": "forward-pe-divided-by-growth-percentage-points",
  "growth_unit": "percentage-points",
  "peer_count": 5,
  "peer_ratios": [
    {
      "id": "G1",
      "forward_pe": 18,
      "expected_eps_growth_percent": 15,
      "peg_ratio": 1.2
    },
    {
      "id": "G2",
      "forward_pe": 21,
      "expected_eps_growth_percent": 15,
      "peg_ratio": 1.4
    },
    {
      "id": "G3",
      "forward_pe": 24,
      "expected_eps_growth_percent": 15,
      "peg_ratio": 1.6
    }
  ],
  "peg_summary": {
    "minimum": 1.2,
    "median": 1.6,
    "maximum": 2,
    "range": 0.8
  },
  "target_forward_pe": 24,
  "target_growth_percent": 12,
  "target_peg_ratio": 2,
  "selected_peer_peg": 1.6,
  "relative_peg": 1.25,
  "implied_forward_pe": 19.200000000000003,
  "forward_earnings_per_share": 2.5,
  "implied_price": 48.00000000000001,
  "premium_discount_to_current": -0.19999999999999984
}

Showing 14 of 15 fields.

Other exports#

This module also exports calculate, pEComparableValuation, evEbitdaComparableValuation, priceToBookValuation, 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#

PEG Ratio — article hero
PEG Ratio — decision boundaries
PEG Ratio — method selection
PEG Ratio — 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#