LaunchKit · 2026
Back to Skills

market-test-price

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

0
0 downloads
by @li-zoe-x

Setup & Installation

openclaw skills install @li-zoe-x/market-test-price

Or with the ClawHub CLI, for registry-managed skill folders outside a full OpenClaw workspace:

npx clawhub install market-test-price

What This Skill Does

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.

When to use it

  • 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

Example Workflow

Here's how your AI assistant might use this skill in practice.

INPUT

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

AGENT
  1. 1Validates token contract addresses and chain IDs for each token
  2. 2Constructs the JSON array body with chainIndex and tokenContractAddress fields
  3. 3Builds HMAC-SHA256 signature using timestamp + POST + path + exact body string as prehash
  4. 4Sends authenticated POST request to https://web3.okx.com/api/v6/dex/market/price
  5. 5Parses response data array and formats price strings with timestamp for each token
OUTPUT

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)

Requirements

Accounts, API keys, or tools you or your AI assistant may need to set up while using this skill.

OKX_ACCESS_KEY environment variableOKX_SECRET_KEY environment variableOKX_PASSPHRASE environment variableOKX account with web3 API access enabled