Binance AI-Agent 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. Zugriff auf Echtzeit-Binance-Marktdaten in Telegram mit GPT-4o formatiert
- •Telegram Bot Token
- •Möglicherweise sind Ziel-API-Anmeldedaten erforderlich
- •OpenAI API Key
Verwendete Nodes (35)
{
"id": "ahrPDHmf7YOdXsl2",
"meta": {
"instanceId": "a5283507e1917a33cc3ae615b2e7d5ad2c1e50955e6f831272ddd5ab816f3fb6"
},
"name": "Binance AI Agent v1.02",
"tags": [],
"nodes": [
{
"id": "94403c10-3da3-4fd8-b6c3-cdf046f0a4d0",
"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": "76a4db9d-5a82-4647-b98c-c87e779f275b",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-1008,
240
],
"webhookId": "944e6f8d-ffcc-4692-a777-7410f2fd4016",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "NRLKuLR7z8vCesub",
"name": "BinanceSpotTradingAIAgent_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "60601a5d-9f40-4bbf-97a5-7513ac6fd385",
"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": "e396c95d-f49d-4e6a-bb63-d37b5bfb33fa",
"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": "928b463d-3135-461e-8248-ddba9272eeed",
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
896,
240
],
"webhookId": "79d6c29c-1e04-414a-9989-afb1f7a58035",
"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": "e233cb3c-98fd-423a-bbbc-b043528e5920",
"name": "Teilt Nachricht bei über 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": "ab8f1233-6042-48fb-861b-e6c527fe64db",
"name": "Haftnotiz",
"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": "8a30b225-b801-41db-aa7e-11c84db638a7",
"name": "Haftnotiz1",
"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": "e591fe19-2fd8-4bd3-85b9-bfa383feeef5",
"name": "Haftnotiz2",
"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": "285d5678-88ff-4a4e-a0c0-f38cf2b1a08b",
"name": "Haftnotiz3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
-320
],
"parameters": {
"color": 7,
"width": 480,
"height": 756,
"content": "## Main AI Agent: Data Fetcher\n\n**Node: Binance Data Agent**\nThis is the **core orchestrator**. It uses OpenAI only to **format and present raw Binance market data**, not to analyze or generate strategies.\n\nIt has direct **HTTP request access** to the Binance REST API and retrieves:\n\n* **Live price** (`/api/v3/ticker/price`)\n* **24h ticker stats** (`/api/v3/ticker/24hr`)\n* **Order book depth** (`/api/v3/depth`)\n* **Best bid/ask** (`/api/v3/ticker/bookTicker`)\n* **Klines/candlesticks** (`/api/v3/klines`)\n\nThe agent calls these endpoints in parallel for the requested symbol, validates results, and then **presents the data in clean Telegram HTML format**.\n\nIt does **not**:\n\n* Perform technical analysis\n* Generate strategies or predictions\n* Fetch sentiment or news\n\n\n"
},
"typeVersion": 1
},
{
"id": "1e78ced2-31e2-458a-9bcf-9f7d397ea882",
"name": "Haftnotiz4",
"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": "ff0ceeb6-e8cd-4f33-8965-ccc2485bbc13",
"name": "Haftnotiz5",
"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": "a6163a28-384d-4553-b428-c936c7198979",
"name": "Haftnotiz6",
"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": "8e4892bd-c079-474c-9cc9-85a1bd0f8253",
"name": "Haftnotiz7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
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### **Order Book Depth**\n\n**Endpoint:** `GET /api/v3/depth`\n**What it does:** Returns **order book** bids/asks up to `limit`.\n**Params:**\n\n* `symbol` (STRING, required)\n* `limit` (INT, default 100; max 5000; we default 100)\n **Request weight:** varies by `limit` (1–100 → 5; 101–500 → 25; 501–1000 → 50; 1001–5000 → 250).\n **Returns:** `lastUpdateId`, `bids: [[price, qty], ...]`, `asks: [[price, qty], ...]`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\nlimit = $fromAI('parameters1_Value', 100, 'number')\n```\n\n**Notes:** If `limit > 5000`, only 5000 are returned."
},
"typeVersion": 1
},
{
"id": "3c5ac786-7958-4071-b8b3-59101c41b17a",
"name": "Haftnotiz8",
"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 (Book Ticker)**\n\n**Endpoint:** `GET /api/v3/ticker/bookTicker`\n**What it does:** Best **bid/ask** and sizes for the symbol.\n**Params:** `symbol` (optional; **we send it**)\n**Request weight:** `2` with `symbol`, `4` otherwise.\n**Returns:** `{\"symbol\":\"BTCUSDT\",\"bidPrice\":\"...\",\"bidQty\":\"...\",\"askPrice\":\"...\",\"askQty\":\"...\"}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Great for quick spread snapshot."
},
"typeVersion": 1
},
{
"id": "d41d5678-dafa-4ca7-a77a-aa7a7bd3eadb",
"name": "Haftnotiz9",
"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": "062407b4-b9db-4285-ade5-f3010d566737",
"name": "Simple Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-992,
736
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"name": "Binance KI-Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-96,
240
],
"parameters": {
"text": "={{ $json.message }}",
"options": {
"systemMessage": "You are the **Binance Spot Market Data Agent**. \n\nYou have **HTTP request access** to the official Binance REST API to retrieve market data for any requested Binance Spot trading pair. \nYour job is to **fetch and present data only**. You do **not** analyze, predict, or recommend.\n\n---\n\n## 🔗 API Access\n\n**Base endpoints** (primary default = `https://api.binance.com`): \n- https://api.binance.com \n- https://api-gcp.binance.com \n- https://api1.binance.com … https://api4.binance.com \n\n**Format rules:** \n- All requests are **HTTP GET** \n- Responses are **JSON** \n- Parameters use query strings (e.g., `?symbol=BTCUSDT&limit=100`) \n- `symbol` is always uppercase, no `/` or `-` (e.g., `BTCUSDT`) \n\n---\n\n## 📌 Available Market Data Endpoints\n\n1. **Order Book Depth** \n `GET /api/v3/depth?symbol=BTCUSDT&limit=100` \n • Returns top bids/asks up to the limit (default 100, max 5000). \n\n2. **Recent Trades** \n `GET /api/v3/trades?symbol=BTCUSDT&limit=100` \n • Most recent trades (default 500, max 1000). \n\n3. **Aggregate Trades** \n `GET /api/v3/aggTrades?symbol=BTCUSDT&limit=100` \n • Aggregated trades by taker, price, and time. \n\n4. **Kline / Candlestick Data** \n `GET /api/v3/klines?symbol=BTCUSDT&interval=15m&limit=20` \n • Supported intervals: `1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M` \n • Default limit = 500 (max 1000). \n\n5. **Current Average Price** \n `GET /api/v3/avgPrice?symbol=BTCUSDT` \n • Returns rolling average price. \n\n6. **24hr Ticker Price Change Statistics** \n `GET /api/v3/ticker/24hr?symbol=BTCUSDT` \n • Includes open, high, low, last, volume, % change, etc. \n\n7. **Latest Symbol Price** \n `GET /api/v3/ticker/price?symbol=BTCUSDT` \n • Returns the latest trade price. \n\n8. **Order Book Best Bid/Ask** \n `GET /api/v3/ticker/bookTicker?symbol=BTCUSDT` \n • Returns best bid and ask with sizes. \n\n---\n\n## 🧩 Utility Tools\n\n- **Calculator** → Perform math inside the workflow (e.g., spreads, % changes, normalizations). \n- **Think** → Lightweight reasoning helper to reshape JSON, select fields, and prepare outputs. \n\n---\n\n## 📤 Output Format (Telegram HTML)\n\nStart every response with: \n```html\n<b>{{SYMBOL}} — Binance Spot Data</b>\n````\n\nThen group logically:\n\n```html\n<b>Price</b>\n• Last: {{lastPrice}}\n• Avg: {{avgPrice}}\n• Change (24h): {{pctChange}}%\n\n<b>24h Stats</b>\n• Open: {{open}} • High: {{high}} • Low: {{low}} • Close: {{close}}\n• Volume: {{baseVol}} • Quote Vol: {{quoteVol}}\n\n<b>Order Book (Top 5)</b>\n• Bids: [price x qty] …\n• Asks: [price x qty] …\n\n<b>Klines (latest 20)</b>\n• Interval: {{interval}} (O/H/L/C per candle)\n```\n\n---\n\n## ⚠️ Rules\n\n* Always **call the correct API endpoint** for the requested data.\n* Do **not** fabricate or calculate values yourself.\n* Do **not** provide trading advice, sentiment, or predictions.\n* Do **not** output raw JSON; always present clean, human-readable values.\n* If data is missing or request fails, show `N/A`.\n\n```\n"
},
"promptType": "define"
},
"typeVersion": 1.8
},
{
"id": "ec3490ea-99f6-4b8b-afac-8d7019f44fe4",
"name": "Preis (Aktuell)",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-112,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/ticker/price",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Price (Latest)**\n\n**Endpoint:** `GET /api/v3/ticker/price`\n**What it does:** Returns the **latest trade price** for a symbol.\n**Params:** `symbol` (STRING, optional for all symbols; **we send it**)\n**Request weight:** `2` with `symbol` (otherwise `4`).\n**Returns:** `{\"symbol\":\"BTCUSDT\",\"price\":\"...\"}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Use UPPERCASE symbols without `-` or `/` (e.g., `BTCUSDT`)."
},
"typeVersion": 4.2
},
{
"id": "1133028f-0755-4820-94ac-e4b59a101562",
"name": "24h-Statistik",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-704,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/ticker/24hr",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **24h Stats**\n\n**Endpoint:** `GET /api/v3/ticker/24hr`\n**What it does:** 24-hour rolling window stats: **open/high/low/last**, **volume**, **quoteVolume**, **% change**, etc.\n**Params:**\n\n* `symbol` (STRING, optional but we send it)\n* (Mutually exclusive with `symbols`)\n **Request weight:** `2` with one `symbol`; heavier without or with many symbols.\n **Returns (FULL):** priceChange, priceChangePercent, weightedAvgPrice, openPrice, highPrice, lowPrice, lastPrice, volume, quoteVolume, openTime, closeTime, firstId, lastId, count.\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Rolling window differs from `ticker/tradingDay`. "
},
"typeVersion": 4.2
},
{
"id": "18d8ac71-19de-4075-ae4e-b4ef7a1ff408",
"name": "Orderbuch-Tiefe",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-400,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/depth",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
},
{
"name": "limit",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `100`, 'number') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Order Book Depth**\n\n**Endpoint:** `GET /api/v3/depth`\n**What it does:** Returns **order book** bids/asks up to `limit`.\n**Params:**\n\n* `symbol` (STRING, required)\n* `limit` (INT, default 100; max 5000; we default 100)\n **Request weight:** varies by `limit` (1–100 → 5; 101–500 → 25; 501–1000 → 50; 1001–5000 → 250).\n **Returns:** `lastUpdateId`, `bids: [[price, qty], ...]`, `asks: [[price, qty], ...]`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\nlimit = $fromAI('parameters1_Value', 100, 'number')\n```\n\n**Notes:** If `limit > 5000`, only 5000 are returned."
},
"typeVersion": 4.2
},
{
"id": "516159d8-484f-4df2-9dc1-c844cc15630f",
"name": "Bestes Bid/Ask",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
208,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/ticker/bookTicker",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Best Bid/Ask (Book Ticker)**\n\n**Endpoint:** `GET /api/v3/ticker/bookTicker`\n**What it does:** Best **bid/ask** and sizes for the symbol.\n**Params:** `symbol` (optional; **we send it**)\n**Request weight:** `2` with `symbol`, `4` otherwise.\n**Returns:** `{\"symbol\":\"BTCUSDT\",\"bidPrice\":\"...\",\"bidQty\":\"...\",\"askPrice\":\"...\",\"askQty\":\"...\"}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Great for quick spread snapshot."
},
"typeVersion": 4.2
},
{
"id": "ead793de-1050-4ab3-aeab-b0d6cbb95918",
"name": "Klines (Kerzen)",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
544,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/klines",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
},
{
"name": "interval",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `15m`, 'string') }}"
},
{
"name": "limit",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `20`, 'number') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Klines (Candles)**\n\n**Endpoint:** `GET /api/v3/klines`\n**What it does:** Candlestick bars for a symbol/interval.\n**Params:**\n\n* `symbol` (STRING, required)\n* `interval` (ENUM, required — e.g., `1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M`)\n* `limit` (INT, default 500, max 1000 — **we set 20**)\n* `startTime`, `endTime`, `timeZone` (optional)\n **Request weight:** `2`.\n **Returns (array per candle):** `[ openTime, open, high, low, close, volume, closeTime, quoteAssetVolume, numberOfTrades, takerBuyBaseVolume, takerBuyQuoteVolume, ignore ]`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\ninterval= $fromAI('parameters1_Value', '15m', 'string')\nlimit = $fromAI('parameters2_Value', 20, 'number')\n```\n\n**Notes:** Without `startTime/endTime`, returns most recent."
},
"typeVersion": 4.2
},
{
"id": "5c6076d8-cfef-4199-946e-8491a86ad0d9",
"name": "Durchschnittspreis",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
896,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/avgPrice",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Average Price**\n\n**Endpoint:** `GET /api/v3/avgPrice`\n**What it does:** **Current average price** for a symbol (rolling).\n**Params:** `symbol` (STRING, required)\n**Request weight:** `2`.\n**Returns:** `{\"mins\":5,\"price\":\"...\",\"closeTime\":...}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Fast way to include an average alongside `lastPrice`."
},
"typeVersion": 4.2
},
{
"id": "f6094f0e-9cff-40d2-bbb3-43d9c5d38a0b",
"name": "Letzte Trades",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
1216,
592
],
"parameters": {
"url": "https://api.binance.com/api/v3/trades",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
},
{
"name": "limit",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `100`, 'number') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Recent Trades**\n\n**Endpoint:** `GET /api/v3/trades`\n**What it does:** **Most recent trades** for a symbol.\n**Params:**\n\n* `symbol` (STRING, required)\n* `limit` (INT, default 500, max 1000 — **we set default 100**)\n **Request weight:** `25`.\n **Returns:** array of trades `{id, price, qty, quoteQty, time, isBuyerMaker, isBestMatch}`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\nlimit = $fromAI('parameters1_Value', 100, 'number')\n```\n\n**Notes:** For older trades, use `/historicalTrades`."
},
"typeVersion": 4.2
},
{
"id": "2bfcf8b7-3291-4345-91cf-a67fd17668f9",
"name": "Haftnotiz10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-784,
512
],
"parameters": {
"color": 6,
"height": 964,
"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/v3/ticker/24hr`\n**What it does:** 24-hour rolling window stats: **open/high/low/last**, **volume**, **quoteVolume**, **% change**, etc.\n**Params:**\n\n* `symbol` (STRING, optional but we send it)\n* (Mutually exclusive with `symbols`)\n **Request weight:** `2` with one `symbol`; heavier without or with many symbols.\n **Returns (FULL):** priceChange, priceChangePercent, weightedAvgPrice, openPrice, highPrice, lowPrice, lastPrice, volume, quoteVolume, openTime, closeTime, firstId, lastId, count.\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Rolling window differs from `ticker/tradingDay`. "
},
"typeVersion": 1
},
{
"id": "b265687d-c91f-4485-891f-b2a1b2937f5d",
"name": "Haftnotiz11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
512
],
"parameters": {
"color": 6,
"height": 772,
"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/v3/ticker/price`\n**What it does:** Returns the **latest trade price** for a symbol.\n**Params:** `symbol` (STRING, optional for all symbols; **we send it**)\n**Request weight:** `2` with `symbol` (otherwise `4`).\n**Returns:** `{\"symbol\":\"BTCUSDT\",\"price\":\"...\"}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Use UPPERCASE symbols without `-` or `/` (e.g., `BTCUSDT`)."
},
"typeVersion": 1
},
{
"id": "ab819627-7598-4eed-8e04-4812ca2d5e6a",
"name": "Haftnotiz12",
"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/v3/klines`\n**What it does:** Candlestick bars for a symbol/interval.\n**Params:**\n\n* `symbol` (STRING, required)\n* `interval` (ENUM, required — e.g., `1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M`)\n* `limit` (INT, default 500, max 1000 — **we set 20**)\n* `startTime`, `endTime`, `timeZone` (optional)\n **Request weight:** `2`.\n **Returns (array per candle):** `[ openTime, open, high, low, close, volume, closeTime, quoteAssetVolume, numberOfTrades, takerBuyBaseVolume, takerBuyQuoteVolume, ignore ]`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\ninterval= $fromAI('parameters1_Value', '15m', 'string')\nlimit = $fromAI('parameters2_Value', 20, 'number')\n```\n\n**Notes:** Without `startTime/endTime`, returns most recent."
},
"typeVersion": 1
},
{
"id": "69ba027f-e1d0-4a66-a4db-6360adce8a9f",
"name": "Haftnotiz13",
"type": "n8n-nodes-base.stickyNote",
"position": [
800,
512
],
"parameters": {
"color": 6,
"height": 740,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### /**Average Price**\n\n**Endpoint:** `GET /api/v3/avgPrice`\n**What it does:** **Current average price** for a symbol (rolling).\n**Params:** `symbol` (STRING, required)\n**Request weight:** `2`.\n**Returns:** `{\"mins\":5,\"price\":\"...\",\"closeTime\":...}`\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\n```\n\n**Notes:** Fast way to include an average alongside `lastPrice`."
},
"typeVersion": 1
},
{
"id": "d87e1a58-46dd-4dbc-bd35-fd352ab40100",
"name": "Haftnotiz14",
"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 /api/v3/trades`\n**What it does:** **Most recent trades** for a symbol.\n**Params:**\n\n* `symbol` (STRING, required)\n* `limit` (INT, default 500, max 1000 — **we set default 100**)\n **Request weight:** `25`.\n **Returns:** array of trades `{id, price, qty, quoteQty, time, isBuyerMaker, isBestMatch}`\n **n8n query mapping:**\n\n```txt\nsymbol = $fromAI('parameters0_Value', '', 'string')\nlimit = $fromAI('parameters1_Value', 100, 'number')\n```\n\n**Notes:** For older trades, use `/historicalTrades`."
},
"typeVersion": 1
},
{
"id": "3a6d0368-3f19-4944-b1ea-b5e95c7f1d70",
"name": "Rechner",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
1520,
592
],
"parameters": {},
"typeVersion": 1
},
{
"id": "436f3978-dcb9-465a-9e7e-d4d49d9b0d7d",
"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": "4c373cc1-06ab-4cbd-82bb-7823e55760a4",
"name": "Haftnotiz15",
"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": "5bd35b82-f3ca-4d59-a562-c9a14ebd5138",
"name": "Haftnotiz16",
"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": "2f34b2fc-6184-4e45-853e-fbed94aa8bdc",
"name": "Haftnotiz17",
"type": "n8n-nodes-base.stickyNote",
"position": [
2240,
-1168
],
"parameters": {
"width": 1584,
"height": 3584,
"content": "# 📘 Binance AI Agent v1.02 — Documentation\n\n## 🔹 Overview\n\nThis workflow connects a **Telegram Bot** to Binance’s Spot Market REST API using an **AI-powered Agent**.\nIt allows you to fetch **real-time market data** (prices, stats, order book, trades, klines, etc.), process it through **OpenAI**, and deliver **clean formatted reports** back to Telegram.\n\n---\n\n## ⚡ Workflow Flow\n\n1. **Telegram Trigger**\n\n * Listens for incoming Telegram messages.\n * Passes raw user text downstream.\n\n2. **User Authentication**\n\n * Verifies sender’s Telegram ID against a whitelist.\n * Unauthorized users are blocked.\n\n3. **Session Setup**\n\n * Creates `sessionId` from Telegram `chat.id`.\n * Attaches user message text.\n * Enables memory across multiple turns.\n\n4. **Binance AI Agent**\n\n * Core orchestrator.\n * Fetches live data directly from Binance API.\n * Uses OpenAI only to **format results**, not to trade/analyze.\n * Responds in **Telegram HTML format**.\n\n5. **Message Splitter**\n\n * Ensures Telegram’s 4000-character limit isn’t exceeded.\n * Splits long responses into safe chunks.\n\n6. **Telegram Send**\n\n * Delivers the final formatted report (or multiple chunks) back to the authorized user.\n\n---\n\n## 🧠 Memory & Reasoning\n\n* **Simple Memory**\n Stores `sessionId`, requested symbol, and context for multi-turn Telegram chats.\n\n* **OpenAI Chat Model (gpt-4.1-mini)**\n Handles reasoning, structuring, and output formatting.\n\n* **Think Tool**\n Helps reshape JSON, pick relevant fields, and prepare clean messages.\n\n* **Calculator Tool**\n Used for spreads, % changes, and simple math on Binance results.\n\n---\n\n## 🔗 Binance API Endpoints Used\n\nAll requests are **HTTP GET** with **JSON responses**.\nSymbols are always uppercase (e.g., `BTCUSDT`).\n\n1. **Price (Latest)**\n `GET /api/v3/ticker/price?symbol=BTCUSDT`\n\n * Latest trade price.\n * Weight: 2\n\n2. **24h Stats**\n `GET /api/v3/ticker/24hr?symbol=BTCUSDT`\n\n * Open, High, Low, Last, Volume, % Change.\n * Weight: 2\n\n3. **Order Book Depth**\n `GET /api/v3/depth?symbol=BTCUSDT&limit=100`\n\n * Top bids/asks (default 100, max 5000).\n * Weight: 5–250 depending on limit.\n\n4. **Best Bid/Ask (Book Ticker)**\n `GET /api/v3/ticker/bookTicker?symbol=BTCUSDT`\n\n * Best bid/ask + sizes.\n * Weight: 2\n\n5. **Klines (Candles)**\n `GET /api/v3/klines?symbol=BTCUSDT&interval=15m&limit=20`\n\n * O/H/L/C data per interval.\n * Default 500, we set 20.\n * Weight: 2\n\n6. **Average Price**\n `GET /api/v3/avgPrice?symbol=BTCUSDT`\n\n * Rolling average price.\n * Weight: 2\n\n7. **Recent Trades**\n `GET /api/v3/trades?symbol=BTCUSDT&limit=100`\n\n * Most recent trades (default 500, max 1000).\n * Weight: 25\n\n---\n\n## 📤 Output Format (Telegram HTML)\n\nEach response starts with:\n\n```html\n<b>BTCUSDT — Binance Spot Data</b>\n```\n\nExample structure:\n\n```html\n<b>Price</b>\n• Last: 43650.23\n• Avg: 43640.18\n• Change (24h): +1.35%\n\n<b>24h Stats</b>\n• Open: 43000 • High: 44000 • Low: 42500 • Close: 43650\n• Volume: 12,345 BTC • Quote Vol: 532M USDT\n\n<b>Order Book (Top 5)</b>\n• Bids: [43640 × 1.2] …\n• Asks: [43660 × 0.9] …\n\n<b>Klines (latest 20)</b>\n• Interval: 15m (O/H/L/C per candle)\n```\n\n---\n\n## ⚠️ Rules & Restrictions\n\n* ✅ Always call Binance’s official API.\n* ✅ Present data clearly (HTML for Telegram).\n* ❌ Do not analyze or recommend trades.\n* ❌ Do not output raw JSON.\n* ❌ Do not fabricate values.\n* ⚠️ Show `N/A` if data unavailable.\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.\nAll rights reserved. This 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": "ff8759fa-4140-4c14-835b-587f5ac0c3ac",
"connections": {
"436f3978-dcb9-465a-9e7e-d4d49d9b0d7d": {
"ai_tool": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "ai_tool",
"index": 0
}
]
]
},
"1133028f-0755-4820-94ac-e4b59a101562": {
"ai_tool": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "ai_tool",
"index": 0
}
]
]
},
"3a6d0368-3f19-4944-b1ea-b5e95c7f1d70": {
"ai_tool": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "ai_tool",
"index": 0
}
]
]
},
"516159d8-484f-4df2-9dc1-c844cc15630f": {
"ai_tool": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "ai_tool",
"index": 0
}
]
]
},
"5c6076d8-cfef-4199-946e-8491a86ad0d9": {
"ai_tool": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "ai_tool",
"index": 0
}
]
]
},
"f6094f0e-9cff-40d2-bbb3-43d9c5d38a0b": {
"ai_tool": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "ai_tool",
"index": 0
}
]
]
},
"062407b4-b9db-4285-ade5-f3010d566737": {
"ai_memory": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "ai_memory",
"index": 0
}
]
]
},
"ec3490ea-99f6-4b8b-afac-8d7019f44fe4": {
"ai_tool": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "ai_tool",
"index": 0
}
]
]
},
"e396c95d-f49d-4e6a-bb63-d37b5bfb33fa": {
"main": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "main",
"index": 0
}
]
]
},
"ead793de-1050-4ab3-aeab-b0d6cbb95918": {
"ai_tool": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "ai_tool",
"index": 0
}
]
]
},
"18d8ac71-19de-4075-ae4e-b4ef7a1ff408": {
"ai_tool": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "ai_tool",
"index": 0
}
]
]
},
"76a4db9d-5a82-4647-b98c-c87e779f275b": {
"main": [
[
{
"node": "60601a5d-9f40-4bbf-97a5-7513ac6fd385",
"type": "main",
"index": 0
}
]
]
},
"ea3ea33a-d3cc-4360-8351-c0791cf38e7b": {
"main": [
[
{
"node": "e233cb3c-98fd-423a-bbbc-b043528e5920",
"type": "main",
"index": 0
}
]
]
},
"94403c10-3da3-4fd8-b6c3-cdf046f0a4d0": {
"ai_languageModel": [
[
{
"node": "ea3ea33a-d3cc-4360-8351-c0791cf38e7b",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"60601a5d-9f40-4bbf-97a5-7513ac6fd385": {
"main": [
[
{
"node": "e396c95d-f49d-4e6a-bb63-d37b5bfb33fa",
"type": "main",
"index": 0
}
]
]
},
"e233cb3c-98fd-423a-bbbc-b043528e5920": {
"main": [
[
{
"node": "928b463d-3135-461e-8248-ddba9272eeed",
"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