使用CoinGecko和ExchangeRate-API创建BTC-ETH价格和美元汇率API
中级
这是一个Crypto Trading, Miscellaneous, Multimodal AI领域的自动化工作流,包含 7 个节点。主要使用 Code, Merge, Webhook, HttpRequest, RespondToWebhook 等节点。 使用CoinGecko和ExchangeRate-API创建BTC/ETH价格和美元汇率API
前置要求
- •HTTP Webhook 端点(n8n 会自动生成)
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"
},
"nodes": [
{
"id": "f43de1da-85c9-4e07-87b2-e3d54aba8cfd",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
-704,
-16
],
"webhookId": "9cb6d3c6-0ff2-4ff4-a992-4b8ebc27de72",
"parameters": {
"path": "crypto-fx",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 1
},
{
"id": "53645dd6-4117-4e41-b958-5d3bfc022f6a",
"name": "Get Fiat Exchange Rates",
"type": "n8n-nodes-base.httpRequest",
"position": [
-496,
-80
],
"parameters": {
"url": "https://api.exchangerate-api.com/v4/latest/USD",
"options": {}
},
"typeVersion": 4.1
},
{
"id": "9d0c77d1-67bc-4030-93d2-75ca981bb504",
"name": "获取加密货币价格",
"type": "n8n-nodes-base.httpRequest",
"position": [
-496,
80
],
"parameters": {
"url": "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum&vs_currencies=usd&include_24hr_change=true",
"options": {}
},
"typeVersion": 4.1
},
{
"id": "9bd74632-a79c-4076-b75d-2a7550325356",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
-304,
0
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "89163b24-4f91-4a12-b260-d00b47849a73",
"name": "Build JSON",
"type": "n8n-nodes-base.code",
"position": [
-96,
0
],
"parameters": {
"jsCode": "let fx,cg;for(const it of $input.all()){ if(it.json?.rates) fx=it.json; if(it.json?.bitcoin) cg=it.json; }\nconst payload={\n btc:{ price: cg?.bitcoin?.usd ?? null, change_24h: cg?.bitcoin?.usd_24h_change ?? null },\n eth:{ price: cg?.ethereum?.usd ?? null, change_24h: cg?.ethereum?.usd_24h_change ?? null },\n usd_eur: fx?.rates?.EUR ?? null,\n usd_ngn: fx?.rates?.NGN ?? null,\n ts: new Date().toISOString()\n};\nreturn [{json: payload}];"
},
"typeVersion": 2
},
{
"id": "70a8ddb0-b644-4344-a17f-1cadbb8074e6",
"name": "Respond",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
128,
0
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "28ab2e99-d2cc-420c-9e5f-c73fd14639c0",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
272,
-208
],
"parameters": {
"width": 544,
"height": 640,
"content": "## 🌐 Crypto + FX Micro-API (Webhook JSON)\n\n**What it does:** \nExposes a lightweight **GET** endpoint that returns **BTC/ETH price + 24h %** and **USD→EUR / USD→NGN** in clean JSON.\n\n**Route:** \n`/webhook/crypto-fx` (use n8n’s Test or Production URL)\n\n**Flow:** \n**Webhook (GET)** → ExchangeRate-API → CoinGecko → **Merge** → **Code (build JSON)** → **Respond**\n\n**Example Response:** \n```json\n{\n \"btc\": { \"price\": 112417, \"change_24h\": 1.22 },\n \"eth\": { \"price\": 4334.57, \"change_24h\": 1.33 },\n \"usd_eur\": 0.854,\n \"usd_ngn\": 1524.54,\n \"ts\": \"2025-09-08T08:00:00.000Z\"\n}\n"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Merge": {
"main": [
[
{
"node": "Build JSON",
"type": "main",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "Get Fiat Exchange Rates",
"type": "main",
"index": 0
},
{
"node": "Get Crypto Prices",
"type": "main",
"index": 0
}
]
]
},
"Build JSON": {
"main": [
[
{
"node": "Respond",
"type": "main",
"index": 0
}
]
]
},
"Get Crypto Prices": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Get Fiat Exchange Rates": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 加密货币交易, 杂项, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
比特币和以太坊加密货币下跌警报(Telegram、Slack 和 SMS)
通过 Telegram、Slack 和 SMS 发送比特币和以太坊加密货币下跌警报
If
Code
Slack
+5
8 节点David Olusola
加密货币交易
使用 CoinGecko 通过邮件/SMS 监控比特币和以太坊价格告警
使用 CoinGecko 通过邮件/SMS 监控比特币和以太坊价格告警
If
Code
Gmail
+4
8 节点David Olusola
加密货币交易
使用 CoinGecko 和 ExchangeRate-API 跟踪加密货币价格和汇率至 Notion
使用 CoinGecko 和 ExchangeRate-API 跟踪加密货币价格和汇率至 Notion
Code
Merge
Notion
+3
7 节点David Olusola
杂项
竞争对手内容差距分析器:自动化网站主题映射
使用Gemini AI、Apify和Google Sheets分析竞争对手内容差距
If
Set
Code
+10
30 节点Mychel Garzon
杂项
使用Groq AI和GhostGenius比较LinkedIn个人资料与职位描述
使用Groq AI和GhostGenius比较LinkedIn个人资料与职位描述的匹配度
If
Set
Code
+8
17 节点Stephan Koning
杂项
重新利用 YouTube 视频
使用 Gemini AI 和 ContentDrips 在社交媒体上重新利用 YouTube 视频
If
Code
Merge
+13
47 节点Shayan Ali Bakhsh
杂项
工作流信息
难度等级
中级
节点数量7
分类3
节点类型6
作者
David Olusola
@dae221I help ambitious businesses eliminate operational bottlenecks and scale faster with AI automation. My clients typically see 40-60% efficiency gains within 90 days. Currently accepting 3 new projects this quarter - david@daexai.com
外部链接
在 n8n.io 查看 →
分享此工作流