calculate_pe_ratio
Calculate the price-to-earnings (P/E) ratio: share price divided by earnings per share — how much investors pay per unit of earnings. Formula: P/E = Share Price / EPS. WHEN TO USE: Use for relative valuation against peers, sector averages, or a company’s own history. Higher P/E = market expects higher growth. WHEN NOT TO USE: Do NOT use when EPS is negative or near zero (ratio becomes meaningless), and prefer forward P/E for growth companies. BEHAVIOUR: pure deterministic calculation — no side effects, no network or storage access; idempotent and non-destructive; identical inputs always produce identical outputs. Division by zero or non-finite inputs returns an explicit error instead of a number. RETURNS: JSON object { pe_ratio: number (e.g. 18.5 = 18.5x), inputs }. PARAMETERS: share_price (required): Current share price in currency units, e.g. 45.00. Must be > 0. earnings_per_share (required): Earnings per share (trailing or forward), e.g. 2.43. Must be > 0 for a meaningful ratio.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| share_price | Yes | Current share price in currency units, e.g. 45.00. Must be > 0. | |
| earnings_per_share | Yes | Earnings per share (trailing or forward), e.g. 2.43. Must be > 0 for a meaningful ratio. |