glassnode-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGlassnode CLI (gn
)
gnGlassnode CLI (gn
)
gnCommand-line interface for the Glassnode API.
Glassnode API的命令行界面。
Setup
安装设置
If the command is not available you need to install the CLI. See the Installation section in the README for install and setup options.
gnQuick start:
bash
gn asset list
gn metric get market/price_usd_close --asset BTC --since 30d如果命令不可用,你需要安装该CLI。请查看README中的安装章节获取安装和设置选项。
gn快速开始:
bash
gn asset list
gn metric get market/price_usd_close --asset BTC --since 30dCommands
命令
List assets
列出资产
bash
gn asset list
gn asset list --filter "asset.semantic_tags.exists(tag,tag=='stablecoin')"
gn asset list --filter "asset.id=='BTC'"bash
gn asset list
gn asset list --filter "asset.semantic_tags.exists(tag,tag=='stablecoin')"
gn asset list --filter "asset.id=='BTC'"Prune to specific fields (returns array of objects)
筛选特定字段(返回对象数组)
gn asset list --prune id -o json
gn asset list -p id,symbol -o json
undefinedgn asset list --prune id -o json
gn asset list -p id,symbol -o json
undefinedDescribe an asset
查看资产详情
bash
gn asset describe BTCbash
gn asset describe BTCList metrics
列出指标
bash
gn metric list
gn metric list --asset BTC
gn metric list -a BTC -e binance -i 24h
gn metric list --assets BTC --assets ETH
gn metric list --from-exchange binance --to-exchange coinbaseFilter by any metadata query parameters: , , , , , , , , , , or multiple .
--currency--exchange--interval--from-exchange--to-exchange--miner--maturity--network--period--quote-symbol--assetsbash
gn metric list
gn metric list --asset BTC
gn metric list -a BTC -e binance -i 24h
gn metric list --assets BTC --assets ETH
gn metric list --from-exchange binance --to-exchange coinbase可通过以下元数据查询参数进行筛选:、、、、、、、、、,或使用多个参数。
--currency--exchange--interval--from-exchange--to-exchange--miner--maturity--network--period--quote-symbol--assetsDescribe a metric (discover valid parameters)
查看指标详情(了解可用参数)
bash
gn metric describe market/price_usd_close
gn metric describe market/price_usd_close --asset BTCbash
gn metric describe market/price_usd_close
gn metric describe market/price_usd_close --asset BTCFetch metric data
获取指标数据
bash
gn metric get market/price_usd_close --asset BTC --interval 24h
gn metric get market/price_usd_close --asset BTC --since 2024-01-01 --until 2024-02-01
gn metric get market/price_usd_close --asset BTC --since 30d
gn metric get indicators/sopr --asset BTC --interval 24h --since 30d
gn metric get distribution/balance_exchanges --asset BTC --exchange binance --currency usdbash
gn metric get market/price_usd_close --asset BTC --interval 24h
gn metric get market/price_usd_close --asset BTC --since 2024-01-01 --until 2024-02-01
gn metric get market/price_usd_close --asset BTC --since 30d
gn metric get indicators/sopr --asset BTC --interval 24h --since 30d
gn metric get distribution/balance_exchanges --asset BTC --exchange binance --currency usdBulk fetch (multiple assets)
批量获取(多资产)
Append to the metric path. Repeat (or ) for each asset, or use for all:
/bulk-a--asset-a '*'bash
gn metric get market/marketcap_usd/bulk -a BTC -a ETH -a SOL -s 1d
gn metric get market/marketcap_usd/bulk -a '*' --interval 24h --since 30d在指标路径后追加。重复使用(或)指定每个资产,或使用获取全部资产:
/bulk-a--asset-a '*'bash
gn metric get market/marketcap_usd/bulk -a BTC -a ETH -a SOL -s 1d
gn metric get market/marketcap_usd/bulk -a '*' --interval 24h --since 30dConfig set / get
配置设置/查看
bash
gn config set api-key=your-key
gn config set output=csv
gn config get api-key
gn config get allbash
gn config set api-key=your-key
gn config set output=csv
gn config get api-key
gn config get allGlobal Flags
全局标志
| Flag | Short | Description |
|---|---|---|
| Glassnode API key | |
| | Output format: |
| Print the request URL without executing | |
| Timestamp format in output |
| 标志 | 简写 | 描述 |
|---|---|---|
| Glassnode API密钥 | |
| | 输出格式: |
| 打印请求URL但不执行请求 | |
| 输出中的时间戳格式 |
Best Practices
最佳实践
- Always call before
gn metric describe <path>to discover valid parameters, assets, exchanges, and intervals for a metric.gn metric get - Use (default) for structured output suitable for piping to
--output json.jq - Use to preview the API request URL without executing:
--dry-run.gn metric get market/price_usd_close --asset BTC --since 30d --dry-run - For bulk metrics (path ending in ), use
/bulkwith specific assets or-afor all.-a '*' - Relative time values are supported for and
--since: e.g.--until,30d,7d.1h
- 在执行之前,务必调用
gn metric get来了解该指标的可用参数、资产、交易所和时间间隔。gn metric describe <path> - 使用(默认格式)获取结构化输出,便于通过
--output json进行管道处理。jq - 使用预览API请求URL而不执行:
--dry-run。gn metric get market/price_usd_close --asset BTC --since 30d --dry-run - 对于批量指标(路径以结尾),使用
/bulk指定特定资产或-a获取全部资产。-a '*' - 和
--since支持相对时间值:例如--until、30d、7d。1h
Output Formats
输出格式
- (default) — JSON, suitable for
--output jsonprocessingjq - — CSV format, suitable for spreadsheets
--output csv - — human-readable ASCII table
--output table
bash
undefined- (默认)—— JSON格式,适合
--output json处理jq - —— CSV格式,适合导入电子表格
--output csv - —— 人类可读的ASCII表格
--output table
bash
undefinedPipe JSON to jq
将JSON通过管道传给jq
gn metric get market/price_usd_close -a BTC --since 7d | jq '.[].v'
gn metric get market/price_usd_close -a BTC --since 7d | jq '.[].v'
Export to CSV
导出为CSV
gn metric get market/price_usd_close -a BTC --since 30d -o csv > prices.csv
gn metric get market/price_usd_close -a BTC --since 30d -o csv > prices.csv
Quick look in the terminal
在终端快速查看
gn metric get market/price_usd_close -a BTC --since 7d -o table
undefinedgn metric get market/price_usd_close -a BTC --since 7d -o table
undefined