# Track guidance revisions with an API: initial forecast, revisions and achievement rate

Turn Japanese companies' published guidance into a table per fiscal year: initial forecast, each upgrade or downgrade, the actual result and the achievement rate.

When you check a customer's or competitor's outlook, do you look only at the latest guidance in the kessan tanshin (earnings summary)? Japanese companies publish full-year guidance with their annual results and revise it with each quarterly report, up or down. The latest figure alone does not tell you how far it moved from the start of the year, or how well the company has delivered on its plans in past years.

The script on this page pulls the guidance history and actual results through an API and builds one table per fiscal year: initial forecast, revisions, actual and achievement rate. The examples use data retrieved from ZENITH Code on October 29, 2026 for Toyota Motor (7203, March year-end), Fast Retailing (9983, August year-end) and Kao (4452, December year-end).

## What you will get from this page

- How to work out which fiscal year a guidance row refers to, including companies whose year does not end in March
- How to order rows by announcement time and count revisions and their direction
- When the achievement rate (actual ÷ latest forecast) is meaningful, and when it is not
- How to handle the price-derived values and document links that arrive with the guidance

## The job: following guidance over a year

To show how a company's plan changed, you need four sets of guidance for one fiscal year, from the annual results release through the third-quarter release. Then you add the actual result a year later to see whether the plan was met. Five competitors over five years means opening about a hundred releases.

[`/earnings-forecast`](https://zenithcode.net/en/docs/earnings-forecast) returns the revenue, operating income, net income and EPS guidance printed in each earnings release, one row per release, for one token per call. `limit=20` covers roughly five years. Actual results come from [`/income-statement`](https://zenithcode.net/en/docs/income-statement), so each company costs two tokens.

## Do not accept price-derived values or document links

Besides the forecast values, the `/earnings-forecast` response includes these fields.

| Field | Contents | Handling on this page |
|---|---|---|
| `perForecast`, `psrForecast`, `pegRatioForecast` | Multiples computed from guidance and the share price | Not kept. Never shown on screen or in articles |
| `archiveUrl` | A PDF served through ZENITH Code's delivery route (needs an API key) | Not kept. Do not put filing PDFs or links in your material |
| `sourceUrl` | Official viewing link; EDINET only while the filing is viewable, null for TDnet | Kept for EDINET rows only |

Copying only the fields you need means nothing unexpected reaches the table if the API adds fields later.

```python
import csv, json, os, urllib.parse, urllib.request
from datetime import datetime, timedelta, timezone

BASE = "https://api.zenithcode.net/stable"
API_KEY = os.environ.get("ZENITH_API_KEY", "YOUR_API_KEY")
JST = timezone(timedelta(hours=9))

# Do not keep perForecast, psrForecast, pegRatioForecast (price-derived) or archiveUrl (filing PDF)
KEEP = ("fiscalPeriod", "period", "forecastTarget", "forecastFiscalPeriod", "accountingStandard",
        "announcedAt", "source", "docId", "revenueForecast", "operatingIncomeForecast",
        "netIncomeForecast")


def get(path, **params):
    url = f"{BASE}{path}?{urllib.parse.urlencode(params)}"
    req = urllib.request.Request(url, headers={"x-api-key": API_KEY})
    with urllib.request.urlopen(req, timeout=30) as res:
        return json.load(res)


def forecasts(symbol):
    rows = []
    for r in get("/earnings-forecast", symbol=symbol, limit=20):   # omit period to get quarterly rows too
        row = {k: r.get(k) for k in KEEP}
        if row["source"] != "edinet":
            row["docId"] = None        # keep TDnet document IDs out of the table
        rows.append(row)
    return rows
```

## Find the fiscal year a forecast refers to

A guidance row's `fiscalPeriod` is the period of the release that carried the forecast, not the period being forecast. There are two kinds of rows.

| Row (`period`) | Guidance it carries | `forecastTarget` |
|---|---|---|
| `FY` (annual results) | Full-year guidance for the next fiscal year (the initial forecast) | `next-fiscal-year` |
| `Q1` to `Q3` | Full-year guidance for the current fiscal year, as of that quarter | `current-fiscal-year` |

FY rows carry the target year-end in `forecastFiscalPeriod`. Quarterly rows have `forecastFiscalPeriod` set to null, so the script adds the months left from the quarter end to the year-end.

```python
MONTHS_TO_YEAR_END = {"Q1": 9, "Q2": 6, "Q3": 3, "FY": 0}


def add_months(ym, n):
    total = int(ym[:4]) * 12 + int(ym[5:7]) - 1 + n
    return f"{total // 12:04d}-{total % 12 + 1:02d}"


def target_period(row):
    if row.get("forecastFiscalPeriod"):
        return row["forecastFiscalPeriod"]
    months = MONTHS_TO_YEAR_END.get(row.get("period"))
    if months is None or not row.get("fiscalPeriod"):
        return None
    year_end = add_months(row["fiscalPeriod"], months)
    if row.get("forecastTarget") == "current-fiscal-year":
        return year_end
    if row.get("forecastTarget") == "next-fiscal-year":
        return add_months(year_end, 12)
    return None
```

| Company (year-end) | Row | Calculation | Target fiscal year |
|---|---|---|---|
| Toyota Motor (March) | `Q1` of `2025-06` | add 9 months | ending March 2026 |
| Fast Retailing (August) | `Q3` of `2026-05` | add 3 months | ending August 2026 |
| Kao (December) | `Q1` of `2026-03` | add 9 months | ending December 2026 |
| Fast Retailing (August) | `FY` of `2025-08` | value of `forecastFiscalPeriod` | ending August 2026 |

Hard-coding "Q1 means June" pairs the wrong year's guidance with the wrong actuals for August and December year-end companies.

## Order by announcement time and label each revision

Group the rows by target fiscal year and sort by `announcedAt`. The first row is the initial forecast; later rows are revisions, each labeled by comparison with the previous one.

```python
def jst_date(iso):
    return datetime.fromisoformat(iso.replace("Z", "+00:00")).astimezone(JST).date().isoformat()


def group_by_target(rows):
    groups, skipped = {}, {"no target year": 0, "no announcement time": 0}
    for r in rows:
        target = target_period(r)
        if target is None:
            skipped["no target year"] += 1
        elif not r.get("announcedAt"):
            skipped["no announcement time"] += 1   # do not guess a date
        else:
            groups.setdefault(target, []).append(r)
    for entries in groups.values():
        entries.sort(key=lambda r: r["announcedAt"])
    return groups, skipped


def direction(before, after):
    if before is None or after is None:
        return ""
    return "up" if after > before else "down" if after < before else "unchanged"
```

Rows the script sets aside are counted by reason and printed at the end. This matters most when a row without an announcement time is an FY row: that year then loses its initial forecast, and the Q1 guidance shows up as "initial." Printing the count lets whoever builds the deck notice.

## Line up actuals and compute the achievement rate

Actual results come from the income statement row for the same fiscal year. For net income, the script prefers net income attributable to owners of the parent.

```python
ACTUAL = {"revenue": "revenue", "operatingIncome": "operatingIncome",
          "netIncome": "netIncomeAttributableToOwners"}


def plan_vs_actual(symbol, metric="operatingIncome"):
    groups, skipped = group_by_target(forecasts(symbol))
    actuals = {y["fiscalPeriod"]: y for y in
               get("/income-statement", symbol=symbol, period="annual", limit=6)}
    out = []
    for target in sorted(groups):
        entries, prev = groups[target], None
        for i, e in enumerate(entries):
            value = e[metric + "Forecast"]
            late = jst_date(e["announcedAt"])[:7] > target     # announced after the year ended
            out.append({"target": target, "stage": "initial" if i == 0 else f"revision {i}",
                        "basis": f'{e["fiscalPeriod"]} {e["period"]}',
                        "announced": jst_date(e["announcedAt"]), "source": e["source"],
                        "docId": e["docId"], "value": value, "direction": direction(prev, value),
                        "late": late})
            prev = value if value is not None else prev
        actual_row = actuals.get(target)
        if actual_row:
            actual = actual_row.get(ACTUAL[metric])
            if metric == "netIncome" and actual is None:
                actual = actual_row.get("netIncome")
            latest = next((e for e in reversed(entries) if not (jst_date(e["announcedAt"])[:7] > target)), entries[-1])
            forecast = latest[metric + "Forecast"]
            same_std = not (latest["accountingStandard"] and actual_row["accountingStandard"]
                            and latest["accountingStandard"] != actual_row["accountingStandard"])
            rate = actual / forecast if (actual is not None and forecast and forecast > 0 and same_std) else None
            out.append({"target": target, "stage": "actual", "value": actual})
            out.append({"target": target, "stage": "achievement", "value": rate})
    return out, skipped
```

The achievement rate is reported only when three conditions hold.

- **The latest forecast is positive.** If a company forecasts a loss and the loss comes in smaller, the ratio falls below 1 and reads backwards.
- **The denominator is guidance issued before the year ended.** Guidance announced after the target year closed stays in the table but is not used. Comparing against late guidance makes the plan look closer to the actual than it was.
- **Forecast and actual use the same accounting standard.** Dividing Japanese GAAP guidance into an IFRS result compares figures with different scopes.

## Write the CSV

```python
def write(symbols, metric="operatingIncome", path="plan-vs-actual.csv"):
    cols = ["symbol", "target", "stage", "basis", "announced", "source", "docId",
            "value", "direction", "late"]
    with open(path, "w", newline="", encoding="utf-8-sig") as f:
        w = csv.DictWriter(f, fieldnames=cols)
        w.writeheader()
        for s in symbols:                                     # one company at a time
            rows, skipped = plan_vs_actual(s, metric)
            for r in rows:
                w.writerow({"symbol": s, **r})
            print(s, "set aside:", skipped)


write(["7203", "9983", "4452"])
```

Amounts are in yen and the achievement rate is a 0–1 decimal. Missing values are blank, including guidance the company published as "undetermined."

## Sample output: Toyota Motor, operating income for the year ended March 2026

| Stage | Basis | Announced | Operating income (¥100 million) | Direction | Source |
|---|---|---|---:|---|---|
| Initial | 2025-03 FY | 2025-06-18 | 38,000.0 | | EDINET |
| Revision 1 | 2025-06 Q1 | 2025-08-07 | 32,000.0 | down | TDnet |
| Revision 2 | 2025-09 Q2 | 2025-11-13 | 34,000.0 | up | EDINET |
| Revision 3 | 2025-12 Q3 | 2026-02-06 | 38,000.0 | up | TDnet |
| Actual | | | 37,662.2 | | |
| Achievement | | | 99.1% | | |

The final guidance, ¥3.8 trillion, equals the initial forecast. Comparing only the first and last figures shows no change. In between, though, guidance was cut once and then restored. Laying out the history makes that visible in the table. In the CSV the achievement rate is 0.991; on screen it is 99.1%.

Across the fiscal years ended March 2022 through March 2026, operating income achievement was 107.0%, 113.5%, 109.2%, 102.0% and 99.1%: four of five years beat the latest guidance. For the year ending March 2027, still in progress, the initial ¥3.0 trillion forecast has been raised once to ¥3.4 trillion (+13.3% from the initial figure).

### The same table works for other year-ends

For Fast Retailing's fiscal year ended August 2026, operating income guidance started at ¥610 billion, was raised three times to ¥730 billion, and the actual was ¥743.13 billion, an achievement rate of 101.8%. For Kao's fiscal year ended December 2023, the initial ¥120 billion forecast was cut to ¥60 billion in the second quarter; the actual was ¥60.04 billion, for 100.1%.

An achievement rate near 100% against the latest guidance can hide a large move from the initial plan. Show the initial forecast and the number of revisions next to the achievement rate.

## Reading the numbers correctly

### fiscalPeriod is when the guidance was issued

A guidance row's `fiscalPeriod` is the fiscal period of the release that carried it, not the year being forecast. Only FY rows fill `forecastFiscalPeriod`; quarterly rows leave it null. Compute the target from the quarter end as shown above, or use the FY row's value. In the transition year of a company that changed its year-end, the computed target may not match the real year-end, so cross-check against the income statement's periods.

### Null means "undetermined"; no row means "no guidance"

A null forecast value means the company published its guidance as undetermined. Periods with no guidance at all have no row. Companies that do not publish guidance, such as SoftBank Group, Rakuten Group, Mitsubishi UFJ Financial Group and Nomura Holdings, return no rows. Neither case means zero.

### Announcement times are UTC and can be null

`announcedAt` is ISO 8601 in UTC (ending in `Z`). Add nine hours for Japan time. Anything announced between 0:00 and 8:59 Japan time falls on the previous day in UTC, so taking the first ten characters as the date can be a day off. The script's `jst_date` converts to Japan time first. Rows whose source has no time are null, and the script sets them aside rather than guessing.

### EDINET-sourced dates can be later than the earnings release

For rows with `source` set to `edinet`, the announcement time is that of the filing submitted to EDINET (the FSA's electronic disclosure system). The kessan tanshin is usually published earlier, on TDnet (the exchange's timely disclosure system). For example, Toyota's initial guidance row for the year ending March 2027 shares a document (S100Y8NY) and a date (June 10, 2026) with the actual row for the year ended March 2026. If you need the date guidance was first made public, confirm it against the earnings release. In the data retrieved, 15 of Toyota's 20 rows came from EDINET and 5 from TDnet.

### Do not read announcement dates from TDnet document IDs

The date embedded in a TDnet row's `docId` is the registration date and can precede the announcement (confirmed for 6282). Order and date rows by `announcedAt`. The script keeps TDnet document IDs and links out of the table.

### The oldest year may start partway through

Because the script requests `limit=20`, the oldest year may lack its initial forecast. Toyota's fiscal year ended March 2022 starts from the Q2 guidance of the period ended September 2021, which appears as "initial." Kao's fiscal year ended December 2021 has a single Q3 row. Do not trust the "initial" label alone; check the basis column.

### Guidance rows do not say consolidated or parent-only

Guidance rows have no field for consolidated versus parent-only. In a kessan tanshin, companies that prepare consolidated statements give consolidated guidance. The actual rows from the income statement carry `consolidation`, so for parent-only companies, or companies that moved from consolidated to parent-only reporting, check the flag on the actual side.

### FY rows also carry growth against the prior actual

FY rows include fields such as `revenueGrowthVsActual` and `operatingIncomeGrowthVsActual`, which compare the guidance with the full-year actual on the same row. Use them to see how much growth the initial plan assumed. Quarterly rows do not carry them.

## Adapting it to your company

- To spot revisions quickly, run the same script during earnings season and compare row counts with the previous CSV. Only companies with new rows need a look.
- Revenue and net income work the same way: change the metric, as in `plan_vs_actual(s, "revenue")`.
- To view one company's plan history on a screen, try the [company deep-dive template](https://github.com/Crab-grass/zenith-code-examples/tree/main/templates/company-deep-dive). Its saved demo opens without an API key.

## Related

- API docs: [earnings forecast](https://zenithcode.net/en/docs/earnings-forecast), [income statement](https://zenithcode.net/en/docs/income-statement)
- Related articles: [Build a peer benchmarking table](https://zenithcode.net/en/docs/cookbook/applied/analysis-peer-benchmark), [Compare competitors' free cash flow and shareholder returns](https://zenithcode.net/en/docs/cookbook/applied/analysis-cash-and-balance), [TDnet vs. EDINET](https://zenithcode.net/en/learn/tdnet-vs-edinet)
- Templates: [zenith-code-examples](https://github.com/Crab-grass/zenith-code-examples)
- [Data display rights](https://zenithcode.net/en/docs/display-rights)

An illustrated series on the same material is on [Qiita](https://qiita.com/Sohei-Taniguchi-CG/items/595d98c387e34d7a3fc2) (in Japanese).

This page explains how to handle financial data. It is not a recommendation to buy or sell any security.

---
Page: https://zenithcode.net/en/docs/cookbook/applied/analysis-forecast-revisions
日本語: https://zenithcode.net/docs/cookbook/applied/analysis-forecast-revisions.md
Site guide for AI tools: https://zenithcode.net/llms.txt
