coinapi-openapi-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CoinAPI REST Skill

CoinAPI REST 技能

Use this skill to run CoinAPI REST market data operations through
uxc
+ OpenAPI.
Reuse the
uxc
skill for shared execution, auth, and error-handling guidance.
使用本技能通过
uxc
+ OpenAPI执行CoinAPI REST市场数据操作。
复用
uxc
技能以实现共享执行、认证和错误处理机制。

Prerequisites

前提条件

  • uxc
    is installed and available in
    PATH
    .
  • Network access to
    https://rest.coinapi.io
    .
  • Access to the curated OpenAPI schema URL:
    • https://raw.githubusercontent.com/holon-run/uxc/main/skills/coinapi-openapi-skill/references/coinapi-market.openapi.json
  • A CoinAPI key.
  • uxc
    已安装并可在
    PATH
    中访问。
  • 可访问网络至
    https://rest.coinapi.io
  • 可访问经过整理的OpenAPI Schema URL:
    • https://raw.githubusercontent.com/holon-run/uxc/main/skills/coinapi-openapi-skill/references/coinapi-market.openapi.json
  • 拥有CoinAPI密钥。

Scope

适用范围

This skill covers a read-first market data surface:
  • current exchange rates
  • current quote snapshots
  • latest OHLCV candles
  • latest trades
  • latest order books
This skill does not cover:
  • FIX, WebSocket, or MCP transport surfaces
  • write operations
  • the broader CoinAPI catalog
本技能覆盖只读优先的市场数据场景:
  • 当前汇率
  • 当前报价快照
  • 最新OHLCV蜡烛图
  • 最新交易记录
  • 最新订单簿
本技能包含以下内容:
  • FIX、WebSocket或MCP传输协议
  • 写入操作
  • 更广泛的CoinAPI产品目录

Authentication

认证方式

CoinAPI uses
X-CoinAPI-Key
header auth.
Configure one API-key credential and bind it to
rest.coinapi.io
:
bash
uxc auth credential set coinapi \
  --auth-type api_key \
  --api-key-header X-CoinAPI-Key \
  --secret-env COINAPI_KEY

uxc auth binding add \
  --id coinapi \
  --host rest.coinapi.io \
  --scheme https \
  --credential coinapi \
  --priority 100
Validate the active mapping when auth looks wrong:
bash
uxc auth binding match https://rest.coinapi.io
CoinAPI使用
X-CoinAPI-Key
请求头进行认证。
配置一个API密钥凭证并绑定到
rest.coinapi.io
bash
uxc auth credential set coinapi \
  --auth-type api_key \
  --api-key-header X-CoinAPI-Key \
  --secret-env COINAPI_KEY

uxc auth binding add \
  --id coinapi \
  --host rest.coinapi.io \
  --scheme https \
  --credential coinapi \
  --priority 100
当认证出现问题时,验证当前的映射关系:
bash
uxc auth binding match https://rest.coinapi.io

Core Workflow

核心工作流程

  1. Use the fixed link command by default:
    • command -v coinapi-openapi-cli
    • If missing, create it:
      uxc link coinapi-openapi-cli https://rest.coinapi.io --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/coinapi-openapi-skill/references/coinapi-market.openapi.json
    • coinapi-openapi-cli -h
  2. Inspect operation schema first:
    • coinapi-openapi-cli get:/v1/exchangerate/{asset_id_base}/{asset_id_quote} -h
    • coinapi-openapi-cli get:/v1/ohlcv/{symbol_id}/latest -h
    • coinapi-openapi-cli get:/v1/trades/{symbol_id}/latest -h
  3. Prefer narrow spot and latest reads before broader crawls:
    • coinapi-openapi-cli get:/v1/exchangerate/{asset_id_base}/{asset_id_quote} asset_id_base=BTC asset_id_quote=USD
    • coinapi-openapi-cli get:/v1/quotes/current filter_symbol_id=BINANCE_SPOT_BTC_USDT
  4. Execute with key/value parameters:
    • coinapi-openapi-cli get:/v1/ohlcv/{symbol_id}/latest symbol_id=BINANCE_SPOT_BTC_USDT period_id=1DAY limit=10
    • coinapi-openapi-cli get:/v1/orderbooks/{symbol_id}/latest symbol_id=BINANCE_SPOT_BTC_USDT limit_levels=20
  1. 默认使用固定链接命令:
    • command -v coinapi-openapi-cli
    • 如果未找到,创建链接:
      uxc link coinapi-openapi-cli https://rest.coinapi.io --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/coinapi-openapi-skill/references/coinapi-market.openapi.json
    • coinapi-openapi-cli -h
  2. 先查看操作Schema:
    • coinapi-openapi-cli get:/v1/exchangerate/{asset_id_base}/{asset_id_quote} -h
    • coinapi-openapi-cli get:/v1/ohlcv/{symbol_id}/latest -h
    • coinapi-openapi-cli get:/v1/trades/{symbol_id}/latest -h
  3. 在进行大范围爬取前,优先选择精准的现货和最新数据读取:
    • coinapi-openapi-cli get:/v1/exchangerate/{asset_id_base}/{asset_id_quote} asset_id_base=BTC asset_id_quote=USD
    • coinapi-openapi-cli get:/v1/quotes/current filter_symbol_id=BINANCE_SPOT_BTC_USDT
  4. 使用键值参数执行操作:
    • coinapi-openapi-cli get:/v1/ohlcv/{symbol_id}/latest symbol_id=BINANCE_SPOT_BTC_USDT period_id=1DAY limit=10
    • coinapi-openapi-cli get:/v1/orderbooks/{symbol_id}/latest symbol_id=BINANCE_SPOT_BTC_USDT limit_levels=20

Operations

支持的操作

  • get:/v1/exchangerate/{asset_id_base}/{asset_id_quote}
  • get:/v1/quotes/current
  • get:/v1/ohlcv/{symbol_id}/latest
  • get:/v1/trades/{symbol_id}/latest
  • get:/v1/orderbooks/{symbol_id}/latest
  • get:/v1/exchangerate/{asset_id_base}/{asset_id_quote}
  • get:/v1/quotes/current
  • get:/v1/ohlcv/{symbol_id}/latest
  • get:/v1/trades/{symbol_id}/latest
  • get:/v1/orderbooks/{symbol_id}/latest

Guardrails

防护规则

  • Keep automation on the JSON output envelope; do not use
    --text
    .
  • Parse stable fields first:
    ok
    ,
    kind
    ,
    protocol
    ,
    data
    ,
    error
    .
  • Treat this v1 skill as read-only. Do not imply order entry or market connectivity support.
  • Keep
    filter_symbol_id
    ,
    period_id
    ,
    limit
    , and
    limit_levels
    narrow unless the user explicitly wants larger pulls.
  • coinapi-openapi-cli <operation> ...
    is equivalent to
    uxc https://rest.coinapi.io --schema-url <coinapi_openapi_schema> <operation> ...
    .
  • 自动化操作仅使用JSON输出格式;请勿使用
    --text
    参数。
  • 优先解析稳定字段:
    ok
    kind
    protocol
    data
    error
  • 本v1技能为只读工具,不支持订单提交或市场连接功能。
  • 除非用户明确要求获取大量数据,否则请限制
    filter_symbol_id
    period_id
    limit
    limit_levels
    的范围。
  • coinapi-openapi-cli <operation> ...
    等价于
    uxc https://rest.coinapi.io --schema-url <coinapi_openapi_schema> <operation> ...

References

参考资料