8
n8n 中文网amn8n.com

HTX AI代理 v1.02

高级

这是一个Miscellaneous, AI Chatbot, Multimodal AI领域的自动化工作流,包含 35 个节点。主要使用 Set, Code, Telegram, Agent, HttpRequestTool 等节点。 使用HTX API、GPT-4o和Telegram分析加密货币市场数据

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "kZ3wJtLi5OI0WzFF",
  "meta": {
    "instanceId": "a5283507e1917a33cc3ae615b2e7d5ad2c1e50955e6f831272ddd5ab816f3fb6"
  },
  "name": "HTX AI Agent v1.02",
  "tags": [],
  "nodes": [
    {
      "id": "297e04f4-eea6-483a-ac66-b7eaa8736c75",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1264,
        736
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "yUizd8t0sD5wMYVG",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9a3813bf-2888-47d9-b6fe-ae4d6acff278",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1008,
        240
      ],
      "webhookId": "5efb4c0e-a995-4dff-8b82-0b876786d0da",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "NRLKuLR7z8vCesub",
          "name": "BinanceSpotTradingAIAgent_Bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "24b0013b-ad84-4e59-b8eb-47bf0c44ebb4",
      "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": "5c213506-27d4-448a-86a7-4bd310a8d3d3",
      "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": "d46968c2-f161-4b84-8d7a-afbe3d273b55",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        896,
        240
      ],
      "webhookId": "1030ef2a-578d-47aa-90c8-bd9dfebad15f",
      "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": "9c52c121-7184-4f3f-a6ca-a6ff152486ac",
      "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": "3fdfb9bf-1c8e-41de-8a3f-d31251024614",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1072,
        -32
      ],
      "parameters": {
        "color": 4,
        "height": 460,
        "content": "## 触发传入的 Telegram 命令"
      },
      "typeVersion": 1
    },
    {
      "id": "b3ecb16d-982a-4199-961e-734b9bfd8045",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -32
      ],
      "parameters": {
        "color": 2,
        "height": 460,
        "content": "## 验证用户访问权限"
      },
      "typeVersion": 1
    },
    {
      "id": "ee812a3d-e975-4c84-9725-592c4cf00d95",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -32
      ],
      "parameters": {
        "color": 5,
        "height": 460,
        "content": "## 生成会话元数据"
      },
      "typeVersion": 1
    },
    {
      "id": "57c343be-dc21-4ede-bfeb-5f94bb2a3d6b",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        -496
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 932,
        "content": "## 主 AI Agent:数据获取器 (HTX)"
      },
      "typeVersion": 1
    },
    {
      "id": "c308c89f-1650-4cf4-8845-51c45f1e6876",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        -32
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 460,
        "content": "## 处理 Telegram 消息限制"
      },
      "typeVersion": 1
    },
    {
      "id": "e95075f4-d564-4009-8511-c8d7c2f77370",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        -32
      ],
      "parameters": {
        "color": 4,
        "height": 460,
        "content": "## 发送最终报告到 Telegram"
      },
      "typeVersion": 1
    },
    {
      "id": "9caa9127-eb4d-42f2-833b-f8ce8396edd7",
      "name": "### 需要帮助?",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        640
      ],
      "parameters": {
        "height": 540,
        "content": "## 用于推理的 GPT 模型"
      },
      "typeVersion": 1
    },
    {
      "id": "9538e331-7ae2-4d6f-97c7-6dfd66ccbe58",
      "name": "## 试试看!",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 1076,
        "content": "### **订单簿深度**"
      },
      "typeVersion": 1
    },
    {
      "id": "540558b9-6cbe-49be-937e-234489be85fa",
      "name": "GET 模型",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 868,
        "content": "### **最佳买价/卖价(订单簿行情)**"
      },
      "typeVersion": 1
    },
    {
      "id": "803bcfaf-7d72-4616-b459-e6ad8db4ac8c",
      "name": "## 1. 创建新的自定义 OpenAI 凭据",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1072,
        640
      ],
      "parameters": {
        "color": 3,
        "height": 540,
        "content": "## 短期记忆模块"
      },
      "typeVersion": 1
    },
    {
      "id": "98ebfd96-fa61-4908-9bc0-feb3c57c191b",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -992,
        736
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "3438fe42-4c59-4ebf-9633-70dc3243c244",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 884,
        "content": "### **24小时统计数据(行情详情)**"
      },
      "typeVersion": 1
    },
    {
      "id": "6811afcf-331a-4120-aa73-5612cf980f67",
      "name": "便签 11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 820,
        "content": "### **价格(最新)**"
      },
      "typeVersion": 1
    },
    {
      "id": "5ef7dc9e-d003-4b36-bf4f-61ede9307fc5",
      "name": "便签 12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 1060,
        "content": "### **K线(蜡烛图)**"
      },
      "typeVersion": 1
    },
    {
      "id": "b155271b-7656-4a6e-9e24-9496e18b77f8",
      "name": "便利贴13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 900,
        "content": "### **聚合行情(买价/卖价/最后)**"
      },
      "typeVersion": 1
    },
    {
      "id": "c999ffb2-e531-4111-b3b5-6d001343af02",
      "name": "便签14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 868,
        "content": "### **近期交易**"
      },
      "typeVersion": 1
    },
    {
      "id": "699f4811-924c-4734-add9-7e92453f22a5",
      "name": "计算器",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        1520,
        592
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "9f866f49-6516-4248-8092-28fe70363c7e",
      "name": "思考",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        1808,
        592
      ],
      "parameters": {
        "description": "### 🏷 工具:**思考**"
      },
      "typeVersion": 1.1
    },
    {
      "id": "e05fedc2-d50f-4bb5-a499-e96a16f2d3bf",
      "name": "便签 15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 836,
        "content": "### **计算器**"
      },
      "typeVersion": 1
    },
    {
      "id": "6e6d72dc-2560-4a28-bbb5-0bd53b70f3c7",
      "name": "便签16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1728,
        512
      ],
      "parameters": {
        "color": 6,
        "height": 932,
        "content": "### **思考**"
      },
      "typeVersion": 1
    },
    {
      "id": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
      "name": "HTX AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -96,
        240
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "options": {
          "systemMessage": "You are the **HTX Spot Market Data Agent**.\n\nYou have **HTTP request access** to the official **HTX REST API** (`https://api.huobi.pro`) to retrieve spot market data for any requested trading pair.\n\nYour job is to **fetch and present raw market data only**.  \nYou do **not** analyze, predict, or recommend.\n\n---\n\n## 🔗 Available Endpoints\n\n1. **Live Price (Aggregated Ticker)**  \n   `GET /market/detail/merged`  \n   • Returns best bid/ask, last trade price, volume, turnover.\n\n2. **24h Market Summary**  \n   `GET /market/detail`  \n   • 24h stats: open, high, low, close, volume, amount, count.\n\n3. **Market Depth**  \n   `GET /market/depth`  \n   • Order book bids/asks (step/levels configurable).\n\n4. **Full Order Book**  \n   `GET /market/fullMbp`  \n   • Complete market depth (up to 5000 levels).\n\n5. **Last Trade**  \n   `GET /market/trade`  \n   • Most recent single trade.\n\n6. **Recent Trades**  \n   `GET /market/history/trade`  \n   • List of recent trades.\n\n7. **Klines (Candlesticks)**  \n   `GET /market/history/kline`  \n   • Multiple intervals supported (`1s, 1min, 5min, 15min, 1day, 1week, 1mon, 1year`).  \n   • The AI automatically selects the correct interval (`seconds, minutes, days, weeks, months, years`).\n\n---\n\n## 📤 Output Format\n\nAlways respond in **clean, structured text** (Telegram HTML). Example:\n\n```\n\nBTC-USDT — HTX Spot Data\n\nPrice\n• Last: 58000.12\n• Change (24h): +2.4%\n\n24h Stats\n• Open: 56500 • High: 58500 • Low: 56200\n• Volume: 12,430 BTC • Turnover: 720M USDT\n\nOrder Book (Top 5)\n• Bids: \\[57990 x 0.5], \\[57980 x 1.2], …\n• Asks: \\[58010 x 0.8], \\[58020 x 1.5], …\n\nKlines (15m, latest 5)\n• O/H/L/C: 57800 / 58020 / 57750 / 57990\n\n```\n\n---\n\n## ⚠️ Rules\n\n* Always **call the correct HTX API endpoint**.  \n* Do **not** fabricate or calculate values (except simple formatting).  \n* Do **not** output raw JSON.  \n* Do **not** give advice, predictions, or strategies.  \n* If data is missing, output `N/A`.\n```\n\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "8e68fe2c-a84c-4340-b6c8-e9d0a69c717b",
      "name": "24小时统计数据",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -704,
        608
      ],
      "parameters": {
        "url": "https://api.huobi.pro/market/detail",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "symbol",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `btcusdt`, 'string') }}"
            }
          ]
        },
        "toolDescription": "### 🏷 Tool: **24h Stats (Ticker Detail)**\n\n**Endpoint:** `GET /market/detail`\n**What it does:** Returns the **24h rolling summary** for a single HTX spot symbol: **open/high/low/close**, **amount (base volume)**, **vol (quote turnover)**, and **trade count**.\n\n**Params:**\n- `symbol` (STRING, required) → e.g., `btcusdt` (lowercase, no dash)\n\n**Returns (core fields):** `ts`, `tick.open`, `tick.close`, `tick.high`, `tick.low`, `tick.amount`, `tick.vol`, `tick.count`.\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'btcusdt', 'string')\n```\n\n**Notes:** For all symbols at once, use `GET /market/tickers`.\n"
      },
      "typeVersion": 4.2
    },
    {
      "id": "0a3e5648-3f35-4ba8-bed1-3b60f307f001",
      "name": "订单簿深度",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -400,
        608
      ],
      "parameters": {
        "url": "https://api.huobi.pro/market/depth",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "symbol",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `btcusdt`, 'string') }}"
            },
            {
              "name": "type",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `step0`, 'string') }}"
            },
            {
              "name": "depth",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `20`, 'number') }}"
            }
          ]
        },
        "toolDescription": "### 🏷 Tool: **Order Book Depth**\n\n**Endpoint:** `GET /market/depth`\n\n**What it does:** Returns the **order book snapshot** (bids/asks) for a trading pair up to the requested depth level.\n\n**Params:**\n- `symbol` (STRING, required) → e.g., `btcusdt` (lowercase, no dash)\n- `type` (STRING, required) → depth aggregation level (`step0`–`step5`)\n  - `step0` = no aggregation (full precision)\n  - `step1` = aggregated to 1 decimal place\n  - … up to `step5`\n- `depth` (INT, optional) → max entries per side (default 20, max 150)\n\n**Returns:** `ts`, `tick.bids: [[price, qty], ...]`, `tick.asks: [[price, qty], ...]`\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'btcusdt', 'string')\ntype   = $fromAI('parameters1_Value', 'step0', 'string')\ndepth  = $fromAI('parameters2_Value', 20, 'number')\n```\n\n**Notes:** For lightweight quick book snapshot, use `step0` with smaller depth (20/50)."
      },
      "typeVersion": 4.2
    },
    {
      "id": "0df3137a-638e-4c99-8121-c8d119566ca8",
      "name": "价格(最新)",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -112,
        608
      ],
      "parameters": {
        "url": "https://api.huobi.pro/market/detail/merged",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "symbol",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `btcusdt`, 'string') }}"
            }
          ]
        },
        "toolDescription": "### 🏷 Tool: **Price (Latest)**\n\n**Endpoint:** `GET /market/detail/merged`\n\n**What it does:** Returns the **latest trade price**, best bid/ask, and other snapshot details for a symbol.\n\n**Params:**\n- `symbol` (STRING, required) → e.g., `btcusdt` (lowercase, no dash)\n\n**Returns:** `tick.close` = last trade price, plus bid/ask/volumes.\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'btcusdt', 'string')\n```\n\n**Notes:** Use lowercase symbols without `-` or `/` (e.g., `btcusdt`)."
      },
      "typeVersion": 4.2
    },
    {
      "id": "2a5e0910-992b-409d-83d5-5af4121f71af",
      "name": "最佳买价/卖价",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        208,
        608
      ],
      "parameters": {
        "url": "https://api.huobi.pro/market/detail/merged",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "symbol",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `btcusdt`, 'string') }}"
            }
          ]
        },
        "toolDescription": "### 🏷 Tool: **Best Bid/Ask (Order Book Ticker)**\n\n**Endpoint:** `GET /market/detail/merged`\n\n**What it does:** Returns the best **bid/ask** snapshot along with the latest trade price for a symbol.\n\n**Params:**\n- `symbol` (STRING, required) → e.g., `btcusdt` (lowercase, no dash)\n\n**Returns:** `tick.bid` = `[price, qty]`, `tick.ask` = `[price, qty]`\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'btcusdt', 'string')\n```\n\n**Notes:** Use lowercase symbols without `-` or `/` (e.g., `btcusdt`)."
      },
      "typeVersion": 4.2
    },
    {
      "id": "c31f039c-42da-47ed-9c7a-bd47dd276634",
      "name": "K线(蜡烛图)",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        544,
        592
      ],
      "parameters": {
        "url": "https://api.huobi.pro/market/history/kline",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "symbol",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `btcusdt`, 'string') }}"
            },
            {
              "name": "period",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `15min`, 'string') }}"
            },
            {
              "name": "size",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `20`, 'number') }}"
            }
          ]
        },
        "toolDescription": "### 🏷 Tool: **Klines (Candles)**\n\n**Endpoint:** `GET /market/history/kline`\n\n**What it does:** Returns candlestick data for a symbol/interval.\n\n**Params:**\n- `symbol` (STRING, required) → lowercase (e.g., `btcusdt`)\n- `period` (ENUM, required — e.g., `1min,5min,15min,30min,60min,4hour,1day,1mon,1week,1year`)\n- `size` (INT, optional, default 20, max 2000)\n\n**Returns (array per candle):** `[id, open, close, low, high, amount, vol, count]`\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'btcusdt', 'string')\nperiod = $fromAI('parameters1_Value', '15min', 'string')\nsize   = $fromAI('parameters2_Value', 20, 'number')\n```\n\n**Notes:**\n- Use lowercase symbols without `-` (e.g., `btcusdt`).\n- If no `size` provided, defaults to 20 latest candles."
      },
      "typeVersion": 4.2
    },
    {
      "id": "b773e24e-b4b3-49b2-82a5-89a110613538",
      "name": "平均价格",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        880,
        592
      ],
      "parameters": {
        "url": "https://api.huobi.pro/market/detail/merged",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "symbol",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `btcusdt`, 'string') }}"
            }
          ]
        },
        "toolDescription": "### 🏷 Tool: **Merged Ticker (Bid/Ask/Last)**\n\n**Endpoint:** `GET /market/detail/merged`\n**What it does:** Returns best bid/ask and last price for a symbol. Use Calculator to derive a midpoint `(bid+ask)/2` if you need an average.\n\n**Params:** `symbol` (STRING, required) → lowercase, no dash (e.g., `btcusdt`)\n\n**Returns (key fields):** `tick.bid`, `tick.ask`, `tick.close`, `tick.high`, `tick.low`, `tick.amount`, `tick.vol`, `ts`\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'btcusdt', 'string')\n```\n\n**Notes:** HTX has no direct avg-price endpoint; this is the canonical ticker to pair with Calculator for midpoint."
      },
      "typeVersion": 4.2
    },
    {
      "id": "96a09dbc-cfd5-46d2-ba6a-1cb4dfd661b3",
      "name": "近期交易",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1216,
        592
      ],
      "parameters": {
        "url": "https://api.huobi.pro/market/history/trade",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "symbol",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `btcusdt`, 'string') }}"
            },
            {
              "name": "size",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `100`, 'number') }}"
            }
          ]
        },
        "toolDescription": "### 🏷 Tool: **Recent Trades**\n\n**Endpoint:** `GET /market/history/trade`\n**What it does:** Returns the most recent trades for a given symbol.\n\n**Params:**\n* `symbol` (STRING, required) → lowercase, no dash (e.g., `btcusdt`)\n* `size` (INT, default 100, max 2000 — we set default 100)\n\n**Returns:** array of trade batches → each batch has `data: [{id, price, amount, direction, ts}]`\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'btcusdt', 'string')\nsize   = $fromAI('parameters1_Value', 100, 'number')\n```\n\n**Notes:** Unlike Binance, HTX nests trades inside `data` arrays per batch."
      },
      "typeVersion": 4.2
    },
    {
      "id": "29213890-b332-491a-80f3-589cc94c7aab",
      "name": "便签17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2128,
        -992
      ],
      "parameters": {
        "width": 1200,
        "height": 2464,
        "content": "# 🧠 HTX 现货市场数据 AI Agent – 完整系统文档"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4d9a7688-a32d-4e45-a66c-a30c88d00a81",
  "connections": {
    "Think": {
      "ai_tool": [
        [
          {
            "node": "HTX AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "24h Stats": {
      "ai_tool": [
        [
          {
            "node": "HTX AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "HTX AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Best Bid/Ask": {
      "ai_tool": [
        [
          {
            "node": "HTX AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "HTX AI Agent": {
      "main": [
        [
          {
            "node": "Splits message is more than 4000 characters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Average Price": {
      "ai_tool": [
        [
          {
            "node": "HTX AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Recent Trades": {
      "ai_tool": [
        [
          {
            "node": "HTX AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "HTX AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Price (Latest)": {
      "ai_tool": [
        [
          {
            "node": "HTX AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Adds \"SessionId\"": {
      "main": [
        [
          {
            "node": "HTX AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Klines (Candles)": {
      "ai_tool": [
        [
          {
            "node": "HTX AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Order Book Depth": {
      "ai_tool": [
        [
          {
            "node": "HTX AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "User Authentication (Replace Telegram ID)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "HTX AI Agent",
            "type": "ai_languageModel",
            "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 聊天机器人, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
高级
节点数量35
分类3
节点类型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 查看

分享此工作流