{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "63461f58-4b36-4329-916a-5ab08e6b8f90",
      "name": "Every Hour Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        1424,
        752
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "19639c26-62b1-499c-ae97-167fadd57d46",
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "position": [
        1600,
        752
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "ce721305-82c2-4710-af60-ab94e9c57124",
      "name": "Get Portfolio from Signal Handler",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        2112,
        272
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "8614dd3d-6b5b-48b9-8642-b890c1687015",
      "name": "NewsAPI Headlines",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        2112,
        464
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "73db56b8-ded7-4d6c-9531-5e8e034f2b0c",
      "name": "FinnHub Market News",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        2112,
        656
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "2d5c0ed9-fc1d-4d4f-b9c8-a12c4ca3b722",
      "name": "Alpha Vantage Macro Sentiment",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        2112,
        848
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "18a0ff4b-9686-4681-883d-068b3fea6da9",
      "name": "Fear & Greed Index",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        2112,
        1040
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "acc704c9-9291-46e1-9b0e-b151568ca9da",
      "name": "Forex Factory Calendar",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        2112,
        1232
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "211ecc23-f028-4374-8f66-ba65597d814d",
      "name": "Merge All Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        2336,
        688
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "8e722f74-723a-4909-99a2-38fb66c8ffd6",
      "name": "Build Full Context",
      "type": "n8n-nodes-base.code",
      "position": [
        2496,
        752
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "3a2cdeb3-c275-4b96-8bb0-cc9db9d44595",
      "name": "AI Portfolio Analyst",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        2784,
        752
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "d07784a3-7863-4ed1-9a3c-9e80d1e3f8db",
      "name": "Parse AI Response",
      "type": "n8n-nodes-base.code",
      "position": [
        3168,
        752
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "be0fd99e-9160-4426-9474-cee191620a97",
      "name": "Format Discord Update",
      "type": "n8n-nodes-base.code",
      "position": [
        3360,
        656
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "f908d750-b0aa-4fbb-926b-dd17cf79ebe3",
      "name": "Send Update to Discord",
      "type": "n8n-nodes-base.discord",
      "maxTries": 3,
      "position": [
        3584,
        656
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "1aed1df1-3a38-4f77-8870-6d8e7ae0e2c7",
      "name": "Extract Actions",
      "type": "n8n-nodes-base.code",
      "position": [
        3360,
        848
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "0837bb11-88dc-4470-a1a1-cb0b48b953ca",
      "name": "Has Actions?",
      "type": "n8n-nodes-base.if",
      "position": [
        3584,
        848
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "55e8633c-111b-4bc4-8a3c-c6d642e6145c",
      "name": "Action Type?",
      "type": "n8n-nodes-base.switch",
      "position": [
        3808,
        832
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "3b71e480-c22f-41a8-b36d-f26e32fbde66",
      "name": "Buy: Market or Limit?",
      "type": "n8n-nodes-base.switch",
      "position": [
        4032,
        464
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "88f9a7f2-0414-4122-90ad-91848794e8cd",
      "name": "Buy Market Order",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        4256,
        368
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "da3a3b84-d289-4636-9210-3fb6d288175d",
      "name": "Buy Limit Order",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        4256,
        560
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "8b038a55-c784-46f8-926b-4ddb988378ef",
      "name": "Sell: Market or Limit?",
      "type": "n8n-nodes-base.switch",
      "position": [
        4032,
        848
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "e23f7327-e20a-4a16-9e18-d8bd8928b2a6",
      "name": "Sell Market Order",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        4256,
        752
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "888107aa-ee7b-4413-82be-7cfde5165d21",
      "name": "Sell Limit Order",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        4256,
        944
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "406d294d-0ab7-4b8d-b477-0acdd456a3cb",
      "name": "Close Position Signal",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        4256,
        1136
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "106ab39b-799d-4589-aa95-6b6163d7573c",
      "name": "Build Execution Confirmation",
      "type": "n8n-nodes-base.code",
      "position": [
        4480,
        848
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "a1e74152-c254-471b-bbbe-d84f81e11167",
      "name": "Send Trade Confirmation",
      "type": "n8n-nodes-base.discord",
      "maxTries": 3,
      "position": [
        4704,
        848
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "94a4917e-0932-4d7e-8ba5-54bc28cd606b",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        528
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "44f91fc2-3083-4e0f-85ba-79fd7441b09d",
      "name": "Data Sources",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1824,
        -96
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "9acfefee-37d4-4360-9105-732269bc7b43",
      "name": "AI Engine",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2688,
        352
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2517f245-c2a1-466b-93a8-afef1320328d",
      "name": "Execution Router",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3136,
        352
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "5ee92a0a-709b-4992-a142-850efb195614",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        2784,
        960
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "90d21b94-733a-4296-bb40-d67ece9a8da9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        528
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Config": {
      "main": [
        [
          {
            "node": "Get Portfolio from Signal Handler",
            "type": "main",
            "index": 0
          },
          {
            "node": "NewsAPI Headlines",
            "type": "main",
            "index": 0
          },
          {
            "node": "FinnHub Market News",
            "type": "main",
            "index": 0
          },
          {
            "node": "Alpha Vantage Macro Sentiment",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fear & Greed Index",
            "type": "main",
            "index": 0
          },
          {
            "node": "Forex Factory Calendar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Action Type?": {
      "main": [
        [
          {
            "node": "Buy: Market or Limit?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Sell: Market or Limit?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Close Position Signal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Actions?": {
      "main": [
        [
          {
            "node": "Action Type?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge All Data": {
      "main": [
        [
          {
            "node": "Build Full Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Buy Limit Order": {
      "main": [
        [
          {
            "node": "Build Execution Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Actions": {
      "main": [
        [
          {
            "node": "Has Actions?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Buy Market Order": {
      "main": [
        [
          {
            "node": "Build Execution Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sell Limit Order": {
      "main": [
        [
          {
            "node": "Build Execution Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NewsAPI Headlines": {
      "main": [
        [
          {
            "node": "Merge All Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Parse AI Response": {
      "main": [
        [
          {
            "node": "Format Discord Update",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract Actions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sell Market Order": {
      "main": [
        [
          {
            "node": "Build Execution Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Full Context": {
      "main": [
        [
          {
            "node": "AI Portfolio Analyst",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every Hour Trigger": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fear & Greed Index": {
      "main": [
        [
          {
            "node": "Merge All Data",
            "type": "main",
            "index": 4
          }
        ]
      ]
    },
    "FinnHub Market News": {
      "main": [
        [
          {
            "node": "Merge All Data",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "AI Portfolio Analyst": {
      "main": [
        [
          {
            "node": "Parse AI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Portfolio Analyst",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Buy: Market or Limit?": {
      "main": [
        [
          {
            "node": "Buy Market Order",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Buy Limit Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Close Position Signal": {
      "main": [
        [
          {
            "node": "Build Execution Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Discord Update": {
      "main": [
        [
          {
            "node": "Send Update to Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Forex Factory Calendar": {
      "main": [
        [
          {
            "node": "Merge All Data",
            "type": "main",
            "index": 5
          }
        ]
      ]
    },
    "Sell: Market or Limit?": {
      "main": [
        [
          {
            "node": "Sell Market Order",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Sell Limit Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Execution Confirmation": {
      "main": [
        [
          {
            "node": "Send Trade Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alpha Vantage Macro Sentiment": {
      "main": [
        [
          {
            "node": "Merge All Data",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Get Portfolio from Signal Handler": {
      "main": [
        [
          {
            "node": "Merge All Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}