Automatisierter Tagesbericht über die Kursveränderungen der Top-100-Aktien

Fortgeschritten

Dies ist ein Crypto Trading, Multimodal AI-Bereich Automatisierungsworkflow mit 13 Nodes. Hauptsächlich werden Set, Code, Cron, WhatsApp, EmailSend und andere Nodes verwendet. Täglicher Aktienmarktbericht mit Twelve Data API, gesendet über WhatsApp und E-Mail

Voraussetzungen
  • Möglicherweise sind Ziel-API-Anmeldedaten erforderlich
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "id": "z8p6r4MRvb3YWvpa",
  "meta": {
    "instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
    "templateCredsSetupCompleted": true
  },
  "name": "Automated Daily Report of Top 100 Stock Price Changes",
  "tags": [],
  "nodes": [
    {
      "id": "e84b9576-6c4a-424c-9f64-0ce3cdca5909",
      "name": "Täglicher Marktschluss-Trigger",
      "type": "n8n-nodes-base.cron",
      "position": [
        -624,
        -32
      ],
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "hour": 17
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d4544920-d3b4-4928-88c9-435fd82e7cbe",
      "name": "Konfigurationsvariablen setzen",
      "type": "n8n-nodes-base.set",
      "position": [
        -400,
        -32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "api-key-assignment",
              "name": "twelvedata_api_key",
              "type": "string",
              "value": "your_api_key_add_here"
            },
            {
              "id": "symbols-assignment",
              "name": "top_symbols",
              "type": "string",
              "value": "AAPL,MSFT,GOOGL,AMZN,TSLA"
            },
            {
              "id": "whatsapp-number",
              "name": "whatsapp_number",
              "type": "string",
              "value": "+919999992211"
            },
            {
              "id": "email-recipient",
              "name": "email_recipient",
              "type": "string",
              "value": "abc@gmail.com"
            },
            {
              "id": "fd42d040-23dc-456f-89ee-144be97a1e8c",
              "name": "",
              "type": "string",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "30d03cb8-c49a-4eb1-8e58-5cf8434c313b",
      "name": "Aktiendaten von Twelve Data abrufen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -176,
        -32
      ],
      "parameters": {
        "url": "=https://api.twelvedata.com/quote?symbol={{ $json.top_symbols }}&apikey={{ $json.twelvedata_api_key }}",
        "options": {
          "timeout": 30000
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "interval",
              "value": "1day"
            },
            {
              "name": "outputsize",
              "value": "1"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9ab66310-6532-4267-bf5e-38131317a677",
      "name": "Kursbewegungen verarbeiten",
      "type": "n8n-nodes-base.code",
      "position": [
        48,
        -32
      ],
      "parameters": {
        "jsCode": "const stockData = $input.first().json;\nlet processedStocks = [];\n\n// Check for API error\nif (stockData.error) {\n  throw new Error(`Twelve Data API Error: ${stockData.error.message}`);\n}\n\n// Handle single or multiple stock responses\nlet quotes = [];\nif (Array.isArray(stockData)) {\n  quotes = stockData;\n} else if (stockData.symbol) {\n  quotes = [stockData];\n} else {\n  quotes = Object.values(stockData).filter(item => item.symbol);\n}\n\nfor (let stock of quotes) {\n  if (stock && stock.symbol && stock.percent_change) {\n    const percentChange = parseFloat(stock.percent_change);\n    const price = parseFloat(stock.close || stock.price);\n    const change = parseFloat(stock.change);\n    processedStocks.push({\n      symbol: stock.symbol,\n      name: stock.name || stock.symbol,\n      price: isNaN(price) ? null : price,\n      change: isNaN(change) ? null : change,\n      percent_change: isNaN(percentChange) ? null : percentChange,\n      volume: stock.volume ? parseInt(stock.volume) : null,\n      movement_type: percentChange > 0 ? 'gain' : 'loss',\n      abs_percent_change: Math.abs(percentChange)\n    });\n  }\n}\n\n// Sort by absolute percentage change\nprocessedStocks.sort((a, b) => b.abs_percent_change - a.abs_percent_change);\n\n// Top 5 movers\nconst topMovers = processedStocks.slice(0, 5);\nconst gainers = topMovers.filter(stock => stock.percent_change > 0).slice(0, 3);\nconst losers = topMovers.filter(stock => stock.percent_change < 0).slice(0, 3);\n\nconst currentDate = new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' });\n\nreturn [{ json: { date: currentDate, total_stocks: processedStocks.length, top_gainers: gainers, top_losers: losers, biggest_movers: topMovers } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "940a5f7c-555d-4eab-8bd1-d4a44060d315",
      "name": "WhatsApp-Nachricht formatieren",
      "type": "n8n-nodes-base.code",
      "position": [
        272,
        -112
      ],
      "parameters": {
        "jsCode": "const data = $input.first().json;\nlet message = `📈 *DAILY STOCK MARKET REPORT*\\n`;\nmessage += `📅 Date: ${data.date}\\n`;\nmessage += `📊 Analyzed: ${data.total_stocks} stocks\\n\\n`;\nmessage += `🟢 *TOP GAINERS*\\n━━━━━━━━━━━━━\\n`;\ndata.top_gainers.forEach((stock, index) => {\n  message += `${index + 1}. ${stock.symbol}\\n`;\n  message += `   💰 $${stock.price?.toFixed(2) || 'N/A'}\\n`;\n  message += `   📈 +${stock.percent_change?.toFixed(2) || 'N/A'}% (+$${stock.change?.toFixed(2) || 'N/A'})\\n\\n`;\n});\nmessage += `🔴 *TOP LOSERS*\\n━━━━━━━━━━━━━\\n`;\ndata.top_losers.forEach((stock, index) => {\n  message += `${index + 1}. ${stock.symbol}\\n`;\n  message += `   💰 $${stock.price?.toFixed(2) || 'N/A'}\\n`;\n  message += `   📉 ${stock.percent_change?.toFixed(2) || 'N/A'}% ($${stock.change?.toFixed(2) || 'N/A'})\\n\\n`;\n});\nmessage += `\\n⚡ Generated by Stock Alert Bot`;\nreturn [{ json: { whatsapp_message: message } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "3d3b1981-004c-4ae1-a450-63690b0e9100",
      "name": "E-Mail-Inhalt formatieren",
      "type": "n8n-nodes-base.code",
      "position": [
        272,
        48
      ],
      "parameters": {
        "jsCode": "const data = $input.first().json;\nlet htmlContent = `<!DOCTYPE html><html><head><style>body { font-family: Arial, sans-serif; margin: 20px; background-color: #f5f5f5; }.container { max-width: 600px; margin: 0 auto; background: white; padding: 20px; border-radius: 10px; }.header { text-align: center; border-bottom: 2px solid #007bff; padding-bottom: 10px; }.section { margin-bottom: 20px; }.stock-table { width: 100%; border-collapse: collapse; }.stock-table th, .stock-table td { padding: 10px; text-align: left; border-bottom: 1px solid #ddd; }.stock-table th { background-color: #f8f9fa; }.gain { color: #28a745; }.loss { color: #dc3545; }.symbol { font-weight: bold; color: #007bff; }</style></head><body><div class=\"container\"><div class=\"header\"><h2>📈 Daily Stock Market Report</h2><p><strong>Date:</strong> ${data.date}</p></div><div class=\"section\"><h3 style=\"color: #28a745;\">🟢 Top Gainers</h3><table class=\"stock-table\"><thead><tr><th>Symbol</th><th>Price</th><th>Change</th><th>% Change</th></tr></thead><tbody>`;\ndata.top_gainers.forEach((stock) => {\n  htmlContent += `<tr><td class=\"symbol\">${stock.symbol}</td><td>$${stock.price?.toFixed(2) || 'N/A'}</td><td class=\"gain\">+$${stock.change?.toFixed(2) || 'N/A'}</td><td class=\"gain\">+${stock.percent_change?.toFixed(2) || 'N/A'}%</td></tr>`;\n});\nhtmlContent += `</tbody></table></div><div class=\"section\"><h3 style=\"color: #dc3545;\">🔴 Top Losers</h3><table class=\"stock-table\"><thead><tr><th>Symbol</th><th>Price</th><th>Change</th><th>% Change</th></tr></thead><tbody>`;\ndata.top_losers.forEach((stock) => {\n  htmlContent += `<tr><td class=\"symbol\">${stock.symbol}</td><td>$${stock.price?.toFixed(2) || 'N/A'}</td><td class=\"loss\">$${stock.change?.toFixed(2) || 'N/A'}</td><td class=\"loss\">${stock.percent_change?.toFixed(2) || 'N/A'}%</td></tr>`;\n});\nhtmlContent += `</tbody></table></div><div style=\"text-align: center; margin-top: 20px; color: #666;\"><p>⚡ Generated by Stock Alert System</p></div></body></html>`;\nconst plainText = `DAILY STOCK MARKET REPORT\\nDate: ${data.date}\\nStocks Analyzed: ${data.total_stocks}\\n\\nTOP GAINERS:\\n${data.top_gainers.map((stock, i) => `${i+1}. ${stock.symbol}: $${stock.price?.toFixed(2) || 'N/A'} (+${stock.percent_change?.toFixed(2) || 'N/A'}%)`).join('\\n')}\\n\\nTOP LOSERS:\\n${data.top_losers.map((stock, i) => `${i+1}. ${stock.symbol}: $${stock.price?.toFixed(2) || 'N/A'} (${stock.percent_change?.toFixed(2) || 'N/A'}%)`).join('\\n')}\\n\\nGenerated by Stock Alert System`;\nreturn [{ json: { email_html: htmlContent, email_text: plainText, email_subject: `Daily Stock Report - ${data.date}` } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "d703c8f4-20c5-4960-8b11-59dd20d8952a",
      "name": "E-Mail-Benachrichtigung senden",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        496,
        48
      ],
      "webhookId": "c8c21150-59d1-4fa9-841c-eb46cd4409cc",
      "parameters": {
        "html": "={{ $json.email_html }}",
        "options": {},
        "subject": "={{ $json.email_subject }}",
        "toEmail": "={{ $('Set Configuration Variables\t').item.json.email_recipient }}",
        "fromEmail": "alert@gmail.com",
        "emailFormat": "html"
      },
      "credentials": {
        "smtp": {
          "id": "G1kyF8cSWTZ4vouN",
          "name": "SMTP -test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "a6436b0d-b49e-4186-b9d7-e80177665e8f",
      "name": "Notizzettel",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -176
      ],
      "parameters": {
        "width": 160,
        "height": 300,
        "content": "Triggers daily at 5:00 PM (after market close) Monday-Friday.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1b1643d8-294d-457f-9164-9a0990ecef94",
      "name": "Notizzettel 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        -176
      ],
      "parameters": {
        "color": 4,
        "width": 170,
        "height": 300,
        "content": "Sets API key, stock symbols, and alert recipients.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e1cafd10-344b-4d39-91d6-04588d7e6d67",
      "name": "Notizzettel 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -176
      ],
      "parameters": {
        "color": 3,
        "width": 170,
        "height": 300,
        "content": "Fetches stock data for selected symbols via Twelve Data API.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4dcb1252-bcc4-4b6d-8a05-b5d8600bce13",
      "name": "Notizzettel 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -176
      ],
      "parameters": {
        "color": 5,
        "width": 170,
        "height": 300,
        "content": "Processes stock data to identify top gainers and losers.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "444844c9-b1c2-40b6-907e-0b93e08aea6c",
      "name": "Notizzettel 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -208
      ],
      "parameters": {
        "color": 6,
        "width": 170,
        "height": 332,
        "content": "Sends formatted alerts via WhatsApp and Email.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "26752e0e-0ab8-4f67-858b-c0d954891d9b",
      "name": "Nachricht senden",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        480,
        -112
      ],
      "webhookId": "51455c3e-b9ee-4048-88c6-bfb2631aa10c",
      "parameters": {
        "textBody": "={{ $json.whatsapp_message }}",
        "operation": "send",
        "phoneNumberId": "=+919877663344",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('Set Configuration Variables\t').item.json.whatsapp_number }}"
      },
      "credentials": {
        "whatsAppApi": {
          "id": "b0PxTDPdWzznWnfG",
          "name": "WhatsApp-test "
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e99f69ff-d8ff-4f02-980c-5c27a29d37cb",
  "connections": {
    "3d3b1981-004c-4ae1-a450-63690b0e9100": {
      "main": [
        [
          {
            "node": "d703c8f4-20c5-4960-8b11-59dd20d8952a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "940a5f7c-555d-4eab-8bd1-d4a44060d315": {
      "main": [
        [
          {
            "node": "26752e0e-0ab8-4f67-858b-c0d954891d9b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9ab66310-6532-4267-bf5e-38131317a677": {
      "main": [
        [
          {
            "node": "940a5f7c-555d-4eab-8bd1-d4a44060d315",
            "type": "main",
            "index": 0
          },
          {
            "node": "3d3b1981-004c-4ae1-a450-63690b0e9100",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e84b9576-6c4a-424c-9f64-0ce3cdca5909": {
      "main": [
        [
          {
            "node": "d4544920-d3b4-4928-88c9-435fd82e7cbe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d4544920-d3b4-4928-88c9-435fd82e7cbe": {
      "main": [
        [
          {
            "node": "30d03cb8-c49a-4eb1-8e58-5cf8434c313b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "30d03cb8-c49a-4eb1-8e58-5cf8434c313b": {
      "main": [
        [
          {
            "node": "9ab66310-6532-4267-bf5e-38131317a677",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

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?

Fortgeschritten - Krypto-Handel, 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.

Workflow-Informationen
Schwierigkeitsgrad
Fortgeschritten
Anzahl der Nodes13
Kategorie2
Node-Typen7
Schwierigkeitsbeschreibung

Für erfahrene Benutzer, mittelkomplexe Workflows mit 6-15 Nodes

Autor
Oneclick AI Squad

Oneclick AI Squad

@oneclick-ai

The AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34