8
n8n 中文网amn8n.com

股票

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 8 个节点。主要使用 Code, GoogleSheets, ScheduleTrigger, ScrapegraphAi 等节点。 使用ScrapeGraphAI、Yahoo Finance和Google Sheets跟踪股价

前置要求
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "lWag7Am9yiDM5TBX",
  "meta": {
    "instanceId": "521567c5f495f323b77849c4cfd0c9f4f2396c986e324e0e66c8425b6f124744",
    "templateCredsSetupCompleted": true
  },
  "name": "股票",
  "tags": [],
  "nodes": [
    {
      "id": "2c187503-6fb2-4b8b-92fe-f8e997fd5559",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        700,
        820
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ce790220-6486-4528-a831-73443107a7a3",
      "name": "Yahoo Finance 股票数据抓取器",
      "type": "n8n-nodes-scrapegraphai.scrapegraphAi",
      "position": [
        1380,
        820
      ],
      "parameters": {
        "userPrompt": "Extract stock information from this site. Use the following schema for response { \"symbol\": \"AAPL\", \"current_price\": \"225.50\", \"change\": \"+2.15\", \"change_percent\": \"+0.96%\", \"volume\": \"45,234,567\", \"market_cap\": \"3.45T\" }",
        "websiteUrl": "https://finance.yahoo.com/quote/AAPL/?guccounter=1&guce_referrer=aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS8&guce_referrer_sig=AQAAADlzEES8CFmJu3LRxJ6p_ijSmVjZEqDA4mfHDia0ZnrdOQqWXJUq9HOUOdpdYRtmkBJNKkXaTV-UDVrDBsX3dbuzVHZ8QjT3-SNtJoccm85QZnKr9glOhEnn2RhgyDej8HZIGoeIQlJa2kjZrLwsU8zPw80Mtfgor3i9_6BrlQqg"
      },
      "credentials": {
        "scrapegraphAIApi": {
          "id": "",
          "name": ""
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ae4d95c5-f352-415c-a65e-01dcd4290c61",
      "name": "Google Sheets 股票记录器",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2980,
        820
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "symbol",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "symbol",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current_price",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current_price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "change",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "change",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "change_percent",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "change_percent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "volume",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "volume",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "market_cap",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "market_cap",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": []
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": ""
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "223ba5e6-4bff-4a36-ba66-491002cacdbc",
      "name": "股票数据格式化器",
      "type": "n8n-nodes-base.code",
      "notes": "Hey this is where \nyou \nformat results ",
      "position": [
        2140,
        820
      ],
      "parameters": {
        "jsCode": "// Get the input data\nconst inputData = $input.all()[0].json;\n\n// Check if it's a single stock or multiple stocks\nif (inputData.result && inputData.result.stocks) {\n  // Multiple stocks format\n  const stocks = inputData.result.stocks;\n  return stocks.map(stock => ({\n    json: {\n      symbol: stock.symbol,\n      current_price: stock.current_price,\n      change: stock.change,\n      change_percent: stock.change_percent,\n      volume: stock.volume,\n      market_cap: stock.market_cap\n    }\n  }));\n} else if (inputData.result) {\n  // Single stock format - return as single item\n  return [{\n    json: {\n      symbol: inputData.result.symbol,\n      current_price: inputData.result.current_price,\n      change: inputData.result.change,\n      change_percent: inputData.result.change_percent,\n      volume: inputData.result.volume,\n      market_cap: inputData.result.market_cap\n    }\n  }];\n}"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "575fba6b-dcc4-47df-8a4c-ab75d7a6a6ee",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1180,
        460
      ],
      "parameters": {
        "color": 5,
        "width": 574.9363634768473,
        "height": 530.4701664623029,
        "content": "# 步骤 2:ScrapeGraphAI 节点 🤖"
      },
      "typeVersion": 1
    },
    {
      "id": "d8a8b5f8-653f-4a84-8953-de8ff9e37aa1",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        460
      ],
      "parameters": {
        "color": 5,
        "width": 574.9363634768473,
        "height": 530.4701664623029,
        "content": "# 步骤 3:格式化响应 🧱"
      },
      "typeVersion": 1
    },
    {
      "id": "2e906fc8-8057-4cf2-8537-0d1f563a145c",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        460
      ],
      "parameters": {
        "color": 5,
        "width": 574.9363634768473,
        "height": 530.4701664623029,
        "content": "# 步骤 1:触发器 ⏱️"
      },
      "typeVersion": 1
    },
    {
      "id": "6a84d8fc-74a5-43a0-ad28-ef1690236e0e",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2680,
        460
      ],
      "parameters": {
        "color": 5,
        "width": 574.9363634768473,
        "height": 530.4701664623029,
        "content": "# 步骤 4:Google Sheets 📊"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6dee100e-de50-4d89-b5b1-6263ec38366f",
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ScrapegraphAI": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "ScrapegraphAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量8
分类2
节点类型5
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流