Bitget AI Agent v1.02
Ceci est unCrypto Trading, AI Chatbot, Multimodal AIworkflow d'automatisation du domainecontenant 31 nœuds.Utilise principalement des nœuds comme Set, Code, Telegram, Agent, HttpRequestTool. utilisationGPT-4o + TelegramobtenirBitget现货市场实时données
- •Token Bot Telegram
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
- •Clé API OpenAI
Nœuds utilisés (31)
{
"id": "H5bqsUPIPid2vFyk",
"meta": {
"instanceId": "a5283507e1917a33cc3ae615b2e7d5ad2c1e50955e6f831272ddd5ab816f3fb6"
},
"name": "Bitget AI Agent v1.02",
"tags": [],
"nodes": [
{
"id": "ce9b21f8-1f5d-49a0-8bfc-886439710297",
"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": "f51b1ea0-88f6-47be-86d4-1460d05e2478",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-1008,
240
],
"webhookId": "35fb8183-10ef-4d6b-8965-0b2dd92c4ba8",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "NRLKuLR7z8vCesub",
"name": "BinanceSpotTradingAIAgent_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "3f52c9c4-97ca-44b2-a21d-b542bf219a99",
"name": "Authentification utilisateur (Remplacer l'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": "769ecd3e-e739-4e24-8b3b-9cd8a13b2e5e",
"name": "Ajoute \"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": "5854038c-1ac6-4a1c-9853-7361d5942a19",
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
896,
240
],
"webhookId": "9ad56dc1-f659-4178-8937-d1750225d85d",
"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": "4a5700e1-ef5d-4ae0-85fb-dfe0d3a9436c",
"name": "Divise le message s'il dépasse 4000 caractères",
"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": "ecc233de-5095-48f5-b5ea-0c383af58313",
"name": "Note adhésive",
"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": "4ced49d4-c400-487f-93f0-6ac1d7de8704",
"name": "Note adhésive1",
"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": "d057cc29-426b-4769-8765-7263c1bd8f8e",
"name": "Note adhésive2",
"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": "83e47566-d233-404a-8c3c-b43212cfb2cd",
"name": "Note adhésive3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
-512
],
"parameters": {
"color": 7,
"width": 480,
"height": 964,
"content": "# Main AI Agent: Data Fetcher (Bitget)\n\n**Node: Bitget Data Agent**\nThis is the **core orchestrator**. It uses OpenAI only to **format and present raw Bitget spot market data**, not to analyze or generate strategies.\n\nIt has direct **HTTP request access** to the Bitget REST API and retrieves:\n\n* **Live ticker (latest price & 24h stats)**\n `GET /api/v2/spot/market/tickers`\n\n* **Order book depth**\n `GET /api/v2/spot/market/orderbook` (with `symbol`, `type=step0`, `limit`)\n\n* **Recent trades**\n `GET /api/v2/spot/market/fills` (for trade history, latest public trades)\n\n* **Klines / Candlesticks**\n `GET /api/v2/spot/market/candles` (with `symbol`, `granularity`, `limit`)\n\n* **Historical candles (optional)**\n `GET /api/v2/spot/market/history-candles` (with `endTime`, `limit`)\n\nThe agent calls these endpoints in parallel for the requested trading pair (e.g., `BTCUSDT`), validates results, and then **presents the data in clean Telegram text format**.\n\n\n"
},
"typeVersion": 1
},
{
"id": "47065561-7279-41c3-9231-c8d9bc81d27f",
"name": "Note adhésive4",
"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": "05a063ef-9294-4692-907e-2e8d43e67dec",
"name": "Note adhésive5",
"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": "6e9a03c3-c867-4c88-871c-c09de2293b60",
"name": "Note adhésive6",
"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": "d835c62a-6fc4-4422-8b77-c0e4e401282a",
"name": "Note adhésive7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
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### **Order Book Depth**\n\n**Endpoint:** `GET /api/v2/spot/market/orderbook`\n**What it does:** Returns order book bids/asks up to `limit`.\n\n**Params:**\n* `symbol` (STRING, required) → e.g., BTCUSDT\n* `type` (STRING, optional) → depth aggregation level (e.g., step0)\n* `limit` (INT, optional) → number of levels (default 100)\n\n**Returns:** bids/asks arrays with price and size.\n\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('symbol', 'BTCUSDT', 'string')\ntype = $fromAI('depthType', 'step0', 'string')\nlimit = $fromAI('limit', 100, 'number')\n```"
},
"typeVersion": 1
},
{
"id": "fd0947eb-9d67-439b-8bd8-a672472531bd",
"name": "Note adhésive8",
"type": "n8n-nodes-base.stickyNote",
"position": [
128,
512
],
"parameters": {
"color": 6,
"height": 820,
"content": "\n\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/v2/spot/market/fills`\n**What it does:** Returns the most recent public trades for a symbol.\n\n**Params:**\n* `symbol` (STRING, required) → e.g., BTCUSDT\n* `limit` (INT, optional) → number of trades (default 100 here)\n\n**Returns:** array of trades with price, size, side, and time.\n\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('symbol', 'BTCUSDT', 'string')\nlimit = $fromAI('limit', 100, 'number')\n```"
},
"typeVersion": 1
},
{
"id": "907737f8-167d-4276-9710-1920cc01b101",
"name": "Note adhésive9",
"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": "852be091-4826-4907-a99b-9cd56d52508e",
"name": "Note adhésive10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-784,
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### **Ticker (Latest & 24h Stats)**\n\n**Endpoint:** `GET /api/v2/spot/market/tickers`\n**What it does:** Returns latest price plus 24h stats for a symbol (last, open/high/low, change %, volumes, best bid/ask).\n\n**Params:**\n* `symbol` (STRING, optional but recommended) → e.g., BTCUSDT\n\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('symbol', 'BTCUSDT', 'string')\n```"
},
"typeVersion": 1
},
{
"id": "22e1d65a-0d59-44fa-b0dc-b103d7191c8c",
"name": "Note adhésive11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
512
],
"parameters": {
"color": 6,
"height": 916,
"content": "\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/v2/spot/market/candles` \n**What it does:** OHLCV candlesticks for a symbol/interval. \n\n**Params:** \n* `symbol` (STRING, required) → e.g., BTCUSDT \n* `granularity` (ENUM, required) → one of **1min, 15min, 1h, 4h, 1day** \n* `limit` (INT, optional) → number of candles (default 20 here) \n* `startTime`, `endTime` (optional) → ms timestamps \n\n**Returns:** arrays per candle: `[timestamp, open, high, low, close, volume]` \n\n**n8n query mapping:** \n```txt\nsymbol = $fromAI('symbol', 'BTCUSDT', 'string')\ngranularity = $fromAI('granularity', '15min', 'string')\nlimit = $fromAI('limit', 20, 'number')\n"
},
"typeVersion": 1
},
{
"id": "62c3ed90-d9f3-43b6-adb5-c4b1c1cfecbb",
"name": "Note adhésive12",
"type": "n8n-nodes-base.stickyNote",
"position": [
464,
512
],
"parameters": {
"color": 6,
"height": 948,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### **Historical Candles**\n\n**Endpoint:** `GET /api/v2/spot/market/history-candles` \n**What it does:** Returns **older OHLCV candlesticks** ending before `endTime`. \n\n**Params:** \n* `symbol` (STRING, required) → e.g., BTCUSDT \n* `granularity` (ENUM, required) → one of **1min, 15min, 1h, 4h, 1day** \n* `endTime` (LONG, required) → Unix ms timestamp (last candle end) \n* `limit` (INT, optional, default 100) \n\n**Returns:** arrays per candle: `[timestamp, open, high, low, close, volume]` \n\n**n8n query mapping:** \n```txt\nsymbol = $fromAI('symbol', 'BTCUSDT', 'string')\ngranularity = $fromAI('granularity', '15min', 'string')\nendTime = $fromAI('endTime', '', 'number')\nlimit = $fromAI('limit', 100, 'number')\n"
},
"typeVersion": 1
},
{
"id": "55a0673c-0626-465e-9e95-375f4470e9af",
"name": "Agent IA Bitget",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-96,
240
],
"parameters": {
"text": "={{ $json.message }}",
"options": {
"systemMessage": "You are the **Bitget Spot Market Data Agent**.\nYou have **HTTP GET** access to the official Bitget REST **v2 Spot API** to retrieve market data for any requested Spot trading pair.\nYour job is to **fetch and present data only** — no analysis, predictions, or advice.\n\n---\n\n## 🔗 API Access\n\n**Base URL:** `https://api.bitget.com/api/v2`\n**Pair format:** `BASEQUOTE` (uppercase, no separator), e.g. `BTCUSDT`.\n\n**General rules**\n\n* All requests are **GET** and return **JSON**.\n* Query params go in the URL, e.g. `?symbol=BTCUSDT&limit=100`.\n* If a field or call fails, output `N/A` and continue.\n\n---\n\n## 📌 Market Data Endpoints (Spot)\n\n1. **Latest Price & 24h Stats**\n `GET /spot/market/tickers?symbol=BTCUSDT`\n Returns last price, open/high/low, 24h % change, base/quote volume, best bid/ask.\n\n2. **Order Book Depth**\n `GET /spot/market/orderbook?symbol=BTCUSDT&type=step0&limit=100`\n Returns bids/asks up to the limit (top-of-book first).\n Use `limit=1` to emulate **Best Bid/Ask**.\n\n3. **Recent Trades**\n `GET /spot/market/fills?symbol=BTCUSDT&limit=100`\n Most recent public trades (price, size, side, time).\n\n4. **Candlesticks (Klines)**\n `GET /spot/market/candles?symbol=BTCUSDT&granularity=15min&limit=20`\n OHLCV candles. Supported intervals: **1min, 15min, 1h, 4h, 1day**.\n\n5. **Historical Candles** (Optional)\n `GET /spot/market/history-candles?symbol=BTCUSDT&granularity=15min&endTime=...&limit=100`\n Older OHLCV candles ending before `endTime`.\n Supported intervals: **1min, 15min, 1h, 4h, 1day**.\n\n---\n\n## 🧩 Utility Tools\n\n* **Calculator** — optional math (spread, midpoint, % change).\n* **Think** — reshape JSON and format the final Telegram text message.\n\n---\n\n## 📤 Output Format (Telegram text)\n\nStart with:\n\n```\nBTCUSDT — Bitget Spot Data\n```\n\nThen group logically:\n\n```\nPrice\n• Last: 26250\n• Best Bid / Ask: 26245 / 26255\n• Change (24h): -1.2%\n\n24h Stats\n• Open: 26500 • High: 27000 • Low: 26000 • Close: 26250\n• Volume: 1,234 BTC • Quote Vol: 32,000,000 USDT\n\nOrder Book (Top 5)\n• Bids: [26245 x 0.5], [26244 x 1.2] …\n• Asks: [26255 x 0.8], [26256 x 1.5] …\n\nCandles (latest 20)\n• Interval: 15min (O/H/L/C per candle)\n\nHistorical Candles\n• End before: {{endTime}} • Interval: {{granularity}}\n```\n\n---\n\n## ⚠️ Rules\n\n* Always call the correct **Bitget Spot v2 endpoint**.\n* Do not fabricate numbers or run technical analysis/sentiment.\n* Do not dump raw JSON; always present clean, readable values.\n* On error or missing fields, show `N/A` and continue.\n\n"
},
"promptType": "define"
},
"typeVersion": 1.8
},
{
"id": "9d0b1a13-5fb3-4479-aa03-d4d8b71ed9e5",
"name": "Ticker (Statistiques 24h)",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-704,
608
],
"parameters": {
"url": "https://api.bitget.com/api/v2/spot/market/tickers",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('symbol', `BTCUSDT`, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Ticker (Latest & 24h Stats)**\n\n**Endpoint:** `GET /api/v2/spot/market/tickers`\n**What it does:** Returns latest price plus 24h stats for a symbol (last, open/high/low, change %, volumes, best bid/ask).\n\n**Params:**\n* `symbol` (STRING, optional but recommended) → e.g., BTCUSDT\n\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('symbol', 'BTCUSDT', 'string')\n```"
},
"typeVersion": 4.2
},
{
"id": "83e887de-8dc0-4951-a092-15c98bc96d0c",
"name": "Profondeur du carnet d'ordres",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-416,
608
],
"parameters": {
"url": "https://api.bitget.com/api/v2/spot/market/orderbook",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ $fromAI('symbol', `BTCUSDT`, 'string') }}"
},
{
"name": "type",
"value": "={{ $fromAI('depthType', `step0`, 'string') }}"
},
{
"name": "limit",
"value": "={{ $fromAI('limit', `100`, 'number') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Order Book Depth**\n\n**Endpoint:** `GET /api/v2/spot/market/orderbook`\n**What it does:** Returns order book bids/asks up to `limit`.\n\n**Params:**\n* `symbol` (STRING, required) → e.g., BTCUSDT\n* `type` (STRING, optional) → depth aggregation level (e.g., step0)\n* `limit` (INT, optional) → number of levels (default 100)\n\n**Returns:** bids/asks arrays with price and size.\n\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('symbol', 'BTCUSDT', 'string')\ntype = $fromAI('depthType', 'step0', 'string')\nlimit = $fromAI('limit', 100, 'number')\n```"
},
"typeVersion": 4.2
},
{
"id": "a3145234-d478-4f6e-8eb9-560b0558bf79",
"name": "Transactions récentes",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
208,
608
],
"parameters": {
"url": "https://api.bitget.com/api/v2/spot/market/fills",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ $fromAI('symbol', `BTCUSDT`, 'string') }}"
},
{
"name": "limit",
"value": "={{ $fromAI('limit', `100`, 'number') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Recent Trades**\n\n**Endpoint:** `GET /api/v2/spot/market/fills`\n**What it does:** Returns the most recent public trades for a symbol.\n\n**Params:**\n* `symbol` (STRING, required) → e.g., BTCUSDT\n* `limit` (INT, optional) → number of trades (default 100 here)\n\n**Returns:** array of trades with price, size, side, and time.\n\n**n8n query mapping:**\n\n```txt\nsymbol = $fromAI('symbol', 'BTCUSDT', 'string')\nlimit = $fromAI('limit', 100, 'number')\n```"
},
"typeVersion": 4.2
},
{
"id": "d337f052-af2c-4ca1-9feb-e1a58ff6349f",
"name": "Chandelles historiques",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
544,
608
],
"parameters": {
"url": "https://api.bitget.com/api/v2/spot/market/history-candles",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `BTCUSDT`, 'string') }}"
},
{
"name": "granularity",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `15m`, 'string') }}"
},
{
"name": "endTime",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', ``, 'string') }}"
},
{
"name": "limit",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters3_Value', `100`, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Historical Candles**\n\n**Endpoint:** `GET /api/v2/spot/market/history-candles` \n**What it does:** Returns **older OHLCV candlesticks** ending before `endTime`. \n\n**Params:** \n* `symbol` (STRING, required) → e.g., BTCUSDT \n* `granularity` (ENUM, required) → one of **1min, 15min, 1h, 4h, 1day** \n* `endTime` (LONG, required) → Unix ms timestamp (last candle end) \n* `limit` (INT, optional, default 100) \n\n**Returns:** arrays per candle: `[timestamp, open, high, low, close, volume]` \n\n**n8n query mapping:** \n```txt\nsymbol = $fromAI('symbol', 'BTCUSDT', 'string')\ngranularity = $fromAI('granularity', '15min', 'string')\nendTime = $fromAI('endTime', '', 'number')\nlimit = $fromAI('limit', 100, 'number')\n"
},
"typeVersion": 4.2
},
{
"id": "bc735a72-1b1f-4b30-a57a-b85828b61295",
"name": "Klines (Chandelles)",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-112,
592
],
"parameters": {
"url": "https://api.bitget.com/api/v2/spot/market/candles",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "symbol",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `BTCUSDT`, 'string') }}"
},
{
"name": "granularity",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `1min, 5min, 15min, 1h, 4h, 1day`, 'string') }}"
},
{
"name": "limit",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `20`, 'string') }}"
}
]
},
"toolDescription": "### 🏷 Tool: **Klines (Candles)**\n\n**Endpoint:** `GET /api/v2/spot/market/candles` \n**What it does:** OHLCV candlesticks for a symbol/interval. \n\n**Params:** \n* `symbol` (STRING, required) → e.g., BTCUSDT \n* `granularity` (ENUM, required) → one of **1min, 15min, 1h, 4h, 1day** \n* `limit` (INT, optional) → number of candles (default 20 here) \n* `startTime`, `endTime` (optional) → ms timestamps \n\n**Returns:** arrays per candle: `[timestamp, open, high, low, close, volume]` \n\n**n8n query mapping:** \n```txt\nsymbol = $fromAI('symbol', 'BTCUSDT', 'string')\ngranularity = $fromAI('granularity', '15min', 'string')\nlimit = $fromAI('limit', 20, 'number')\n"
},
"typeVersion": 4.2
},
{
"id": "bfa7a5b2-6e12-4c5d-9bb6-84adf000bb5f",
"name": "Mémoire simple",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-1008,
720
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "bde84900-04ac-4efb-8096-f68dc35307d9",
"name": "Calculatrice",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
896,
592
],
"parameters": {},
"typeVersion": 1
},
{
"id": "0139552e-d250-4d32-8b62-2604ed61ff23",
"name": "Réflexion",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
1184,
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": "65de308b-818a-4214-ac13-ee08b355f636",
"name": "Note adhésive15",
"type": "n8n-nodes-base.stickyNote",
"position": [
816,
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": "dd67ba06-a20f-45c1-8c7c-469fadd562f5",
"name": "Note adhésive16",
"type": "n8n-nodes-base.stickyNote",
"position": [
1104,
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": "521f1e1b-93cc-4640-81ac-768f0dd0ab51",
"name": "Note adhésive13",
"type": "n8n-nodes-base.stickyNote",
"position": [
1504,
-896
],
"parameters": {
"width": 1200,
"height": 2736,
"content": "# 🧠 Bitget Spot Market AI Agent – Full System Documentation\n\nA specialized **data-fetching AI automation system** for Bitget Spot markets. \nIt retrieves **live tickers, order books, trades, and candlesticks** via the official Bitget REST v2 API and presents them in a **Telegram-friendly format**. \nNo predictions or trading advice are generated — only **raw, structured data presentation**.\n\n---\n\n## 🧩 Included Workflows\n\nInstall and activate **all the following workflows/tools**:\n\n| ✅ Workflow / Tool Name | 📌 Function Description |\n| ----------------------- | ----------------------- |\n| **Bitget AI Agent** | Core orchestrator. Fetches data from Bitget REST API, formats into Telegram output. |\n| **OpenAI Chat Model** | Provides GPT-powered text formatting (gpt-4.1-mini). |\n| **Telegram Trigger** | Listens for new Telegram commands/messages. |\n| **User Authentication (ID Check)** | Ensures only approved Telegram ID can use the agent. |\n| **Adds SessionId** | Creates a session context per Telegram chat. |\n| **Simple Memory** | Short-term state storage for symbol/session continuity. |\n| **Splits Message >4000** | Splits long reports into chunks (Telegram safe). |\n| **Telegram (Send Message)** | Sends the final formatted data/report to user. |\n| **Ticker (24h Stats)** | Gets last price, O/H/L, 24h % change, volumes, bid/ask. |\n| **Order Book Depth** | Pulls top bids/asks from Bitget order book. |\n| **Recent Trades** | Retrieves recent public trades. |\n| **Klines (Candles)** | Pulls OHLCV candlesticks for supported intervals. |\n| **Historical Candles** | Gets older candles ending before `endTime`. |\n| **Calculator** | Performs math operations (spreads, % change). |\n| **Think** | Lightweight reasoning/reshaping tool for JSON → clean text. |\n\n---\n\n## ⚙️ Installation Instructions\n\n### Step 1: Import Workflows\n* Open **n8n Editor UI** \n* Import `Bitget AI Agent v1.02.json` \n* Activate the workflow\n\n### Step 2: Set Credentials\n* **OpenAI API** → add your GPT-4.1-mini key \n* **Telegram Bot API** → connect your Telegram bot \n* **Bitget Data** → no authentication required (public endpoints)\n\n### Step 3: Configure Telegram\n* Add your bot to Telegram \n* Replace the **Telegram ID check** inside `User Authentication` with your own ID \n* Only messages from this ID will trigger the agent\n\n### Step 4: Run the Agent\n* Send `/BTCUSDT` or similar symbol request via Telegram \n* Agent fetches ticker, order book, trades, and candlesticks \n* Returns a formatted, structured report\n\n---\n\n## 🖥️ Workflow Overview\n\n```\n\n\\[Telegram Trigger]\n→ \\[User Authentication (ID Check)]\n→ \\[Adds SessionId]\n→ \\[Bitget AI Agent]\n↳ (Ticker, Order Book, Trades, Klines, Historical Candles, Calculator, Think)\n→ \\[Split if >4000 chars]\n→ \\[Send to Telegram]\n\n````\n\n---\n\n## 📌 Supported Bitget API Endpoints\n\n1. **Ticker (24h Stats)** \n `GET /api/v2/spot/market/tickers?symbol=BTCUSDT` \n\n2. **Order Book Depth** \n `GET /api/v2/spot/market/orderbook?symbol=BTCUSDT&type=step0&limit=100` \n\n3. **Recent Trades** \n `GET /api/v2/spot/market/fills?symbol=BTCUSDT&limit=100` \n\n4. **Klines (Candles)** \n `GET /api/v2/spot/market/candles?symbol=BTCUSDT&granularity=15min&limit=20` \n\n5. **Historical Candles** \n `GET /api/v2/spot/market/history-candles?symbol=BTCUSDT&granularity=15min&endTime=...&limit=100`\n\n---\n\n## 📬 Telegram Output Style\n\n```html\n<b>BTCUSDT — Bitget Spot Data</b>\n\n<b>Price</b>\n• Last: 26,250\n• Best Bid/Ask: 26,245 / 26,255\n• Change (24h): -1.2%\n\n<b>24h Stats</b>\n• Open: 26,500 • High: 27,000 • Low: 26,000 • Close: 26,250\n• Volume: 1,234 BTC • Quote Vol: 32,000,000 USDT\n\n<b>Order Book (Top 5)</b>\n• Bids: [26,245 x 0.5], [26,244 x 1.2] …\n• Asks: [26,255 x 0.8], [26,256 x 1.5] …\n\n<b>Candles (15m, last 20)</b>\n• O/H/L/C values per candle\n\n<b>Historical Candles</b>\n• Interval: 15m • Ending before: 1699999999999\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.\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\n"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "b42bdc61-4f67-4c28-a541-05126540fc04",
"connections": {
"0139552e-d250-4d32-8b62-2604ed61ff23": {
"ai_tool": [
[
{
"node": "55a0673c-0626-465e-9e95-375f4470e9af",
"type": "ai_tool",
"index": 0
}
]
]
},
"bde84900-04ac-4efb-8096-f68dc35307d9": {
"ai_tool": [
[
{
"node": "55a0673c-0626-465e-9e95-375f4470e9af",
"type": "ai_tool",
"index": 0
}
]
]
},
"a3145234-d478-4f6e-8eb9-560b0558bf79": {
"ai_tool": [
[
{
"node": "55a0673c-0626-465e-9e95-375f4470e9af",
"type": "ai_tool",
"index": 0
}
]
]
},
"bfa7a5b2-6e12-4c5d-9bb6-84adf000bb5f": {
"ai_memory": [
[
{
"node": "55a0673c-0626-465e-9e95-375f4470e9af",
"type": "ai_memory",
"index": 0
}
]
]
},
"769ecd3e-e739-4e24-8b3b-9cd8a13b2e5e": {
"main": [
[
{
"node": "55a0673c-0626-465e-9e95-375f4470e9af",
"type": "main",
"index": 0
}
]
]
},
"55a0673c-0626-465e-9e95-375f4470e9af": {
"main": [
[
{
"node": "4a5700e1-ef5d-4ae0-85fb-dfe0d3a9436c",
"type": "main",
"index": 0
}
]
]
},
"bc735a72-1b1f-4b30-a57a-b85828b61295": {
"ai_tool": [
[
{
"node": "55a0673c-0626-465e-9e95-375f4470e9af",
"type": "ai_tool",
"index": 0
}
]
]
},
"83e887de-8dc0-4951-a092-15c98bc96d0c": {
"ai_tool": [
[
{
"node": "55a0673c-0626-465e-9e95-375f4470e9af",
"type": "ai_tool",
"index": 0
}
]
]
},
"f51b1ea0-88f6-47be-86d4-1460d05e2478": {
"main": [
[
{
"node": "3f52c9c4-97ca-44b2-a21d-b542bf219a99",
"type": "main",
"index": 0
}
]
]
},
"ce9b21f8-1f5d-49a0-8bfc-886439710297": {
"ai_languageModel": [
[
{
"node": "55a0673c-0626-465e-9e95-375f4470e9af",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"d337f052-af2c-4ca1-9feb-e1a58ff6349f": {
"ai_tool": [
[
{
"node": "55a0673c-0626-465e-9e95-375f4470e9af",
"type": "ai_tool",
"index": 0
}
]
]
},
"9d0b1a13-5fb3-4479-aa03-d4d8b71ed9e5": {
"ai_tool": [
[
{
"node": "55a0673c-0626-465e-9e95-375f4470e9af",
"type": "ai_tool",
"index": 0
}
]
]
},
"3f52c9c4-97ca-44b2-a21d-b542bf219a99": {
"main": [
[
{
"node": "769ecd3e-e739-4e24-8b3b-9cd8a13b2e5e",
"type": "main",
"index": 0
}
]
]
},
"4a5700e1-ef5d-4ae0-85fb-dfe0d3a9436c": {
"main": [
[
{
"node": "5854038c-1ac6-4a1c-9853-7361d5942a19",
"type": "main",
"index": 0
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Avancé - Trading crypto, Chatbot IA, IA Multimodale
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
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.
Partager ce workflow