📈 每日Nifty波段交易信号机器人
中级
这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 11 个节点。主要使用 Code, Telegram, HttpRequest, GoogleSheets, ScheduleTrigger 等节点。 使用GPT-4、Yahoo Finance、Google Sheets和Telegram生成每日波段交易建议
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "qn0IYQwkkqWmmzQB",
"meta": {
"instanceId": "4864679018d565a892ca43ce23dcbf870b964133cd1081846447be064da60377",
"templateCredsSetupCompleted": true
},
"name": "📈 每日Nifty波段交易信号机器人",
"tags": [],
"nodes": [
{
"id": "57793e93-5594-4171-9620-3fc21ec3c89b",
"name": "通过 Rapid API 获取报价",
"type": "n8n-nodes-base.httpRequest",
"position": [
0,
-64
],
"parameters": {
"url": "=https://apidojo-yahoo-finance-v1.p.rapidapi.com/market/v2/get-quotes?region=IN&symbols={{$json[\"ticker\"]}}\n",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"value": "={ \"symbols\": [{{$json[\"ticker\"]}}], \"proxyConfig\": { \"useApifyProxy\": true } }"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "x-rapidapi-host",
"value": "apidojo-yahoo-finance-v1.p.rapidapi.com"
},
{
"name": "x-rapidapi-key\t",
"value": "<Your API key>"
},
{
"name": "Accept",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "9250c09c-d2a0-4329-99e3-9b8af37ead97",
"name": "拆分交易建议",
"type": "n8n-nodes-base.code",
"position": [
1248,
-64
],
"parameters": {
"jsCode": "const messages = $json.message.content;\n\nlet parsed;\ntry {\n parsed = JSON.parse(messages.match(/```json([\\s\\S]*?)```/)[1].trim());\n} catch (e) {\n throw new Error(\"Failed to parse OpenAI JSON output. Make sure it is enclosed in ```json ... ```.\");\n}\n\nreturn parsed.map(item => ({ json: item }));\n"
},
"typeVersion": 2
},
{
"id": "7d71fd77-1fc1-4805-9763-1d9e275c2932",
"name": "生成波段交易策略 (OpenAI)",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
880,
-64
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "chatgpt-4o-latest",
"cachedResultName": "CHATGPT-4O-LATEST"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "You are a trading assistant for Indian equities. Only use the data provided to generate potential profitable swing trade setups. Do not assume or invent any details."
},
{
"content": "={{$json.prompt}}"
}
]
}
},
"credentials": {
"openAiApi": {
"id": "oCR84cjCbtgnT95o",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "8027fc86-2d78-4729-b474-6557f474b049",
"name": "记录交易到 Google Sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
1728,
-144
],
"parameters": {
"columns": {
"value": {
"Date": "={{ new Date().toLocaleString(\"en-IN\", { timeZone: \"Asia/Kolkata\" }) }}\n",
"Entry": "={{$json.entry}}\n",
"Reason": "={{$json.reason}}\n",
"Status": "=Open\n",
"Symbol": "={{$json.symbol}}\n",
"Target": "={{$json.target}}\n",
"Direction": "={{$json.direction}}",
"Stop Loss": "={{$json.stopLoss}}\n",
"Time Frame": "={{$json.timeFrame}}\n"
},
"schema": [
{
"id": "Date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Symbol",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Symbol",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Direction",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Direction",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Entry",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Entry",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Target",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Target",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Stop Loss",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Stop Loss",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Time Frame",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Time Frame",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Reason",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Reason",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Status",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "pnl",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "pnl",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "currentPrice",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "currentPrice",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "lastChecked",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "lastChecked",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "rowIndex",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "rowIndex",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "pnlColor",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "pnlColor",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "Your google sheet",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1HwZFAfdrRzqDiWcf7eIZFORhFlzr2GxJEVhvs3vnuBI",
"cachedResultUrl": "Your Google Sheet",
"cachedResultName": "Trade_Recommendations_Tracker"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "jTKaRO5NHI7rEcE5",
"name": "Google Sheets account 2"
}
},
"typeVersion": 4.5
},
{
"id": "0b1b7435-f0d0-4da5-a89c-ee3642d36ad4",
"name": "发送交易提醒到 Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
1568,
48
],
"webhookId": "dc775cd6-9ef3-4dc8-adef-279e775476a1",
"parameters": {
"text": "=📊 *{{$json.symbol}}* | {{$json.direction}}\n💸 Entry: ₹{{$json.entry}} | 🎯 Target: ₹{{$json.target}} | 🛑 SL: ₹{{$json.stopLoss}}\n⏳ {{$json.timeFrame}}\n🧠 {{$json.reason}}\n",
"chatId": "Your chat Id",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "wV6tzce5D5KiEq7B",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "9f48a5f8-fa17-4c76-9bfd-56160b055d0a",
"name": "✅ 触发器 - 每日收盘时触发",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-448,
-64
],
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"triggerAtDay": [
1,
2,
3,
4,
5,
6,
0
],
"triggerAtHour": 16,
"triggerAtMinute": 5
}
]
}
},
"typeVersion": 1.2
},
{
"id": "0cdcc80a-5ae4-45e3-94a0-368af8cb57dd",
"name": "🔢 准备股票列表 (NSE 100)",
"type": "n8n-nodes-base.code",
"position": [
-224,
-64
],
"parameters": {
"jsCode": "const tickers = [\n \"TCS.NS\", \"RELIANCE.NS\", \"INFY.NS\", \"HDFCBANK.NS\"\n // (Add more if needed up to 100)\n];\n\nreturn tickers.map(ticker => ({\n json: { ticker }\n}));\n"
},
"typeVersion": 2
},
{
"id": "b7452ca2-852c-446c-addb-31978642f6dc",
"name": "🧮 格式化EOD数据",
"type": "n8n-nodes-base.code",
"position": [
224,
-64
],
"parameters": {
"jsCode": "const output = [];\n\nfor (const item of items) {\n const result = item.json.quoteResponse?.result?.[0];\n if (!result) continue;\n\n output.push({\n symbol: result.symbol,\n name: result.shortName || result.longName || result.symbol,\n price: result.regularMarketPrice,\n open: result.regularMarketOpen,\n high: result.regularMarketDayHigh,\n low: result.regularMarketDayLow,\n prevClose: result.regularMarketPreviousClose,\n volume: result.regularMarketVolume,\n pe: result.trailingPE,\n fiftyDayAvg: result.fiftyDayAverage,\n twoHundredDayAvg: result.twoHundredDayAverage\n });\n}\n\n// ✅ This is the correct return format (not wrapped in [])\nreturn {\n json: {\n stocks: output.slice(0, 40) // or however many you want\n }\n};\n"
},
"typeVersion": 2
},
{
"id": "2c04ccba-c395-478c-adef-27efc4bbfb14",
"name": "📊 筛选有效股票数据",
"type": "n8n-nodes-base.code",
"position": [
448,
-64
],
"parameters": {
"jsCode": "// Extract and flatten stocks array if wrapped in an outer object\nconst input = $json;\nlet stocks = [];\n\nif (Array.isArray(input) && input[0].stocks) {\n stocks = input[0].stocks;\n} else if (input.stocks) {\n stocks = input.stocks;\n} else {\n throw new Error(\"No valid 'stocks' array found in input.\");\n}\n\nreturn [\n {\n json: {\n stocks,\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "aeeba8d3-c27b-44ff-ad43-f9adb92d6aa4",
"name": "🗃️ 构建LLM提示输入",
"type": "n8n-nodes-base.code",
"position": [
672,
-64
],
"parameters": {
"jsCode": "const stocks = $json.stocks;\n\nlet formattedStocks = stocks.map(stock => {\n return `Symbol: ${stock.symbol}\nPrice: ₹${stock.price}\nOpen: ₹${stock.open}\nHigh: ₹${stock.high}\nLow: ₹${stock.low}\nPrev Close: ₹${stock.prevClose}\nVolume: ${stock.volume}\nPE Ratio: ${stock.pe}\n50DMA: ₹${stock.fiftyDayAvg}\n200DMA: ₹${stock.twoHundredDayAvg}`;\n}).join(\"\\n\\n\");\n\nreturn [\n {\n json: {\n prompt: `You are a technical analyst. Based only on the EOD data provided below, identify the top 3 swing trades from this list. Return the answer in JSON format with: symbol, direction (Buy/Sell), entry, target, stopLoss, timeFrame, and reason.\\n\\n${formattedStocks}`\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "31271c84-cb7e-49d5-ab71-73b2ddf6ef59",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
160
],
"parameters": {
"width": 1000,
"height": 280,
"content": "│ 📛 节点名称 │ 🎯 功能描述 │"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "cd6dec2a-1cee-4745-903c-0db62aef1447",
"connections": {
"🧮 Format EOD Data\t": {
"main": [
[
{
"node": "📊 Filter Valid Stock Data\t",
"type": "main",
"index": 0
}
]
]
},
"Fetch Quote via Rapid API": {
"main": [
[
{
"node": "🧮 Format EOD Data\t",
"type": "main",
"index": 0
}
]
]
},
"Split Trade Recommendations": {
"main": [
[
{
"node": "Send Trade Alert to Telegram",
"type": "main",
"index": 0
},
{
"node": "Log Trade to Google Sheet",
"type": "main",
"index": 0
}
]
]
},
"Send Trade Alert to Telegram": {
"main": [
[]
]
},
"📊 Filter Valid Stock Data\t": {
"main": [
[
{
"node": "🗃️ Build LLM Prompt Input\t",
"type": "main",
"index": 0
}
]
]
},
"🗃️ Build LLM Prompt Input\t": {
"main": [
[
{
"node": "Generate Swing Trade Ideas (OpenAI)",
"type": "main",
"index": 0
}
]
]
},
"✅ Trigger - Daily Market Close\t": {
"main": [
[
{
"node": "🔢 Prepare Stock List (NSE 100)\t",
"type": "main",
"index": 0
}
]
]
},
"🔢 Prepare Stock List (NSE 100)\t": {
"main": [
[
{
"node": "Fetch Quote via Rapid API",
"type": "main",
"index": 0
}
]
]
},
"Generate Swing Trade Ideas (OpenAI)": {
"main": [
[
{
"node": "Split Trade Recommendations",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - AI 摘要总结, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
带有 Chatgpt Agent Prompt 检查的信用卡
AI驱动信用卡推荐系统,集成OpenAI GPT、Telegram和Google Sheets
If
Set
Code
+7
31 节点Nishant
AI 聊天机器人
新闻自动收集器 → Google表格
使用NewsAPI、OpenAI和Google表格收集并总结多语言新闻
If
Set
Code
+6
19 节点Supira Inc.
AI 摘要总结
每日 WhatsApp 群组智能分析:GPT-4.1 分析与语音消息转录
每日 WhatsApp 群组智能分析:GPT-4.1 分析与语音消息转录
If
Set
Code
+20
52 节点Daniel Lianes
杂项
LinkedIn帖子生成器
LinkedIn内容工厂:使用GPT-5、DALL·E和Google Sheets自动生成帖子
Code
Merge
Google Drive
+4
39 节点Nishant
内容创作
使用GPT-4o分析和Google Sheets监控Reddit招聘帖子并发送Telegram警报
使用GPT-4o分析和Google Sheets监控Reddit招聘帖子并发送Telegram警报
If
Set
Code
+10
28 节点Meelioo
AI 摘要总结
使用Gemini AI、ElevenLabs和Telegram警报的支持呼叫分析与路由
使用Gemini AI、ElevenLabs和Telegram警报的支持呼叫分析与路由
Code
Switch
Telegram
+8
16 节点Atta
AI 摘要总结