KuCoin KI-Proxy v1.02
Dies ist ein Crypto Trading, AI Chatbot, Multimodal AI-Bereich Automatisierungsworkflow mit 35 Nodes. Hauptsächlich werden Set, Code, Telegram, Agent, HttpRequestTool und andere Nodes verwendet. Börsendaten mit dem KuCoin-KI-Agenten abrufen | GPT-4o + Telegram
- •Telegram Bot Token
- •Möglicherweise sind Ziel-API-Anmeldedaten erforderlich
- •OpenAI API Key
Verwendete Nodes (35)
{
"id": "WUDAKeJzCkwYJWhT",
"meta": {
"instanceId": "a5283507e1917a33cc3ae615b2e7d5ad2c1e50955e6f831272ddd5ab816f3fb6"
},
"name": "KuCoin AI Agent v1.02",
"tags": [],
"nodes": [
{
"id": "40d3604c-9a06-44fd-96fb-a3e8ab7acf05",
"name": "OpenAI Chat Model",
"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": "94f8aa5b-70b5-49a2-a7d3-c6758c27615c",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-1008,
240
],
"webhookId": "f6d6d17e-bf55-4ff2-b2c1-5b0729157802",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "NRLKuLR7z8vCesub",
"name": "BinanceSpotTradingAIAgent_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "33874650-9204-47a2-a705-7c8852dded20",
"name": "Benutzerauthentifizierung (Ersetze 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": "fc6cfa39-7dcc-4a52-af2c-ac646fd9a1f2",
"name": "Fügt \"SessionId\" hinzu",
"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": "d81987fc-02dd-4b65-bff4-b005f63faee3",
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
896,
240
],
"webhookId": "3b2fd921-572c-4e5d-8e0e-23a817d1a7f5",
"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": "f7fc9038-2a34-4c2c-abd9-934c53ca4f2c",
"name": "Teilt Nachricht bei >4000 Zeichen",
"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": "0b1e49c0-1dd1-44bb-acb7-4a964925d5f5",
"name": "Notizzettel",
"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": "5a6a8a98-02f9-4c80-85b2-2de68913e48c",
"name": "Notizzettel1",
"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": "b081804a-fe79-45da-a1fc-8475fbbd14b4",
"name": "Notizzettel2",
"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": "ab0c5696-8ace-49ce-8caa-27f6c14f8a7b",
"name": "Notizzettel3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
-224
],
"parameters": {
"color": 7,
"width": 480,
"height": 660,
"content": "## KuCoin Spot Market AI Agent\n\n- This is the orchestrator for KuCoin spot market data.\n- Uses HTTP tools to call KuCoin REST endpoints directly.\n- GPT is only for formatting and structuring the response, never for generating predictions.\n\nCore Endpoints Queried:\n- Price (Latest)\n- 24h Stats\n- Order Book Depth\n- Best Bid/Ask\n- Klines (Candles)\n- Recent Trades\n- Average Price (via Ticker)\n\nUtility Tools:\n- Calculator (for spreads, % changes, math)\n- Think (for JSON reshaping and clean outputs)\n\n\n\n"
},
"typeVersion": 1
},
{
"id": "bb596a9a-e594-4c48-938d-87f79e14e8cc",
"name": "Notizzettel4",
"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": "4ebe0a92-299f-4074-997d-a4de853a1de8",
"name": "Notizzettel5",
"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": "be156b45-cb7d-4f14-aa8d-356c16aaa825",
"name": "Notizzettel6",
"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": "6bd54e6e-a5bf-4107-a53b-8183e12809bc",
"name": "Notizzettel7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
512
],
"parameters": {
"color": 6,
"height": 1172,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### 🏷 Tool: **Order Book Depth**\n\n**Endpoint:** `GET /api/v1/market/orderbook/{level}`\n**What it does:** Returns **order book** bids/asks for a KuCoin symbol.\n\n**Levels (choose via `level`):**\n* `level2_20` → top 20 levels\n* `level2_100` → top 100 levels (default)\n* `level2_1` → best bid/ask (book ticker equivalent)\n\n**Params:**\n* `level` (STRING, required) → one of `level2_20`, `level2_100`, `level2_1` (we default `level2_100`)\n* `symbol` (STRING, required) → KuCoin pair with dash, e.g. `BTC-USDT`\n\n**Returns:** `time, sequence, bids: [[price, size], ...], asks: [[price, size], ...]`\n\n**n8n query mapping:**\n```txt\nlevel = $fromAI('level', 'level2_100', 'string')\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\n```\n\n**Notes:**\n* For **best bid/ask only**, set `level = level2_1`.\n* If you need deeper/full book snapshots, KuCoin also offers `/api/v3/market/orderbook/level2?symbol=...&depth=...`."
},
"typeVersion": 1
},
{
"id": "e1025717-59c4-4c7d-baa6-ee9d6c9a5cda",
"name": "Notizzettel8",
"type": "n8n-nodes-base.stickyNote",
"position": [
128,
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\n### **Best Bid/Ask (Book Ticker)**\n\n**Endpoint:** `GET /api/v1/market/orderbook/level1`\n**What it does:** Returns the **best bid/ask** and the **latest price** for a KuCoin symbol.\n\n**Params:**\n* `symbol` (STRING, required) → KuCoin format with dash, e.g. `BTC-USDT`\n\n**Returns:** fields such as `time`, `symbol`, `bestBid`, `bestBidSize`, `bestAsk`, `bestAskSize`, `price` (last).\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\n```\n\n**Notes:** Use for quick spread snapshot. For full book depth, use `/api/v1/market/orderbook/level2_X`."
},
"typeVersion": 1
},
{
"id": "1550f50b-9f44-4794-959d-5cfe2dc46844",
"name": "Notizzettel9",
"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": "98f7f3fd-c24a-4f0a-905b-63550d74bc53",
"name": "Einfacher Speicher",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-992,
736
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "9d927de7-dd01-49bb-9204-ee4220fda5a9",
"name": "Notizzettel10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-784,
512
],
"parameters": {
"color": 6,
"height": 1044,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **24h Stats**\n\n**Endpoint:** `GET /api/v1/market/stats`\n**What it does:** Returns the **24-hour stats** for a given trading pair: open, high, low, close, last, change %, base volume, quote volume.\n\n**Params:**\n* `symbol` (STRING, required) → KuCoin pair format with dash, e.g. `BTC-USDT`\n\n**Returns:** `time, symbol, buy, sell, changeRate, changePrice, high, low, vol, volValue, last, averagePrice, takerFeeRate, makerFeeRate, takerCoefficient, makerCoefficient`\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\n```\n\n**Notes:**\n* This endpoint provides the **24h rolling window stats**.\n* For metadata (min/max order sizes, increments), use `/api/v2/symbols/{symbol}`."
},
"typeVersion": 1
},
{
"id": "a7756691-1ebd-45a5-a474-fc272aa26456",
"name": "Notizzettel11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
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### **Price (Latest)**\n\n**Endpoint:** `GET /api/v1/market/orderbook/level1`\n**What it does:** Returns the **latest price** and **best bid/ask** for a KuCoin symbol.\n\n**Params:**\n* `symbol` (STRING, required) → KuCoin format with dash, e.g. `BTC-USDT`\n\n**Returns:** fields such as `time`, `symbol`, `price` (last), `bestBid`, `bestBidSize`, `bestAsk`, `bestAskSize`.\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\n```\n\n**Notes:** Use this for quick latest price + spread snapshot. For full 24h stats, use `/api/v1/market/stats`."
},
"typeVersion": 1
},
{
"id": "b73f76d2-4705-4586-a6d5-3109b7513094",
"name": "Notizzettel12",
"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 /api/v1/market/candles`\n**What it does:** Retrieve candlestick bars for a KuCoin symbol and interval.\n\n**Params:**\n* `symbol` (STRING, required — e.g., `BTC-USDT`)\n* `type` (ENUM, required — e.g., `1min,3min,5min,15min,30min,1hour,2hour,4hour,6hour,8hour,12hour,1day,1week,1month`)\n* `startAt` (LONG, optional — start time in seconds)\n* `endAt` (LONG, optional — end time in seconds)\n\n**Returns (array per candle):** `[ time, open, close, high, low, volume, turnover ]`\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\ntype = $fromAI('parameters1_Value', '15min', 'string')\nstartAt = $fromAI('parameters2_Value', '', 'number')\nendAt = $fromAI('parameters3_Value', '', 'number')\n```\n\n**Notes:** Without `startAt` and `endAt`, returns the most recent candles."
},
"typeVersion": 1
},
{
"id": "b28e6cae-489e-4c71-8514-0687f80798f3",
"name": "Notizzettel13",
"type": "n8n-nodes-base.stickyNote",
"position": [
800,
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### **Average Price (via Ticker)**\n\n**Endpoint:** `GET /api/v1/market/orderbook/level1`\n**What it does:** Returns the **latest market data** for a symbol, including last trade price, best bid/ask, size, and time.\n\n**Params:**\n* `symbol` (STRING, required — e.g., `BTC-USDT`)\n\n**Returns:** `{ \"symbol\":\"BTC-USDT\",\"bestBid\":\"...\",\"bestAsk\":\"...\",\"price\":\"...\",\"size\":\"...\",\"time\":... }`\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\n```\n\n**Notes:** KuCoin does not provide a rolling `avgPrice` endpoint like Binance. Use this for **real-time average proxy** via bid/ask spread and last price."
},
"typeVersion": 1
},
{
"id": "f5becf91-8947-4f2a-aa21-27aae3ec0c0c",
"name": "Notizzettel14",
"type": "n8n-nodes-base.stickyNote",
"position": [
1136,
512
],
"parameters": {
"color": 6,
"height": 804,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### 🏷 Tool: **Recent Trades**\n\n**Endpoint:** `GET /api/v1/market/histories`\n**What it does:** Returns the **most recent public trades** for a KuCoin symbol.\n\n**Params:**\n* `symbol` (STRING, required) → e.g., `BTC-USDT`\n* `limit` (INT, optional; default 100)\n\n**Returns:** array of trades like `{ sequence, price, size, side, time }` (newest first).\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\nlimit = $fromAI('parameters1_Value', 100, 'number')\n```"
},
"typeVersion": 1
},
{
"id": "a0bed784-ec26-449e-8d4a-1d1dc19d1340",
"name": "Rechner",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
1520,
592
],
"parameters": {},
"typeVersion": 1
},
{
"id": "78dd87bf-b1b4-4b6e-a5dd-61c3187c631d",
"name": "Denken",
"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": "3aad6e1f-d622-43bb-8b08-2abfd667f09b",
"name": "Notizzettel15",
"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": "b5cd1090-3b35-4319-be51-007ef7350a54",
"name": "Notizzettel16",
"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": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"name": "KuCoin KI-Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-96,
240
],
"parameters": {
"text": "={{ $json.message }}",
"options": {
"systemMessage": "You are the KuCoin Spot Market Data Agent.\n\nYou have HTTP request access to the official KuCoin Spot REST API to retrieve market data for any requested trading pair.\nYour job is to fetch and present data only. You do not analyze, predict, or recommend.\n\n---\n\nAPI Access\n- Base endpoint: https://api.kucoin.com\n- All requests are HTTP GET\n- Responses are JSON\n- Parameters use query strings (e.g., ?symbol=BTC-USDT&limit=100)\n- Symbol format: uppercase with dash (e.g., BTC-USDT)\n\n---\n\nAvailable Market Data Endpoints\n1. Order Book Depth\n GET /api/v1/market/orderbook/level2_100?symbol=BTC-USDT\n - Returns top bids/asks (100 entries).\n - Variants: level2_20, level2_100, level2_1\n\n2. Recent Trades\n GET /api/v1/market/histories?symbol=BTC-USDT\n - Most recent trades (default limit = 100)\n\n3. Aggregate Ticker (24h Stats)\n GET /api/v1/market/stats?symbol=BTC-USDT\n - Includes open, high, low, close, last, volume, % change\n\n4. Kline / Candlestick Data\n GET /api/v1/market/candles?symbol=BTC-USDT&type=15min&limit=20\n - Intervals: 1min,3min,5min,15min,30min,1h,2h,4h,6h,8h,12h,1d,1w\n - Default limit = 100, max = 1500\n\n5. Ticker — Latest Symbol Price\n GET /api/v1/market/orderbook/level1?symbol=BTC-USDT\n - Best bid/ask and last trade price\n\n---\n\nUtility Tools\n- Calculator → perform math (spreads, % changes, normalizations)\n- Think → reshape JSON, select fields, prepare outputs\n\n---\n\nOutput Format\nStart every response with:\n[SYMBOL] — KuCoin Spot Data\n\nThen group logically:\nPrice\n• Last: {{lastPrice}}\n• Avg: {{avgPrice}}\n• Change (24h): {{pctChange}}%\n\n24h Stats\n• Open: {{open}} • High: {{high}} • Low: {{low}} • Close: {{close}}\n• Volume: {{baseVol}} • Quote Vol: {{quoteVol}}\n\nOrder Book (Top 5)\n• Bids: [price x qty] …\n• Asks: [price x qty] …\n\nKlines (latest 20)\n• Interval: {{interval}} (O/H/L/C per candle)\n\n---\n\nRules\n- Always call the correct KuCoin API endpoint.\n- Do not fabricate or calculate values yourself.\n- Do not provide trading advice, sentiment, or predictions.\n- Do not output raw JSON; present clean, human-readable values.\n- If data is missing or request fails, show N/A.\n"
},
"promptType": "define"
},
"typeVersion": 1.8
},
{
"id": "c576165c-f0c4-48d0-bcce-20bca6cfaa09",
"name": "24h-Statistiken",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-704,
592
],
"parameters": {
"url": "https://api.kucoin.com/api/v1/market/stats",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `BTC-USDT`, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **24h Stats**\n\n**Endpoint:** `GET /api/v1/market/stats`\n**What it does:** Returns the **24-hour stats** for a given trading pair: open, high, low, close, last, change %, base volume, quote volume.\n\n**Params:**\n* `symbol` (STRING, required) → KuCoin pair format with dash, e.g. `BTC-USDT`\n\n**Returns:** `time, symbol, buy, sell, changeRate, changePrice, high, low, vol, volValue, last, averagePrice, takerFeeRate, makerFeeRate, takerCoefficient, makerCoefficient`\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\n```\n\n**Notes:**\n* This endpoint provides the **24h rolling window stats**.\n* For metadata (min/max order sizes, increments), use `/api/v2/symbols/{symbol}`."
},
"typeVersion": 4.2
},
{
"id": "59c784f7-0125-4449-955c-6a53b6ed6bfe",
"name": "Orderbuch-Tiefe",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-416,
592
],
"parameters": {
"url": "={{ 'https://api.kucoin.com/api/v1/market/orderbook/' + $fromAI('level', `level2_100`, 'string') }}",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `BTC-USDT`, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Order Book Depth**\n\n**Endpoint:** `GET /api/v1/market/orderbook/{level}`\n**What it does:** Returns **order book** bids/asks for a KuCoin symbol.\n\n**Levels (choose via `level`):**\n* `level2_20` → top 20 levels\n* `level2_100` → top 100 levels (default)\n* `level2_1` → best bid/ask (book ticker equivalent)\n\n**Params:**\n* `level` (STRING, required) → one of `level2_20`, `level2_100`, `level2_1` (we default `level2_100`)\n* `symbol` (STRING, required) → KuCoin pair with dash, e.g. `BTC-USDT`\n\n**Returns:** `time, sequence, bids: [[price, size], ...], asks: [[price, size], ...]`\n\n**n8n query mapping:**\n```txt\nlevel = $fromAI('level', 'level2_100', 'string')\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\n```\n\n**Notes:**\n* For **best bid/ask only**, set `level = level2_1`.\n* If you need deeper/full book snapshots, KuCoin also offers `/api/v3/market/orderbook/level2?symbol=...&depth=...`."
},
"typeVersion": 4.2
},
{
"id": "53732cb5-f3c1-473b-baee-bd7e48715677",
"name": "Preis (aktuell)",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-112,
592
],
"parameters": {
"url": "https://api.kucoin.com/api/v1/market/orderbook/level1",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `BTC-USDT`, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Price (Latest)**\n\n**Endpoint:** `GET /api/v1/market/orderbook/level1`\n**What it does:** Returns the **latest price** and **best bid/ask** for a KuCoin symbol.\n\n**Params:**\n* `symbol` (STRING, required) → KuCoin format with dash, e.g. `BTC-USDT`\n\n**Returns:** fields such as `time`, `symbol`, `price` (last), `bestBid`, `bestBidSize`, `bestAsk`, `bestAskSize`.\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\n```\n\n**Notes:** Use this for quick latest price + spread snapshot. For full 24h stats, use `/api/v1/market/stats`."
},
"typeVersion": 4.2
},
{
"id": "8fa72375-9547-4920-93f5-f0d37d7f4170",
"name": "Bestes Gebot/Nachfrage",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
192,
592
],
"parameters": {
"url": "https://api.kucoin.com/api/v1/market/orderbook/level1",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `BTC-USDT`, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Best Bid/Ask (Book Ticker)**\n\n**Endpoint:** `GET /api/v1/market/orderbook/level1`\n**What it does:** Returns the **best bid/ask** and the **latest price** for a KuCoin symbol.\n\n**Params:**\n* `symbol` (STRING, required) → KuCoin format with dash, e.g. `BTC-USDT`\n\n**Returns:** fields such as `time`, `symbol`, `bestBid`, `bestBidSize`, `bestAsk`, `bestAskSize`, `price` (last).\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\n```\n\n**Notes:** Use for quick spread snapshot. For full book depth, use `/api/v1/market/orderbook/level2_X`."
},
"typeVersion": 4.2
},
{
"id": "c621ca98-1c7d-4d30-83f6-f5a1cca5f478",
"name": "Klines (Kerzen)",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
544,
592
],
"parameters": {
"url": "https://api.kucoin.com/api/v1/market/candles",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `BTC-USDT`, 'string') }}"
},
{
"name": "type",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `15min`, 'string') }}"
},
{
"name": "startAt",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', ``, 'number') }}"
},
{
"name": "endAt",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters3_Value', ``, 'number') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Klines (Candles)**\n\n**Endpoint:** `GET /api/v1/market/candles`\n**What it does:** Retrieve candlestick bars for a KuCoin symbol and interval.\n\n**Params:**\n* `symbol` (STRING, required — e.g., `BTC-USDT`)\n* `type` (ENUM, required — e.g., `1min,3min,5min,15min,30min,1hour,2hour,4hour,6hour,8hour,12hour,1day,1week,1month`)\n* `startAt` (LONG, optional — start time in seconds)\n* `endAt` (LONG, optional — end time in seconds)\n\n**Returns (array per candle):** `[ time, open, close, high, low, volume, turnover ]`\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\ntype = $fromAI('parameters1_Value', '15min', 'string')\nstartAt = $fromAI('parameters2_Value', '', 'number')\nendAt = $fromAI('parameters3_Value', '', 'number')\n```\n\n**Notes:** Without `startAt` and `endAt`, returns the most recent candles."
},
"typeVersion": 4.2
},
{
"id": "0b9d91af-abe1-4d59-99d6-5cc14cfb126b",
"name": "Durchschnittspreis (via Ticker)",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
880,
592
],
"parameters": {
"url": "https://api.kucoin.com/api/v1/market/orderbook/level1",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `BTC-USDT`, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Average Price (via Ticker)**\n\n**Endpoint:** `GET /api/v1/market/orderbook/level1`\n**What it does:** Returns the **latest market data** for a symbol, including last trade price, best bid/ask, size, and time.\n\n**Params:**\n* `symbol` (STRING, required — e.g., `BTC-USDT`)\n\n**Returns:** `{ \"symbol\":\"BTC-USDT\",\"bestBid\":\"...\",\"bestAsk\":\"...\",\"price\":\"...\",\"size\":\"...\",\"time\":... }`\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\n```\n\n**Notes:** KuCoin does not provide a rolling `avgPrice` endpoint like Binance. Use this for **real-time average proxy** via bid/ask spread and last price."
},
"typeVersion": 4.2
},
{
"id": "2164f096-c4b1-4398-b40c-717d87b59330",
"name": "Aktuelle Trades",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
1216,
592
],
"parameters": {
"url": "https://api.kucoin.com/api/v1/market/histories",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `BTC-USDT`, 'string') }}"
},
{
"name": "limit",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `100`, 'number') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Recent Trades**\n\n**Endpoint:** `GET /api/v1/market/histories`\n**What it does:** Returns the **most recent public trades** for a KuCoin symbol.\n\n**Params:**\n* `symbol` (STRING, required) → e.g., `BTC-USDT`\n* `limit` (INT, optional; default 100)\n\n**Returns:** array of trades like `{ sequence, price, size, side, time }` (newest first).\n\n**n8n query mapping:**\n```txt\nsymbol = $fromAI('parameters0_Value', 'BTC-USDT', 'string')\nlimit = $fromAI('parameters1_Value', 100, 'number')\n```"
},
"typeVersion": 4.2
},
{
"id": "dc96dd65-67dc-4b1d-ada3-b5dd9e586f12",
"name": "Notizzettel17",
"type": "n8n-nodes-base.stickyNote",
"position": [
2144,
-1136
],
"parameters": {
"width": 912,
"height": 3024,
"content": "# 📄 KuCoin AI Agent v1.02 – Documentation\n\n## 🧩 Overview\n\nThis workflow connects a Telegram bot with an AI agent that can **fetch Spot Market data from the official KuCoin REST API**.\n\n* **Trigger:** Telegram message\n* **Auth:** Telegram user ID check\n* **Core AI Agent:** KuCoin Spot Market Data Agent\n* **Output:** Clean, structured report sent back to Telegram\n\n---\n\n## 🔗 API Access\n\n**Base URL:** `https://api.kucoin.com`\n**Method:** All requests are **HTTP GET**\n**Response:** JSON\n\n---\n\n## 📌 Supported Endpoints\n\n1. **24h Stats**\n\n * `GET /api/v1/market/stats?symbol=BTC-USDT`\n * Returns: open, high, low, last, change rate, volume, quote volume, etc.\n\n2. **Order Book Depth**\n\n * `GET /api/v1/market/orderbook/level2_100?symbol=BTC-USDT`\n * Returns: top bids/asks up to 100 entries.\n\n3. **Latest Price**\n\n * `GET /api/v1/market/orderbook/level1?symbol=BTC-USDT`\n * Returns: best bid, best ask, last traded price.\n\n4. **Klines (Candlestick Data)**\n\n * `GET /api/v1/market/candles?symbol=BTC-USDT&type=15min&limit=20`\n * Returns OHLCV data for supported intervals.\n\n5. **Recent Trades**\n\n * `GET /api/v1/market/histories?symbol=BTC-USDT`\n * Returns recent trades (price, size, side, time).\n\n---\n\n## 🧩 Utility Tools\n\n* **Calculator** → Math operations (spreads, % change, averages).\n* **Think** → Helper for cleaning JSON, reshaping, formatting outputs.\n\n---\n\n## ⚙️ Workflow Components\n\n### 1. **Telegram Trigger**\n\n* Listens for new Telegram messages.\n* Passes user input downstream.\n\n### 2. **User Authentication**\n\n* Checks Telegram `from.id` against approved ID.\n* Blocks unauthorized users.\n\n### 3. **Adds SessionId**\n\n* Stores Telegram chat ID as `sessionId`.\n* Used for memory + multi-turn conversations.\n\n### 4. **Simple Memory**\n\n* Buffer window memory to track session context.\n\n### 5. **OpenAI Chat Model**\n\n* GPT model (`gpt-4.1-mini`) used for reasoning, structuring responses.\n\n### 6. **KuCoin AI Agent**\n\n* Agent configured with system message:\n\n * Fetches **only market data** (no predictions or advice).\n * Uses official **KuCoin API endpoints**.\n * Always returns structured, readable outputs.\n\n### 7. **Message Splitter**\n\n* Splits GPT output if >4000 chars (Telegram limit).\n\n### 8. **Telegram SendMessage**\n\n* Sends final structured report (or split chunks) back to the user.\n\n---\n\n## 📤 Output Rules\n\n* Clean, human-readable summaries.\n* Grouped into **Price, 24h Stats, Order Book, Klines, Trades**.\n* No raw JSON unless debugging.\n* No financial advice or fabricated values.\n\n---\n\n## ⚠️ Special Notes\n\n* `symbol` format on KuCoin: **BTC-USDT** (with dash, not concatenated).\n* All endpoints are **public**, no API key required.\n* Default `limit` values set for safety (e.g., 20 klines, 100 trades).\n\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"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "7403d36e-62eb-4baa-933c-915fcf6fc566",
"connections": {
"78dd87bf-b1b4-4b6e-a5dd-61c3187c631d": {
"ai_tool": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "ai_tool",
"index": 0
}
]
]
},
"c576165c-f0c4-48d0-bcce-20bca6cfaa09": {
"ai_tool": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "ai_tool",
"index": 0
}
]
]
},
"a0bed784-ec26-449e-8d4a-1d1dc19d1340": {
"ai_tool": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "ai_tool",
"index": 0
}
]
]
},
"8fa72375-9547-4920-93f5-f0d37d7f4170": {
"ai_tool": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "ai_tool",
"index": 0
}
]
]
},
"2164f096-c4b1-4398-b40c-717d87b59330": {
"ai_tool": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "ai_tool",
"index": 0
}
]
]
},
"98f7f3fd-c24a-4f0a-905b-63550d74bc53": {
"ai_memory": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "ai_memory",
"index": 0
}
]
]
},
"53732cb5-f3c1-473b-baee-bd7e48715677": {
"ai_tool": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "ai_tool",
"index": 0
}
]
]
},
"fc6cfa39-7dcc-4a52-af2c-ac646fd9a1f2": {
"main": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "main",
"index": 0
}
]
]
},
"c621ca98-1c7d-4d30-83f6-f5a1cca5f478": {
"ai_tool": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "ai_tool",
"index": 0
}
]
]
},
"fd353acc-ae35-4e35-ad5c-06f14a289382": {
"main": [
[
{
"node": "f7fc9038-2a34-4c2c-abd9-934c53ca4f2c",
"type": "main",
"index": 0
}
]
]
},
"59c784f7-0125-4449-955c-6a53b6ed6bfe": {
"ai_tool": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "ai_tool",
"index": 0
}
]
]
},
"94f8aa5b-70b5-49a2-a7d3-c6758c27615c": {
"main": [
[
{
"node": "33874650-9204-47a2-a705-7c8852dded20",
"type": "main",
"index": 0
}
]
]
},
"40d3604c-9a06-44fd-96fb-a3e8ab7acf05": {
"ai_languageModel": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"0b9d91af-abe1-4d59-99d6-5cc14cfb126b": {
"ai_tool": [
[
{
"node": "fd353acc-ae35-4e35-ad5c-06f14a289382",
"type": "ai_tool",
"index": 0
}
]
]
},
"33874650-9204-47a2-a705-7c8852dded20": {
"main": [
[
{
"node": "fc6cfa39-7dcc-4a52-af2c-ac646fd9a1f2",
"type": "main",
"index": 0
}
]
]
},
"f7fc9038-2a34-4c2c-abd9-934c53ca4f2c": {
"main": [
[
{
"node": "d81987fc-02dd-4b65-bff4-b005f63faee3",
"type": "main",
"index": 0
}
]
]
}
}
}Wie verwende ich diesen Workflow?
Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.
Für welche Szenarien ist dieser Workflow geeignet?
Experte - Krypto-Handel, KI-Chatbot, Multimodales KI
Ist es kostenpflichtig?
Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.
Verwandte Workflows
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.
Diesen Workflow teilen