image

A price-to-earnings ratio compares with another period only while its date stays on the value.

The ratios module returns one ticker. Each field is a date mapped to a value. There is no example file, so the amounts below stay placeholders. The date keys are from an annual response.

To access this endpoint, you must obtain an API key: Get your API key

Request annual ratios

GET /v1/markets/stock/modules with module=ratios. timeframe accepts annually, quarterly, or trailing. Omitting it selects annually. Documentation: stock modules.

import requests

url = "https://api.mboum.com/v1/markets/stock/modules"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
params = {"ticker": "AAPL", "module": "ratios", "timeframe": "annually"}

response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
payload = response.json()
pe = payload["body"]["pe"]
for date, value in pe.items():
    print(date, value)

Print each price-to-earnings entry with its date

meta.symbol is the ticker. meta.keys holds the description. The values are numbers. roe and currentratio are sibling maps, each with its own dates.

{
  "meta": {
    "symbol": "AAPL",
    "keys": {
      "pe": "Price-to-Earnings Ratio (P/E Ratio), the ratio of a company's share price to its earnings per share."
    }
  },
  "body": {
    "pe": {
      "TTM": "<value>",
      "2025-09-27": "<value>",
      "2024-09-28": "<value>",
      "2023-09-30": "<value>",
      "2022-09-24": "<value>",
      "2021-09-25": "<value>"
    }
  }
}

TTM is a key on that map beside the period-end dates.

Learn more or explore other endpoints: stock modules

How to Read Short Interest with the Mboum API Oct 22, 2026

How to Read Short Interest with the Mboum API

Read short interest for one stock as a settlement-date series of shares short and days to cover.

How to Read Congressional Insider Trades with the Mboum API Oct 19, 2026

How to Read Congressional Insider Trades with the Mboum API

A congressional insider page can be ranked once the dollar text on each row is a number.

How to Calculate MACD with the Mboum API Oct 18, 2026

How to Calculate MACD with the Mboum API

The MACD line, the signal, and the histogram stay on one timestamp when the three periods go out on the request.

How to Calculate RSI with the Mboum API Oct 18, 2026

How to Calculate RSI with the Mboum API

Relative strength stays with the price series you send, one RSI reading for each timestamp.