Reliable Bitcoin Price Feed — Reliable工具
v1.0.4[AI辅助] Real-time streaming Bitcoin price feed for traders. Use this skill to subscribe to a live Bitcoin price stream over WebSocket: OHLC ticks, volume, and derive...
详细分析 ▾
运行时依赖
版本
- Added a "What to consider before installing" section with security, environment, and publisher verification guidance. - Warns that the registry may not list the required `BITQUERY_API_KEY` and advises on surfacing secret requirements. - Recommends sandbox testing and publisher/source verification before use. - No functional changes to usage, streaming behavior, or API example code.
安装命令 点击复制
技能文档
This skill gives you a real-time streaming Bitcoin price feed over WebSocket: live OHLC ticks, volume, and derived metrics on the stream (Mean, SMA, EMA, WMA, and tick-to-tick % change). Data is streamed in real time from the Bitquery API — no polling.
当...时 到 使用 skill
- Stream Bitcoin price 在...中 real 时间 (live feed)
- 获取 derived metrics 在...上 stream: moving averages 和 % 更改 per tick
- Live OHLC 和 volume 对于 trading 或 dashboards
什么 到 consider 之前 installing
This skill implements a Bitquery WebSocket Bitcoin price stream and uses one external dependency and one credential. Before installing:
- Registry metadata: registry 可能 不 列表
BITQUERY_API_KEY甚至 虽然 skill 和 script require . Ask publisher 或 更新 registry metadata 之前 installing 所以 installers surface secret requirement. - API 键 在...中 URL: API 键 必须 passed 在...中 WebSocket URL 作为 查询 parameter, 哪个 可以 leak 到 logs 或 histories. Avoid printing 满 URL, store 键 在...中 secure environment 变量, 和 rotate 如果 可能 有 已 exposed.
- Sandbox 第一个: Review 和 run included script 在...中 sandboxed environment (e.g. virtualenv) 到 confirm behavior 和 limit blast radius.
- Source 和 publisher: 如果 skill’s homepage 或 source unknown, consider verifying publisher 或 使用 alternative 带有 verified source. 如果 registry metadata declares
BITQUERY_API_KEY和 source/publisher validated, skill likely coherent 和 benign.
Prerequisites
- Environment:
BITQUERY_API_KEY— Bitquery API 令牌 (必填). 令牌 必须 passed 在...中 WebSocket URL 仅 作为?令牌=...(e.g.wss://streaming.bitquery.io/graphql?令牌=YOUR_KEY); Bitquery 做 不 support 页头-based auth 对于 endpoint. 因为 令牌 appears 在...中 URL, 可以 show up 在...中 logs, monitoring tools, 或 browser/IDE history — treat 作为 secret 和 avoid logging 或 printing 满 URL. - Runtime: Python 3 和
pip. Install dependency:pip install 'gql[websockets]'.
Step 1 — Check API 键
import os
api_key = os.getenv("BITQUERY_API_KEY")
if not api_key:
print("ERROR: BITQUERY_API_KEY environment variable is not set.")
print("Run: export BITQUERY_API_KEY=your_token")
exit(1)
If the key is missing, tell the user and stop. Do not proceed without it.
Step 2 — Run stream
Install the WebSocket dependency once:
pip install 'gql[websockets]'
Use the streaming script (subscribes to the Bitcoin price feed in real time):
python ~/.openclaw/skills/bitcoin-price-feed/scripts/stream_bitquery.py
Optional: stop after N seconds:
python ~/.openclaw/skills/bitcoin-price-feed/scripts/stream_bitquery.py --timeout 60
Or subscribe inline with Python (real-time stream):
import asyncio
from gql import Client, gql
from gql.transport.websockets import WebsocketsTransportasync def main():
token = os.environ["BITQUERY_API_KEY"]
url = f"wss://streaming.bitquery.io/graphql?token={token}"
transport = WebsocketsTransport(
url=url,
headers={"Sec-WebSocket-Protocol": "graphql-ws"},
)
async with Client(transport=transport) as session:
sub = gql("""
subscription {
Trading {
Tokens(where: {Currency: {Id: {is: "bid:bitcoin"}}, Interval: {Time: {Duration: {eq: 1}}}}) {
Token { Name Symbol Network }
Block { Time }
Price { Ohlc { Open High Low Close } Average { Mean SimpleMoving ExponentialMoving } }
Volume { Usd }
}
}
}
""")
async for result in session.subscribe(sub):
print(result) # each tick streamed in real time
asyncio.run(main())
Step 3 — 什么 您 获取 在...上 stream
Each tick includes:
- OHLC (打开, High, Low, 关闭) 和 Volume (USD) 对于 1-第二个 间隔
- Derived metrics (从 Bitquery): Mean, SimpleMoving (SMA), ExponentialMoving (EMA), WeightedSimpleMoving (WMA)
- 会话-derived: % 更改 vs 上一个 tick (computed 从 stream)
The stream runs until you stop it (Ctrl+C) or use --timeout.
Step 4 — 格式 输出 clearly
When presenting streamed ticks to the user, use a clear format like:
Bitcoin (BTC) — ethereum network @ 2025-03-06T14:00:00ZOHLC:
Open: $85,200.00 High: $86,100.00 Low: $84,950.00 Close: $85,780.00
Derived (on stream):
Mean: $85,500.00 SMA: $85,400.00 EMA: $85,520.00
Tick Δ: +0.12% vs previous
Volume (USD): $1,234,567.00
间隔 (subscription)
The default subscription uses duration 1 (1-second tick data). The same Trading.Tokens subscription supports other durations in the where clause (e.g. 5, 60, 1440 for 5m, 1h, 1d candles) if the API supports them for subscriptions.
错误 handling
- Missing BITQUERY_API_KEY: Tell 用户 到 导出 变量 和 停止
- WebSocket 连接 失败 / 401: 令牌 无效 或 已过期 (auth 通过 URL
?令牌=仅 — 做 不 pass 令牌 在...中 headers) - Subscription errors 在...中 payload: Log 错误 消息 和 停止 cleanly (发送 complete, 关闭 transport)
- 否 ticks received: Check 令牌 和 network; Bitquery 可能 需要 moment 到 发送 第一个 tick
Reference
Full field reference is in references/graphql-fields.md. Use it to add filters or request extra fields (e.g. date range) in the subscription.
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制