The Problem: Different P/E on Different Sites

For the same company (Microsoft) on the same date (May 6, 2023), different financial services show different P/E ratios: Stockopedia — 28.93, Morningstar — 32.05, Macrotrends — 32.66, Yahoo Finance — 33.80, Companies Market Cap — 34.4. The reason is different calculation approaches: trailing-twelve-month vs fiscal-year-end earnings, different data sources and methodologies.

Step 1: Understand the P/E Formula

P/E = Stock Price / Earnings Per Share (EPS). EPS can be calculated in different ways: over the last 12 months (TTM), last fiscal year, or forecasted. Each gives a different result.

Step 2: Use Open Source Code for Consistent Calculation

The author of the project published code on GitHub that calculates P/E using a single methodology, using data from open sources (e.g., company financial reports). This allows you to get comparable values for different companies and periods.

Step 3: Apply in Practice

Clone the repository, install dependencies, and run the script for the company you are interested in. You will get a P/E calculated using the standard TTM formula, eliminating discrepancies between sites.

FAQ

Why do different sites show different P/E?
Due to different earnings sources (TTM, annual, forecast) and different data update times.

Where to get the code?
GitHub repository (search for "open-source P/E calculator").

Can I trust open source code?
Yes, the code is transparent; you can check the logic and adapt it to your needs if necessary.

VirtCardPay

A virtual card in 2 minutes

Pay for subscriptions, AI tools, travel, and international stores. Top up via USDT-TRC20 with no acquiring fees.

Open in Telegram Learn more about the service →

Sources

This material is for informational purposes only and is not financial advice. Data and service terms may change, so check primary sources before making a payment or investment decision. Mentions of third-party brands and services do not imply official partnership, support, or endorsement by VirtCardPay.
Back