Crypto market data from the AiCoin Open API v3 — prices, K-lines, derivatives, news, signals, airdrops, treasuries and more across 200+ exchanges.
Run the script from the directory where SKILL.md is located. The CoinClaw three-engine container (OpenClaw / Hermes / Claude Code) automatically injects the skill path,
cdto the skill directory.
How to use
One command to call all interfaces:
node scripts/aicoin.mjs <接口> '<JSON 参数>'
<接口> is /api/v3/ the path segment after it, for example market/ticker、coins/tickers。
- Returnsunified envelope
{ ok, data, error, meta }—— First checkok。ok:falsewhenerror.code/error.message, it clearly states where the error is. - Not sure which interfaces exist or how to fill in parameters →
node scripts/aicoin.mjs catalog [分组]. The catalog is the live online interface menu and is always accurate. Check it first before calling. - Want to know which interfaces the current key can use →
node scripts/aicoin.mjs key。
node scripts/aicoin.mjs catalog # 看全部 183 个接口(按分组)
node scripts/aicoin.mjs catalog derivatives # 看 derivatives 分组每个接口的参数
node scripts/aicoin.mjs market/ticker '{"coin_key":"bitcoin","market":"binance"}'
Common interfaces quick reference
| What to look up | Interface + example |
|---|---|
| Coin price / change / market cap / net inflow | coins/tickers '{"coin_key":"bitcoin,ethereum"}' —— degree_24h_usd / degree_7day_usd is the 24h / 7-day change (%) |
| Single trading pair real-time quote | market/ticker '{"coin_key":"bitcoin","market":"binance"}' |
| K-line | market/klines '{"coin_key":"bitcoin","market":"binance","interval":"1h","limit":100}' |
| Search coins / check which exchanges a coin is on | coins/search '{"query":"PEPE"}' —— each result includes db_keys, listing all trading pairs for that coin across exchanges |
| Coin details / introduction | coins/detail '{"coin_key":"bitcoin"}' |
| All coins / all exchanges | coins '{"limit":100}' / markets |
| All trading pair quotes for an exchange | market/tickers '{"market":"binance"}' |
| Trading pair list | pairs '{"market":"binance"}' |
| Hot sector coins | markets/hot-coins '{"tab_key":"defi"}' |
| Funding rate | derivatives/funding-rates '{"coin_key":"bitcoin","market":"binance"}' —— returns an 8h OHLC series,close is the current settlement rate (decimal, ×100 to get percentage) |
| Long/short ratio | Single trading pair historical series derivatives/long-short-ratio '{"coin_key":"bitcoin","market":"binance"}'; whole-market current summary derivatives/long-short-ratio/summary(not per coin, don't treat it as a specific coin's) |
| Contract open interest ranking | derivatives/open-interest/ranking |
| Liquidation map / liquidation summary | derivatives/liquidations/map '{"coin_key":"bitcoin","market":"binance","window":"24h"}' / derivatives/liquidations/summary |
| Large orders / large order trades | market/big-orders '{"coin_key":"bitcoin","market":"binance"}' / market/aggregate-trades '{"coin_key":"bitcoin","market":"binance"}' |
| Order book depth | market/orderbook/latest-depth '{"coin_key":"bitcoin","market":"binance"}' |
| News articles / flash news | content/articles / content/newsflashes / industry content/newsflashes/industry |
| Search flash news | content/newsflashes/search '{"query":"bitcoin"}' |
| Twitter/X | content/social/x/posts/latest / search content/social/x/posts/search '{"query":"bitcoin"}' |
| Airdrop projects (which are worth doing) | drop-radar/projects —— most complete projects; details drop-radar/projects/detail '{"project_id":"..."}' |
| Exchange airdrops / airdrop calendar | airdrops '{"source":"all"}'(exchange events, may be empty) / airdrops/calendar '{"year":2026,"month":5}' |
| Public company coin holdings (treasury) | treasuries/summary '{"coin_key":"bitcoin"}' / entity treasuries/entities '{"coin_key":"bitcoin"}' |
| Grayscale holdings | institutions/grayscale/holdings |
| Crypto concept stocks / global stock indices | equities/crypto-exposure/quotes / macro/stock-indices |
| Indices (fear and greed, etc.) | indexes / indexes/ticker '{"index_key":"i:fgi:alternative"}' |
| Anomaly signals / alerts | signals/changes / signals/alerts |
| AI coin selection recommendations | coins/recommendations '{"coin_keys":["bitcoin"]}' |
All other interfaces are in catalog —— if you can't find what you want, first run catalog, don't guess the path.
A few things to remember
- Don't make up data. Always run the script to get real data.
datais empty /ok:falsethen tell the user truthfully, don't make up explanations, don't make up prices. - For crypto data use only this script, don't use
web_search/web_fetch/curl/ browser to piece it together. coin_keyorcoin? ordinary interfaces usecoin_key—— AiCoin coin slug, lowercase (bitcoin、ethereum);hyperliquid/*interface usescoin—— trading symbol (BTC、HYPE). For each parameter follow thecatalogindesc/exampleFill in.- Get the id for detail endpoints from the list endpoint first: For news flash/article details first
content/newsflashes、content/articlesget the id; for airdrop/project details firstairdrops、drop-radar/projectsgetproject_id。 ok:false+ HTTP 403 = the current key has no permission for this endpoint,do not retry. Do not immediately assert "the plan is insufficient": a common pitfall on local host is that the script fell back to a free/old key — firstnode scripts/aicoin.mjs keycheck whether key_id is the user's Pro version (the key should be at~/.coinos/.env). If it truly is insufficient plan, then tell the user to go to https://www.aicoin.com/opendata to upgrade.200+ emptydatameans "no data under this condition",not an error。- Use Unix milliseconds for time(
start_time/end_time), for pagination uselimit/offset。 - For K-line latest values read only
_timeseries.latest, and check the time field against_timeseries.field(usuallytime/timestamp). When the time is more than two K-line periods from now, you may only label it "latest as of a certain time"; it is forbidden to call it "current/real-time". Do not usehead/tail/cutto truncate JSON and then guess the array order. - Use only
scripts/aicoin.mjs. Oldmarket.mjsand other v2 entry points are deprecated; upon receivinglegacy_entrypoint_retiredyou must migrate according to the returned prompt, and must not bypass it or fetch data from leftover scripts. - Usethe user's languageto reply (if the question is in Chinese, use Chinese throughout).
- Do not misjudge an upstream failure as an invalid Key.
node scripts/aicoin.mjs keyUse only basic market probes to judge the Key: only the core probe401indicates the Key is invalid,403means permissions do not cover it, and a timeout or5xxis an endpoint/upstream anomaly. When an optional endpoint fails, the already successful market and K-line data can still be used to answer. - Do not retry a failing endpoint repeatedly. After a single request timeout or
5xximmediately degrade and label it truthfully; funding rate, depth, and indicators are optional enhancement data, and you must not claim "all data cannot be queried" just because they failed. - Check coverage for indicators first. Before calling
market/indicator-klinesfirst callmarket/indicator-pairsto confirm the trading pair and indicator have coverage. When both return an empty sequence for200, it means there is currently no coverage; skip that indicator, do not do local calculations, and do not retry. - Strictly respect the K-line period. When the user asks about "a single-day rise/fall exceeding 8%", you must use
1dK-line; you cannot use3dK-line as a substitute for "single day". If the daily historical window is insufficient, give a conclusion based on the existing daily data and clearly state the sample range.
API Key
A free key is built in, ready to use out of the box, enough for market data, K-line, coins, news, and the like. Funding rate, large orders, liquidations, HL whales, treasury, etc. require a paid plan.On receiving 403 first node scripts/aicoin.mjs key check whether key_id is the user's Pro version (the key should be placed at ~/.coinos/.env), confirm no wrong key is loaded, and only then judge whether the plan is truly insufficient — misreporting "the key wasn't loaded correctly" as "the endpoint requires payment" will infuriate paying users.
Use your own key — recommended set-key command (it validates first, then writes .env,Do not hand-edit .env):
node scripts/aicoin.mjs set-key <key_id> <secret>
# 或直接把 AiCoin 后台 JSON 整段喂进来,脚本认字段名:
node scripts/aicoin.mjs set-key '{"api_key":"<id>","access_key":"<secret>"}'
⚠️ AiCoin backend field names are counterintuitive: the api_key in JSON is actually the public ID (corresponding to AICOIN_ACCESS_KEY_ID),access_key is the SECRET (corresponding to AICOIN_ACCESS_SECRET). The script stores it according to this mapping for you, so you don't have to reverse it in your head.
Environment variable name (write .env or use export):
AICOIN_ACCESS_KEY_ID=... # = AiCoin 后台的 api_key
AICOIN_ACCESS_SECRET=... # = AiCoin 后台的 access_key
Security note: The AiCoin API Key is only used to fetch market data; it cannot trade and cannot read any of your information on the exchange. All keys are stored only locally in .env, and are not uploaded to any server. CoinClaw users configure it in the EnvSection of the web UI.
Cross-skill
| Requirement | Which skill to use |
|---|---|
| Hyperliquid whales / smart money / large on-chain funds | aicoin-hyperliquid |
| Exchange orders / closing positions / checking balances | aicoin-trading |
| Freqtrade strategies / backtesting / deployment | aicoin-freqtrade |
| On-chain DEX swap / wallet / token | aicoin-onchain |