{
  "name": "Track weekly portfolio risk using GPT-4.1, Slack alerts, and Google Sheets",
  "nodes": [
    {
      "id": "3046421b-2102-4ed3-80f9-2606215a2eaf",
      "name": "Validate Portfolio Input",
      "type": "n8n-nodes-base.code",
      "position": [
        448,
        0
      ]
    },
    {
      "id": "57a4a2f3-7feb-44f7-928c-05044466668d",
      "name": "Read Portfolio Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        240,
        0
      ]
    },
    {
      "id": "1553ecc1-4878-4f9d-8896-2a84ecab3108",
      "name": "Risk Thresholds and Settings",
      "type": "n8n-nodes-base.set",
      "position": [
        48,
        0
      ]
    },
    {
      "id": "b9f5f207-58c8-4f4a-a7e5-90664fece572",
      "name": "Batch Portfolio Symbols",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        752,
        0
      ]
    },
    {
      "id": "e027c478-cce2-48d0-a469-3d05826fd56a",
      "name": "Fetch Market Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1008,
        240
      ]
    },
    {
      "id": "f88ae8d9-b9cb-46de-889b-3eb778f8fc10",
      "name": "Normalize Alpha Vantage Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1424,
        240
      ]
    },
    {
      "id": "523d5dee-1205-4d2b-9fc6-095949031da5",
      "name": "Portfolio Risk Engine",
      "type": "n8n-nodes-base.code",
      "position": [
        1008,
        -368
      ]
    },
    {
      "id": "6baea2e1-76b3-4847-84ca-5017ae484233",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1456,
        -256
      ]
    },
    {
      "id": "b2f88dd5-43c7-401e-884d-79ae6c6d884c",
      "name": "Build Alert Payload",
      "type": "n8n-nodes-base.set",
      "position": [
        1840,
        -480
      ]
    },
    {
      "id": "e421c4b5-b081-4c61-8e18-0643775a9fdf",
      "name": "Send Notification",
      "type": "n8n-nodes-base.slack",
      "position": [
        2080,
        -608
      ]
    },
    {
      "id": "b878566d-ad96-4d69-9c14-28c89069af55",
      "name": "Rate Limit Buffer (Alpha Vantage)",
      "type": "n8n-nodes-base.wait",
      "position": [
        1200,
        240
      ]
    },
    {
      "id": "5d4fe480-add6-491c-a591-bdcd56182c45",
      "name": "Portfolio Risk Summary",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1488,
        -480
      ]
    },
    {
      "id": "528cf80f-2a37-42b3-818c-26d2542ab6ff",
      "name": "Risk Check",
      "type": "n8n-nodes-base.if",
      "position": [
        1248,
        -464
      ]
    },
    {
      "id": "8ef7a9a4-67db-4e0e-88e1-e7fd5caf90ca",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -832
      ],
      "parameters": {
        "width": 528,
        "height": 832,
        "content": "## Workflow Overview\n\n\n \n### How it works\n\nThis workflow automatically analyzes the risk of a stock portfolio and stores weekly risk insights in Google Sheets.\n\nThe workflow starts with a scheduled tr"
      }
    },
    {
      "id": "087391b0-7371-42a5-898d-aaffb1f5bf78",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -176
      ],
      "parameters": {
        "width": 832,
        "height": 400,
        "content": "### Config and portfolio output\n\nThese nodes control workflow timing, configuration, and input data. Risk thresholds and feature toggles are defined first, then the portfolio is read from Google Sheet"
      }
    },
    {
      "id": "ebfe456b-fafc-4229-af7c-0d8a52ee3cf9",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -48
      ],
      "parameters": {
        "width": 1040,
        "height": 704,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### Market data and rate limiting\n\nThese nodes fetch historical price data from Alpha Vantage. Stocks are processed in batches with a wait step to respect API"
      }
    },
    {
      "id": "8b683e9c-b5db-4252-a53e-d44f050707ae",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        -544
      ],
      "parameters": {
        "width": 368,
        "height": 384,
        "content": "### Risk calculation engine\n \nThis node performs portfolio-level risk analysis.\nIt calculates sector concentration, volatility, and correlation, then produces a single risk result with a risk score an"
      }
    },
    {
      "id": "0498b0c9-8ab8-4eb5-af94-dc0c1d9f0d38",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1216,
        -736
      ],
      "parameters": {
        "width": 1104,
        "height": 640,
        "content": "### Ai summary and storage\n\nThese nodes run only when risk is detected. This section sends a clear weekly risk alert to Slack. An AI summary explains the risks in simple language, and the same summari"
      }
    },
    {
      "id": "30c674c7-7f8b-44cc-938e-64d876b6271f",
      "name": "Store Weekly Risk Snapshot",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2096,
        -336
      ]
    },
    {
      "id": "0585a511-baa8-4297-85a3-561a0e8e97c1",
      "name": "Weekly Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -176,
        0
      ]
    }
  ],
  "connections": {
    "Risk Check": {
      "main": [
        [
          {
            "node": "Portfolio Risk Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Market Data": {
      "main": [
        [
          {
            "node": "Rate Limit Buffer (Alpha Vantage)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Portfolio Risk Summary",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send Notification": {
      "main": [
        []
      ]
    },
    "Build Alert Payload": {
      "main": [
        [
          {
            "node": "Send Notification",
            "type": "main",
            "index": 0
          },
          {
            "node": "Store Weekly Risk Snapshot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Portfolio Sheet": {
      "main": [
        [
          {
            "node": "Validate Portfolio Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Portfolio Risk Engine": {
      "main": [
        [
          {
            "node": "Risk Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Portfolio Risk Summary": {
      "main": [
        [
          {
            "node": "Build Alert Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batch Portfolio Symbols": {
      "main": [
        [
          {
            "node": "Portfolio Risk Engine",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fetch Market Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Schedule Trigger": {
      "main": [
        [
          {
            "node": "Risk Thresholds and Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Portfolio Input": {
      "main": [
        [
          {
            "node": "Batch Portfolio Symbols",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Alpha Vantage Data": {
      "main": [
        [
          {
            "node": "Batch Portfolio Symbols",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Risk Thresholds and Settings": {
      "main": [
        [
          {
            "node": "Read Portfolio Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rate Limit Buffer (Alpha Vantage)": {
      "main": [
        [
          {
            "node": "Normalize Alpha Vantage Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}