跳到正文
TakoAPI
返回技能列表

market-test-price

由 li-zoe-x 提供

Browser & Automation
—暂无评分
你的评分

简介

Fetch token prices from OKX DEX Market Price API (v6)

描述

该技能的功能

Fetches token prices from the OKX DEX Market Price API v6 using authenticated POST requests with HMAC-SHA256 signing. Supports batch queries of 1-100 tokens per request across Ethereum, BSC, Polygon, Solana, and other chains. Generates production-ready Python or Node.js code with correct credential handling and response parsing.

OKX's POST signing requires the request body in the prehash, a detail that causes 401 errors if missed — this skill handles it correctly by construction.

何时使用

  • Checking current ETH price on Ethereum mainnet
  • Batch querying all token prices in a DeFi portfolio
  • Fetching stablecoin prices across multiple chains
  • Building a real-time price feed for a wallet dashboard
  • Monitoring token prices on Arbitrum or Base for a trading bot

示例工作流

输入

User asks: Get the current price of USDC on Ethereum and a token on BSC

智能体
  1. 1

    Validates token contract addresses and chain IDs for each token

  2. 2

    Constructs the JSON array body with chainIndex and tokenContractAddress fields

  3. 3

    Builds HMAC-SHA256 signature using timestamp + POST + path + exact body string as prehash

  4. 4

    Sends authenticated POST request to https://web3.okx.com/api/v6/dex/market/price

  5. 5

    Parses response data array and formats price strings with timestamp for each token

输出

USDC on Ethereum: $1.00012 (as of 2025-05-28 12:00:20 UTC); BSC token: $0.4821 (as of 2025-05-28 12:00:20 UTC)

前置要求

  • OKX_ACCESS_KEY environment variable
  • OKX_SECRET_KEY environment variable
  • OKX_PASSPHRASE environment variable
  • OKX account with web3 API access enabled

安装

clawhub install li-zoe-x/market-test-price

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接