{
  "name": "Tesla quant trading AI agent using Telegram + GPT-4.1 (main interFace)",
  "nodes": [
    {
      "id": "8677aed4-a1bf-4439-8b5e-57c283f81862",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -560,
        -100
      ]
    },
    {
      "id": "fddcfaab-f575-4e72-b3f1-e0965e3c71b5",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        140,
        260
      ]
    },
    {
      "id": "f6e5726a-1010-4a55-9d54-f6889eb780e1",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1380,
        -100
      ]
    },
    {
      "id": "62f3f30c-47e4-4c86-828b-3ab4de28e6c3",
      "name": "User Authentication (Replace Telegram ID)",
      "type": "n8n-nodes-base.code",
      "position": [
        -300,
        -100
      ]
    },
    {
      "id": "5a79ae5f-583d-41a0-9055-914de6eaf341",
      "name": "Tesla Quant Trading AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        520,
        -100
      ]
    },
    {
      "id": "966cf9b6-abd4-48a0-bd32-6c83985a33ac",
      "name": "Tesla Financial Market Data Analyst Tool",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        700,
        260
      ]
    },
    {
      "id": "dbf1bef5-044a-4594-af1b-1468d4cdc06a",
      "name": "Tesla News and Sentiment Analyst Tool",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        980,
        260
      ]
    },
    {
      "id": "2109ef95-4256-4713-aa9d-8a8ecd40eff3",
      "name": "Add SessionId",
      "type": "n8n-nodes-base.set",
      "position": [
        260,
        -100
      ]
    },
    {
      "id": "0f45fae9-fef5-4595-97f0-04f974790cd3",
      "name": "Splits message is more than 4000 characters",
      "type": "n8n-nodes-base.code",
      "position": [
        1020,
        -100
      ]
    },
    {
      "id": "8e7dcfd4-7f2a-47b4-8e5a-1bc4d77fced7",
      "name": "Date & Time",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        -20,
        -100
      ]
    },
    {
      "id": "f31dbe9c-25a2-4751-ba34-38ed0ae9e18c",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        420,
        260
      ]
    },
    {
      "id": "97dfa658-3a67-4ed7-9662-b62573e0958b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -340
      ],
      "parameters": {
        "width": null,
        "height": 420,
        "content": "## Trigger Incoming Telegram Command\n\nThis node **listens for new Telegram messages** to initiate report generation."
      }
    },
    {
      "id": "b7d99e5f-0f36-4963-aa2c-33db04689fc5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -340
      ],
      "parameters": {
        "width": 260,
        "height": 420,
        "content": "## Validate User Access\n\nEnsures only **authorized Telegram user IDs** can trigger the agent."
      }
    },
    {
      "id": "9a4d6ba0-2d75-4453-8b05-bc4dedf81be5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -340
      ],
      "parameters": {
        "width": null,
        "height": 420,
        "content": "## Capture Timestamp\n\nCaptures the **current system date and time** for session tracking and report stamping."
      }
    },
    {
      "id": "157ba065-d228-41f0-a88f-ea8122fb5fa8",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -340
      ],
      "parameters": {
        "width": null,
        "height": 420,
        "content": "## Generate Session Metadata\n\nAssigns **sessionId based on Telegram chat ID** and stores current **date/time** for context continuity."
      }
    },
    {
      "id": "6fe0bc11-94da-4c82-bf28-5fe6429d6e86",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -340
      ],
      "parameters": {
        "width": 340,
        "height": 420,
        "content": "## Main AI Agent: Trading Report Generator\n\nUses **GPT model to combine technical and sentiment data** into a structured **TSLA swing-trading report**.\nCalls **Financial Market Analyst + Sentiment Ana"
      }
    },
    {
      "id": "7a1e3a33-713a-4a72-81c0-001e74af8f73",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        940,
        -340
      ],
      "parameters": {
        "width": 260,
        "height": 420,
        "content": "## Handle Telegram Message Limits\n\nChecks **output message length and splits into 4000-character** chunks if needed.\n\n"
      }
    },
    {
      "id": "b5ac3bcb-baa5-4d39-9e44-6be888317089",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1300,
        -340
      ],
      "parameters": {
        "width": 260,
        "height": 420,
        "content": "## Send Final Report to Telegram\n\nSends **formatted HTML report (or split parts)** back to the **original Telegram user**."
      }
    },
    {
      "id": "5df88223-3acc-4b27-b592-58d499a638dd",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        60,
        220
      ],
      "parameters": {
        "width": null,
        "height": 400,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n## GPT Model for Reasoning\nUses **OpenAI GPT (e.g., GPT-4o)** to process signal analysis and produce **final report** text."
      }
    },
    {
      "id": "c7bcc5bc-48b9-464b-9a6b-062535810543",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        340,
        220
      ],
      "parameters": {
        "width": null,
        "height": 400,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Short-Term Memory Module\nMaintains **state during session**. Helps agent **track message history and previous context**.\n\n"
      }
    },
    {
      "id": "b17ec86d-5d91-469f-bc9d-fb5e22ecbfaf",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        220
      ],
      "parameters": {
        "width": null,
        "height": 400,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Fetch Technical Indicator Insights\nCalls all **15m, 1h, 1d, and Klines sub-agents** via **webhook** to retrieve structured **market analysis**.\n\n"
      }
    },
    {
      "id": "1eda1d9b-2b50-4cd1-8b83-6a7d37517d31",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        900,
        220
      ],
      "parameters": {
        "width": null,
        "height": 400,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Scrape Tesla News & Generate Sentiment\nPulls latest **Tesla-related headlines from trusted RSS feeds** and **returns structured sentiment** summary.\n\n"
      }
    },
    {
      "id": "8e2ebe09-5488-4fb9-8175-b88ba68fcb9e",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1900,
        -1680
      ],
      "parameters": {
        "width": 1280,
        "height": 2300,
        "content": "\n# 🧠 Tesla Quant Trading AI Agent – Full System Documentation\n\nA professional-grade AI-driven stock analysis system designed to deliver structured Tesla (TSLA) swing-trading insights based on real-tim"
      }
    }
  ],
  "connections": {
    "Telegram": {
      "main": [
        []
      ]
    },
    "Date & Time": {
      "main": [
        [
          {
            "node": "Add SessionId",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add SessionId": {
      "main": [
        [
          {
            "node": "Tesla Quant Trading AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Tesla Quant Trading AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "User Authentication (Replace Telegram ID)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Tesla Quant Trading AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Tesla Quant Trading AI Agent": {
      "main": [
        [
          {
            "node": "Splits message is more than 4000 characters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tesla News and Sentiment Analyst Tool": {
      "ai_tool": [
        [
          {
            "node": "Tesla Quant Trading AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Tesla Financial Market Data Analyst Tool": {
      "ai_tool": [
        [
          {
            "node": "Tesla Quant Trading AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "User Authentication (Replace Telegram ID)": {
      "main": [
        [
          {
            "node": "Date & Time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Splits message is more than 4000 characters": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}