coinapi-openapi-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCoinAPI REST Skill
CoinAPI REST 技能
Use this skill to run CoinAPI REST market data operations through + OpenAPI.
uxcReuse the skill for shared execution, auth, and error-handling guidance.
uxc使用本技能通过 + OpenAPI执行CoinAPI REST市场数据操作。
uxc复用技能以实现共享执行、认证和错误处理机制。
uxcPrerequisites
前提条件
- is installed and available in
uxc.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 header auth.
X-CoinAPI-KeyConfigure one API-key credential and bind it to :
rest.coinapi.iobash
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 100Validate the active mapping when auth looks wrong:
bash
uxc auth binding match https://rest.coinapi.ioCoinAPI使用请求头进行认证。
X-CoinAPI-Key配置一个API密钥凭证并绑定到:
rest.coinapi.iobash
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.ioCore Workflow
核心工作流程
-
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
-
Inspect operation schema first:
coinapi-openapi-cli get:/v1/exchangerate/{asset_id_base}/{asset_id_quote} -hcoinapi-openapi-cli get:/v1/ohlcv/{symbol_id}/latest -hcoinapi-openapi-cli get:/v1/trades/{symbol_id}/latest -h
-
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=USDcoinapi-openapi-cli get:/v1/quotes/current filter_symbol_id=BINANCE_SPOT_BTC_USDT
-
Execute with key/value parameters:
coinapi-openapi-cli get:/v1/ohlcv/{symbol_id}/latest symbol_id=BINANCE_SPOT_BTC_USDT period_id=1DAY limit=10coinapi-openapi-cli get:/v1/orderbooks/{symbol_id}/latest symbol_id=BINANCE_SPOT_BTC_USDT limit_levels=20
-
默认使用固定链接命令:
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
-
先查看操作Schema:
coinapi-openapi-cli get:/v1/exchangerate/{asset_id_base}/{asset_id_quote} -hcoinapi-openapi-cli get:/v1/ohlcv/{symbol_id}/latest -hcoinapi-openapi-cli get:/v1/trades/{symbol_id}/latest -h
-
在进行大范围爬取前,优先选择精准的现货和最新数据读取:
coinapi-openapi-cli get:/v1/exchangerate/{asset_id_base}/{asset_id_quote} asset_id_base=BTC asset_id_quote=USDcoinapi-openapi-cli get:/v1/quotes/current filter_symbol_id=BINANCE_SPOT_BTC_USDT
-
使用键值参数执行操作:
coinapi-openapi-cli get:/v1/ohlcv/{symbol_id}/latest symbol_id=BINANCE_SPOT_BTC_USDT period_id=1DAY limit=10coinapi-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/currentget:/v1/ohlcv/{symbol_id}/latestget:/v1/trades/{symbol_id}/latestget:/v1/orderbooks/{symbol_id}/latest
get:/v1/exchangerate/{asset_id_base}/{asset_id_quote}get:/v1/quotes/currentget:/v1/ohlcv/{symbol_id}/latestget:/v1/trades/{symbol_id}/latestget:/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, andlimitnarrow unless the user explicitly wants larger pulls.limit_levels - is equivalent to
coinapi-openapi-cli <operation> ....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
参考资料
- Usage patterns:
references/usage-patterns.md - Curated OpenAPI schema:
references/coinapi-market.openapi.json - CoinAPI REST docs: https://docs.coinapi.io/market-data/rest-api
- 使用模式:
references/usage-patterns.md - 经过整理的OpenAPI Schema:
references/coinapi-market.openapi.json - CoinAPI REST文档:https://docs.coinapi.io/market-data/rest-api