# CN Data – China Margin Trading & Short Selling Data

> CN Data – China Margin Trading & Short Selling Data is a paid API for AI agents from cn-data-x402.cn-data-x402-worker.workers.dev, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-16).

Returns Chinese A-share margin trading (融资融券) data including margin balances, net buy amounts, short positions, and rankings, for a given trading date or historical series for a specific stock.

## Facts

- Endpoint: GET https://cn-data-x402.cn-data-x402-worker.workers.dev/cn/margin?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-16
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/cn-data-china-margin-trading-short-selling-data-c0faa917
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-F0raCbTYC6jxorKMwNw2

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability cn-data-china-margin-trading-short-selling-data-c0faa917
```

Example prompt: Pull today's margin trading data for Chinese A-shares, sorted by 5-day net margin buying (net5d), showing the top 30 stocks across both Shanghai and Shenzhen markets.

## When to prefer this

Use this endpoint when you need structured, machine-readable Chinese A-share margin trading (融资融券) data that is otherwise only available as web pages or proprietary data terminals. It is ideal for agents that need daily margin flow rankings, stock-level margin balance history, or short position screening across Shanghai and Shenzhen markets without requiring an API key or subscription — just a $0.02 USDC micropayment per call via the x402 protocol.

## Known failure modes

- HTTP 402 returned before payment — must pay $0.02 USDC on Base and retry
- Invalid date (non-trading day or future date) may return empty items array
- Invalid symbol (non-existent stock code) returns empty or single-item result
- Invalid sort value or market value may result in default fallback or error
- limit out of range (outside 1-300) may cause validation error
- Network timeout from upstream Eastmoney data source

## How this service works

Chinese market and China-focused public data over the x402 protocol. No API key and no signup: call any endpoint, receive HTTP 402 with payment terms, pay the listed amount in USDC on Base and retry. Every response is JSON. Some Chinese-language sources are published only as web pages — these endpoints return them as clean, machine-readable JSON.

## Output

A JSON object with ok:true, a date field, sort method used, market filter, total matching records count, and an items array where each element contains: stock code, name, board, symbol, close price, percent change, margin buy amount, margin repay amount, margin net buy, 5-day and 10-day net buy, short balance, short volume, margin balance, margin balance 5-day and 10-day percent change, and margin-to-market-cap ratio. Also includes aggregate totals for margin net buy and balance across returned items, and a source attribution string.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "date": {
       "type": "string",
       "description": "交易日 YYYY-MM-DD，默认最近一个交易日"
      },
      "sort": {
       "type": "string",
       "description": "排序：net（融资净买入，默认）/ balance（融资余额）/ buy（融资买入额）/ net5d（5 日净买入）/ ratio（占流通市值比）/ short（融券余额）"
      },
      "limit": {
       "type": "integer",
       "description": "返回条数 1-300，默认 50"
      },
      "market": {
       "type": "string",
       "description": "市场：sh（沪市）/ sz（深市），不传是两市合并"
      },
      "symbol": {
       "type": "string",
       "description": "6 位股票代码，传了就是该股的历史（按日期倒序），如 600519"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "data": {
   "date": "2026-10-09",
   "sort": "net",
   "items": [
    {
     "code": "600519",
     "date": "2026-10-09",
     "name": "贵州茅台",
     "board": "上交所主板",
     "symbol": "600519.SH",
     "closePrice": 1263,
     "changePercent": 0.5741,
     "marginBuyYuan": 250134331,
     "marketCapYuan": 1578853062063,
     "marginRepayYuan": 393467744,
     "marginNetBuyYuan": -143333413,
     "shortBalanceYuan": 258217824,
     "totalBalanceYuan": 17344870437,
     "marginBalanceYuan": 17086652613,
     "shortVolumeShares": 204448,
     "marginNetBuy5dYuan": -139569268,
     "shortNetSellShares": -1000,
     "marginNetBuy10dYuan": 26916683,
     "shortSellVolumeShares": 1800,
     "marginBalanceChange5dPercent": 2.1019,
     "marginBalanceChange10dPercent": -0.3141,
     "marginBalanceToMarketCapPercent": 1.0822193
    }
   ],
   "market": null,
   "source": "融资融券数据来自东方财富数据中心公开接口（RPTA_WEB_RZRQ_GGMX）。",
   "symbol": "600519",
   "returned": 1,
   "totalMatching": 3994,
   "returnedTotals": {
    "marginNetBuyYuan": -143333413,
    "marginBalanceYuan": 17086652613
   }
  },
  "endpoint": "/cn/margin"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/cn-data-china-margin-trading-short-selling-data-c0faa917/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from cn-data-x402.cn-data-x402-worker.workers.dev](https://www.zero.xyz/host/cn-data-x402.cn-data-x402-worker.workers.dev/llms.txt)
