๐ ๋งค์ผ 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
์ฌ์ฉ๋ ๋ ธ๋ (11)
์นดํ ๊ณ ๋ฆฌ
{
"id": "qn0IYQwkkqWmmzQB",
"meta": {
"instanceId": "4864679018d565a892ca43ce23dcbf870b964133cd1081846447be064da60377",
"templateCredsSetupCompleted": true
},
"name": "๐ Daily Nifty Swing Trade Signal Bot",
"tags": [],
"nodes": [
{
"id": "57793e93-5594-4171-9620-3fc21ec3c89b",
"name": "Fetch Quote via 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": "Split Trade Recommendations",
"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": "Generate Swing Trade Ideas (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": "Log Trade to 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": "Send Trade Alert to 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": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
160
],
"parameters": {
"width": 1000,
"height": 280,
"content": "โ ๐ Node Name โ ๐ฏ Purpose โ\nโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค\nโ โฐ Trigger - Daily Market Close โ Triggers the workflow post EOD (e.g., 4:15 PM IST) โ\nโ ๐ฆ Prepare Stock List (NSE 100) โ Generates the list of NSE 100 stock symbols to analyze โ\nโ ๐ Fetch EOD Data (RapidAPI) โ Fetches end-of-day stock data from RapidAPI โ\nโ ๐ ๏ธ Format EOD Data โ Extracts and formats the quote data from API response โ\nโ ๐งน Filter Valid Stock Data โ Filters/cleans/slices usable stock entries โ\nโ ๐งพ Build LLM Prompt Input โ Converts JSON stock data to string for OpenAI prompt โ\nโ ๐ค Generate Swing Trade Ideas (OpenAI) โ Uses OpenAI to generate top swing trade ideas based on input data โ\nโ ๐ด Split JSON Output (Trade-wise) โ Splits the LLM output into individual trade objects โ\nโ ๐ Save Trade to Google Sheet โ Appends each trade recommendation to Google Sheet tracker โ\nโ ๐ฒ Send Telegram Trade Alert โ Sends trade alerts to Telegram user in real-time "
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "cd6dec2a-1cee-4745-903c-0db62aef1447",
"connections": {
"b7452ca2-852c-446c-addb-31978642f6dc": {
"main": [
[
{
"node": "2c04ccba-c395-478c-adef-27efc4bbfb14",
"type": "main",
"index": 0
}
]
]
},
"57793e93-5594-4171-9620-3fc21ec3c89b": {
"main": [
[
{
"node": "b7452ca2-852c-446c-addb-31978642f6dc",
"type": "main",
"index": 0
}
]
]
},
"9250c09c-d2a0-4329-99e3-9b8af37ead97": {
"main": [
[
{
"node": "0b1b7435-f0d0-4da5-a89c-ee3642d36ad4",
"type": "main",
"index": 0
},
{
"node": "8027fc86-2d78-4729-b474-6557f474b049",
"type": "main",
"index": 0
}
]
]
},
"0b1b7435-f0d0-4da5-a89c-ee3642d36ad4": {
"main": [
[]
]
},
"2c04ccba-c395-478c-adef-27efc4bbfb14": {
"main": [
[
{
"node": "aeeba8d3-c27b-44ff-ad43-f9adb92d6aa4",
"type": "main",
"index": 0
}
]
]
},
"aeeba8d3-c27b-44ff-ad43-f9adb92d6aa4": {
"main": [
[
{
"node": "7d71fd77-1fc1-4805-9763-1d9e275c2932",
"type": "main",
"index": 0
}
]
]
},
"9f48a5f8-fa17-4c76-9bfd-56160b055d0a": {
"main": [
[
{
"node": "0cdcc80a-5ae4-45e3-94a0-368af8cb57dd",
"type": "main",
"index": 0
}
]
]
},
"0cdcc80a-5ae4-45e3-94a0-368af8cb57dd": {
"main": [
[
{
"node": "57793e93-5594-4171-9620-3fc21ec3c89b",
"type": "main",
"index": 0
}
]
]
},
"7d71fd77-1fc1-4805-9763-1d9e275c2932": {
"main": [
[
{
"node": "9250c09c-d2a0-4329-99e3-9b8af37ead97",
"type": "main",
"index": 0
}
]
]
}
}
}์ด ์ํฌํ๋ก์ฐ๋ฅผ ์ด๋ป๊ฒ ์ฌ์ฉํ๋์?
์์ JSON ๊ตฌ์ฑ ์ฝ๋๋ฅผ ๋ณต์ฌํ์ฌ n8n ์ธ์คํด์ค์์ ์ ์ํฌํ๋ก์ฐ๋ฅผ ์์ฑํ๊ณ "JSON์์ ๊ฐ์ ธ์ค๊ธฐ"๋ฅผ ์ ํํ ํ, ๊ตฌ์ฑ์ ๋ถ์ฌ๋ฃ๊ณ ํ์์ ๋ฐ๋ผ ์ธ์ฆ ์ค์ ์ ์์ ํ์ธ์.
์ด ์ํฌํ๋ก์ฐ๋ ์ด๋ค ์๋๋ฆฌ์ค์ ์ ํฉํ๊ฐ์?
์ค๊ธ - AI ์์ฝ, ๋ฉํฐ๋ชจ๋ฌ AI
์ ๋ฃ์ธ๊ฐ์?
์ด ์ํฌํ๋ก์ฐ๋ ์์ ํ ๋ฌด๋ฃ์ด๋ฉฐ ์ง์ ๊ฐ์ ธ์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋ค๋ง, ์ํฌํ๋ก์ฐ์์ ์ฌ์ฉํ๋ ํ์ฌ ์๋น์ค(์: OpenAI API)๋ ์ฌ์ฉ์ ์ง์ ๋น์ฉ์ ์ง๋ถํด์ผ ํ ์ ์์ต๋๋ค.
๊ด๋ จ ์ํฌํ๋ก์ฐ ์ถ์ฒ
Nishant
@pandita์ด ์ํฌํ๋ก์ฐ ๊ณต์