## 标记价格 ---- 接口:GET /api/v5/public/mark-price 描述:获取合约的标记价格。标记价格用于计算未实现盈亏和强制平仓,比最新成交价更稳定。 限频:20次/2s **输入参数** | 名称 | 类型 | 必选 | 描述 | | ---- | ---- | ---- | ---- | | instType | str | Y | 产品类型:`SWAP`、`FUTURES`、`OPTION` | | instId | str | N | 产品ID(可选过滤) | **输出参数** | 名称 | 类型 | 描述 | | ---- | ---- | ---- | | instType | str | 产品类型 | | instId | str | 产品ID | | markPx | str | 标记价格 | | ts | str | 时间戳(毫秒) | **接口示例** ```python import requests BASE_URL = "https://www.okx.com/api/v5" # 获取 BTC 永续标记价格 resp = requests.get(f"{BASE_URL}/public/mark-price", params={ "instType": "SWAP", "instId": "BTC-USDT-SWAP" }) data = resp.json()["data"][0] print(f"BTC 永续标记价格: {data['markPx']}") # 获取所有永续合约标记价格 resp = requests.get(f"{BASE_URL}/public/mark-price", params={"instType": "SWAP"}) all_marks = resp.json()["data"] print(f"合约数量: {len(all_marks)}") ```