Agente HTX AI v1.02
Este es unMiscellaneous, AI Chatbot, Multimodal AIflujo de automatización del dominio deautomatización que contiene 35 nodos.Utiliza principalmente nodos como Set, Code, Telegram, Agent, HttpRequestTool. Analizar datos del mercado de criptomonedas con HTX API, GPT-4o y Telegram
- •Bot Token de Telegram
- •Pueden requerirse credenciales de autenticación para la API de destino
- •Clave de API de OpenAI
Nodos utilizados (35)
Categoría
{
"id": "kZ3wJtLi5OI0WzFF",
"meta": {
"instanceId": "a5283507e1917a33cc3ae615b2e7d5ad2c1e50955e6f831272ddd5ab816f3fb6"
},
"name": "HTX AI Agent v1.02",
"tags": [],
"nodes": [
{
"id": "297e04f4-eea6-483a-ac66-b7eaa8736c75",
"name": "Modelo de Chat 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": "Disparador 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": "Autenticación de Usuario (Reemplazar ID Telegram)",
"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": "Agrega \"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": "Divide mensajes mayores a 4000 caracteres",
"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": "Nota Adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1072,
-32
],
"parameters": {
"color": 4,
"height": 460,
"content": "## Trigger Incoming Telegram Command\nNode: Telegram Trigger\n**Listens for new Telegram messages** from users.\nTriggers the full agent process and passes raw user input downstream."
},
"typeVersion": 1
},
{
"id": "b3ecb16d-982a-4199-961e-734b9bfd8045",
"name": "Nota Adhesiva1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-752,
-32
],
"parameters": {
"color": 2,
"height": 460,
"content": "## Validate User Access\nNode: User **Authentication\nChecks incoming Telegram ID** against the approved user list."
},
"typeVersion": 1
},
{
"id": "ee812a3d-e975-4c84-9725-592c4cf00d95",
"name": "Nota Adhesiva2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-464,
-32
],
"parameters": {
"color": 5,
"height": 460,
"content": "## Generate Session Metadata\nNode: Add S**essionId\nCreates a sessionId using the Telegram chat_id**.\nThis is passed into all downstream tools for memory and workflow routing."
},
"typeVersion": 1
},
{
"id": "57c343be-dc21-4ede-bfeb-5f94bb2a3d6b",
"name": "Nota Adhesiva3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
-496
],
"parameters": {
"color": 7,
"width": 480,
"height": 932,
"content": "## Main AI Agent: Data Fetcher (HTX)\n\n**Node: HTX Data Agent**\nThis is the **core orchestrator**. It uses OpenAI **only to format and present raw HTX market data**, not to analyze or generate strategies.\n\nIt has direct **HTTP request access** to the **HTX REST API** (`https://api.huobi.pro`) and retrieves:\n\n* **Live Price (Aggregated Ticker)** — `/market/detail/merged`\n Returns best bid/ask + last trade price, volume, turnover.\n\n* **24h Market Summary** — `/market/detail`\n Rolling 24-hour stats: open, high, low, close, volume, amount, count.\n\n* **Market Depth** — `/market/depth`\n Order book bids/asks up to requested step/levels.\n\n* **Full Order Book** — `/market/fullMbp`\n Complete market depth, up to **5000 levels**, refreshed once per second.\n\n* **Last Trade** — `/market/trade`\n The latest executed trade.\n\n* **Recent Trades** — `/market/history/trade`\n Most recent trades list.\n\n* **Klines (Candlesticks)** — `/market/history/kline`\n Supports multiple intervals (`1s, 1min, 5min, 15min, 1day, 1week, 1mon, 1year`, etc.).\n The AI chooses the correct interval keyword (`seconds, minutes, days, weeks, months, years`).\n\n"
},
"typeVersion": 1
},
{
"id": "c308c89f-1650-4cf4-8845-51c45f1e6876",
"name": "Nota Adhesiva4",
"type": "n8n-nodes-base.stickyNote",
"position": [
384,
-32
],
"parameters": {
"color": 5,
"width": 260,
"height": 460,
"content": "## Handle Telegram Message Limits\nNode: Code (split logic)\nChecks if the **GPT output exceeds 4000 characters**.\nIf so, it splits the message into safe chunks and passes them on sequentially."
},
"typeVersion": 1
},
{
"id": "e95075f4-d564-4009-8511-c8d7c2f77370",
"name": "Nota Adhesiva5",
"type": "n8n-nodes-base.stickyNote",
"position": [
832,
-32
],
"parameters": {
"color": 4,
"height": 460,
"content": "## Send Final Report to Telegram\nNode: Telegram sendMessage\nSends **formatted HTML report (or split chunks)** directly to the authenticated user via Telegram bot."
},
"typeVersion": 1
},
{
"id": "9caa9127-eb4d-42f2-833b-f8ce8396edd7",
"name": "Nota Adhesiva6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1344,
640
],
"parameters": {
"height": 540,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## GPT Model for Reasoning\nNode: OpenAI Chat Model\nModel: **gpt-4o-mini**\nUsed to:\n\nInterpret signal values\n\nGenerate structured HTML\n\n**Recommend spot and leverage trades**\n\n"
},
"typeVersion": 1
},
{
"id": "9538e331-7ae2-4d6f-97c7-6dfd66ccbe58",
"name": "Nota Adhesiva7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
512
],
"parameters": {
"color": 6,
"height": 1076,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **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": 1
},
{
"id": "540558b9-6cbe-49be-937e-234489be85fa",
"name": "Nota Adhesiva8",
"type": "n8n-nodes-base.stickyNote",
"position": [
128,
512
],
"parameters": {
"color": 6,
"height": 868,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **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": 1
},
{
"id": "803bcfaf-7d72-4616-b459-e6ad8db4ac8c",
"name": "Nota Adhesiva9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1072,
640
],
"parameters": {
"color": 3,
"height": 540,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Short-Term Memory Module\nNode: **Simple Memory\nStores the sessionId**, symbol, and other state data.\nUseful for:\n\nMulti-turn Telegram interactions\n\nTracking indicator agreement across timeframes\n\n"
},
"typeVersion": 1
},
{
"id": "98ebfd96-fa61-4908-9bc0-feb3c57c191b",
"name": "Memoria Simple",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-992,
736
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "3438fe42-4c59-4ebf-9633-70dc3243c244",
"name": "Nota Adhesiva10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-784,
512
],
"parameters": {
"color": 6,
"height": 884,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **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": 1
},
{
"id": "6811afcf-331a-4120-aa73-5612cf980f67",
"name": "Nota Adhesiva11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
512
],
"parameters": {
"color": 6,
"height": 820,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n ### **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": 1
},
{
"id": "5ef7dc9e-d003-4b36-bf4f-61ede9307fc5",
"name": "Nota Adhesiva12",
"type": "n8n-nodes-base.stickyNote",
"position": [
464,
512
],
"parameters": {
"color": 6,
"height": 1060,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **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": 1
},
{
"id": "b155271b-7656-4a6e-9e24-9496e18b77f8",
"name": "Nota Adhesiva13",
"type": "n8n-nodes-base.stickyNote",
"position": [
800,
512
],
"parameters": {
"color": 6,
"height": 900,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **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": 1
},
{
"id": "c999ffb2-e531-4111-b3b5-6d001343af02",
"name": "Nota Adhesiva14",
"type": "n8n-nodes-base.stickyNote",
"position": [
1136,
512
],
"parameters": {
"color": 6,
"height": 868,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **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": 1
},
{
"id": "699f4811-924c-4734-add9-7e92453f22a5",
"name": "Calculadora",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
1520,
592
],
"parameters": {},
"typeVersion": 1
},
{
"id": "9f866f49-6516-4248-8092-28fe70363c7e",
"name": "Think",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
1808,
592
],
"parameters": {
"description": "### 🏷 Tool: **Think**\n\n**Purpose:**\n\n* Lightweight **reasoning helper**.\n* Lets the AI Agent process intermediate logic, format outputs, or decide how to combine multiple API results before sending the final report.\n* Does not fetch data itself.\n\n**Use cases:**\n\n* Clean/reshape JSON from Binance endpoints\n* Extract only the needed fields (e.g., `lastPrice`, `volume`)\n* Help prepare data for Telegram message formatting\n\n**n8n setup notes:**\n\n* No API call, just an **AI Tool** node.\n* Connect upstream API results → Think → Report Agent."
},
"typeVersion": 1.1
},
{
"id": "e05fedc2-d50f-4bb5-a499-e96a16f2d3bf",
"name": "Nota Adhesiva15",
"type": "n8n-nodes-base.stickyNote",
"position": [
1440,
512
],
"parameters": {
"color": 6,
"height": 836,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **Calculator**\n\n**Purpose:**\n\n* Perform **math operations** inside the workflow.\n* Supports add/subtract/multiply/divide, percentages, rounding, etc.\n\n**Use cases:**\n\n* Calculate spreads (ask – bid)\n* Compute % changes from open vs. last price\n* Normalize volumes or confidence scores\n\n**n8n setup notes:**\n\n* Node: `Calculator` (n8n built-in)\n* Input fields can come from Binance API JSON\n* Output can be chained into Think → Final Report\n"
},
"typeVersion": 1
},
{
"id": "6e6d72dc-2560-4a28-bbb5-0bd53b70f3c7",
"name": "Nota Adhesiva16",
"type": "n8n-nodes-base.stickyNote",
"position": [
1728,
512
],
"parameters": {
"color": 6,
"height": 932,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **Think**\n\n**Purpose:**\n\n* Lightweight **reasoning helper**.\n* Lets the AI Agent process intermediate logic, format outputs, or decide how to combine multiple API results before sending the final report.\n* Does not fetch data itself.\n\n**Use cases:**\n\n* Clean/reshape JSON from Binance endpoints\n* Extract only the needed fields (e.g., `lastPrice`, `volume`)\n* Help prepare data for Telegram message formatting\n\n**n8n setup notes:**\n\n* No API call, just an **AI Tool** node.\n* Connect upstream API results → Think → Report Agent."
},
"typeVersion": 1
},
{
"id": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"name": "Agente HTX AI",
"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": "Estadísticas 24h",
"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": "Profundidad del Libro de Órdenes",
"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": "Precio (Último)",
"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": "Mejor Oferta/Demanda",
"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": "Klines (Velas)",
"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": "Precio Promedio",
"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": "Operaciones Recientes",
"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": "Nota Adhesiva17",
"type": "n8n-nodes-base.stickyNote",
"position": [
2128,
-992
],
"parameters": {
"width": 1200,
"height": 2464,
"content": "# 🧠 HTX Spot Market Data AI Agent – Full System Documentation\n\nA specialized AI automation system for **HTX (Huobi) spot market data retrieval**.\nIt fetches and formats **live market data** only — **no predictions, no strategies**.\nOutputs are structured into **Telegram-ready reports** for traders and analysts.\n\n---\n\n## 🧩 Included Workflows\n\nYou must install and activate **all of the following workflows/tools** for the system to function:\n\n| ✅ Workflow / Tool Name | 📌 Function Description |\n| ---------------------- | ---------------------------------------------------------------------------------------- |\n| HTX AI Agent | Core orchestrator. Calls HTX REST APIs and formats raw data into Telegram-ready reports. |\n| 24h Stats Tool | Pulls rolling 24-hour OHLC, volume, and trade count for a symbol. |\n| Price (Latest) Tool | Fetches the latest trade price and best bid/ask. |\n| Best Bid/Ask Tool | Returns top-of-book bid/ask snapshot. |\n| Order Book Depth Tool | Retrieves order book bids/asks with configurable depth aggregation. |\n| Klines (Candles) Tool | Returns OHLCV candlestick data for configurable intervals (1m–1y). |\n| Recent Trades Tool | Shows most recent executed trades. |\n| Average Price Tool | Computes midpoint between bid/ask using Calculator (HTX has no direct avg-price). |\n| Calculator | Performs math inside workflow (e.g., spreads, % changes). |\n| Think | Lightweight reasoning helper (JSON cleanup, formatting). |\n| Simple Memory | Stores `sessionId` and symbol state for continuity across Telegram interactions. |\n\n---\n\n## ⚙️ Installation Instructions\n\n### Step 1: Import Workflows\n\n* Open **n8n Editor UI**\n* Import the JSON file(s) provided (`HTX AI Agent v1.02.json`)\n* Activate the workflows\n\n### Step 2: Set Credentials\n\n* **OpenAI API Credential** → for GPT-4.1-mini (formatting only)\n* **Telegram API Credential** → Bot key for sending/receiving messages\n* **HTX Market Data** → No auth required (public endpoints)\n\n### Step 3: Configure Webhook & Auth\n\n* Update the **Telegram ID Check node** with your personal Telegram ID\n* Only this ID can trigger the agent\n\n### Step 4: Deploy & Test\n\n* Send a symbol (e.g., `btcusdt`) to your Telegram bot\n* Agent retrieves live data and formats into a clean HTML report\n\n---\n\n## 🖥️ System Workflow Overview\n\n```\n[Telegram Trigger]\n→ [User Authentication]\n→ [Add SessionId + Memory]\n→ [HTX AI Agent]\n ↳ (24h Stats, Price, Best Bid/Ask, Order Book, Klines, Trades)\n ↳ (Calculator + Think for cleanup/formatting)\n→ [Split Messages > 4000 chars]\n→ [Telegram SendMessage]\n```\n\n---\n\n## 📬 Telegram Output Style\n\n```html\n<b>HTX Market Data – BTCUSDT</b>\n\n<b>Price</b>\n• Last: 58,000.12\n• Best Bid: 57,990 | Best Ask: 58,010\n\n<b>24h Stats</b>\n• Open: 56,500 | High: 58,500 | Low: 56,200\n• Volume: 12,430 BTC | Turnover: 720M USDT\n\n<b>Order Book (Top 5)</b>\n• Bids: [57,990 x 0.5], [57,980 x 1.2] …\n• Asks: [58,010 x 0.8], [58,020 x 1.5] …\n\n<b>Klines (15m, last 3)</b>\n• O/H/L/C: 57,800 / 58,020 / 57,750 / 57,990\n```\n\n---\n\n## ⚠️ Rules\n\n* Only fetch and format data — **no trading signals or advice**\n* Always use lowercase symbols (e.g., `btcusdt`)\n* Do not output raw JSON — must be formatted for Telegram\n* If data missing → show `N/A`\n\n---\n\n## 🚀 Support & Licensing\n\n🔗 **Don Jayamaha – LinkedIn**\n[linkedin.com/in/donjayamahajr](http://linkedin.com/in/donjayamahajr)\n\n© 2025 Treasurium Capital Limited Company. All rights reserved.\nThis system architecture, prompts, and workflow structure are proprietary and protected by **U.S. copyright law**.\nReuse or resale prohibited without license.\n\n"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "4d9a7688-a32d-4e45-a66c-a30c88d00a81",
"connections": {
"9f866f49-6516-4248-8092-28fe70363c7e": {
"ai_tool": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "ai_tool",
"index": 0
}
]
]
},
"8e68fe2c-a84c-4340-b6c8-e9d0a69c717b": {
"ai_tool": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "ai_tool",
"index": 0
}
]
]
},
"699f4811-924c-4734-add9-7e92453f22a5": {
"ai_tool": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "ai_tool",
"index": 0
}
]
]
},
"2a5e0910-992b-409d-83d5-5af4121f71af": {
"ai_tool": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "ai_tool",
"index": 0
}
]
]
},
"60b4a1c1-a32f-4679-8818-e09f7ba2c25e": {
"main": [
[
{
"node": "9c52c121-7184-4f3f-a6ca-a6ff152486ac",
"type": "main",
"index": 0
}
]
]
},
"b773e24e-b4b3-49b2-82a5-89a110613538": {
"ai_tool": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "ai_tool",
"index": 0
}
]
]
},
"96a09dbc-cfd5-46d2-ba6a-1cb4dfd661b3": {
"ai_tool": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "ai_tool",
"index": 0
}
]
]
},
"98ebfd96-fa61-4908-9bc0-feb3c57c191b": {
"ai_memory": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "ai_memory",
"index": 0
}
]
]
},
"0df3137a-638e-4c99-8121-c8d119566ca8": {
"ai_tool": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "ai_tool",
"index": 0
}
]
]
},
"5c213506-27d4-448a-86a7-4bd310a8d3d3": {
"main": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "main",
"index": 0
}
]
]
},
"c31f039c-42da-47ed-9c7a-bd47dd276634": {
"ai_tool": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "ai_tool",
"index": 0
}
]
]
},
"0a3e5648-3f35-4ba8-bed1-3b60f307f001": {
"ai_tool": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "ai_tool",
"index": 0
}
]
]
},
"9a3813bf-2888-47d9-b6fe-ae4d6acff278": {
"main": [
[
{
"node": "24b0013b-ad84-4e59-b8eb-47bf0c44ebb4",
"type": "main",
"index": 0
}
]
]
},
"297e04f4-eea6-483a-ac66-b7eaa8736c75": {
"ai_languageModel": [
[
{
"node": "60b4a1c1-a32f-4679-8818-e09f7ba2c25e",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"24b0013b-ad84-4e59-b8eb-47bf0c44ebb4": {
"main": [
[
{
"node": "5c213506-27d4-448a-86a7-4bd310a8d3d3",
"type": "main",
"index": 0
}
]
]
},
"9c52c121-7184-4f3f-a6ca-a6ff152486ac": {
"main": [
[
{
"node": "d46968c2-f161-4b84-8d7a-afbe3d273b55",
"type": "main",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Avanzado - Varios, Chatbot de IA, IA Multimodal
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
Don Jayamaha Jr
@don-the-gem-dealerWith 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.
Compartir este flujo de trabajo