Créer une API BTC-ETH et taux de change USD avec CoinGecko et ExchangeRate-API

Intermédiaire

Ceci est unCrypto Trading, Miscellaneous, Multimodal AIworkflow d'automatisation du domainecontenant 7 nœuds.Utilise principalement des nœuds comme Code, Merge, Webhook, HttpRequest, RespondToWebhook. Utiliser CoinGecko et ExchangeRate-API pour créer une API de prix BTC/ETH et de taux de change USD

Prérequis
  • Point de terminaison HTTP Webhook (généré automatiquement par n8n)
  • Peut nécessiter les informations d'identification d'authentification de l'API cible
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "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": "Obtenir les taux de change des devises",
      "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": "Obtenir les prix des cryptomonnaies",
      "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": "Fusionner",
      "type": "n8n-nodes-base.merge",
      "position": [
        -304,
        0
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "89163b24-4f91-4a12-b260-d00b47849a73",
      "name": "Construire 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": "Répondre",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        128,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "28ab2e99-d2cc-420c-9e5f-c73fd14639c0",
      "name": "Note adhésive",
      "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": {
    "9bd74632-a79c-4076-b75d-2a7550325356": {
      "main": [
        [
          {
            "node": "89163b24-4f91-4a12-b260-d00b47849a73",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f43de1da-85c9-4e07-87b2-e3d54aba8cfd": {
      "main": [
        [
          {
            "node": "53645dd6-4117-4e41-b958-5d3bfc022f6a",
            "type": "main",
            "index": 0
          },
          {
            "node": "9d0c77d1-67bc-4030-93d2-75ca981bb504",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "89163b24-4f91-4a12-b260-d00b47849a73": {
      "main": [
        [
          {
            "node": "70a8ddb0-b644-4344-a17f-1cadbb8074e6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9d0c77d1-67bc-4030-93d2-75ca981bb504": {
      "main": [
        [
          {
            "node": "9bd74632-a79c-4076-b75d-2a7550325356",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "53645dd6-4117-4e41-b958-5d3bfc022f6a": {
      "main": [
        [
          {
            "node": "9bd74632-a79c-4076-b75d-2a7550325356",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Intermédiaire - Trading crypto, Divers, IA Multimodale

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Intermédiaire
Nombre de nœuds7
Catégorie3
Types de nœuds6
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Auteur
David Olusola

David Olusola

@dae221

I 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

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34