{
  "name": "AI Powered Trading App - Hybrid Model",
  "nodes": [
    {
      "id": "1",
      "name": "Trigger (Scheduler)",
      "type": "n8n-nodes-base.cron",
      "parameters": {
        "triggerTimes": [
          {
            "mode": "everyMinute"
          }
        ]
      }
    },
    {
      "id": "2",
      "name": "Fetch Market Data",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "https://api.angelbroking.com/rest/secure/angelbroking/market/v1/ohlc",
        "method": "GET",
        "authentication": "headerAuth",
        "responseFormat": "json"
      }
    },
    {
      "id": "3",
      "name": "LSTM Intraday Prediction",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "https://your-lstm-api.com/predict",
        "method": "POST",
        "responseFormat": "json",
        "jsonParameters": true,
        "options": {},
        "body": {
          "ohlc": "={{$json[\"data\"]}}"
        }
      }
    },
    {
      "id": "4",
      "name": "XGBoost Signal Confirmation",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "https://your-xgboost-api.com/signal",
        "method": "POST",
        "jsonParameters": true,
        "responseFormat": "json",
        "body": {
          "indicators": "={{$json[\"indicators\"]}}",
          "signal": "={{$json[\"signal\"]}}"
        }
      }
    },
    {
      "id": "5",
      "name": "Options Strategy (RL Model)",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "https://your-rl-api.com/options",
        "method": "POST",
        "jsonParameters": true,
        "responseFormat": "json",
        "body": {
          "options_chain": "={{$json[\"options\"]}}"
        }
      }
    },
    {
      "id": "6",
      "name": "Sentiment Analysis (FinBERT)",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "https://your-finbert-api.com/sentiment",
        "method": "POST",
        "jsonParameters": true,
        "responseFormat": "json",
        "body": {
          "headlines": "={{$json[\"news\"]}}"
        }
      }
    },
    {
      "id": "7",
      "name": "Anomaly Detection",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "https://your-anomaly-api.com/detect",
        "method": "POST",
        "jsonParameters": true,
        "responseFormat": "json",
        "body": {
          "market_data": "={{$json[\"data\"]}}"
        }
      }
    },
    {
      "id": "8",
      "name": "Combine AI Results",
      "type": "n8n-nodes-base.function",
      "parameters": {
        "functionCode": "return [{\n  signal: $json[\"signal\"] || $json[\"lstm_signal\"],\n  confidence: Math.round((($json[\"lstm_conf\"]+ $json[\"xgboost_conf\"]+ $json[\"rl_conf\"]+ $json[\"sentiment_score\"])/4)),\n  strategy: $json[\"rl_strategy\"],\n  sentiment: $json[\"sentiment\"],\n  risk: $json[\"anomaly_flag\"]\n}];"
      }
    },
    {
      "id": "9",
      "name": "Send Push Notification",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "https://onesignal.com/api/v1/notifications",
        "method": "POST",
        "authentication": "headerAuth",
        "jsonParameters": true,
        "responseFormat": "json",
        "body": {
          "app_id": "YOUR_ONESIGNAL_APP_ID",
          "contents": {
            "en": "AI Signal \u2192 {{$json[\"signal\"]}} | Confidence: {{$json[\"confidence\"]}}%"
          }
        }
      }
    },
    {
      "id": "10",
      "name": "Send Telegram Alert",
      "type": "n8n-nodes-base.telegram",
      "parameters": {
        "chatId": "YOUR_TELEGRAM_CHAT_ID",
        "text": "AI says {{$json[\"signal\"]}} | Strategy: {{$json[\"strategy\"]}} | Confidence: {{$json[\"confidence\"]}}%"
      }
    }
  ],
  "connections": {
    "1": {
      "main": [
        [
          {
            "node": "Fetch Market Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2": {
      "main": [
        [
          {
            "node": "LSTM Intraday Prediction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3": {
      "main": [
        [
          {
            "node": "XGBoost Signal Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4": {
      "main": [
        [
          {
            "node": "Options Strategy (RL Model)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5": {
      "main": [
        [
          {
            "node": "Sentiment Analysis (FinBERT)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6": {
      "main": [
        [
          {
            "node": "Anomaly Detection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7": {
      "main": [
        [
          {
            "node": "Combine AI Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8": {
      "main": [
        [
          {
            "node": "Send Push Notification",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Telegram Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}