{
  "name": "AI Trading Bot v4.0",
  "nodes": [
    {
      "id": "1",
      "name": "Market Data Ingestion",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "={{$credentials.marketDataAPI}}/real-time",
        "options": {},
        "queryParameters": {
          "assets": "XAUUSD,US30,SP500,EURUSD,BTCUSD"
        }
      },
      "credentials": {
        "marketDataAPI": "<your credential>"
      }
    },
    {
      "id": "2",
      "name": "Multi-Source Signal Aggregation",
      "type": "n8n-nodes-base.function",
      "parameters": {
        "functionCode": "const signals = aggregateSignals([TradingView, CoinMarketCap, Discord, Telegram, News]);\nreturn { signals: signals };"
      }
    },
    {
      "id": "3",
      "name": "Sentiment Analysis",
      "type": "n8n-nodes-base.function",
      "parameters": {
        "functionCode": "const newsSentiment = analyzeHeadlines(items[0].json.news);\nreturn { sentimentScore: newsSentiment };"
      }
    },
    {
      "id": "4",
      "name": "Risk Management Check",
      "type": "n8n-nodes-base.if",
      "parameters": {
        "conditions": {
          "conditions": [
            {
              "value1": "={{$node[\"Market Data Ingestion\"].json.volatility}}",
              "operation": "larger",
              "value2": 2.0
            },
            {
              "value1": "={{$node[\"AI Strategy Engine\"].json.riskScore}}",
              "operation": "smaller",
              "value2": 5
            }
          ]
        }
      }
    },
    {
      "id": "5",
      "name": "AI Strategy Engine",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "const strategy = await runAIModel(items[0].json);\nreturn strategy;"
      }
    },
    {
      "id": "6",
      "name": "Dynamic AI Recalibration",
      "type": "n8n-nodes-base.cron",
      "parameters": {
        "interval": 5,
        "mode": "Every X Seconds"
      }
    },
    {
      "id": "7",
      "name": "Order Execution",
      "type": "n8n-nodes-base.metaTrader",
      "parameters": {
        "operation": "placeOrder",
        "instrument": "={{$node[\"Market Data Ingestion\"].json.symbol}}",
        "units": "={{$node[\"AI Strategy Engine\"].json.lotSize}}",
        "stopLoss": "={{$node[\"AI Strategy Engine\"].json.SL}}",
        "takeProfit": "={{$node[\"AI Strategy Engine\"].json.TP}}",
        "leverage": "={{$node[\"AI Strategy Engine\"].json.leverage}}"
      }
    },
    {
      "id": "8",
      "name": "Performance Monitoring",
      "type": "n8n-nodes-base.cron",
      "parameters": {
        "interval": 300,
        "mode": "Every X Minutes"
      }
    }
  ],
  "connections": {
    "Market Data Ingestion": {
      "main": [
        [
          {
            "node": "Multi-Source Signal Aggregation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Multi-Source Signal Aggregation": {
      "main": [
        [
          {
            "node": "Sentiment Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sentiment Analysis": {
      "main": [
        [
          {
            "node": "Risk Management Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Risk Management Check": {
      "main": [
        [
          {
            "node": "AI Strategy Engine",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Strategy Engine": {
      "main": [
        [
          {
            "node": "Order Execution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dynamic AI Recalibration": {
      "main": [
        [
          {
            "node": "AI Strategy Engine",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Performance Monitoring": {
      "main": [
        [
          {
            "node": "Market Data Ingestion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionTimeout": 60000,
    "maxExecutionOrder": "vip",
    "errorHandling": {
      "retryCount": 3,
      "retryInterval": 3000
    }
  }
}