# China Macro Revision Monitor (`zinin/china-macro-revision-monitor`) Actor

Monitor bounded China macro observations and historical revisions from the official World Bank WDI source=2 API.

- **URL**: https://apify.com/zinin/china-macro-revision-monitor.md
- **Developed by:** [Tim Zinin](https://apify.com/zinin) (community)
- **Categories:** News, Automation
- **Stats:** 2 total users, 1 monthly users, 60.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.55 / 1,000 china wdi indicator checkeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## China Macro Revision Monitor

Monitor a small, fixed set of China macroeconomic indicators from the official World
Bank World Development Indicators API. Each run returns structured annual observations
and compares them with the prior delivered baseline to identify newly published periods
and historical revisions.

This Actor is designed for research, business intelligence and scheduled data-quality
checks. It is keyless, uses no proxy, accepts no arbitrary URL and is restricted to China
(`CHN`) and WDI source `2`.

### What it monitors

- GDP level and annual growth;
- consumer-price inflation;
- foreign direct investment level and share of GDP;
- exports and imports;
- unemployment, population and energy use;
- `baseline_created`, `no_change`, `new_observation`, `revision` and `mixed_change` states.

The first valid run for an indicator and `watchName` creates a baseline. A replay of the
same source facts returns `no_change`. A previously null or absent period becoming numeric
is `new_observation`; a changed previously numeric period is a `revision`. The baseline is
updated only after Dataset delivery is confirmed. Transport or source-contract failures
produce explicit free error rows and preserve the prior baseline.

### Quick start

```json
{
  "indicators": [
    "NY.GDP.MKTP.KD.ZG",
    "BX.KLT.DINV.WD.GD.ZS"
  ],
  "startYear": 2021,
  "endYear": 2025,
  "watchName": "china-macro-main"
}
```

Run this once, inspect the Dataset and then create an Apify Schedule with the same
`watchName`, indicators and year window. Annual WDI series usually do not justify an
hourly schedule; weekly or monthly checks are proportionate.

### Input

| Field | Required | Description |
| --- | --- | --- |
| `indicators` | no | 1-5 unique codes from the closed WDI whitelist; default is GDP growth plus FDI inflows as a share of GDP. |
| `startYear` | no | Inclusive first year, 1960 or later. |
| `endYear` | no | Inclusive last year, no later than the current UTC year. |
| `watchName` | no | Stable 1-80 character private baseline scope. |

The inclusive window is limited to 10 years. Country, source ID, host, path, pagination,
license, proxy and credentials are not buyer-controlled. Invalid input fails before any
network request.

### Output

Each valid indicator response yields one Dataset row. Missing WDI values stay explicit:

```json
{
  "watchName": "china-macro-main",
  "indicator": {
    "id": "NY.GDP.MKTP.KD.ZG",
    "name": "GDP growth (annual %)",
    "unit": "percent"
  },
  "country": {"code": "CHN", "name": "China"},
  "window": {"startYear": 2021, "endYear": 2025},
  "found": true,
  "changeType": "revision",
  "changedPeriods": ["2023"],
  "newObservations": [],
  "revisions": [{"period": "2023", "previousValue": 5.2, "currentValue": 5.4}],
  "observations": [
    {"period": "2023", "value": 5.4, "isMissing": false},
    {"period": "2025", "value": null, "isMissing": true}
  ],
  "sourceUpdatedAt": "2026-07-24",
  "source": {
    "provider": "World Bank",
    "dataset": "World Development Indicators",
    "sourceId": "2",
    "license": "CC BY 4.0",
    "attribution": "Source: World Bank, World Development Indicators (WDI), licensed under CC BY 4.0."
  },
  "partial": false,
  "error": "",
  "isDemo": false
}
```

A valid response containing only null observations is delivered as a free
`no_observation` row. A timeout, HTTP failure, wrong country/source/indicator identity,
malformed JSON or changed upstream schema is a free `error` row with `partial: true`.
Neither case is silently converted into a numeric value.

### Source, license and responsible reuse

The Actor calls only:

`https://api.worldbank.org/v2/country/CHN/indicator/<approved-code>?source=2&...`

The [World Development Indicators dataset](https://datacatalog.worldbank.org/search/dataset/0037712/world-development-indicators)
is published under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which
permits commercial reuse with attribution. Every row carries its API URL, dataset link,
license link and attribution. Delta and revision fields are marked as a modification of
source observations; they are not official World Bank conclusions. Do not use the World
Bank name or logo to imply endorsement.

### Pricing

Pay per event on the FREE tier: **$0.005 per run start + $0.003 per successfully
delivered indicator check containing at least one finite observation**. Explicit
null-only and source-error rows are free.

| Tier | Start | Indicator check | Discount |
| --- | ---: | ---: | ---: |
| FREE | $0.00500 | $0.00300 | 0% |
| BRONZE | $0.00475 | $0.00285 | 5% |
| SILVER | $0.00450 | $0.00270 | 10% |
| GOLD | $0.00425 | $0.00255 | 15% |
| PLATINUM | $0.00410 | $0.00246 | 18% |
| DIAMOND | $0.00400 | $0.00240 | 20% |

Dataset delivery and the `indicator-checked` charge use one SDK call. Pricing, the
zero-priced default Dataset event and remaining charge budget are checked before source
work. If those values cannot be verified, paid work fails closed.

### API and automation

#### JavaScript

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('zinin/china-macro-revision-monitor').call({
  indicators: ['NY.GDP.MKTP.KD.ZG', 'BX.KLT.DINV.WD.GD.ZS'],
  startYear: 2021,
  endYear: 2025,
  watchName: 'china-macro-main',
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Python

```python
from apify_client import ApifyClient
import os

client = ApifyClient(os.environ['APIFY_TOKEN'])
run = client.actor('zinin/china-macro-revision-monitor').call(run_input={
    'indicators': ['NY.GDP.MKTP.KD.ZG', 'BX.KLT.DINV.WD.GD.ZS'],
    'startYear': 2021,
    'endYear': 2025,
    'watchName': 'china-macro-main',
})
print(client.dataset(run['defaultDatasetId']).list_items().items)
```

Use the included Task fixture with an Apify Schedule. A webhook on
`ACTOR.RUN.SUCCEEDED` can pass the Dataset `changes` view to n8n, Make, Slack or a data
warehouse. Treat `ACTOR.RUN.FAILED` and `partial: true` as unknown source state.

### 中文说明

此 Actor 通过世界银行官方 World Development Indicators API 监控中国宏观数据。
数据源固定为中国（`CHN`）和 WDI source `2`，无需 API Key，也不使用代理。首次有效
运行建立基线；后续运行会区分 `no_change`（无变化）、`new_observation`（新增数据）和
`revision`（历史值修订）。缺失值会明确返回 `null`，网络或上游格式错误会返回免费的
错误记录，并保留原有基线，不会生成或猜测数值。

建议使用相同的 `watchName` 建立每周或每月定时任务。每行均包含世界银行来源链接、
WDI 数据集链接和 CC BY 4.0 署名信息。Actor 的变化计算属于二次处理，不代表世界银行
官方判断或背书。

### Limitations

- WDI annual observations can be delayed, revised or remain null for recent years.
- The Actor monitors at most five approved indicators and ten inclusive years per run;
  it is not a bulk World Bank exporter.
- A missing value is not evidence that an economic event did not occur.
- Values are source observations, not investment, legal, accounting or policy advice.
- Baselines are scoped by `watchName`; changing the year window creates a new baseline
  comparison for that indicator.
- World Bank availability and schema can change. Failures remain explicit unknown state.

Built by [zinin](https://apify.com/zinin). Questions: Telegram
[@timzinin](https://t.me/timzinin).

# Actor input Schema

## `indicators` (type: `array`):

Approved World Development Indicators. Arbitrary codes and other World Bank datasets are rejected.

## `startYear` (type: `integer`):

Inclusive first year. Runtime validation enforces 1960 or later and a maximum 10-year window.

## `endYear` (type: `integer`):

Inclusive last year, not later than the current UTC year.

## `watchName` (type: `string`):

Stable private baseline scope. Reuse it in scheduled runs to identify new observations and revisions.

## Actor input object example

```json
{
  "indicators": [
    "NY.GDP.MKTP.KD.ZG",
    "BX.KLT.DINV.WD.GD.ZS"
  ],
  "startYear": 2021,
  "endYear": 2025,
  "watchName": "china-macro-main"
}
```

# Actor output Schema

## `results` (type: `string`):

API URL for paid successful checks and free explicit null/error rows.

## `OUTPUT` (type: `string`):

API URL for terminal status, counters and baseline-storage information.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "indicators": [
        "NY.GDP.MKTP.KD.ZG",
        "BX.KLT.DINV.WD.GD.ZS"
    ],
    "startYear": 2021,
    "endYear": 2025,
    "watchName": "china-macro-main"
};

// Run the Actor and wait for it to finish
const run = await client.actor("zinin/china-macro-revision-monitor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "indicators": [
        "NY.GDP.MKTP.KD.ZG",
        "BX.KLT.DINV.WD.GD.ZS",
    ],
    "startYear": 2021,
    "endYear": 2025,
    "watchName": "china-macro-main",
}

# Run the Actor and wait for it to finish
run = client.actor("zinin/china-macro-revision-monitor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "indicators": [
    "NY.GDP.MKTP.KD.ZG",
    "BX.KLT.DINV.WD.GD.ZS"
  ],
  "startYear": 2021,
  "endYear": 2025,
  "watchName": "china-macro-main"
}' |
apify call zinin/china-macro-revision-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zinin/china-macro-revision-monitor"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/pfVTwC2eHwdsTFSyK/builds/fdbdwPouKVkTj4XTz/openapi.json
