{
  "name": "Generate institutional-grade stock price targets and BUY/HOLD/SELL signals with GPT-5, Gemini, Alpha Vantage and Google Sheets",
  "nodes": [
    {
      "id": "392f7ccd-aba3-4911-859a-556535f45eea",
      "name": "loop_over_tickers",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        320,
        1168
      ]
    },
    {
      "id": "6e5b9817-b6ec-4c0a-98fd-b41340ab6230",
      "name": "Read_tickers_from_Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        96,
        1168
      ]
    },
    {
      "id": "0dc93919-fb1a-46df-b316-1044f11cd791",
      "name": "write_sentiment_to_sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        4752,
        1440
      ]
    },
    {
      "id": "3cbf7b55-50ae-4d1c-8f9e-56941441ef00",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -128,
        1168
      ]
    },
    {
      "id": "ce8d9b54-2026-4faa-9ee1-c261170c8426",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        64
      ],
      "parameters": {
        "width": 480,
        "height": 440,
        "content": "# Workflow Overview \n**This workflow automates the process of analyzing the sentiment of stock market news.**\n\n- retrieves a list of stock tickers from a Google Sheet \n- fetchs recent news articles fo"
      }
    },
    {
      "id": "efaee1f9-e57a-4640-a1d6-eb5bc5f341af",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        576
      ],
      "parameters": {
        "width": 880,
        "height": 832,
        "content": "# 1. Daily Trigger and Stock Ticker Retrieval\n- **Schedule Trigger:** This workflow is set to run automatically every three day at 4:00 PM (Asia/Jerusalem time). This ensures that the script runs just"
      }
    },
    {
      "id": "eaca666d-2830-4e98-bfe4-44c15d452939",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        -160
      ],
      "parameters": {
        "width": 2200,
        "height": 1436,
        "content": "# 2. Financial and News Data Retrieval & Validation\n2.1 Financial Data Fetching (Alpha Vantage APIs)\nFetch Financial Data (Alpha Vantage):\nFor each ticker, the workflow sends multiple HTTP requests to"
      }
    },
    {
      "id": "92a8b9e8-cdca-4584-938f-b478b8136867",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2992,
        464
      ],
      "parameters": {
        "width": 836,
        "height": 1536,
        "content": "# 3. Sentiment Analysis with AI\n\n- **AI Agent & Google Gemini Chat Model/ChatGPT:** This is the core of the sentiment analysis. The \"AI Agent\" node is configured with a detailed prompt that instructs "
      }
    },
    {
      "id": "aa4c0dfb-0e02-4f74-b908-27b6b81bbef1",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3856,
        464
      ],
      "parameters": {
        "width": 560,
        "height": 1532,
        "content": "# 4. Output Formatting and Error Handling\n\n- **format_output_as_json:** The output from the AI models is a raw string that includes a JSON object. This code node extracts the clean JSON from the strin"
      }
    },
    {
      "id": "cd441252-7867-40e4-9fb9-aa1e6fd53fb9",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4464,
        464
      ],
      "parameters": {
        "width": 520,
        "height": 1528,
        "content": "# 5. Storing the Results\n\n\n- **write_sentiment_to_sheets:** Once a valid sentiment analysis result is obtained and formatted, this node appends the data to \"Sheet1\" of the \"Stock Sentiment\" Google She"
      }
    },
    {
      "id": "7eaf394e-4043-41ce-a094-b08d28413509",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        4016,
        1200
      ]
    },
    {
      "id": "4b094b92-271b-422c-9d89-b603dd199390",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        3648,
        1104
      ]
    },
    {
      "id": "ea73393c-1449-43ae-8014-0b59f4b60aa1",
      "name": "Message a model",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        3120,
        880
      ]
    },
    {
      "id": "b6d3f2f7-a27a-42cf-8942-5e0cd21386a8",
      "name": "XML",
      "type": "n8n-nodes-base.xml",
      "position": [
        1744,
        1680
      ]
    },
    {
      "id": "3a1f9abb-a8bd-45c6-ae5d-f0f3e86a22cf",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        2816,
        1088
      ]
    },
    {
      "id": "f1c73d00-f4de-4f2f-a229-6998da7baf74",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        4224,
        1312
      ]
    },
    {
      "id": "be94ef8b-ea23-4023-835c-8705558e589a",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        1312,
        1680
      ]
    },
    {
      "id": "1a5039a2-9424-44d5-90b6-0b6c496a3a8c",
      "name": "Edit Fields2",
      "type": "n8n-nodes-base.set",
      "position": [
        1936,
        1680
      ]
    },
    {
      "id": "85c8e4cc-a8fb-44b4-9da5-24e1c4e074cf",
      "name": "Merge2",
      "type": "n8n-nodes-base.merge",
      "position": [
        1808,
        320
      ]
    },
    {
      "id": "0a98c267-b2d2-4a23-ad2c-29ee26a1f873",
      "name": "Is Cache Valid?",
      "type": "n8n-nodes-base.if",
      "position": [
        944,
        640
      ]
    },
    {
      "id": "35fcac15-4883-4a6c-a134-6ffab038c940",
      "name": "Cache Lookup",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        576,
        1056
      ]
    },
    {
      "id": "b5e7e0a9-3dd5-4376-ba58-685db5dc98b6",
      "name": "alphavantage - Balance Sheet",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1232,
        304
      ]
    },
    {
      "id": "b189892c-35da-478a-ad6f-23b7f950d1ed",
      "name": "alphavantage - Profile",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1232,
        512
      ]
    },
    {
      "id": "40deac93-692c-4df4-bc28-40af485ddd14",
      "name": "alphavantage - Income Statement",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1232,
        688
      ]
    },
    {
      "id": "0203cdb9-24dd-403e-8928-34b482fb68ac",
      "name": "Merge3",
      "type": "n8n-nodes-base.merge",
      "position": [
        1648,
        592
      ]
    },
    {
      "id": "3d012dc2-9ab6-4ae4-9130-6154a185a011",
      "name": "Get row(s) in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1200,
        1088
      ]
    },
    {
      "id": "5c318795-5695-41ed-a8f7-89dc844cb9e2",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        2336,
        336
      ]
    },
    {
      "id": "ca7f63bd-a588-4ea5-97dd-b52dd7b33190",
      "name": "Update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2400,
        624
      ]
    },
    {
      "id": "318f0afb-8875-4234-8477-075e21a2d1a5",
      "name": "Insert Row",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2400,
        848
      ]
    },
    {
      "id": "023ff7ab-93e2-4339-a245-69696f26ea1d",
      "name": "alphavantage - CashFlow",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1216,
        864
      ]
    },
    {
      "id": "c1ffc9d2-401b-4773-aa1c-846b5c245124",
      "name": "Merge4",
      "type": "n8n-nodes-base.merge",
      "position": [
        1984,
        688
      ]
    },
    {
      "id": "6da55c24-c5b0-4376-8d5c-be1f464092e9",
      "name": "Check the cache",
      "type": "n8n-nodes-base.code",
      "position": [
        800,
        1024
      ]
    },
    {
      "id": "0a4cc04c-137e-46b4-84d0-fbf78719cd98",
      "name": "Seekingalpha Articles",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        896,
        1664
      ]
    },
    {
      "id": "4f7ab138-6aa4-4d09-8811-ebe715aff036",
      "name": "Clean balance sheet",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        304
      ]
    },
    {
      "id": "9f07de28-b72c-48ca-b2ed-acc8a8166697",
      "name": "Clean Profile",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        496
      ]
    },
    {
      "id": "a372771f-529b-44aa-b1cc-7e42940d4834",
      "name": "Clean Income statement",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        688
      ]
    },
    {
      "id": "81eef3bf-3089-4494-982a-f5aaf756948d",
      "name": "Clean Ccashflow",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        848
      ]
    },
    {
      "id": "5fe3436c-a83a-45cc-a535-85e3628c52d5",
      "name": "Clean Read Financial",
      "type": "n8n-nodes-base.code",
      "position": [
        2144,
        688
      ]
    },
    {
      "id": "8e5e3d3d-47de-4a0e-9edd-c0d0e829368c",
      "name": "Clean Old Financial",
      "type": "n8n-nodes-base.code",
      "position": [
        2432,
        1088
      ]
    },
    {
      "id": "7e003755-bba0-4bbe-b501-c0bbefe3f8ac",
      "name": "Merge New Financial",
      "type": "n8n-nodes-base.code",
      "position": [
        2608,
        720
      ]
    },
    {
      "id": "d5704ba4-120e-42fd-9a0e-7be69ba1490b",
      "name": "alphavantage - Current Price",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1456,
        992
      ]
    },
    {
      "id": "5fd29a42-a969-47ff-9f72-14a40cdebb49",
      "name": "Clean Current Price",
      "type": "n8n-nodes-base.code",
      "position": [
        1680,
        976
      ]
    },
    {
      "id": "5fa9b6cb-9b3e-424e-b726-928f1fd24b9f",
      "name": "Merge5",
      "type": "n8n-nodes-base.merge",
      "position": [
        1776,
        816
      ]
    },
    {
      "id": "f5f85439-56d1-4404-800c-f205bbd26d67",
      "name": "Clean the news",
      "type": "n8n-nodes-base.code",
      "position": [
        1088,
        1664
      ]
    },
    {
      "id": "a157d224-6c96-4e5f-8202-520c7a0b66b9",
      "name": "return the news",
      "type": "n8n-nodes-base.code",
      "position": [
        1520,
        1840
      ]
    },
    {
      "id": "f1bae301-1e6e-49e5-8aba-a85d702e879c",
      "name": "Final version of news",
      "type": "n8n-nodes-base.code",
      "position": [
        2448,
        1680
      ]
    },
    {
      "id": "be4d33b2-8736-4328-947b-c29a4866ae97",
      "name": "Clean Up ChatGPT",
      "type": "n8n-nodes-base.code",
      "position": [
        3488,
        736
      ]
    },
    {
      "id": "5c6aaad9-868f-4e70-933f-320a43f74023",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        1296
      ],
      "parameters": {
        "width": 2200,
        "height": 700,
        "content": "# 2. SeekingAlpha News Data Retrieval & Validation\nGet Articles from Seeking Alpha:\nFor each ticker, the workflow sends an HTTP request to retrieve recent Seeking Alpha articles within a defined time "
      }
    },
    {
      "id": "17b04b39-4d23-49fa-882d-21a621fc58bb",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        576,
        880
      ]
    },
    {
      "id": "12c9b380-3075-46d0-bf82-11cc67c49a39",
      "name": "Message a model1",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        3088,
        1184
      ]
    },
    {
      "id": "5b8967b8-a8fa-44ce-90f9-32eb3c011b46",
      "name": "Clean up Gemini",
      "type": "n8n-nodes-base.code",
      "position": [
        3440,
        1184
      ]
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "write_sentiment_to_sheets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "loop_over_tickers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "XML",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "return the news",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If2": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Insert Row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "XML": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          },
          {
            "node": "Message a model1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge2": {
      "main": [
        [
          {
            "node": "Merge4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge3": {
      "main": [
        [
          {
            "node": "Merge2",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge4": {
      "main": [
        [
          {
            "node": "Clean Read Financial",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge5": {
      "main": [
        [
          {
            "node": "Merge4",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Insert Row": {
      "main": [
        [
          {
            "node": "Merge New Financial",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cache Lookup": {
      "main": [
        [
          {
            "node": "Check the cache",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Final version of news",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Profile": {
      "main": [
        [
          {
            "node": "Merge3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean the news": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check the cache": {
      "main": [
        [
          {
            "node": "Is Cache Valid?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Ccashflow": {
      "main": [
        [
          {
            "node": "Merge5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean up Gemini": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Is Cache Valid?": {
      "main": [
        [
          {
            "node": "alphavantage - Balance Sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "alphavantage - Profile",
            "type": "main",
            "index": 0
          },
          {
            "node": "alphavantage - Income Statement",
            "type": "main",
            "index": 0
          },
          {
            "node": "alphavantage - CashFlow",
            "type": "main",
            "index": 0
          },
          {
            "node": "alphavantage - Current Price",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Clean Up ChatGPT",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "return the news": {
      "main": [
        [
          {
            "node": "XML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Up ChatGPT": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model1": {
      "main": [
        [
          {
            "node": "Clean up Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Read_tickers_from_Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "loop_over_tickers": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Cache Lookup",
            "type": "main",
            "index": 0
          },
          {
            "node": "Seekingalpha Articles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Current Price": {
      "main": [
        [
          {
            "node": "Merge5",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Clean Old Financial": {
      "main": [
        [
          {
            "node": "Merge New Financial",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean balance sheet": {
      "main": [
        [
          {
            "node": "Merge2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Clean Old Financial",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge New Financial": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        [
          {
            "node": "Merge New Financial",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Read Financial": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Final version of news": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Seekingalpha Articles": {
      "main": [
        [
          {
            "node": "Clean the news",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Income statement": {
      "main": [
        [
          {
            "node": "Merge3",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "alphavantage - Profile": {
      "main": [
        [
          {
            "node": "Clean Profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read_tickers_from_Sheet": {
      "main": [
        [
          {
            "node": "loop_over_tickers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "alphavantage - CashFlow": {
      "main": [
        [
          {
            "node": "Clean Ccashflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "write_sentiment_to_sheets": {
      "main": [
        [
          {
            "node": "loop_over_tickers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "alphavantage - Balance Sheet": {
      "main": [
        [
          {
            "node": "Clean balance sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "alphavantage - Current Price": {
      "main": [
        [
          {
            "node": "Clean Current Price",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "alphavantage - Income Statement": {
      "main": [
        [
          {
            "node": "Clean Income statement",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}