8
n8n 中文网amn8n.com

Coinbase AI代理 v1.02

高级

这是一个Crypto Trading, AI Chatbot领域的自动化工作流,包含 35 个节点。主要使用 Set, Code, Telegram, Agent, HttpRequestTool 等节点。 使用GPT-4o + Telegram获取Coinbase现货市场实时数据

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "9aTix0CxjipAFy56",
  "meta": {
    "instanceId": "a5283507e1917a33cc3ae615b2e7d5ad2c1e50955e6f831272ddd5ab816f3fb6"
  },
  "name": "Coinbase AI 代理 v1.02",
  "tags": [],
  "nodes": [
    {
      "id": "a55bf961-08ec-4b57-bc79-5d61f25fd56d",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1264,
        736
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "yUizd8t0sD5wMYVG",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a6a4ee3a-efe9-4ab0-a201-bb98780f9d0b",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1008,
        240
      ],
      "webhookId": "3a41e209-f915-4251-9cfc-510889a178dd",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "NRLKuLR7z8vCesub",
          "name": "BinanceSpotTradingAIAgent_Bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5b32884d-b376-4775-a47c-07bec03191b9",
      "name": "用户认证(替换 Telegram ID)",
      "type": "n8n-nodes-base.code",
      "position": [
        -688,
        240
      ],
      "parameters": {
        "jsCode": "if ($input.first().json.message.from.id !== <<Replace>>) { // Replace with your actual ID\n  return {unauthorized: true};\n} else {\n  // Return the original data when authorized\n  return $input.all();\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "75eb688d-d8b7-4498-be72-73f2f31ac8aa",
      "name": "添加 \"SessionId\"",
      "type": "n8n-nodes-base.set",
      "position": [
        -416,
        240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "47598bf1-e55f-4cc0-ae75-272085e7ce02",
              "name": "=sessionId",
              "type": "string",
              "value": "={{ $json.message.chat.id }}"
            },
            {
              "id": "daa49d74-e55e-47bc-ac52-8686d591ab83",
              "name": "message",
              "type": "string",
              "value": "={{ $json.message.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d1e44ee5-6f45-4cca-9b0c-e0d1ce43a65a",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        896,
        240
      ],
      "webhookId": "d8929443-0757-4121-8384-d12c076d3156",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "NRLKuLR7z8vCesub",
          "name": "BinanceSpotTradingAIAgent_Bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "302330a2-2f5f-44a3-b1b5-18979ae3681a",
      "name": "拆分超过 4000 字符的消息",
      "type": "n8n-nodes-base.code",
      "position": [
        464,
        240
      ],
      "parameters": {
        "jsCode": "// Input: assumes incoming message in `item.json.message`\nconst input = $json.output;\nconst chunkSize = 4000;\n\n// Function to split text\nfunction splitMessage(text, size) {\n  const result = [];\n  for (let i = 0; i < text.length; i += size) {\n    result.push(text.substring(i, i + size));\n  }\n  return result;\n}\n\n// Logic\nif (input.length <= chunkSize) {\n  return [{ json: { message: input } }];\n} else {\n  const chunks = splitMessage(input, chunkSize);\n  return chunks.map(chunk => ({ json: { message: chunk } }));\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "4b9e1661-7200-41fd-a832-1105989dec6d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1072,
        -32
      ],
      "parameters": {
        "color": 4,
        "height": 460,
        "content": "## 触发传入的Telegram命令"
      },
      "typeVersion": 1
    },
    {
      "id": "1ab48202-ada4-44c7-b8f8-767bdcc63a55",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -32
      ],
      "parameters": {
        "color": 2,
        "height": 460,
        "content": "## 验证用户访问权限"
      },
      "typeVersion": 1
    },
    {
      "id": "cdbe47f8-2fd9-4532-8f0b-b326f269197f",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -32
      ],
      "parameters": {
        "color": 5,
        "height": 460,
        "content": "## 生成会话元数据"
      },
      "typeVersion": 1
    },
    {
      "id": "4b9e5cdb-f05c-4554-9c89-42ad66fb4955",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        -368
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 804,
        "content": "## 主 AI 代理:数据获取器"
      },
      "typeVersion": 1
    },
    {
      "id": "8543d31f-9681-4cf9-9d45-fd243075c83e",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        -32
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 460,
        "content": "## 处理Telegram消息限制"
      },
      "typeVersion": 1
    },
    {
      "id": "6030ece9-6513-45ae-8680-4d38e792eee4",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        -32
      ],
      "parameters": {
        "color": 4,
        "height": 460,
        "content": "## 发送最终报告到Telegram"
      },
      "typeVersion": 1
    },
    {
      "id": "89de4e6a-21c6-4b57-9297-ea03e424c2fe",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        640
      ],
      "parameters": {
        "height": 540,
        "content": "## 用于推理的GPT模型"
      },
      "typeVersion": 1
    },
    {
      "id": "0a5588cc-2ad7-4b40-b595-3e2045103bca",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 980,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "661bcfce-269d-40b3-9a1d-1ae0e0300cea",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 916,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1a6f0427-35f1-4799-889a-9ec534caacbe",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1072,
        640
      ],
      "parameters": {
        "color": 3,
        "height": 540,
        "content": "## 短期记忆模块"
      },
      "typeVersion": 1
    },
    {
      "id": "1600fc25-60f5-495e-8aad-93e9632a9cf3",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -992,
        736
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "cdb20aa4-7b22-40e6-95b4-4a480a819064",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 852,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "8f91da18-3d8e-4788-bf8e-a33b6addceb4",
      "name": "便利贴11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 884,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "76abe339-9456-472f-b3f0-11b37f3950e8",
      "name": "便签12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 964,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2ef6ad08-14c2-417b-8dc3-e09bb653203c",
      "name": "便签13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 1044,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ff624f1e-6101-4d93-9c6d-c0194edbedef",
      "name": "便签14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 1092,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "00e14a00-38db-455a-b771-30585e0a8570",
      "name": "计算器",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        1520,
        592
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "89546696-8844-4378-b8ed-36c5431ca957",
      "name": "思考",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        1808,
        592
      ],
      "parameters": {
        "description": "### 🏷 工具:**思考**"
      },
      "typeVersion": 1.1
    },
    {
      "id": "077de91e-f21c-4fa7-984c-3604ae546082",
      "name": "便签15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 836,
        "content": "### **计算器**"
      },
      "typeVersion": 1
    },
    {
      "id": "b84095a1-b007-4ba2-8ec5-544d64156925",
      "name": "便签 16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1728,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 932,
        "content": "### **思考**"
      },
      "typeVersion": 1
    },
    {
      "id": "a52823fe-fc0a-4612-ae21-67748ad38c33",
      "name": "Coinbase AI 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -96,
        240
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "options": {
          "systemMessage": "You are the **Coinbase Spot Market Data Agent**.\n\nYou have **HTTP request access** to the official **Coinbase Exchange REST API** to retrieve market data for any requested Coinbase spot trading pair.\nYour job is to **fetch and present data only**. You do **not** analyze, predict, or recommend.\n\n---\n\n## 🔗 API Access\n\n**Base endpoint (primary default):** `https://api.exchange.coinbase.com` :contentReference[oaicite:0]{index=0}  \n**Format rules:**\n- All requests are **HTTP GET**; responses are **JSON**:contentReference[oaicite:1]{index=1}.\n- `product_id` format is `BASE-QUOTE` (e.g., `BTC-USD`) and **lowercase URLs** are required:contentReference[oaicite:2]{index=2}.\n- Public endpoints don’t require auth; private endpoints do (signed headers):contentReference[oaicite:3]{index=3}.\n- Public REST rate limit: **10 rps per IP** (burst up to 15). Private: **15 rps per profile** (burst up to 30). Exceeding returns **429**:contentReference[oaicite:4]{index=4}.\n\n---\n\n## 📌 Available Market Data Endpoints (Public REST)\n\n1) **Order Book Depth**  \n   `GET /products/{product_id}/book?level=2` → top-of-book depth (aggregated):contentReference[oaicite:5]{index=5}  \n   - Use `level=1` for best bid/ask only (L1).  \n   - Use `level=2` for aggregated L2 (recommended over L3 via REST).\n\n2) **Recent Trades**  \n   `GET /products/{product_id}/trades` → latest trades (price, size, side, time):contentReference[oaicite:6]{index=6}  \n\n3) **Aggregate Trades**  \n   **Not provided** as a REST endpoint on Coinbase. Use **Recent Trades** or simulate aggregation in workflow (optional).  \n\n4) **Klines / Candles**  \n   `GET /products/{product_id}/candles?granularity=900` → OHLCV arrays:contentReference[oaicite:7]{index=7}  \n   - Supported `granularity` (seconds): **60, 300, 900, 3600, 21600, 86400** (1m, 5m, 15m, 1h, 6h, 1d).\n\n5) **Current Average Price**  \n   **Not provided** as a REST endpoint. Optionally derive from midpoint of `/book?level=1` ( (bid+ask)/2 ) in your Calculator node.\n\n6) **24h Ticker Price Change Statistics**  \n   `GET /products/{product_id}/stats` → 24h open, high, low, last, volume:contentReference[oaicite:8]{index=8}  \n\n7) **Latest Symbol Price**  \n   `GET /products/{product_id}/ticker` → last price, best bid/ask, volume:contentReference[oaicite:9]{index=9}  \n\n8) **Order Book Best Bid/Ask**  \n   `GET /products/{product_id}/book?level=1` → best bid/ask only (L1):contentReference[oaicite:10]{index=10}  \n\n---\n\n## 🧩 Utility Tools\n- **Calculator** → simple math (e.g., spread, pct change, midpoint).  \n- **Think** → reshape JSON, pick fields, and prepare the Telegram HTML.\n\n---\n\n## 📤 Output Format (Telegram HTML)\n\nStart with:\n```html\n<b>{{PRODUCT_ID}} — Coinbase Spot Data</b>\n````\n\nThen group:\n\n```html\n<b>Price</b>\n• Last: {{lastPrice}}\n• Mid (derived): {{midPrice}}  <!-- optional: (best_bid+best_ask)/2 -->\n• Change (24h): {{pctChange}}%\n\n<b>24h Stats</b>\n• Open: {{open}} • High: {{high}} • Low: {{low}} • Last: {{last}}\n• Volume: {{baseVol}}\n\n<b>Order Book (Top 5)</b>\n• Bids: [price x size] …\n• Asks: [price x size] …\n\n<b>Candles (latest N)</b>\n• Interval: {{interval}} (O/H/L/C per candle)\n```\n\n---\n\n## ⚠️ Rules\n\n* Always **call the correct Coinbase endpoint** for the requested data.\n* Do **not** fabricate or compute indicators; only basic formatting/derivations (e.g., midpoint) are allowed.\n* Do **not** provide advice, sentiment, or predictions.\n* Do **not** dump raw JSON; present clean, human-readable values.\n* If a request fails or a field is missing, show `N/A` and continue with available data.\n\n---\n\n## 🔧 n8n parameter bindings (suggested)\n\nFor each HTTP Request node:\n\n* `product_id` → `={{ /*n8n-auto-generated-fromAI*/ $fromAI('product_id', 'BTC-USD', 'string') }}`\n* `granularity` → `={{ $fromAI('granularity', 900, 'number') }}`  <!-- 15m default -->\n* `limit` (if you add pagination elsewhere) → `={{ $fromAI('limit', 100, 'number') }}`\n\nExample URL for **Ticker**:\n\n```\nhttps://api.exchange.coinbase.com/products/={{$fromAI('product_id','BTC-USD','string')}}/ticker\n```\n\n```\n\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "52aee742-d806-4d15-82fe-4a6eba03deed",
      "name": "24小时统计1",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -704,
        592
      ],
      "parameters": {
        "url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `BTC-USD`, 'string') }}",
        "options": {},
        "toolDescription": "### 🏷 Tool: **24h Stats**\n\n**Endpoint:** `GET /products/{product_id}/stats`\n**What it does:** 24-hour rolling window stats: **open/high/low/last**, **volume**.\n**Params:**\n\n* `product_id` (STRING, required) → format: `BASE-QUOTE` (e.g., BTC-USD)\n\n**Returns (FULL):** open, high, low, last, volume (24h).\n**n8n query mapping:**\n\n```txt\nproduct_id = $fromAI('product_id', 'BTC-USD', 'string')\n```\n\nhttps://api.exchange.coinbase.com/products/{{$fromAI('product_id','BTC-USD','string')}}/stats"
      },
      "typeVersion": 4.2
    },
    {
      "id": "fce2f2ac-c799-4c6c-8402-8ff6f49e6a0d",
      "name": "订单簿深度1",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -400,
        592
      ],
      "parameters": {
        "url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `BTC-USD`, 'string') }}",
        "options": {},
        "toolDescription": "### 🏷 Tool: **Order Book Depth**\n\n**Endpoint:** `GET /products/{product_id}/book?level=2`\n**What it does:** Returns the **order book** for a product. Use `level=1` for best bid/ask (L1) or `level=2` for aggregated depth (L2).\n**Params:**\n\n* `product_id` (STRING, required) → format `BASE-QUOTE` (e.g., BTC-USD)\n* `level` (INT, optional) → `1` (top of book) or `2` (aggregated depth). Default: `2`.\n\n**Returns (L2):** `bids: [[price, size], ...]`, `asks: [[price, size], ...]` plus metadata.\n**n8n query mapping:**\n\n```txt\nproduct_id = $fromAI('product_id', 'BTC-USD', 'string')\nlevel      = $fromAI('level', 2, 'number')\n```\n\nhttps://api.exchange.coinbase.com/products/{{ $fromAI('product_id','BTC-USD','string') }}/book"
      },
      "typeVersion": 4.2
    },
    {
      "id": "84fd5218-005b-44eb-b4bf-c307267a29f1",
      "name": "价格(最新)1",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -112,
        592
      ],
      "parameters": {
        "url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `BTC-USD`, 'string') }}",
        "options": {},
        "toolDescription": "### 🏷 Tool: **Price (Latest)**\n\n**Endpoint:** `GET /products/{product_id}/ticker`\n**What it does:** Returns the **latest trade price** plus best bid/ask and volume for a product.\n**Params:**\n\n* `product_id` (STRING, required) → format: `BASE-QUOTE` (e.g., BTC-USD)\n\n**Returns:** `{ \"trade_id\": ..., \"price\": \"...\", \"size\": \"...\", \"bid\": \"...\", \"ask\": \"...\", \"volume\": \"...\", \"time\": \"...\" }`\n\n**n8n query mapping:**\n\n```txt\nproduct_id = $fromAI('product_id', 'BTC-USD', 'string')\n```\nhttps://api.exchange.coinbase.com/products/{{ $fromAI('product_id','BTC-USD','string') }}/ticker"
      },
      "typeVersion": 4.2
    },
    {
      "id": "89182a5b-03c0-453e-b0d9-974ec3e7edda",
      "name": "最佳买/卖价1",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        208,
        592
      ],
      "parameters": {
        "url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `BTC-USD`, 'string') }}",
        "options": {},
        "toolDescription": "### 🏷 Tool: **Best Bid/Ask (Book Ticker)**\n\n**Endpoint:** `GET /products/{product_id}/book?level=1`\n**What it does:** Returns the best **bid/ask** with sizes for the product.\n**Params:**\n\n* `product_id` (STRING, required) → format: `BASE-QUOTE` (e.g., BTC-USD)\n* `level` (INT, fixed = 1)\n\n**Returns:** `{ \"bids\": [[price, size]], \"asks\": [[price, size]], \"sequence\": ... }`\n\n**n8n query mapping:**\n\n```txt\nproduct_id = $fromAI('product_id', 'BTC-USD', 'string')\nlevel      = 1\n```\n\nhttps://api.exchange.coinbase.com/products/{{ $fromAI('product_id','BTC-USD','string') }}/book"
      },
      "typeVersion": 4.2
    },
    {
      "id": "33a2447c-1026-40ff-bdf0-b18a4c1a1ee2",
      "name": "K线(蜡烛图)1",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        528,
        592
      ],
      "parameters": {
        "url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `BTC-USD`, 'string') }}",
        "options": {},
        "toolDescription": "### 🏷 Tool: **Klines (Candles)**\n\n**Endpoint:** `GET /products/{product_id}/candles`\n**What it does:** Candlestick (OHLCV) data for a product.\n**Params:**\n\n* `product_id` (STRING, required) → format: `BASE-QUOTE` (e.g., BTC-USD)\n* `granularity` (INT, required) → supported: 60, 300, 900, 3600, 21600, 86400 (1m, 5m, 15m, 1h, 6h, 1d)\n* `start`, `end` (ISO8601, optional)\n\n**Returns (array per candle):** `[ time, low, high, open, close, volume ]`\n\n**n8n query mapping:**\n\n```txt\nproduct_id  = $fromAI('product_id', 'BTC-USD', 'string')\ngranularity = $fromAI('granularity', 900, 'number')   # 900 = 15m default\n```\nhttps://api.exchange.coinbase.com/products/{{ $fromAI('product_id','BTC-USD','string') }}/candles"
      },
      "typeVersion": 4.2
    },
    {
      "id": "a1b19454-5272-4122-a1be-95eff5923847",
      "name": "平均价格(衍生)",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        880,
        592
      ],
      "parameters": {
        "url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `BTC-USD`, 'string') }}",
        "options": {},
        "toolDescription": "### 🏷 Tool: **Average Price (Derived)**\n\n**Endpoint:** `GET /products/{product_id}/book?level=1`\n**What it does:** Coinbase does not provide a direct average price endpoint. This tool fetches the **best bid/ask** and you can derive a midpoint average `(bid + ask)/2`.\n**Params:**\n\n* `product_id` (STRING, required) → format: `BASE-QUOTE` (e.g., BTC-USD)\n* `level` (INT, fixed = 1)\n\n**Returns:** `{ \"bids\": [[price, size]], \"asks\": [[price, size]] }`\n\n**n8n query mapping:**\n\n```txt\nproduct_id = $fromAI('product_id', 'BTC-USD', 'string')\nlevel      = 1\n```\n\n**Notes:** Use Calculator node to compute midpoint from bid/ask.\n\nhttps://api.exchange.coinbase.com/products/{{ $fromAI('product_id','BTC-USD','string') }}/book"
      },
      "typeVersion": 4.2
    },
    {
      "id": "9c5657f8-1c31-46f3-8146-93f36fa25e49",
      "name": "最近交易1",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1200,
        592
      ],
      "parameters": {
        "url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `BTC-USD`, 'string') }}",
        "options": {},
        "toolDescription": "### 🏷 Tool: **Recent Trades**\n\n**Endpoint:** `GET /products/{product_id}/trades`\n**What it does:** Returns the **most recent trades** for a Coinbase product.\n**Params:**\n\n* `product_id` (STRING, required) → format: `BASE-QUOTE` (e.g., BTC-USD)\n* `limit` (INT, optional) → number of trades to return (defaults ~100)\n\n**Returns (array):** `[ { \"time\": \"...\", \"trade_id\": 123, \"price\": \"...\", \"size\": \"...\", \"side\": \"buy|sell\" }, ... ]`\n\n**n8n query mapping:**\n\n```txt\nproduct_id = $fromAI('product_id', 'BTC-USD', 'string')\nlimit      = $fromAI('limit', 100, 'number')\n```\n\n**Notes:** Endpoint supports pagination via `before` / `after` cursors if you later need historical pages.\n\nhttps://api.exchange.coinbase.com/products/{{ $fromAI('product_id','BTC-USD','string') }}/trades"
      },
      "typeVersion": 4.2
    },
    {
      "id": "4e47f927-47c3-4f73-a790-4d44606ce7a5",
      "name": "便签17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2128,
        -496
      ],
      "parameters": {
        "width": 1664,
        "height": 2016,
        "content": "# 🧠 Coinbase 现货市场量化 AI 代理 – 完整系统文档"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6d33dd3b-6ec0-4fca-86cd-0387726696d9",
  "connections": {
    "Think": {
      "ai_tool": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "24h Stats1": {
      "ai_tool": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Best Bid/Ask1": {
      "ai_tool": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Recent Trades1": {
      "ai_tool": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Price (Latest)1": {
      "ai_tool": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Adds \"SessionId\"": {
      "main": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "User Authentication (Replace Telegram ID)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Klines (Candles)1": {
      "ai_tool": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Order Book Depth1": {
      "ai_tool": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Coinbase  AI Agent": {
      "main": [
        [
          {
            "node": "Splits message is more than 4000 characters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Average Price (Derived)": {
      "ai_tool": [
        [
          {
            "node": "Coinbase  AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "User Authentication (Replace Telegram ID)": {
      "main": [
        [
          {
            "node": "Adds \"SessionId\"",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Splits message is more than 4000 characters": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 加密货币交易, AI 聊天机器人

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量35
分类2
节点类型11
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Don Jayamaha Jr

Don Jayamaha Jr

@don-the-gem-dealer

With 12 years of experience as a Blockchain Strategist and Web3 Architect, I specialize in bridging the gap between traditional industries and decentralized technologies. My expertise spans tokenized assets, crypto payment integrations, and blockchain-driven market solutions.

外部链接
在 n8n.io 查看

分享此工作流