特斯拉量化交易AI代理 n8n
高级
这是一个Finance, AI领域的自动化工作流,包含 23 个节点。主要使用 Set, Code, DateTime, Telegram, Agent 等节点,结合人工智能技术实现智能自动化。 使用Telegram + GPT-4.1的特斯拉量化交易AI代理(主界面)
前置要求
- •Telegram Bot Token
- •OpenAI API Key
使用的节点 (23)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "YtPhfFCx9D9Eq9zi",
"meta": {
"instanceId": "a5283507e1917a33cc3ae615b2e7d5ad2c1e50955e6f831272ddd5ab816f3fb6",
"templateCredsSetupCompleted": true
},
"name": "特斯拉量化交易 AI Agent n8n",
"tags": [],
"nodes": [
{
"id": "8677aed4-a1bf-4439-8b5e-57c283f81862",
"name": "Telegram触发器",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-560,
-100
],
"webhookId": "721eba88-462f-40ab-8c53-c6c2f3897e11",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "FH5VC4KOy7sBQBc0",
"name": "Dad's Tesla AI Agent"
}
},
"typeVersion": 1.2
},
{
"id": "fddcfaab-f575-4e72-b3f1-e0965e3c71b5",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
140,
260
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "yUizd8t0sD5wMYVG",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "f6e5726a-1010-4a55-9d54-f6889eb780e1",
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
1380,
-100
],
"webhookId": "77b6658d-8dfb-415b-9e67-4f34ef086cdb",
"parameters": {
"text": "={{ $json.message }}",
"chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "FH5VC4KOy7sBQBc0",
"name": "Dad's Tesla AI Agent"
}
},
"typeVersion": 1.2
},
{
"id": "62f3f30c-47e4-4c86-828b-3ab4de28e6c3",
"name": "用户认证(替换 Telegram ID)",
"type": "n8n-nodes-base.code",
"position": [
-300,
-100
],
"parameters": {
"jsCode": "if ($input.first().json.message.from.id !== <<replace your ID here>>) { // 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": "5a79ae5f-583d-41a0-9055-914de6eaf341",
"name": "特斯拉量化交易 AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
520,
-100
],
"parameters": {
"text": "={{ $('Telegram Trigger').item.json.message.text }}",
"options": {
"systemMessage": "You are the **Tesla Quant Trading AI Agent**, responsible for generating structured, professional swing-trading reports for **TSLA** based on both **real-time technical analysis** and **curated sentiment data**.\n\n---\n\n### 🔗 Connected Tools:\n\n1. **Tesla Financial Market Data Analyst Tool** \n - Aggregates multi-timeframe indicators + candlestick signals from:\n • Tesla 15min Indicators Tool \n • Tesla 1h Indicators Tool \n • Tesla 1d Indicators Tool \n • Tesla Klines Tool (1h & 1d pattern/volume) \n - Uses Alpha Vantage indicators: **RSI, BBANDS, SMA, EMA, ADX, MACD** \n - Each tool returns the **20 most recent points**, cleaned and trimmed \n - Pattern logic: detects **Doji, Engulfing**, and **volume divergence**\n\n2. **Tesla News and Sentiment Analyst Tool** \n - Scrapes from trusted RSS sources: **Google News, Yahoo Finance, Electrek, CleanTechnica, TeslaNorth** \n - Returns: \n • **Sentiment score**: Bullish / Bearish / Neutral \n • **Summary**: 2–3 sentence narrative \n • **Top 3–5 Headlines** (with sources)\n\n---\n\n### 📊 Responsibilities:\n\n1. **Ingest structured inputs** from the tools listed above:\n - Indicator values and candlestick/volume behavior \n - News sentiment summaries and headlines\n\n2. **Perform technical analysis** across timeframes:\n - **Short-Term**: 15m + 1h \n - **Long-Term**: 1d + 1h \n - Assess trend, support/resistance, divergence, and reversal signals \n - Confirm with lagging indicators and macro sentiment alignment\n\n3. **Generate two trade strategy sections**:\n\n<b>Spot Recommendations</b> \n• Action: Buy / Sell / Hold \n• Entry Price \n• Stop Loss \n• Take Profit \n• Rationale: \n - <b>Primary Signals</b>: e.g. candle pattern, breakout \n - <b>Lagging Indicators</b>: RSI, BBANDS, etc. \n - <b>Sentiment & Macro Analysis</b>: use news summary + headlines\n\n<b>Leveraged Recommendations</b> \n• Position: Long / Short \n• Leverage: 2x / 3x / 5x \n• Entry Price \n• Stop Loss \n• Take Profit \n• Rationale: \n - <b>Primary Price Action Signals</b> \n - <b>Lagging Indicator Confirmation</b> \n - <b>Sentiment & Macro Analysis</b>\n\n4. **Score your signal strength** \n• Confidence score (0–100) \n• Strength label: Low / Medium / High / Very High\n\n5. **Include sentiment and headlines** at the bottom of the report: \n• A short <b>News Sentiment Summary</b> \n• Top 3 Tesla-related headlines with bullet formatting\n\n---\n\n### 🧾 Output Format (Telegram HTML)\n\nStart your message with:\n<b>TSLA Analysis</b>\n\n\nUse:\n• `<b>` for bold headers \n• `•` for bullet points \n• Clean line breaks \n\n---\n\n⚠️ DO NOT:\n• Fabricate or assume any data \n• Repeat this prompt or system instructions \n• Include raw JSON or raw API format in your output\n\nOnly use what is provided via structured input. Write like a seasoned quantitative analyst.\n"
},
"promptType": "define"
},
"typeVersion": 1.8
},
{
"id": "966cf9b6-abd4-48a0-bd32-6c83985a33ac",
"name": "特斯拉金融市场数据分析工具",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
700,
260
],
"parameters": {
"name": "Tesla_Financial_Market_Data_Analyst",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "WmWhVZ3XkJdjTmME",
"cachedResultName": "Work Drive — Tesla Financial Market Data Analyst"
},
"workflowInputs": {
"value": {
"message": "={{ $fromAI(\"message\",\"Populate this with a relevant message to this subagent\")}}",
"sessionId": "={{ $json.sessionId }}"
},
"schema": [
{
"id": "message",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "message",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "sessionId",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "sessionId",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.1
},
{
"id": "dbf1bef5-044a-4594-af1b-1468d4cdc06a",
"name": "特斯拉新闻和情绪分析工具",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
980,
260
],
"parameters": {
"name": "Tesla_News_and_Sentiment_Analyst",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "kOIhNsok4gtt6fD3",
"cachedResultName": "Work Drive — Tesla News and Sentiment Analyst"
},
"workflowInputs": {
"value": {
"message": "={{ $fromAI(\"message\",\"Populate this with a relevant message to this subagent\")}}",
"sessionId": "={{ $json.sessionId }}"
},
"schema": [
{
"id": "message",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "message",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "sessionId",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "sessionId",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.1
},
{
"id": "2109ef95-4256-4713-aa9d-8a8ecd40eff3",
"name": "添加会话 ID",
"type": "n8n-nodes-base.set",
"position": [
260,
-100
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c9d7a6f2-7e01-46fb-a4ee-f0c3b248bd6b",
"name": "sessionId",
"type": "string",
"value": "={{ $('Telegram Trigger').item.json.message.chat.id }}"
},
{
"id": "d5929b35-1751-4a6a-bbee-d844cbb8e0aa",
"name": "DateandTime",
"type": "string",
"value": "={{ $json.currentDate }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "0f45fae9-fef5-4595-97f0-04f974790cd3",
"name": "拆分超过 4000 字符的消息",
"type": "n8n-nodes-base.code",
"position": [
1020,
-100
],
"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": "8e7dcfd4-7f2a-47b4-8e5a-1bc4d77fced7",
"name": "日期与时间",
"type": "n8n-nodes-base.dateTime",
"position": [
-20,
-100
],
"parameters": {
"options": {}
},
"typeVersion": 2
},
{
"id": "f31dbe9c-25a2-4751-ba34-38ed0ae9e18c",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
420,
260
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "97dfa658-3a67-4ed7-9662-b62573e0958b",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
-340
],
"parameters": {
"color": 4,
"height": 420,
"content": "## 触发传入的 Telegram 命令"
},
"typeVersion": 1
},
{
"id": "b7d99e5f-0f36-4963-aa2c-33db04689fc5",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-380,
-340
],
"parameters": {
"color": 2,
"width": 260,
"height": 420,
"content": "## 验证用户访问权限"
},
"typeVersion": 1
},
{
"id": "9a4d6ba0-2d75-4453-8b05-bc4dedf81be5",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-80,
-340
],
"parameters": {
"color": 5,
"height": 420,
"content": "## 捕获时间戳"
},
"typeVersion": 1
},
{
"id": "157ba065-d228-41f0-a88f-ea8122fb5fa8",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
200,
-340
],
"parameters": {
"height": 420,
"content": "## 生成会话元数据"
},
"typeVersion": 1
},
{
"id": "6fe0bc11-94da-4c82-bf28-5fe6429d6e86",
"name": "便签说明4",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
-340
],
"parameters": {
"color": 7,
"width": 340,
"height": 420,
"content": "## 主 AI Agent:交易报告生成器"
},
"typeVersion": 1
},
{
"id": "7a1e3a33-713a-4a72-81c0-001e74af8f73",
"name": "便签说明5",
"type": "n8n-nodes-base.stickyNote",
"position": [
940,
-340
],
"parameters": {
"color": 5,
"width": 260,
"height": 420,
"content": "## 处理 Telegram 消息限制"
},
"typeVersion": 1
},
{
"id": "b5ac3bcb-baa5-4d39-9e44-6be888317089",
"name": "便签 6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1300,
-340
],
"parameters": {
"color": 4,
"width": 260,
"height": 420,
"content": "## 发送最终报告到 Telegram"
},
"typeVersion": 1
},
{
"id": "5df88223-3acc-4b27-b592-58d499a638dd",
"name": "便签 7",
"type": "n8n-nodes-base.stickyNote",
"position": [
60,
220
],
"parameters": {
"color": 2,
"height": 400,
"content": ""
},
"typeVersion": 1
},
{
"id": "c7bcc5bc-48b9-464b-9a6b-062535810543",
"name": "## 为什么选择 4o 模型?👆",
"type": "n8n-nodes-base.stickyNote",
"position": [
340,
220
],
"parameters": {
"color": 3,
"height": 400,
"content": ""
},
"typeVersion": 1
},
{
"id": "b17ec86d-5d91-469f-bc9d-fb5e22ecbfaf",
"name": "便签 9",
"type": "n8n-nodes-base.stickyNote",
"position": [
620,
220
],
"parameters": {
"color": 6,
"height": 400,
"content": ""
},
"typeVersion": 1
},
{
"id": "1eda1d9b-2b50-4cd1-8b83-6a7d37517d31",
"name": "便签10",
"type": "n8n-nodes-base.stickyNote",
"position": [
900,
220
],
"parameters": {
"color": 6,
"height": 400,
"content": ""
},
"typeVersion": 1
},
{
"id": "8e2ebe09-5488-4fb9-8175-b88ba68fcb9e",
"name": "便签11",
"type": "n8n-nodes-base.stickyNote",
"position": [
1900,
-1680
],
"parameters": {
"width": 1280,
"height": 2300,
"content": ""
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "b77078ba-b904-4315-aa13-f80fded7f9a9",
"connections": {
"Telegram": {
"main": [
[]
]
},
"Date & Time": {
"main": [
[
{
"node": "Add SessionId",
"type": "main",
"index": 0
}
]
]
},
"Add SessionId": {
"main": [
[
{
"node": "Tesla Quant Trading AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "Tesla Quant Trading AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "User Authentication (Replace Telegram ID)",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Tesla Quant Trading AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Tesla Quant Trading AI Agent": {
"main": [
[
{
"node": "Splits message is more than 4000 characters",
"type": "main",
"index": 0
}
]
]
},
"Tesla News and Sentiment Analyst Tool": {
"ai_tool": [
[
{
"node": "Tesla Quant Trading AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Tesla Financial Market Data Analyst Tool": {
"ai_tool": [
[
{
"node": "Tesla Quant Trading AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"User Authentication (Replace Telegram ID)": {
"main": [
[
{
"node": "Date & Time",
"type": "main",
"index": 0
}
]
]
},
"Splits message is more than 4000 characters": {
"main": [
[
{
"node": "Telegram",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 财务, 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
币安现货市场量化AI智能体
币安现货市场量化AI智能体 | GPT-4o + Telegram (主界面)
Set
Code
Telegram
+7
21 节点Don Jayamaha Jr
财务
CoinMarketCap_AI_数据分析师_代理
使用AI驱动的CoinMarketCap数据分析师分析加密货币市场
Set
Telegram
Agent
+5
12 节点Don Jayamaha Jr
财务
加密货币新闻与情绪分析
通过Telegram使用GPT-4o进行实时加密货币新闻与情绪分析
Set
Code
Merge
+7
30 节点Don Jayamaha Jr
财务
终极游戏AI代理
通过Telegram和GPT-4o Vision的实时游戏策略教练
Set
Code
Switch
+8
24 节点Don Jayamaha Jr
其他
股市技术分析
使用 GPT-4o 和 TradingView 为 Telegram 提供股市技术分析
Set
Code
Telegram
+9
16 节点Badr
财务
AAVE投资组合专业AI助手
Telegram + 邮件 + GPT-4o + Moralis
Set
Code
Gmail
+7
23 节点Don Jayamaha Jr
财务
工作流信息
难度等级
高级
节点数量23
分类2
节点类型10
作者
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.
外部链接
在 n8n.io 查看 →
分享此工作流