获取加密货币主动买卖情况
okx_taker_volumeFetch OKX cryptocurrency taker buy and sell volume. Supports spot and derivatives markets with configurable symbol and time period.
Instructions
获取OKX加密货币主动买入和卖出的交易量
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "okx_taker_volume"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | No | 币种,格式: BTC 或 ETH | BTC |
| period | No | 时间粒度,仅支持: [5m/1H/1D] 注意大小写,仅分钟为小写m | 1h |
| instType | No | 产品类型 SPOT:现货 CONTRACTS:衍生品 | SPOT |
Implementation Reference
- mcp_aktools/__init__.py:436-439 (registration)Tool registration via @mcp.tool decorator with title '获取加密货币主动买卖情况' and description about OKX cryptocurrency taker volume
@mcp.tool( title="获取加密货币主动买卖情况", description="获取OKX加密货币主动买入和卖出的交易量", ) - mcp_aktools/__init__.py:440-462 (handler)Handler function that calls OKX API /api/v5/rubik/stat/taker-volume with symbol, period, and instType params, returns CSV-formatted taker volume data
def okx_taker_volume( symbol: str = Field("BTC", description="币种,格式: BTC 或 ETH"), period: str = Field("1h", description="时间粒度,仅支持: [5m/1H/1D] 注意大小写,仅分钟为小写m"), instType: str = Field("SPOT", description="产品类型 SPOT:现货 CONTRACTS:衍生品"), ): res = requests.get( f"{OKX_BASE_URL}/api/v5/rubik/stat/taker-volume", params={ "ccy": symbol, "period": period, "instType": instType, }, timeout=20, ) data = res.json() or {} dfs = pd.DataFrame(data.get("data", [])) if dfs.empty: return pd.DataFrame() dfs.columns = ["时间", "卖出量", "买入量"] dfs["时间"] = pd.to_datetime(dfs["时间"], errors="coerce", unit="ms") dfs["卖出量"] = pd.to_numeric(dfs["卖出量"], errors="coerce") dfs["买入量"] = pd.to_numeric(dfs["买入量"], errors="coerce") return dfs.to_csv(index=False, float_format="%.2f").strip() - mcp_aktools/__init__.py:441-443 (schema)Input parameters: symbol (default BTC), period (default 1h, supports 5m/1H/1D), instType (default SPOT, supports SPOT/CONTRACTS)
symbol: str = Field("BTC", description="币种,格式: BTC 或 ETH"), period: str = Field("1h", description="时间粒度,仅支持: [5m/1H/1D] 注意大小写,仅分钟为小写m"), instType: str = Field("SPOT", description="产品类型 SPOT:现货 CONTRACTS:衍生品"),