{
  "id": "cNTAqpIGoHikevVw",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Portfolio Analysis Template",
  "tags": [],
  "nodes": [
    {
      "id": "0ef280c8-3c4e-4a33-9fb9-b9d205ab376b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        -432
      ],
      "parameters": {
        "width": 192,
        "height": 1184,
        "content": "Add workbook ID to Sheet nodes\n\nIE docs.google.com/spreadsheets/d/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      },
      "typeVersion": 1
    },
    {
      "id": "f0ed66cd-08cf-430d-96f5-a1dda66d6579",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        -288
      ],
      "parameters": {
        "width": 224,
        "height": 224,
        "content": "Add Email\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ada18341-8267-4c8c-b357-14643ac9fcf6",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        48
      ],
      "parameters": {
        "color": 6,
        "width": 2672,
        "height": 384,
        "content": "Stock Analysis - Weekly Monday + Wednesday Follow-up"
      },
      "typeVersion": 1
    },
    {
      "id": "44dad330-ad4a-49c4-8ded-65528d41c58e",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        -336
      ],
      "parameters": {
        "height": 1168,
        "content": "Add Claude Credentials"
      },
      "typeVersion": 1
    },
    {
      "id": "d34fda79-648e-47fb-9e75-f91673bf1eef",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        528
      ],
      "parameters": {
        "color": 6,
        "width": 3296,
        "height": 496,
        "content": "Mid-Week Follow-up - User Input Integration"
      },
      "typeVersion": 1
    },
    {
      "id": "85677cc7-cd22-4458-a6c3-80931422e55e",
      "name": "Sticky Note 8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -464
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 448,
        "content": "## How it works\nAutomated portfolio analysis with AI-powered recommendations:\n- Monday: Complete stock analysis (fundamental + technical + synthesis)\n- Wednesday: Follow-up analysis based on user input \n- Monthly: Index fund performance review\n\n## Setup steps\n1. Copy the Google Sheets template (see link below)\n2. Add your Google Sheets ID to all \"Read\" nodes\n3. Configure Gmail OAuth2 for email delivery\n4. Add Anthropic API credentials to all Claude nodes\n5. Update email addresses in Send nodes\n6. Test with a small position first\n\nReplace all placeholder values marked with YOUR_*"
      },
      "typeVersion": 1
    },
    {
      "id": "e039d5df-2681-4424-bafd-7aff8622c291",
      "name": "Sticky Note 9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        32
      ],
      "parameters": {
        "color": 7,
        "width": 280,
        "height": 240,
        "content": "Google Sheets Setup\n\nCopy template:\ndocs.google.com/spreadsheets/d/1WHdSdkS0M67EVAcsDWb5WLzQqLVj0_8zvbYIx8vGA4w\n\nAdd your Sheet ID to all Read nodes\n\nDO not change layout or formatting without updating Prepare Data Node"
      },
      "typeVersion": 1
    },
    {
      "id": "d1223cd2-59c9-415d-b2c6-a9f860644cc9",
      "name": "Sticky Note 10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        -416
      ],
      "parameters": {
        "color": 5,
        "width": 1600,
        "height": 416,
        "content": "Index Fund Analysis - Monthly Review"
      },
      "typeVersion": 1
    },
    {
      "id": "c52159d7-b6a9-4f4b-bd2e-9ee1af6baae2",
      "name": "Format Index Fund Email",
      "type": "n8n-nodes-base.code",
      "position": [
        1600,
        -256
      ],
      "parameters": {
        "jsCode": "user@example.com"
      },
      "typeVersion": 2
    },
    {
      "id": "6fb014fb-60c2-4930-b77c-b0fceb5d1d8f",
      "name": "Send Index Fund Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1808,
        -256
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $json.body }}",
        "options": {},
        "subject": "={{ $json.subject }}"
      },
      "typeVersion": 2
    },
    {
      "id": "b4878a14-eaea-4379-bd6f-16309c54a6f2",
      "name": "Read Index Funds1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        768,
        -256
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1EA7hgz1NRLlV9eseAXKl6feooDAVwr7LOdFsW51C8gE/edit#gid=0",
          "cachedResultName": "Index Funds"
        },
        "documentId": "YOUR_DOCUMENTID_ID"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "54925db5-ecf7-48e2-bc35-def8c51fe2ee",
      "name": "First day of Month",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        544,
        -256
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "months",
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7d968e0e-42b3-4447-8e63-491180e0a604",
      "name": "Every Monday 8AM2",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        576,
        160
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 8 * * 1"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e31e0f01-25d0-4d81-91c5-e8d4b9a18146",
      "name": "Read Stocks2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        784,
        160
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1832493459,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1EA7hgz1NRLlV9eseAXKl6feooDAVwr7LOdFsW51C8gE/edit#gid=1832493459",
          "cachedResultName": "Stocks"
        },
        "documentId": "YOUR_DOCUMENTID_ID"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "4b1bb00e-349d-47af-90e0-0916956f887a",
      "name": "Prepare Stock Data1",
      "type": "n8n-nodes-base.code",
      "position": [
        992,
        160
      ],
      "parameters": {
        "jsCode": "// Get all items from stocks sheet\nconst items = $input.all();\n\n// Extract cash amount from row with \"Account cash\" or similar\nconst cashRow = items.find(item => \n  item.json['Stock Name'] && \n  item.json['Stock Name'].toLowerCase().includes('cash') &&\n  !item.json['Stock Symbol'] // Empty stock symbol indicates cash row\n);\nconst availableCash = cashRow ? parseFloat(cashRow.json['Buy In Price (Full ammount invested including multiple shares']) || 0 : 0;\n\n// Extract tickers from Stocks - UPDATED FOR FRACTIONAL SHARES AND WATCHING\nconst stocks = items\n  .filter(item => {\n      const symbol = item.json['Stock Symbol'] ? item.json['Stock Symbol'].toString().trim() : '';\n      const hasSymbol = symbol.length > 0;\n      const hasBuyPrice = !!item.json['Buy In Price (Full ammount invested including multiple shares'];\n      const isWatching = item.json['Watching (No Buy)'] === true || item.json['Watching (No Buy)'] === 'TRUE' || item.json['Watching (No Buy)'] === '1';\n      return hasSymbol && (hasBuyPrice || isWatching);\n  })\n  .map(item => {\n    const amountSpent = parseFloat(item.json['Buy In Price (Full ammount invested including multiple shares']) || 0; // Column D\n    const priceAtPurchase = parseFloat(item.json['Price at time of purchase']) || 0; // Column E\n    const isFractional = item.json['Fractional?'] === true || item.json['Fractional?'] === 'TRUE' || item.json['Fractional?'] === '1'; // Column F\n    const isWatching = item.json['Watching (No Buy)'] === true || item.json['Watching (No Buy)'] === 'TRUE'; // Column G\n    const watchDate = item.json['Date Started Watching']; // Column H\n    const watchPrice = parseFloat(item.json['Price at time of Watch Start']) || 0; // Column I\n\n    const sharesOwned = priceAtPurchase > 0 ? (amountSpent / priceAtPurchase) : 0;\n    \n    return {\n      ticker: item.json['Stock Symbol'],\n      name: item.json['Stock Name'],\n      buyDate: item.json['Buy In Date'],\n      amountSpent: amountSpent, // Dollar amount invested\n      priceAtPurchase: priceAtPurchase, // Stock price when purchased\n      sharesOwned: sharesOwned, // Calculated shares (fractional or whole)\n      isFractional: isFractional,\n      isWatching: isWatching,\n      watchDate: watchDate,\n      watchPrice: watchPrice,\n      type: isWatching ? 'watching' : 'stock'\n    };\n  });\n\n// Get unique list of all tickers for API call\nconst allTickers = [...new Set(stocks.map(s => s.ticker))];\n\n// Calculate total invested amount (exclude watching)\nconst totalInvested = stocks.filter(s => !s.isWatching).reduce((sum, stock) => sum + stock.amountSpent, 0);\n\nreturn [{\n  json: {\n    stocks,\n    allTickers: allTickers.join(','),\n    availableCash: availableCash,\n    totalInvested: totalInvested,\n    totalPortfolioValue: totalInvested + availableCash\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "352c5068-35d5-492f-a304-568fdd4b91c6",
      "name": "Send Dual Analysis Email1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2640,
        0
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $json.body }}",
        "options": {},
        "subject": "={{ $json.subject }}"
      },
      "typeVersion": 2
    },
    {
      "id": "34e94a16-afb6-4334-973b-dae40bbd5648",
      "name": "Claude Stock Analysis - Fundemental",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1408,
        160
      ],
      "parameters": {
        "url": "https://api.anthropic.com/v1/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"claude-sonnet-4-5-20250929\",\n  \"max_tokens\": 20000,\n  \"temperature\": 0.3,\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": {{ JSON.stringify($json.prompt) }}\n    }\n  ],\n  \"tools\": [\n    {\n      \"type\": \"web_search_20250305\",\n      \"name\": \"web_search\",\n      \"max_uses\": 20\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "YOUR_AUTHENTICATION_ID",
        "headerParameters": {
          "parameters": [
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4
    },
    {
      "id": "133260c1-2dd9-467a-a4ad-54de2d144fdf",
      "name": "Prepare Claude Technical Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        1600,
        160
      ],
      "parameters": {
        "jsCode": "const fundamentalResponse = $input.first().json;\n\n// Extract Claude's fundamental analysis\nconst content = fundamentalResponse.content;\nconst textBlocks = content.filter(block => block.type === 'text');\nconst fundamentalAnalysis = textBlocks.map(block => block.text).join('\\n\\n');\n\n// Extract Claude's usage stats for reference\nconst fundamentalUsage = fundamentalResponse.usage || {};\nconst searchCount = content.filter(block => block.type === 'tool_use' && block.name === 'web_search').length;\n\n// Build technical prompt that references fundamental analysis\nconst technicalPrompt = `You are an independent technical analyst. Current date: ${new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}.\n\n**YOUR ROLE:** A fundamental analyst has completed their research and made stock recommendations, including both existing holdings and stocks being watched. Your job is to evaluate the TECHNICAL setup and ENTRY TIMING for their picks, paying special attention to \"Watching\" stocks.\n\n**CRITICAL:** You MUST use web_search to gather current technical data. Do NOT assume or estimate.\n\n---\n\n# FUNDAMENTAL ANALYST'S COMPLETE ANALYSIS\n\n${fundamentalAnalysis}\n\n---\n\n# YOUR TECHNICAL EVALUATION MANDATE\n\nThe fundamental analyst has classified the market regime and found opportunities. Now you determine:\n\n1. **Does the chart support entry NOW?** (or wait for better setup)\n2. **What are the precise technical risk levels?** (stop-loss placement)\n3. **Are there timing red flags?** (earnings, overbought conditions, support breaks)\n\n## SCORING WEIGHT AWARENESS\n\nBased on the market regime from fundamental analysis, you should understand your analysis will be weighted differently:\n\n**Your Technical Score Weight:**\n- Risk-On + Growth Stock: **60-65%** of combined score (your opinion matters MORE)\n- Transitional: **50-55%** of combined score\n- Risk-Off + Value Stock: **35-40%** of combined score (fundamentals matter more)\n\n**Why this matters:** In momentum markets, you have more influence. Entry timing can make or break performance. Be thorough.\n\n---\n\n## REQUIRED TECHNICAL RESEARCH\n\nFor EACH stock (both existing holdings + new recommendations + **stocks being watched**):\n\n### 1. CURRENT CHART SETUP\n\nSearch \"[TICKER] stock chart\" or \"[TICKER] moving averages\" to gather:\n\n**Price vs Moving Averages:**\n- Current price: $XX.XX\n- 20-day MA: $XX.XX \u2192 Price is [+/-X%] [above/below]\n- 50-day MA: $XX.XX \u2192 Price is [+/-X%] [above/below]\n- 200-day MA: $XX.XX \u2192 Price is [+/-X%] [above/below]\n\n**Trend Classification:**\n- **Strong Bullish:** Above all MAs, MAs in proper order (20>50>200)\n- **Bullish:** Above 50 & 200, may be below 20 (healthy pullback)\n- **Neutral/Choppy:** Mixed signals, crossing MAs\n- **Bearish:** Below 50 & 200\n- **Strong Bearish:** Below all MAs, MAs inverted\n\n**Extension Analysis:**\n- Distance from 200-day MA: [+/-X%]\n  * >50% above = Extreme extension (high risk)\n  * 20-50% above = Extended (caution)\n  * 10-20% above = Healthy bull trend\n  * <10% or negative = Potential value/reversal setup\n\n---\n\n### 2. MOMENTUM INDICATORS\n\nSearch \"[TICKER] RSI\" or \"[TICKER] MACD\" or check trading platforms:\n\n**RSI (14-period):** [Search current value]\n- < 30 = **Oversold** (potential bounce setup)\n- 30-40 = Bearish but not extreme\n- 40-60 = **Neutral** (healthy trading range)\n- 60-70 = Bullish but not extreme\n- > 70 = **Overbought** (pullback risk)\n\n**RSI Interpretation by Context:**\n- Strong uptrend + RSI 60-70 = Healthy (not a sell signal)\n- Choppy/Weak trend + RSI >70 = Warning (likely to fail)\n- Downtrend + RSI <30 = May get cheaper (not automatic buy)\n\n**MACD (12,26,9):** [Search or reference chart]\n- Bullish setup: MACD line crossing above signal line\n- Bearish setup: MACD line crossing below signal line\n- Divergence warning: Price making new highs but MACD not confirming = Bearish divergence\n\n**Volume Analysis:**\n- Recent volume vs 50-day average: [+/-X%]\n- Rising volume on up days = Healthy\n- Rising volume on down days = Distribution (bearish)\n- Falling volume overall = Lack of conviction\n\n---\n\n### 3. SUPPORT & RESISTANCE LEVELS\n\nSearch \"[TICKER] support resistance\" or analyze recent price action:\n\n**Support Levels (where buyers emerge):**\n- **Primary support:** $XX.XX [Recent low / MA support / prior breakout level]\n- **Secondary support:** $XX.XX [Stronger level below]\n- **Major support:** $XX.XX [Critical level - break would be very bearish]\n\n**Resistance Levels (where sellers emerge):**\n- **Nearest resistance:** $XX.XX [Recent high / round number / MA resistance]\n- **Major resistance:** $XX.XX [Key level - break would be very bullish]\n\n**Current Position Assessment:**\n\nCalculate: (Current Price - Support) / (Resistance - Support)\n\n- **0-25%:** Near support = \u2705 **LOW RISK ENTRY** (tight stop possible)\n- **25-50%:** Lower middle = \u26a0\ufe0f **MODERATE** (acceptable)\n- **50-75%:** Upper middle = \u26a0\ufe0f **MODERATE-HIGH** (limited upside to resistance)\n- **75-100%:** Near resistance = \u274c **HIGH RISK ENTRY** (likely rejection)\n\n**Risk/Reward Calculation:**\n- Downside to stop: $X.XX (-X%)\n- Upside to resistance: $X.XX (+X%)\n- **R/R Ratio:** X:1 (want \u22652:1 for new entries)\n\n---\n\n### 4. PATTERN RECOGNITION\n\nLook for chart patterns:\n\n**Bullish Patterns:**\n- Cup & Handle\n- Ascending triangle\n- Bull flag (consolidation after rally)\n- Higher lows forming\n\n**Bearish Patterns:**\n- Head & Shoulders\n- Descending triangle\n- Bear flag (consolidation after sell-off)\n- Lower highs forming\n\n**Neutral/Continuation:**\n- Symmetrical triangle\n- Rectangle/range\n- Tight consolidation\n\n---\n\n### 5. TIMING RED FLAGS\n\n**Critical Event Risk:**\n\nSearch \"[TICKER] earnings date\":\n- Next earnings: [DATE]\n- Days away: [Calculate from today]\n\n**Earnings Proximity Risk Assessment:**\n- 0-3 days: \ud83d\udea8\ud83d\udea8\ud83d\udea8 **EXTREME RISK** - Do not enter (binary event)\n- 4-7 days: \ud83d\udea8\ud83d\udea8 **HIGH RISK** - Reduce size significantly or wait\n- 8-14 days: \ud83d\udea8 **MODERATE RISK** - Acceptable if strong conviction, tight stop\n- 15+ days: \u2705 **LOW RISK** - Sufficient runway before volatility\n\n**Other Timing Considerations:**\n- Ex-dividend date approaching? (can cause gap)\n- Major product launch / FDA approval / legal decision pending?\n- Sector-wide event (FOMC for financials, OPEC for energy)?\n\n---\n\n### 6. TECHNICAL SCORE (1-10 scale)\n\nFor each stock, score these components:\n\n**A. Trend Quality (1-10):**\n- 9-10: Strong uptrend, above all MAs, MAs properly stacked\n- 7-8: Bullish, above 50/200, slight pullback to 20 MA\n- 5-6: Neutral, choppy, mixed MA signals\n- 3-4: Weak, below 50 MA, downtrend attempt\n- 1-2: Strong downtrend, below all MAs\n\n**B. Momentum Health (1-10):**\n- 9-10: RSI 50-65 with bullish MACD, strong volume\n- 7-8: RSI 45-70, MACD bullish or neutral\n- 5-6: RSI 35-75, mixed signals\n- 3-4: RSI >75 (overbought) or <35 (oversold in downtrend)\n- 1-2: Extreme overbought (>80) with bearish divergence\n\n**C. Entry Positioning (1-10):**\n- 9-10: Within 5% of support, R/R > 3:1\n- 7-8: 5-15% above support, R/R > 2:1\n- 5-6: Middle of range, R/R 1.5:1\n- 3-4: Near resistance, R/R < 1.5:1\n- 1-2: At resistance, R/R < 1:1 (poor setup)\n\n**D. Timing Risk (1-10):**\n- 9-10: No earnings for 15+ days, clear runway\n- 7-8: Earnings 14+ days out, minor events\n- 5-6: Earnings 7-14 days, manageable\n- 4-5: Earnings 4-7 days, elevated risk\n- 3-4: Earnings 0-3 days, binary event TODAY/TOMORROW\n\n**CRITICAL - Binary Event Handling:**\nIf earnings in 0-3 days:\n- Score timing component normally (3-4/10)\n- Add separate \ud83d\udea8\ud83d\udea8\ud83d\udea8 BINARY EVENT FLAG\n- In your assessment, state: \"Chart scores X/10 technically, but binary event requires position sizing decision\"\n- DO NOT destroy the overall technical score to 1-2/10 just because earnings are imminent\n- A great chart is still a great chart - the earnings just mean \"don't add size\"\n\n**OVERALL TECHNICAL SCORE:**\n\nCalculate as: (Trend \u00d7 0.30) + (Momentum \u00d7 0.25) + (Entry \u00d7 0.30) + (Timing \u00d7 0.15)\n\nRound to 1 decimal place.\n\n**CRITICAL - Don't Destroy Scores for Binary Events:**\n\nExample of WRONG scoring:\n- Trend: 9/10, Momentum: 8/10, Entry: 7/10, Timing: 1/10 (earnings today)\n- Overall: 2.0/10 \u274c This tells portfolio manager \"terrible setup\"\n\nExample of CORRECT scoring:\n- Trend: 9/10, Momentum: 8/10, Entry: 7/10, Timing: 4/10 (earnings today)\n- Overall: 7.3/10 \u2705 This tells portfolio manager \"good setup\"\n- Add flag: \"\ud83d\udea8\ud83d\udea8\ud83d\udea8 BINARY EVENT: Earnings today \u00b110% move\"\n- Recommendation: \"Technically strong, but binary event = position sizing decision\"\n\nThe score should reflect chart quality. The binary event flag indicates risk management needs.\n\n---\n\n## OUTPUT FORMAT\n\n### TECHNICAL VALIDATION TABLE (Summary)\n\n| Ticker | Fund Score | Tech Score | Type | Chart Setup | Entry Quality | Timing Risk | Agreement |\n|--------|-----------|-----------|------|-------------|---------------|-------------|-----------|\n| TICKER | X.X/10 | X.X/10 | Existing/New | Bullish/Neutral/Bearish | Good/Wait/Poor | Low/Moderate/High | \u2705/\u26a0\ufe0f/\u274c |\n\n---\n\n### DETAILED TECHNICAL ASSESSMENTS\n\nFor EACH stock (existing holdings + new recommendations + **stocks being watched**):\n\n---\n\n**[TICKER] - [Company Name]** - Technical Evaluation\n\n**Fundamental Analyst Recommendation:**\n- Action: [Hold / Buy $XX / Trim / etc]\n- Score: X.X/10 ([Value/Growth] stock)\n- Key thesis: [Quote 1-2 key sentences from fundamental analysis]\n\n---\n\n**Current Chart Setup:**\n\nPrice: $XX.XX (as of [date from search])\n\nMoving Averages:\n- 20-day MA: $XX.XX ([+/-X%] \u2192 [Above/Below])\n- 50-day MA: $XX.XX ([+/-X%] \u2192 [Above/Below])\n- 200-day MA: $XX.XX ([+/-X%] \u2192 [Above/Below])\n\n**Trend Status:** [Strong Bullish/Bullish/Neutral/Bearish/Strong Bearish]\n\nExtension from 200-day MA: [+/-X%]\n- Interpretation: [Healthy/Extended/Extreme - see guidelines in section 1]\n\n---\n\n**Momentum Analysis:**\n\nRSI(14): [XX] \u2192 [Oversold <30 / Neutral 30-70 / Overbought >70]\n- Context: [Explain if this RSI level is bullish or bearish given trend]\n\nMACD: [Bullish crossover / Bearish crossover / Neutral]\n- Signal: [What this suggests for near-term direction]\n\nVolume vs 50-day avg: [+/-X%]\n- Interpretation: [Healthy buying/selling / Lack of conviction / Distribution]\n\n**Pattern Recognition:**\n- [Describe any visible chart patterns: flags, triangles, cup & handle, etc]\n- [Or state: \"No clear pattern - in range/trend\"]\n\n---\n\n**Support & Resistance Levels:**\n\nResistance:\n- Near resistance: $XX.XX ([X%] above current)\n- Major resistance: $XX.XX ([X%] above current)\n\nSupport:\n- Primary support: $XX.XX ([X%] below current)\n- Secondary support: $XX.XX ([X%] below current)\n\n**Current Position in Range:**\n- [Near support / Lower-mid / Upper-mid / Near resistance]\n- Risk/Reward to stops: [X%] down / [X%] up = [X:1] ratio\n\n**Entry Assessment:**\n[\u2705 Good - Near support, tight stop possible]\n[\u26a0\ufe0f Moderate - Middle of range, acceptable but not ideal]\n[\u274c Poor - Near resistance, poor R/R]\n\n---\n\n**Timing Red Flags:**\n\nEarnings Date: [DATE] ([X days away])\n**Earnings Risk: [\ud83d\udea8\ud83d\udea8\ud83d\udea8 EXTREME / \ud83d\udea8\ud83d\udea8 HIGH / \ud83d\udea8 MODERATE / \u2705 LOW]**\n\n[If High/Extreme: Explain specific options-implied move or recent earnings volatility]\n\nOther Events: [Any other near-term catalysts that could cause volatility]\n\n---\n\n**Technical Score Breakdown:**\n\n| Component | Score | Rationale |\n|-----------|-------|-----------|\n| Trend Quality | X/10 | [Specific: above/below MAs, direction, strength] |\n| Momentum Health | X/10 | [Specific: RSI level, MACD signal, volume] |\n| Entry Positioning | X/10 | [Specific: distance to support, R/R ratio] |\n| Timing Risk | X/10 | [Specific: days to earnings, other events] |\n| **OVERALL** | **X.X/10** | **Weighted average** |\n\n---\n\n**My Technical Assessment:**\n\n[Choose one of the following frameworks:]\n\n---\n\n\u2705 **AGREE - Strong Chart, Binary Event**\n\n\"The chart is technically EXCELLENT: [specific strengths: trend/momentum/positioning]. Fundamental score of [X/10] reflects strong business quality. HOWEVER, earnings in [X hours/days] creates \u00b1[X%] binary event.\n\nThis is NOT a weak opportunity - it's a STRONG opportunity with timing complexity.\"\n\n**Technical Assessment:**\n- Chart Quality: [X/10] (trend, momentum, levels all strong)\n- Binary Event: Earnings [date/time]\n- Implied Move: \u00b1[X%] = $[X] swing\n\n**Position Sizing Recommendation:**\n[If no position]: Skip this week OR enter 25-50% size if high conviction\n[If small position <2% portfolio]: HOLD through - risk manageable\n[If large position >5% portfolio]: Consider trimming to 2-3% before event\n\n**Post-Event Strategy:**\n- If beats: [Specific action with levels]\n- If meets: [Specific action with levels]  \n- If misses: [Specific action with levels]\n\n**My Technical View:** Chart deserves [X/10], binary event requires position sizing adjustment, not score destruction.\n\n**Supporting Factors:**\n1. [Specific technical positive #1]\n2. [Specific technical positive #2]\n3. [Specific technical positive #3]\n\n**Action Recommendation:**\n- Proceed with fundamental analyst's recommendation\n- Entry: [Market order / Limit at $XX if you want better entry]\n- **Stop-Loss:** $XX.XX ([Below primary support / -X% from entry])\n  * This protects if [specific breakdown scenario]\n- **Initial target:** $XX.XX ([At resistance / +X% / R/R ratio X:1])\n\n**Monitoring:**\n- Watch [specific level or indicator] for [bullish/bearish] confirmation\n- If [condition], consider [adding to position / taking partial profits]\n\n---\n\n\u26a0\ufe0f **MODIFY - Good Stock, Timing Concerns**\n\n\"Fundamentals are compelling, BUT the technical setup has [specific issue: overbought condition / poor entry point / earnings risk]. The opportunity is real, but timing could be better.\"\n\n**Technical Concerns:**\n1. [Specific issue #1 - e.g., RSI >75 with bearish divergence]\n2. [Specific issue #2 - e.g., near resistance at $XX]\n3. [Specific issue #3 - e.g., earnings in 4 days]\n\n**Modified Action Plan:**\n\n**OPTION A: Reduced Size Entry** (If moderate concerns)\n- Enter [50%] of recommended allocation NOW\n- Entry: $XX.XX (current market)\n- Stop-Loss: $XX.XX (tighter than normal due to concerns)\n- Deploy remaining [50%] if [specific condition: pullback to $XX / post-earnings]\n\n**OPTION B: Wait for Better Setup** (If significant concerns)\n- Set price alert for $XX.XX ([specific support level / pullback target])\n- Entry trigger: [Condition - break above, pullback to, RSI cooling to <65, etc]\n- If triggered: Full allocation ($XX)\n- Stop-Loss would be: $XX.XX\n\n**OPTION C: Skip This Week, Revisit** (If timing is very poor)\n- Wait for [earnings to pass / overbought to correct / range to resolve]\n- Reassess in [X days / next week]\n- Opportunity isn't going away, but current risk/reward is unfavorable\n\n**My Recommendation:** [Choose Option A, B, or C and explain why]\n\n---\n\n\u274c **DISAGREE - Technical Breakdown**\n\n\"Despite good fundamentals, the chart shows [specific technical weakness] that suggests [specific risk]. Technical risk currently outweighs fundamental opportunity.\"\n\n**Technical Red Flags:**\n1. [Specific issue #1 - e.g., Broke below 50-day MA on high volume]\n2. [Specific issue #2 - e.g., MACD bearish crossover at multi-month highs]\n3. [Specific issue #3 - e.g., Failed breakout with volume declining]\n\n**What This Means:**\n- [Explain the technical story: distribution, failed breakout, momentum shift, etc]\n- Risk of [specific downside: -X% to next support at $XX]\n\n**Action Recommendation:**\n**SKIP** this allocation for now.\n\n**What Would Change My Mind:**\n- [Specific condition: Reclaim 50-day MA with volume]\n- [Specific condition: RSI hold above 50 on pullback]\n- [Specific condition: Base building for 2+ weeks]\n\n**Alternative Suggestion:**\n[If you can suggest a better ticker with similar thesis but better chart, do so]\n[Otherwise: \"Allocate this capital to [cash / highest scoring remaining opportunity / split among other recommendations]\"]\n\n---\n\n[End of technical assessment for this stock]\n\n---\n\n### PORTFOLIO-LEVEL TECHNICAL SUMMARY\n\n**Overall Market Technical Environment:**\n\nS&P 500 Technical Status:\n- Current: XXXX\n- vs 50-day MA: [+/-X%]\n- vs 200-day MA: [+/-X%]\n- **Market Trend:** [Bullish/Neutral/Bearish]\n\nVIX Level: [XX.XX]\n- Interpretation: [<15 = Complacency, 15-20 = Normal, 20-25 = Caution, >25 = Fear]\n- Implication: [What this means for risk-taking]\n\n**Technical Regime Confirmation:**\n[Does technical picture support fundamental analyst's Risk-On/Off classification?]\n\n---\n\n**Highest Technical Risk:** [TICKER]\n- Reason: [Overbought/Earnings imminent/Breaking support/etc]\n- Action: [Skip/Reduce/Wait]\n\n**Best Technical Setup:** [TICKER]\n- Reason: [Near support/Healthy pullback/Breakout confirmed/etc]\n- Action: [Full allocation recommended]\n\n**Lowest Conviction (Technical):** [TICKER]\n- Reason: [Choppy/Mixed signals/No edge on timing/etc]\n- Action: [Skip/Wait for clarity]\n\n---\n\n### MODIFIED ALLOCATION RECOMMENDATION\n\nBased on technical analysis overlay:\n\n\\`\\`\\`\nFUNDAMENTAL ANALYST PROPOSED: $XX total\n- [TICKER]: $XX\n- [TICKER]: $XX\n- Cash: $XX\n\nMY TECHNICAL ADJUSTMENT: $XX total\n- [TICKER]: $XX ([Agree/Reduced from $XX/Skip])\n  \u2192 [Reasoning: Good setup / Wait for pullback / etc]\n  \n- [TICKER]: $XX ([Agree/Reduced from $XX/Skip])\n  \u2192 [Reasoning: Overbought / Earnings risk / etc]\n  \n- Cash: $XX ([X%] of capital)\n  \u2192 [Explain if you're holding MORE cash than fundamental analyst]\n\n**Key Changes from Fundamental Allocation:**\n1. [If you reduced/skipped anything, explain why]\n2. [If you suggest different entry timing, explain]\n3. [If you're more/less aggressive, justify]\n\n**Net Effect:**\n- Reduced deployment from $XX to $XX\n- Rationale: [Timing concerns/Entry quality/Risk management]\n\\`\\`\\`\n\n---\n\n### STOP-LOSS SUMMARY TABLE\n\nFor all positions (existing + new buys), provide clear stop levels:\n\n| Ticker | Current Price | Recommended Stop | % Risk | Rationale |\n|--------|---------------|------------------|--------|-----------|\n| TICKER | $XX.XX | $XX.XX | -X% | Below [support level / MA / breakdown point] |\n\n---\n\n### CRITICAL TIMING NOTES\n\n**Immediate Actions Required:**\n- [If any stocks have earnings this week, flag here]\n- [If any positions need stops set urgently]\n\n**This Week's Calendar:**\n- [Monday]: [Any relevant events]\n- [Wednesday]: [Any relevant events]\n- [Friday]: [Any relevant events]\n\n**Watch List for Next Week:**\n- [TICKER]: Wait for [specific condition]\n- [TICKER]: Monitor [specific level or event]\n\n---\n\n### EXECUTION GUIDANCE\n\n**For New Positions:**\n\n[TICKER] - Entry Strategy:\n- If agreeing: \"Execute at market open Monday\" OR \"Set limit order at $XX\"\n- If waiting: \"Set alert at $XX, then limit order\"\n- Stop placement: \"Immediately after fill, set stop at $XX\"\n\n**For Existing Positions:**\n- [Any recommended stop adjustments]\n- [Any suggested trim/add actions based on technical levels]\n\n---\n\n## YOUR CRITICAL MANDATE\n\n**You are the TIMING SPECIALIST and RISK MANAGER.**\n\nYour job is to:\n1. **Prevent poor entries** - Don't buy tops, wait for setups\n2. **Flag binary risks** - Earnings, events that cause gaps\n3. **Ensure proper stops** - Every position needs a technical invalidation level\n4. **Calibrate position sizing** - Reduce size for riskier setups\\n5. **Provide clear entry/exit for \"Watching\" stocks** - Based on technical readiness.\n\n**You have permission to:**\n- Disagree with fundamental analyst if chart says wait\n- Reduce position sizes for timing/risk reasons\n- Suggest waiting for specific levels or conditions\n- Completely skip opportunities if technically flawed\n\n**But also remember:**\n- Perfect entry doesn't exist - good enough is fine\n- Don't over-optimize - analysis paralysis is real\n- In strong uptrends, waiting for \"the perfect pullback\" means missing the move\n- Your job is risk management, not finding reasons to do nothing\n\n**Balance:** Protect against bad timing while allowing participation in good opportunities, and provide actionable technical guidance for \"Watching\" stocks.\n\n---\n\n## FINAL CHECKLIST\n\nBefore submitting analysis:\n\nAll current prices searched and verified\nMoving averages for each stock calculated/found\nRSI and MACD current values researched\nSupport/resistance levels identified from actual price action\nEarnings dates within 14 days explicitly flagged\nRisk/reward calculated for new entries\nStop-loss levels provided for all positions\nClear agreement/disagreement stated for each recommendation\nIf disagreeing with fundamental, alternative action provided\n\nGenerate your technical analysis report.\n`;\n\nreturn [{\n  json: {\n    technicalPrompt: technicalPrompt,\n    fundamentalAnalysis: fundamentalAnalysis,\n    fundamentalUsage: fundamentalUsage,\n    fundamentalSearchCount: searchCount\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "1a62941b-8bda-4fa2-b751-e25b32186eb7",
      "name": "Prepare Claude Synthesis",
      "type": "n8n-nodes-base.code",
      "position": [
        1984,
        160
      ],
      "parameters": {
        "jsCode": "const fundamentalData = $('Claude Stock Analysis - Fundemental').first().json;\nconst technicalData = $('Claude Stock Analysis - Technical').first().json;\n\n// Extract both analyses\nconst fundamentalAnalysis = fundamentalData.content\n  .filter(block => block.type === 'text')\n  .map(block => block.text)\n  .join('\\n\\n');\n\nconst technicalAnalysis = technicalData.content\n  .filter(block => block.type === 'text')\n  .map(block => block.text)\n  .join('\\n\\n');\n\n// Get usage stats\nconst fundamentalSearches = fundamentalData.content.filter(b => b.type === 'tool_use' && b.name === 'web_search').length;\nconst technicalSearches = technicalData.content.filter(b => b.type === 'tool_use' && b.name === 'web_search').length;\n\nconst synthesisPrompt = `You are the Portfolio Manager / Investment Committee Chairman making final allocation decisions.\n\n**YOUR ROLE:** Two analysts have completed their work. You synthesize their insights and make the final allocation decision.\n\n**Current date:** ${new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}\n\n---\n\n# ANALYST REPORT #1: FUNDAMENTAL ANALYSIS\n\n${fundamentalAnalysis}\n\n---\n\n# ANALYST REPORT #2: TECHNICAL ANALYSIS\n\n${technicalAnalysis}\n\n---\n\n# YOUR SYNTHESIS MANDATE\n\nYour job is to:\n1. **Extract key insights** from both analysts (what's most important?)\n2. **Reconcile disagreements** (when they conflict, who's right and why?)\n3. **Calculate combined scores** (using regime-appropriate weighting)\n4. **Make final allocation decisions** (actual dollars, specific actions)\n5. **Create executive summary** (busy investor can act immediately)\n\n---\n\n## DECISION FRAMEWORK\n\n### STEP 1: Extract Market Regime & Weighting\n\nFrom fundamental analysis, identify:\n- **Market Regime:** [RISK-ON / TRANSITIONAL / RISK-OFF]\n- **Recommended deployment range:** [X-Y%]\n\nThis determines your scoring weights:\n\n| Stock Type | Market Regime | Fund Weight | Tech Weight |\n|------------|---------------|-------------|-------------|\n| Growth | Risk-On | 35% | 65% |\n| Growth | Transitional | 45% | 55% |\n| Growth | Risk-Off | 60% | 40% |\n| Value | Risk-On | 55% | 45% |\n| Value | Transitional | 60% | 40% |\n| Value | Risk-Off | 70% | 30% |\n\n**Why this matters:**\n- Growth stocks in bull markets = timing is everything (tech analyst has more say)\n- Value stocks in bear markets = safety is everything (fundamental analyst has more say)\n\n---\n\n### STEP 2: Calculate Combined Scores\n\nFor EACH opportunity (existing holdings + new buys + **watching stocks**):\n\n**A. Identify Stock Type:**\n- From fundamental analysis: Is this [Value / Growth-Momentum]?\n\n**B. Select Appropriate Weights:**\n- Look up weights in table above based on stock type + market regime\n\n**C. Calculate:**\n\n\\`\\`\\`\nCombined Score = (Fundamental Score \u00d7 Fund Weight) + (Technical Score \u00d7 Tech Weight)\n\\`\\`\\`\n\n**D. Round to 1 decimal place**\n\n**E. Create scoring table:**\n\n| Ticker | Type | Fund Score | Tech Score | Fund Weight | Tech Weight | Combined Score |\n|--------|------|-----------|-----------|-------------|-------------|----------------|\n| TICKER | Growth/Value | X.X/10 | X.X/10 | XX% | XX% | X.X/10 |\n\n---\n\n### STEP 3: Decision Categories & Binary Event Framework\n\nBased on combined score AND analyst agreement:\n\n**\u2705 STRONG BUY** (Deploy full recommended allocation)\n\nCriteria:\n- Combined score \u2265 6.0 (Risk-On), \u22656.5 (Transitional), or \u22657.0 (Risk-Off)\n- Both analysts support the opportunity\n- No major timing issues OR binary event risk is acceptable\n\nAction: Proceed with allocation\n\n---\n\n**\ud83c\udfaf BINARY EVENT SPECIAL CASE** (Earnings, FDA, legal decisions within 3 days)\n\nWhen you see:\n- Strong combined score (\u22656.5)\n- \ud83d\udea8\ud83d\udea8\ud83d\udea8 BINARY EVENT flag from technical analyst\n\nThis is NOT automatically a \"skip\" - it's a **position sizing decision:**\n\n**Decision Framework:**\n\n**IF NO EXISTING POSITION:**\n- Option A: Skip this week, revisit post-event (conservative)\n- Option B: Enter 25-50% of normal size (accept binary risk for upside)\n- **Key question:** \"Do we want exposure to this strong opportunity through the event?\"\n\n**IF SMALL EXISTING POSITION (<2% of portfolio):**\n- Calculate actual risk: Position $ \u00d7 Implied Move %\n- If risk < $50 or <0.5% portfolio: **HOLD THROUGH** (too small to hedge)\n- Don't add before event, but don't force-sell either\n- Set post-event strategy for adding/trimming\n\n**IF MEDIUM POSITION (2-5% of portfolio):**\n- **TRIM to 2%** before event (lock some gains, reduce risk)\n- Hold remaining through event\n- Post-event: Reassess and potentially add back\n\n**IF LARGE POSITION (>5% of portfolio):**\n- **TRIM to 2-3%** before event (risk management)\n- Protect capital while maintaining exposure\n\n**Example Application (PLTR scenario):**\n- Combined score: 8.6/10 (strong fundamentals + strong chart)\n- Binary event: Earnings today \u00b110% move\n- Position: $103 = 1% of portfolio\n- Actual risk: $103 \u00d7 10% = $10 = 0.1% portfolio\n- **Decision:** HOLD $103 through earnings (risk negligible)\n- **New capital:** $0 (don't add before binary)\n- **Post-earnings:** Deploy $30-40 if beats & raises\n\n**The Point:** \n- Score of 8.6/10 means \"strong opportunity\"\n- Binary event means \"position size appropriately\"\n- NOT \"hold 100% cash because something is happening\"\n\n\n---\n\n**\u26a0\ufe0f CONDITIONAL BUY** (Reduce size OR wait for condition)\n\nCriteria:\n- Combined score in \"maybe\" zone (5.5-6.5 depending on regime)\n- OR one analyst enthusiastic, other cautious\n- OR good opportunity but poor timing (overbought, near earnings, etc)\n\nAction Options:\nA. **Reduce Size:** Enter 50% now, 50% later if [condition]\nB. **Set Alert:** Wait for [price level / post-earnings / technical condition]\nC. **Skip This Week:** Opportunity exists but timing isn't right, revisit next week\n\n---\n\n**\u274c SKIP** (Do not deploy capital)\n\nCriteria:\n- Combined score below threshold\n- Both analysts skeptical or major disagreement\n- Critical risk flags (earnings tomorrow, breaking support, thesis deteriorating)\n\nAction: Explicitly pass, explain why\n\n---\n\n**\ud83c\udfe6 WATCHING STOCK - Buy/Keep Watching/Stop Watching**\\n\\n[For stocks currently being watched]\\n\\n**Current Status:**\\n- Watching since: [Date]\\n- Price at watch start: $XX.XX\\n- Current Price: $XX.XX\\n- **Change since watch start: +/-XX%**\\n- Combined score: X.X/10\\n\\n**Action:** [BUY (Allocation $XX) / KEEP WATCHING / STOP WATCHING]\\n\\n**Rationale:**\\n[Explain why we are converting to buy, continuing to watch, or dropping]\\n\\n---\\n\\n**\ud83c\udfe6 EXISTING POSITION MANAGEMENT** (Different rules than new buys)\n\nFor current holdings, evaluate:\n\nA. **Position Context:**\n- Days held: [X days]\n- Entry price: $XX.XX\n- Current price: $XX.XX\n- **P&L: +/-X%** \u2190 This is critical context\n\nB. **Decision Logic:**\n\nIF P&L < 0 (losing position):\n- Combined score \u22656.0: Hold with stop-loss (thesis intact, just poor timing)\n- Combined score <6.0: Consider cutting loss (thesis deteriorating)\n\nIF P&L 0-10% (small gain/scratch):\n- Don't recommend \"taking profits\" (there are no meaningful profits)\n- Treat like new position: Hold if score \u22656.0\n\nIF P&L 10-25% (moderate gain):\n- Combined score \u22657.0: Hold all (winning, thesis intact)\n- Combined score 5-7: Hold all but set trailing stop\n- Combined score <5.0: Trim 25-50% (lock some gains)\n\nIF P&L > 25% (significant gain):\n- Combined score \u22657.0: Hold but consider trailing stop\n- Combined score 5-7: Trim 30-50% (risk management)\n- Combined score <5.0: Trim 50-75% (thesis weakening, protect gains)\n\nIF Binary Risk Imminent (Earnings in <3 days):\n- P&L >20%: Strongly consider trimming 50%+ regardless of score\n- P&L <10%: Hold through if conviction high, otherwise trim 25%\n\nC. **Stop-Loss Assignment:**\n- Every position needs a stop (from technical analyst)\n- Adjust stop based on P&L:\n  * Losing positions: Tighter stops (limit further damage)\n  * Small gains: Normal stops (technical levels)\n  * Large gains: Trailing stops (protect profits)\n\n---\n\n### STEP 4: Allocation Reconciliation\n\n**Starting Point:**\n- Fundamental analyst recommended: $XX deployed\n- Technical analyst recommended: $XX deployed\n\n**When They Disagree:**\n\nIF Technical < Fundamental (Technical analyst more conservative):\n- Usually means: Timing concerns, overbought, earnings risk\n- **Your call:** Favor technical when timing/risk issues are specific and concrete\n- Exception: In strong Risk-On markets, sometimes you accept timing imperfection\n\nIF Fundamental < Technical (Fundamental analyst more conservative):\n- Usually means: Valuation concerns, weak thesis, better opportunities elsewhere\n- **Your call:** Favor fundamental unless technical setup is truly exceptional\n- Exception: In momentum markets, sometimes you ride the technicals\n\n**Resolution Process:**\n1. For each stock, review both analyst recommendations\n2. Identify specific disagreement (size? timing? skip vs buy?)\n3. Determine which concern is more critical\n4. Make final call with explicit reasoning\n\n---\n\n### STEP 5: Portfolio Construction\n\n**Diversification Check:**\n- Sector exposure: No more than 60% in one sector (unless exceptional conviction)\n- Single position sizing: No more than 40% of weekly capital in one stock\n- Correlation: If two stocks highly correlated, reduce total exposure\n\n**Cash Allocation Philosophy:**\n\nThe question is NOT \"should I deploy 100%?\" \n\nThe question is \"given opportunities and risks, what's the optimal allocation?\"\n\n**Deployment Targets by Regime:**\n- Risk-On: 70-100% deployed (default: participate in bull market)\n- Transitional: 50-70% deployed (balanced)\n- Risk-Off: 30-50% deployed (defensive, preserve capital)\n\n**When to hold MORE cash than target:**\n- No opportunities meet combined score thresholds\n- Multiple binary events this week (many earnings)\n- Market at major resistance with momentum weakening\n- Better opportunities likely soon (post-earnings, after pullback)\n\n**When to hold LESS cash than target (be MORE aggressive):**\n- Multiple Strong Buy opportunities (7+ combined scores)\n- Market breakout with momentum accelerating\n- Regime just shifted Risk-On and catch-up likely\n- You've been overly cautious recently and missing rally\n\n**Opportunity Cost:**\nIf holding >50% cash while S&P up >15% YTD, you must justify:\n- Specific risk being avoided\n- Specific entry condition being awaited  \n- Why defensive posture warranted\n\n---\n\n## OUTPUT FORMAT\n\n### \ud83d\udcca EXECUTIVE SUMMARY (Top of Report)\n\n**Investment Committee Final Decision**\n**[Day, Month Date, Year - Time]**\n\n---\n\n**Market Environment:** [RISK-ON / TRANSITIONAL / RISK-OFF]\n**Investment Posture:** [AGGRESSIVE / BALANCED / DEFENSIVE]\n\n**Final Allocation: $XX of $100 deployed (XX% cash)**\n\n**Top Recommendations:**\n1. [TICKER] - $XX allocation - [One-line action: Buy/Hold/Trim + key reason]\n2. [TICKER] - $XX allocation - [One-line action: Buy/Hold/Trim + key reason]\n3. [If 3+ recommendations]\n\n**Held Cash: $XX** - [One-sentence reason if >30%]\n\n**Key Takeaways:**\n- [Most important insight from fundamental analysis]\n- [Most important insight from technical analysis]\n- [Biggest risk this week]\n- [Best opportunity if any, or why we're mostly cash]\n\n---\n\n### \ud83d\udccb FINAL ALLOCATION TABLE\n\n| Ticker | Fundamental | Technical | Combined | Decision | Allocation | Entry Target | Stop-Loss |\n|--------|-------------|-----------|----------|----------|------------|--------------|-----------|\n| TICKER | X.X/10 | X.X/10 | X.X/10 | \u2705/\u26a0\ufe0f/\u274c | $XX | $XX.XX | $XX.XX |\n| TICKER | X.X/10 | X.X/10 | X.X/10 | \u2705/\u26a0\ufe0f/\u274c | $XX | $XX.XX | $XX.XX |\n| CASH | N/A | N/A | N/A | - | $XX | N/A | N/A |\n\n**Scoring Legend:**\n- Combined Score = (Fund Score \u00d7 Weight) + (Tech Score \u00d7 Weight)\n- Weights determined by stock type + market regime\n- \u2705 Strong Buy: Score meets regime threshold + analyst agreement\n- \u26a0\ufe0f Conditional: Score borderline OR timing concerns\n- \u274c Skip: Score below threshold OR critical issues\n\n---\n\n### \ud83d\udea8 CRITICAL IMMEDIATE ACTIONS REQUIRED\n\n**URGENT Actions (Today/Tomorrow):**\n- [If any position has earnings imminent, call it out]\n- [If any stop-loss needs to be set immediately]\n- [If any trim needed before market close]\n\n**Example:**\n\\`\\`\\`\nURGENT: PLTR Decision Deadline - 4:00 PM TODAY\n\nCurrent Position: 0.507 shares worth $103.94\nRecommended Action: TRIM 50% IMMEDIATELY\n\nRationale:\n- Earnings CONFIRMED for TODAY after market close\n- Expected 10%+ volatility swing\n- Position only up 2% (minimal profit to protect)\n- Technical analyst flags extreme overbought (RSI 78)\n\nExecution Plan:\n- SELL 0.254 shares (50%) before 4:00 PM ET\n- Expected proceeds: ~$52\n- Set stop-loss on remaining 0.253 shares at $190 (-7.5%)\n\\`\\`\\`\n\n---\n\n### \ud83d\udcdd DETAILED POSITION ANALYSIS\n\nFor EACH position (existing holdings + new buys), provide this format:\n\n---\n\n**[TICKER] - [Company Name]** - Decision: [BUY / HOLD / TRIM / EXIT]\n\n**Decision Category:** [\u2705 Strong Buy / \u26a0\ufe0f Conditional / \u274c Skip / \ud83c\udfe6 Existing Position]\n\n---\n\n**Position Context:** [If existing holding]\n- Entry: $XX.XX on [Date] ([X days ago])\n- Current: $XX.XX\n- Shares: X.XXXX (fractional calculation if applicable)\n- **P&L: +/-XX%** (Gained/Lost $XX.XX)\n- Score: X.X/10 combined\n\n[Skip this section for new buy recommendations]\n\n---\n\n**Fundamental Case (Score: X.X/10):**\n\n[2-3 sentence summary of fundamental analyst's thesis]\n- Key strength: [Specific fundamental positive]\n- Key concern: [Specific fundamental risk if any]\n\n---\n\n**Technical Assessment (Score: X.X/10):**\n\n[2-3 sentence summary of technical analyst's evaluation]\n- Chart setup: [Bullish/Neutral/Bearish + why]\n- Entry quality: [Good/Moderate/Poor + specific reason]\n- Timing risk: [Any earnings or events]\n\n---\n\n**Synthesis & Final Decision:**\n\n**Combined Score:** X.X/10\n- Calculation: (Fund X.X \u00d7 XX%) + (Tech X.X \u00d7 XX%) = X.X\n- [Stock type: Growth/Value] in [Market regime: Risk-On/etc] = [XX/XX weight split]\n\n**Analyst Agreement:**\n[\u2705 Both agree] / [\u26a0\ufe0f Some disagreement] / [\u274c Major disagreement]\n\n**Binary Event Check:**\n[If earnings/FDA/legal within 3 days:]\n- \ud83d\udea8\ud83d\udea8\ud83d\udea8 BINARY EVENT: [Earnings/FDA/etc] on [date]\n- Implied move: \u00b1[X%] (= \u00b1$[X] on current position)\n- Existing position: $[X] ([X%] of portfolio)\n- Actual risk exposure: $[X] ([X%] of portfolio)\n\n**Position Sizing Rationale:**\n[Based on risk exposure, explain hold/trim/skip decision]\n\n[If no binary event:]\n- \u2705 No imminent binary events\n- Normal position sizing applies\n\n**Specific disagreements:**\n- Fundamental says: [Summary if they differ]\n- Technical says: [Summary if they differ]\n- **My resolution:** [Who's right and why, OR compromise position]\n\n**My Final Decision:**\n\n[Choose one framework:]\n\n**\u2705 STRONG BUY - Proceed with Full Allocation**\n\nCombined score of X.X meets threshold for [regime]. Both analysts support opportunity (or disagree only on minor details). No critical timing risks.\n\n**Action Plan:**\n- **Buy Amount:** $XX\n- **Shares:** X.XXXX (fractional)\n- **Entry:** [Market order Monday / Limit at $XX / Wait for $XX then buy]\n- **Stop-Loss:** $XX.XX (-X% from entry, below [technical level])\n- **Rationale:** [Why this size, why this stock, what's the edge]\n\n**Monitoring:**\n- Watch: [Specific levels, events, indicators]\n- Add more if: [Condition for scaling in]\n- Exit if: [Condition for thesis invalidation]\n\n---\n\n**\u26a0\ufe0f CONDITIONAL BUY - Modified Allocation**\n\nCombined score of X.X is borderline. Good opportunity but [specific concern: timing/valuation/risk].\n\n**Action Plan:**\n\n[Choose one option:]\n\n**OPTION A: Reduced Size**\n- Enter $XX (50% of full allocation) now\n- Reserve $XX for [specific condition: pullback to $XX / post-earnings / etc]\n- Stop-Loss: $XX.XX (tighter due to uncertainty)\n\n**OPTION B: Set Alert & Wait**\n- Do not enter this week\n- Set price alert at $XX.XX ([technical level])\n- If triggered + [confirming condition]: Enter $XX\n- Benefit: Better risk/reward\n\n**OPTION C: Skip This Week**\n- Opportunity exists but timing wrong\n- Revisit next week after [earnings / pullback / consolidation]\n\n**My Recommendation:** [Choose A, B, or C]\n\n**Why:** [Explain specific reasoning for your choice]\n\n---\n\n**\u274c SKIP - Not Deploying Capital**\n\nCombined score of X.X below threshold. [Specific reason: weak fundamentals / technical breakdown / both analysts skeptical].\n\n**Why Passing:**\n1. [Specific issue #1]\n2. [Specific issue #2]\n3. [Specific issue #3]\n\n**What Would Change Mind:**\n- [Specific condition that would make this interesting]\n\n**Capital Allocation:**\n- $XX intended for this stock \u2192 [Reallocated to cash / spread among other picks]\n\n---\n\n**\ud83c\udfe6 EXISTING POSITION - Hold/Trim/Add**\n\n[For existing holdings only]\n\n**Current Status:**\n- P&L: +/-XX% ($XX gained/lost)\n- Days held: XX ([New <30 / Established 30-90 / Long-term >90])\n- Combined score: X.X/10\n\n**Action:** [HOLD / TRIM XX% / ADD $XX / EXIT]\n\n**Rationale:**\n\n[IF HOLD:]\n\"Position up +XX% with combined score of X.X. Thesis intact, no reason to trim. Set stop-loss at $XX to protect gains.\"\n\n[IF TRIM:]\n\"Position up +XX% but score dropped to X.X due to [specific reason]. Recommend trimming XX% to lock gains while maintaining exposure. If [condition improves], can re-add.\"\n\n[IF ADD:]\n\"Position down -XX% but combined score improved to X.X due to [specific positive development]. Consider average down with $XX if conviction is strong.\"\n\n[IF EXIT:]\n\"Position [down -XX% / up +XX%] but score dropped to X.X. Thesis deteriorating: [specific reason]. Cut loss / Take profits before further damage.\"\n\n**Risk Management:**\n- Current stop: $XX.XX\n- [If recommending adjustment]: \"Move stop to $XX.XX because [trailing profits / technical level changed / risk increasing]\"\n\n---\n\n[Repeat above format for each stock]\n\n---\n\n### \ud83d\udcb0 CASH MANAGEMENT STRATEGY\n\n**Total Cash Held: $XX (XX%)**\n\n**Breakdown:**\n- Started with: $100\n- Allocated to new buys: $XX\n- Proceeds from trims: $XX\n- **Remaining Cash: $XX**\n\n**Rationale for Cash Level:**\n\n[IF Holding >50% Cash:]\n\n\"We're holding $XX (XX%) in cash this week because:\n\n1. **Opportunity Quality:** [Only X stocks scored above threshold / Weak overall opportunities]\n2. **Market Regime:** [Market is Risk-Off / Transitional with elevated risk]\n3. **Timing Concerns:** [Multiple stocks have earnings / Technical setups poor / Waiting for pullback]\n4. **Risk Management:** [Existing positions already provide market exposure]\n\nThis is NOT failure to deploy - it's actively choosing capital preservation when risk/reward is unfavorable.\n\n**Cash Deployment Criteria:**\nWe'll deploy this cash when:\n- [Specific condition #1: e.g., \"Market pulls back to S&P 500 support at 5800\"]\n- [Specific condition #2: e.g., \"PLTR pulls back to $180 post-earnings with score >7\"]\n- [Specific condition #3: e.g., \"VIX spike creates buying opportunity\"]\n\n**Opportunity Cost Context:**\n- S&P 500 YTD: +XX%\n- Our portfolio YTD: +XX% [if calculable from data]\n- We're willing to miss some upside to avoid [specific downside risk]\"\n\n---\n\n[IF Holding 30-50% Cash:]\n\n\"Balanced positioning with $XX (XX%) cash. We found [X] opportunities worth deploying $XX, but maintaining dry powder for:\n- [Reason #1]\n- [Reason #2]\"\n\n---\n\n[IF Holding <30% Cash:]\n\n\"Aggressive deployment with $XX (XX%) cash. Market regime is [Risk-On], we found [X] Strong Buy opportunities with combined scores >X.X, and sitting in cash would mean missing the rally. Remaining cash for emergencies only.\"\n\n---\n\n### \u26a1 IMMEDIATE ACTION CHECKLIST\n\n**TODAY (Before Market Close):**\n[ ] [If any urgent trims needed - e.g., earnings today]\n[ ] [If any stop-loss alerts to set]\n\n**THIS WEEK:**\n[ ] [If any new buys to execute]\n[ ] [If any price alerts to set for conditional buys]\n[ ] [If any earnings to monitor]\n\n**NEXT 2 WEEKS:**\n[ ] [Any upcoming events that require review]\n[ ] [Any conditional buys to reassess]\n\n**Example:**\n\\`\\`\\`\nTODAY (Before 4:00 PM ET):\n[ ] PLTR: Trim 50% (0.254 shares) - URGENT earnings today\n[ ] Set stop-loss alert: INTC at $35.00\n\nMONDAY MORNING:\n[ ] Buy MSFT: $30 market order (0.XXX shares)\n[ ] Set stop-loss: MSFT at $XXX.XX immediately after fill\n\nTHIS WEEK:\n[ ] Tuesday: PLTR earnings results - reassess remaining position\n[ ] Friday: Review INTC if approaches stop level\n\nNEXT WEEK:\n[ ] Re-screen for opportunities if cash deployment <50%\n[ ] Check if any conditional buys triggered\n\\`\\`\\`\n\n---\n\n### \ud83c\udfaf SUCCESS METRICS & REVIEW TRIGGERS\n\n**How to Measure This Decision:**\n\n1. **Entry Execution:** Did we get fills within X% of target prices?\n2. **Stop Discipline:** If stops hit, did we actually exit?\n3. **Performance:** Portfolio return vs S&P 500 over next [7/30] days\n4. **Opportunity Cost:** If held significant cash, was it justified by risk avoided?\n\n**Decision Review Triggers:**\n\n**Immediate (This Week):**\n- Any position drops below stop-loss\n- Any earnings result materially different from expectations\n- Market regime shift (VIX spike >25 or crash <12)\n\n**Short-term (Next 2 Weeks):**\n- Reassess any \"Conditional Buy\" setups\n- Review if deployed <50% capital - did opportunities improve?\n- Check if any stopped positions re-enter per technical setups\n\n**Monthly:**\n- Portfolio return vs S&P 500 benchmark\n- Hit rate on recommendations (what % worked?)\n- Average hold time (are we overtrading?)\n\n---\n\n### \ud83d\udd0d PORTFOLIO MANAGER'S FINAL REASONING\n\n**Why These Decisions:**\n\n[This section is YOUR voice explaining your synthesis logic]\n\n**On Analyst Disagreements:**\n\"[Fundamental / Technical] analyst recommended [X], but I'm going with [Y] because [specific reasoning]. While [acknowledge the other view], I believe [your resolution] is the right call because [concrete reason].\"\n\n**On Overall Allocation:**\n\"We're deploying $XX (XX%) this week, which is [more aggressive / in line with / more conservative than] our [regime] target of [XX-XX%]. This is because [specific reasoning about opportunity quality, risk factors, or market conditions].\"\n\n**On Cash Position:**\n[If holding significant cash]\n\"I'm comfortable with $XX in cash despite [fundamental/technical] analyst wanting more deployed because:\n1. [Specific reason #1 - e.g., \"3 of 4 recommended stocks have earnings this week\"]\n2. [Specific reason #2 - e.g., \"Market at resistance, better entries likely soon\"]  \n3. [Specific reason #3 - e.g., \"Quality bar is opportunity cost - better to wait than force\"]\n\nCash is not the enemy of returns - poor entries are.\"\n\n[If very aggressive]\n\"I'm deploying $XX (XX%) which is above target because [specific reasoning about exceptional opportunities or market setup]. Yes, this is aggressive, but [justify the risk-taking given the specific context].\"\n\n**On Position Management:**\n[If trimming a winner]\n\"We're trimming [X%] of [TICKER] despite [positive factors] because [specific risk management logic]. With +XX% gains and [specific risk], locking some profits is prudent while maintaining [X%] exposure.\"\n\n[If holding a loser]\n\"We're holding [TICKER] despite -XX% loss because [specific reason thesis still intact]. Stop-loss at $XX.XX ensures we'll cut if [specific invalidation occurs].\"\n\n**The Real Alpha:**\n\"This week's value-add is [not deploying / deploying / risk management / timing optimization] because [explain what you protected against or captured that a passive approach would miss].\"\n\n**What I'm Watching:**\n\"Key developments to monitor:\n1. [Specific event or level]\n2. [Specific event or level]\n3. [Specific event or level]\n\nIf [X] happens, we'll [specific action]. If [Y] happens, we'll [specific action].\"\n\n---\n\n**Decision Finalized:** [Day, Month Date, Year, Time]\n\n**Next Review:** [Specific trigger or date]\n\n**Investment Committee Vote:** [Unanimous / Majority / etc - you can have fun with this]\n\n---\n\n## YOUR CRITICAL MANDATE\n\n**You are the decision-maker. The analysts provide input, but YOU decide.**\n\n**Your job:**\n- Synthesize conflicting views with clear logic\n- Make allocation decisions you can defend\n- Balance opportunity vs risk\n- Explain your reasoning (especially when overriding analysts)\n\n**You have permission to:**\n- Override analysts when their reasoning is flawed\n- Be more aggressive than both if opportunities are exceptional\n- Be more conservative than both if risks are acute\n- Make uncomfortable decisions (trim winners, hold losers if thesis intact)\n\n**Remember:**\n- Quality over quantity - one great idea beats three mediocre ones\n- Cash is a position - but so is missing the rally\n- Risk management matters - but so does opportunity capture\n- Your fiduciary duty is optimal returns, not perfect entries\n\n**The Standard:**\nCould you explain this allocation to an investor and defend every decision with specific logic? If not, revise until you can.\n\n---\n\n## FINAL CHECKLIST\n\nBefore submitting final decision:\n\n\u2705 Combined scores calculated correctly with regime-appropriate weights\n\u2705 Every allocation decision has specific rationale\n\u2705 All disagreements between analysts resolved explicitly\n\u2705 Cash position justified if >30%\n\u2705 Stop-losses assigned to all positions\n\u2705 Urgent actions (earnings today, etc) clearly flagged\n\u2705 Fractional shares for existing positions calculated correctly\n\u2705 P&L context considered for existing positions (not recommending \"profit-taking\" on 2% gains)\n\u2705 Executive summary is actionable (investor can act without reading full report)\n\u2705 Your personal reasoning provided (not just summarizing analysts)\n\nGenerate your Investment Committee final decision report.\n`;\n\nreturn [{\n  json: {\n    synthesisPrompt: synthesisPrompt,\n    fundamentalAnalysis: fundamentalAnalysis,\n    technicalAnalysis: technicalAnalysis,\n    metadata: {\n      fundamentalSearches: fundamentalSearches,\n      technicalSearches: technicalSearches,\n      fundamentalUsage: fundamentalData.usage,\n      technicalUsage: technicalData.usage\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "eb47abda-02d3-4230-93be-af2f1b790caf",
      "name": "Claude Stock Analysis - Technical",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1808,
        160
      ],
      "parameters": {
        "url": "https://api.anthropic.com/v1/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"claude-sonnet-4-5-20250929\",\n  \"max_tokens\": 20000,\n  \"temperature\": 0.3,\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": {{ JSON.stringify($json.technicalPrompt) }}\n    }\n  ],\n  \"tools\": [\n    {\n      \"type\": \"web_search_20250305\",\n      \"name\": \"web_search\",\n      \"max_uses\": 20\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "YOUR_AUTHENTICATION_ID",
        "headerParameters": {
          "parameters": [
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4
    },
    {
      "id": "76df1c46-2156-4dda-b5ec-afd7679fce4e",
      "name": "Claude Synthesis Analysis",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2208,
        160
      ],
      "parameters": {
        "url": "https://api.anthropic.com/v1/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"claude-sonnet-4-20250514\",\n  \"max_tokens\": 15000,\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": {{ JSON.stringify($json.synthesisPrompt) }}\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "YOUR_AUTHENTICATION_ID",
        "headerParameters": {
          "parameters": [
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4
    },
    {
      "id": "3efad71e-5a45-4cc6-bd95-c5eea601d226",
      "name": "Format Synthesis Email",
      "type": "n8n-nodes-base.code",
      "position": [
        2448,
        160
      ],
      "parameters": {
        "jsCode": "user@example.com"
      },
      "typeVersion": 2
    },
    {
      "id": "5b30f560-0db2-45f7-aabb-aa48946c7b32",
      "name": "Build Claude Prompt- Fundemental",
      "type": "n8n-nodes-base.code",
      "position": [
        1200,
        160
      ],
      "parameters": {
        "jsCode": "// Get the processed data from Prepare Data node\nconst data = $input.first().json;\n\nconst stocks = data.stocks\n  .filter(item => item.type === 'stock')\n  .map(item => {\n    const shareDisplay = item.isFractional ? `${item.sharesOwned.toFixed(3)} shares` : `${Math.floor(item.sharesOwned)} shares`;\n    return `${item.ticker} (${item.name}): ${shareDisplay} - Invested $${item.amountSpent} on ${item.buyDate} at $${item.priceAtPurchase}/share${item.isFractional ? ' (fractional)' : ''}`;\n  })\n  .join('\\n');\n\nconst watchingStocks = data.stocks\n  .filter(item => item.type === 'watching')\n  .map(item => {\n    return `${item.ticker} (${item.name}): Watching since ${item.watchDate} at $${item.watchPrice}/share`;\n  })\n  .join('\\n');\n\nconst prompt = `You are a systematic fundamental analyst. Current date: ${new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}.\n\n**CRITICAL SEARCH REQUIREMENTS:**\nYou MUST use web_search tool before making ANY claims about:\n- Current stock prices (search each ticker individually)\n- Analyst ratings/targets (search \"[TICKER] analyst ratings\")\n- Earnings dates (search \"[TICKER] earnings date\")\n- VIX level (search \"VIX current level\")\n- Fed policy (search \"Federal Reserve latest decision\")\n- Sector performance (search \"sector performance this week\")\n\n**ANTI-HALLUCINATION RULES:**\n1. If you cannot find data via search, say \"Unable to verify [X] via web search\"\n2. NEVER estimate or assume current prices - you MUST search\n3. If search results are unclear, acknowledge uncertainty\n4. Cite specific sources for major claims (analyst targets, earnings dates)\n5. If you find conflicting data, present both sources and note the conflict\n\n**DATA FRESHNESS CHECK:**\nBefore providing recommendations, verify:\n- All prices are from within last 24 hours\n- Analyst data is from within last 30 days\n- Earnings dates are explicitly stated (not assumed from quarterly patterns)\n- Fed policy reflects most recent FOMC meeting\n\n---\n\n# CURRENT PORTFOLIO\n\n## \ud83d\udcb0 CASH POSITION\n**Available Cash:** $${data.availableCash}\n\n## \ud83d\udcca STOCK HOLDINGS\n${stocks.length > 0 ? stocks : 'No current stock holdings.'}\n\n## \ud83d\udc40 STOCKS I'M WATCHING (No Buy Yet)\n${watchingStocks.length > 0 ? watchingStocks : 'No stocks currently being watched.'}\n\n## \ud83d\udcbc PORTFOLIO SUMMARY\n- **Total Invested in Stocks:** $${data.totalInvested}\n- **Available Cash:** $${data.availableCash}\n- **Total Portfolio Value:** $${data.totalPortfolioValue}\n- **Cash Allocation:** ${((data.availableCash / data.totalPortfolioValue) * 100).toFixed(1)}%\n\n**PORTFOLIO INTERPRETATION RULES:**\n\n1. **Cash Management Context:**\n   - Available cash: $${data.availableCash} ready for deployment\n   - Current cash allocation: ${((data.availableCash / data.totalPortfolioValue) * 100).toFixed(1)}%\n   - This cash represents opportunity for new positions or adding to existing ones\n\n2. **Fractional Shares:** The \"Fractional?\" column indicates if this is a fractional share position\n   - If checked: The \"Buy In Price\" is the TOTAL INVESTMENT AMOUNT (not price per share)\n   - If unchecked: The \"Buy In Price\" is the actual price per share\n   \n3. **Position P&L Calculation:**\n   - IF Fractional = TRUE:\n     * Number of shares = (Buy In Price) / (Price at time of purchase)\n     * Current value = (Number of shares) \u00d7 (Current market price)\n     * P&L = (Current value - Buy In Price) / (Buy In Price)\n   - IF Fractional = FALSE:\n     * Assume 1 share\n     * Current value = Current market price\n     * P&L = (Current market price - Buy In Price) / (Buy In Price)\n\n4. **Days Held:** Calculate from \"Buy In Date\" to today\n   - <7 days = Very new position\n   - 7-30 days = New position  \n   - 30-90 days = Established position\n   - >90 days = Long-term hold\n\n**CRITICAL:** Always calculate and report actual P&L for context. Don't recommend \"taking profits\" on positions with <10% gains.\n\n---\n\n# YOUR ANALYTICAL MANDATE - DUAL FOCUS APPROACH\n\nYou are the FUNDAMENTAL & MACRO analyst with TWO EQUAL PRIORITIES:\n\n**PRIORITY 1: DISCOVER NEW INVESTMENT OPPORTUNITIES** - You must actively search for and evaluate stocks NOT in the current portfolio or watching list: ${data.stocks.map(s => s.ticker).join(', ')}\n\n**PRIORITY 2: EVALUATE EXISTING HOLDINGS & WATCHING STOCKS** - Analyze current positions for potential adjustments AND evaluate watching stocks for potential entry or removal from watch list.\n\n**CRITICAL:** Both new opportunities, existing position analysis, and watching stock analysis must receive equal weight in your final recommendations.\n\n## REQUIRED RESEARCH SEQUENCE\n\n### STEP 0: MARKET REGIME CLASSIFICATION\n\nBefore analyzing individual stocks, establish the market environment:\n\n**Search and determine:**\n1. **S&P 500 Technical Position:**\n   - Current S&P 500 level\n   - Distance from 50-day MA (bullish if >3%)\n   - Distance from 200-day MA (bullish if >8%)\n   - Search: \"S&P 500 moving averages\"\n\n2. **Volatility & Sentiment:**\n   - VIX current level (search \"VIX level today\")\n   - Interpretation: <15 = Greed/Complacent, 15-20 = Neutral, 20-25 = Caution, >25 = Fear\n\n3. **Sector Leadership:**\n   - Last 5 days sector performance (search \"sector performance this week\")\n   - Growth sectors (Tech, Discretionary) leading = Risk-On\n   - Defensive sectors (Staples, Utilities) leading = Risk-Off\n\n4. **Fed Policy Stance:**\n   - Latest Fed decision (search \"Federal Reserve latest decision\")\n   - Rate direction: Cutting = Dovish, Pausing = Neutral, Hiking = Hawkish\n\n**REGIME CLASSIFICATION OUTPUT:**\n\n\\`\\`\\`\nMARKET REGIME: [RISK-ON / TRANSITIONAL / RISK-OFF]\n\nEvidence:\n- S&P 500: [Above/Below] 50-day MA by X%\n- VIX: X.XX ([Greed/Neutral/Fear])\n- Sector Leadership: [Growth/Mixed/Defensive]\n- Fed Stance: [Dovish/Neutral/Hawkish]\n\nInvestment Implications:\n- [For Risk-On: Favor growth, deploy 70-100% of capital, lower score thresholds]\n- [For Transitional: Balanced approach, 50-70% deployment, moderate thresholds]\n- [For Risk-Off: Defensive positioning, 30-50% deployment, higher quality bar]\n\\`\\`\\`\n\n---\n\n### STEP 1: NEW OPPORTUNITY DISCOVERY (MANDATORY)\n\nBefore analyzing existing holdings, you MUST search for new investment opportunities:\n\n**Required Searches (perform ALL of these):**\n1. Search \"best performing sectors 2024\" - identify missing sectors\n2. Search \"stocks breaking out new highs this week\" - momentum plays\n3. Search \"analyst upgrades past 7 days\" - newly recommended stocks  \n4. Search \"undervalued stocks strong earnings growth\" - value opportunities\n5. Based on market regime:\n   - Risk-On: Search \"AI stocks earnings growth\", \"growth technology leaders\"\n   - Risk-Off: Search \"dividend aristocrats\", \"defensive consumer staples\"\n\n**For EVERY viable new stock found:**\n- Search \"[TICKER] current price analyst target\"\n- Search \"[TICKER] earnings growth rate\"  \n- Score using same 1-10 framework\n- Calculate recommended position size from $${data.availableCash}\n\n**NEW STOCK EVALUATION TEMPLATE:**\nFor each new opportunity, provide:\n- Ticker & Company Name\n- Current Price & Analyst Target\n- Growth Rate & Key Metrics\n- Fundamental Score (1-10)\n- Recommended Investment: $X from available $${data.availableCash} (fractional shares: X.XXX shares)\n- Portfolio Fit Rationale\n\n**WATCHING STOCK EVALUATION TEMPLATE:**\nFor each stock being watched, provide:\n- Ticker & Company Name\n- Current Price & Analyst Target\n- Growth Rate & Key Metrics\n- Fundamental Score (1-10)\n- Recommendation: BUY (with allocation), KEEP WATCHING (with rationale), or STOP WATCHING (with rationale)\n- Portfolio Fit Rationale\n\n**FRACTIONAL SHARE REQUIREMENTS:**\n- Calculate exact fractional shares: Dollar amount \u00f7 Current stock price = X.XXX shares\n- For high-priced stocks (>$100), specify fractional share amounts (e.g., \"Buy $25 = 0.156 shares of NVDA at $160/share\")\n- Always show both dollar amount AND resulting fractional share quantity\n- Never recommend \"buy 1 share\" of expensive stocks over $200 - use dollar-based fractional investing\n\n**MINIMUM REQUIREMENT:** Evaluate at least 3-5 new stocks AND all watching stocks before analyzing existing holdings.\n\n---\n\n### STEP 2: ALLOCATION FRAMEWORK\n\n**Budget:** $${data.availableCash} available (cash position from account)\n\n**REGIME-ADJUSTED DEPLOYMENT TARGETS:**\n\n| Market Regime | Quality Threshold | Deployment Target | Cash Target | Philosophy |\n|---------------|------------------|-------------------|-------------|------------|\n| **Risk-On** | Combined \u2265 6.0 | 70-100% | 0-30% | Offense - stay invested |\n| **Transitional** | Combined \u2265 6.5 | 50-70% | 30-50% | Balanced |\n| **Risk-Off** | Combined \u2265 7.0 | 30-50% | 50-70% | Defense - preserve capital |\n\n**Position Sizing Logic (Fractional Share Compatible):**\n\n- **High conviction** (Score 8-10): $25-40 per stock (calculate fractional shares)\n- **Medium conviction** (Score 6.5-7.9): $15-25 per stock (calculate fractional shares)\n- **Speculative** (Score 6.0-6.4): $10-15 per stock (only in Risk-On markets, calculate fractional shares)\n\n**FRACTIONAL SHARE CALCULATION EXAMPLES:**\n- NVDA at $160/share: $25 investment = 0.156 shares\n- TSLA at $240/share: $20 investment = 0.083 shares\n- Always express as: \"$X investment = Y.XXX shares at $Z/share\"\n\n**Portfolio Construction Rules:**\n- Maximum single position: 35% of available cash\n- Sector concentration limit: 60% of available cash\n- Must have \u22652 sectors represented if deploying >50% of cash\n\n**Cash Deployment Decision Tree:**\n\n\\`\\`\\`\nAvailable Cash: $${data.availableCash}\n\nIF Market Regime = Risk-On:\n  IF 2+ stocks score \u22656.0: Deploy 70-90% ($${Math.round(data.availableCash * 0.7)}-$${Math.round(data.availableCash * 0.9)})\n  ELSE IF 1 stock scores \u22656.5: Deploy 50-70% ($${Math.round(data.availableCash * 0.5)}-$${Math.round(data.availableCash * 0.7)})\n  ELSE IF 0 stocks score \u22656.0: Deploy 30-40% ($${Math.round(data.availableCash * 0.3)}-$${Math.round(data.availableCash * 0.4)}) OR hold cash\n\nIF Market Regime = Transitional:\n  IF 2+ stocks score \u22656.5: Deploy 60-80% ($${Math.round(data.availableCash * 0.6)}-$${Math.round(data.availableCash * 0.8)})\n  ELSE IF 1 stock scores \u22657.0: Deploy 40-60% ($${Math.round(data.availableCash * 0.4)}-$${Math.round(data.availableCash * 0.6)})\n  ELSE IF 0 stocks score \u22656.5: Deploy 20-30% ($${Math.round(data.availableCash * 0.2)}-$${Math.round(data.availableCash * 0.3)}) OR hold cash\n\nIF Market Regime = Risk-Off:\n  IF 2+ stocks score \u22657.0: Deploy 40-60% ($${Math.round(data.availableCash * 0.4)}-$${Math.round(data.availableCash * 0.6)})\n  ELSE IF 1 stock scores \u22657.5: Deploy 30-40% ($${Math.round(data.availableCash * 0.3)}-$${Math.round(data.availableCash * 0.4)})\n  ELSE: Hold 70-100% cash\n\nCRITICAL: These are GUIDELINES. Use judgment. Opportunity cost matters.\n\\`\\`\\`\n\n**Opportunity Cost Consideration:**\n\nCalculate and present:\n- S&P 500 YTD return: +X%\n- Your portfolio YTD return: +X% (if data available)\n- Relative performance: [Outperforming/Underperforming] by X%\n\nIf holding >50% cash while S&P is up >10% YTD, you must justify:\n- What specific risk you're avoiding\n- What entry condition you're waiting for\n- Why defensive posture warranted despite bull market\n\n**Cash is a position, but so is missing the rally.**\n\n---\n\n## OUTPUT REQUIREMENTS\n\n### ALLOCATION SUMMARY BOX (Top of Report)\n\n\\`\\`\\`\n\ud83d\udcb0 WEEKLY ALLOCATION RECOMMENDATION\n\nAvailable Cash: $${data.availableCash}\nRecommended Deployment: $XX (XX%)\nCash to Hold: $XX (XX%)\n\nMarket Regime: [RISK-ON/TRANSITIONAL/RISK-OFF]\nInvestment Posture: [AGGRESSIVE/BALANCED/DEFENSIVE]\n\nAllocations:\n1. [TICKER]: $XX (X.XXX fractional shares at $YY/share)\n2. [TICKER]: $XX (X.XXX fractional shares at $YY/share)  \n3. Cash Reserved: $XX\n\nQuality Bar: [X.X/10] - [Only recommending stocks above this threshold]\n\nRationale: [2-3 sentences on why this allocation mix given current environment]\n\\`\\`\\`\n\n---\n\n## FINAL CHECKLIST\n\nBefore submitting analysis:\n\n\u2705 All current prices searched and verified (no estimates)\n\u2705 Fractional share positions calculated correctly\n\u2705 Actual P&L calculated for all holdings\n\u2705 Available cash amount properly incorporated ($${data.availableCash})\n\u2705 Market regime explicitly classified\n\u2705 Score thresholds adjusted for regime\n\u2705 Deployment % justified given regime and opportunity quality\n\u2705 If holding >50% cash, opportunity cost addressed\n\u2705 Earnings dates within 14 days flagged as risk\n\u2705 Growth stocks scored on growth metrics, not P/E\n\u2705 Watching stocks evaluated with clear decisions\n\n**CRITICAL PHILOSOPHY:**\n\n- In bull markets (Risk-On), the default is INVESTED, not cash\n- In bear markets (Risk-Off), the default is CASH, not invested\n- Quality matters, but so does participation\n- Your job is finding opportunities, not finding reasons to hold cash\n- Current available cash: $${data.availableCash} - this is real money waiting to be deployed wisely\n\nGenerate your comprehensive report with this MANDATORY structure:\n\n## 1. NEW INVESTMENT OPPORTUNITIES (First Section)\n- List 3-5 evaluated new stocks with scores and recommendations\n- Specify exact dollar amounts AND fractional shares from available $${data.availableCash}\n- Format: \"TICKER: Invest $XX = Y.XXX shares at $Z/share (Score: X.X/10)\"\n\n## 2. WATCHING STOCKS ANALYSIS (Second Section)\n- Evaluate all stocks currently being watched\n- Provide clear recommendation: BUY, KEEP WATCHING, or STOP WATCHING\n\n## 3. EXISTING HOLDINGS ANALYSIS (Third Section)  \n- Analysis of current positions\n- Any position adjustments needed (also specify as fractional shares)\n\n## 4. FINAL ALLOCATION DECISION (Fourth Section)\n- How to deploy the $${data.availableCash} across new stocks, existing positions, and cash reserves\n- All recommendations must include fractional share calculations`;\n\nreturn [{ json: { prompt } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "6fe6df24-99ca-44ec-90c8-1610f5f12777",
      "name": "Prepare Index Fund Data1",
      "type": "n8n-nodes-base.code",
      "position": [
        976,
        -256
      ],
      "parameters": {
        "jsCode": "// Get all items from Index Funds sheet\nconst items = $input.all();\n\n// Extract tickers from Index Funds (column A)\nconst indexFunds = items\n  .filter(item => item.json.Fund && item.json['Allocation %'])\n  .map(item => ({\n    ticker: item.json.Fund,\n    allocation: item.json['Allocation %'],\n    type: 'index_fund'\n  }));\n\n// Get unique list of all tickers for API call\nconst allTickers = [...new Set(indexFunds.map(f => f.ticker))];\n\nreturn [{\n  json: {\n    indexFunds,\n    allTickers: allTickers.join(',')\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "6c8e5479-3c4e-4fa3-b1ab-d660840c7b3e",
      "name": "Build Index Fund Prompt1",
      "type": "n8n-nodes-base.code",
      "position": [
        1184,
        -256
      ],
      "parameters": {
        "jsCode": "// Get the processed data from Prepare Data node\nconst data = $input.first().json;\n\nconst indexFunds = data.indexFunds\n  .map(item => `${item.ticker}: ${(item.allocation * 100).toFixed(2)}%`)\n  .join('\\n');\n\nconst prompt = `You are an expert financial advisor specializing in index fund portfolio analysis. Today is ${new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}.\n\nProvide a comprehensive monthly analysis of my index fund portfolio (401k/IRA holdings) using web search for current market data.\n\n# MY INDEX FUND HOLDINGS\n\n${indexFunds}\n\n# ANALYSIS REQUIRED\n\nUse web search extensively to research and provide:\n\n## 1. CURRENT PERFORMANCE ANALYSIS\nFor EACH index fund:\n- Search for current price/NAV and YTD performance\n- Compare performance vs benchmark (S&P 500, Total Stock Market, etc.)\n- Analyze expense ratios and any recent changes\n- Check for any fund changes, mergers, or management updates\n- Assess whether allocation percentages still make sense\n\n## 2. MARKET CONDITIONS & OUTLOOK\n- Search for current market conditions across major indices\n- Economic indicators affecting long-term investing\n- Interest rate environment impact on different fund categories\n- Sector rotation trends affecting fund performance\n- Inflation impact on different asset classes\n\n## 3. ALLOCATION ANALYSIS\n- Is my current allocation appropriate for long-term growth?\n- Any over/under-exposure to specific sectors or asset classes?\n- Age-appropriate risk assessment (I'm focused on long-term growth)\n- International vs domestic exposure analysis\n- Bond allocation considerations in current rate environment\n\n## 4. REBALANCING RECOMMENDATIONS\n- Should I adjust allocation percentages?\n- Any funds underperforming that should be replaced?\n- Specific rebalancing actions with percentages\n- Timing considerations for any changes\n- Tax implications of rebalancing in 401k vs IRA\n\n## 5. MARKET OUTLOOK & STRATEGY\n- 3-6 month outlook for index fund investing\n- Dollar-cost averaging strategy assessment\n- Any tactical adjustments for current market cycle\n- Defensive vs growth positioning recommendations\n\n# OUTPUT FORMAT\n\nStructure your response with clear markdown:\n- Use ## for main sections  \n- Use ### for subsections\n- Use **bold** for fund tickers and key metrics\n- Include specific percentages and performance numbers\n- Keep paragraphs short (2-3 sentences max)\n- Be direct and actionable\n\n**CRITICAL REQUIREMENTS:**\n\u2705 Search thoroughly for current fund performance data\n\u2705 Compare each fund to relevant benchmarks\n\u2705 Provide specific allocation recommendations with percentages\n\u2705 Include rationale for any suggested changes\n\u2705 Focus on long-term growth strategy\n\u2705 Consider tax-advantaged account implications\n\nSearch thoroughly to ensure all performance data and recommendations are current and accurate.`;\n\nreturn [{ json: { prompt } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "2fdeeb68-691d-4c54-b1f5-c8fc55ff67c4",
      "name": "Claude Index Fund Analysis1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1392,
        -256
      ],
      "parameters": {
        "url": "https://api.anthropic.com/v1/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"claude-sonnet-4-5-20250929\",\n  \"max_tokens\": 8000,\n  \"temperature\": 0.2,\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": {{ JSON.stringify($json.prompt) }}\n    }\n  ],\n  \"tools\": [\n    {\n      \"type\": \"web_search_20250305\",\n      \"name\": \"web_search\",\n      \"max_uses\": 15\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "YOUR_AUTHENTICATION_ID",
        "headerParameters": {
          "parameters": [
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4
    },
    {
      "id": "8c881bf2-33c9-4346-ae67-9aaab321846a",
      "name": "Wait 24hrs for Form Submission",
      "type": "n8n-nodes-base.wait",
      "position": [
        432,
        784
      ],
      "parameters": {
        "resume": "webhook",
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "234f5cd2-6a06-46e6-a2c5-e81065ed105c",
      "name": "Process Form Data",
      "type": "n8n-nodes-base.code",
      "position": [
        768,
        784
      ],
      "parameters": {
        "jsCode": "// Process form submission data\nconst formData = $input.first().json;\n\n// Extract form fields from the webhook body\nconst body = formData.body || {};\nconst analysisNotes = body.analysisNotes || '';\nconst marketObservations = body.marketObservations || '';\nconst timestamp = body.timestamp || new Date().toISOString();\n\n// Combine user input for the follow-up analysis\nconst combinedInput = `Analysis Notes:\\n${analysisNotes}\\n\\nMarket Observations:\\n${marketObservations}`;\n\n// Create formatted data that matches what the follow-up nodes expect\nreturn [{\n  json: {\n    body: combinedInput,\n    text: combinedInput,\n    timestamp,\n    userSubmission: {\n      analysisNotes,\n      marketObservations,\n      hasData: analysisNotes.length > 0 || marketObservations.length > 0\n    },\n    status: 'form_received'\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "a4e0edab-2cb6-41c6-8b98-f08ed7c50056",
      "name": "Portfolio Follow-up Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        560,
        912
      ],
      "parameters": {
        "path": "wed-followup-form",
        "options": {},
        "formTitle": "Portfolio Analysis Follow-up",
        "formFields": {
          "values": [
            {
              "fieldType": "textarea",
              "fieldLabel": "Analysis Notes & Questions",
              "placeholder": "Share your thoughts, questions, or additional analysis you'd like me to consider..."
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Market Observations",
              "placeholder": "Any market trends or observations since Monday's analysis..."
            },
            {
              "fieldType": "file",
              "fieldLabel": "Upload Documents (optional)",
              "acceptFileTypes": "image/*,.pdf,.txt,.doc,.docx"
            }
          ]
        },
        "formDescription": "Provide additional analysis, documents, or insights for this week's follow-up review."
      },
      "typeVersion": 2
    },
    {
      "id": "d1d76fb4-dee6-4b4f-b819-fb69cd9a2a4c",
      "name": "Send Follow-up Email Prompt1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        240,
        624
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<style>\nbody { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 20px auto; padding: 20px; background: #f8f9fa; }\n.container { background: white; padding: 30px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }\nh1 { color: #2563eb; margin-bottom: 20px; }\n.highlight { background: #fef3c7; padding: 15px; border-radius: 6px; margin: 20px 0; border-left: 4px solid #f59e0b; }\n.btn { background: #2563eb; color: white; padding: 12px 24px; text-decoration: none; border-radius: 6px; display: inline-block; margin: 10px 0; }\n.footer { margin-top: 30px; padding-top: 20px; border-top: 1px solid #e5e7eb; font-size: 12px; color: #6b7280; }\n</style>\n</head>\n<body>\n<div class=\"container\">\n<h1>\ud83d\udcca Mid-Week Analysis Check</h1>\n\n<p>Hi Joe,</p>\n\n<p>It's Wednesday afternoon - time for our mid-week portfolio review check-in.</p>\n\n<div class=\"highlight\">\n<strong>\ud83e\udd14 Do you need follow-up analysis on Monday's stock recommendations?</strong><br>\nIf you have any additional analysis, documents, or insights you'd like me to incorporate into this week's analysis, use the form below to submit:\n<ul>\n<li>\ud83d\udcc4 Documents or screenshots</li>\n<li>\ud83d\udcdd Plain text analysis or notes</li> \n<li>\ud83d\udcad Specific questions or concerns</li>\n<li>\ud83d\udcc8 Market observations since Monday</li>\n</ul>\n</div>\n\n<p><strong>What happens next:</strong></p>\n<p>If you submit within 24 hours, I'll run a supplemental analysis that combines:</p>\n<ul>\n<li>\u2705 Monday's original fundamental & technical analysis</li>\n<li>\ud83d\udccb Your additional inputs/documents</li>\n<li>\ud83d\udd04 Updated market data and conditions</li>\n<li>\ud83d\udca1 Follow-up recommendations and adjustments</li>\n</ul>\n\n<p><strong>\ud83d\udcec To provide follow-up analysis input:</strong></p>\n<p style=\"text-align: center; margin: 20px 0;\">\n<a href=\"https://phelementium.app.n8n.cloud/form/wed-followup-form\" class=\"btn\" style=\"background: #10b981; margin: 10px;\">\ud83d\udcdd Submit Follow-up Analysis Request</a>\n</p>\n\n<p><strong>The form will let you:</strong></p>\n<ul>\n<li>\ud83d\udcdd Add text notes and analysis</li>\n<li>\ud83d\udcc4 Upload documents or screenshots</li>\n<li>\ud83d\udcad Ask specific questions</li>\n<li>\ud83d\udcc8 Share market observations</li>\n</ul>\n\n<p>If no input needed, no action required - the workflow will timeout after 24 hours! \ud83d\udc4d</p>\n\n<div class=\"footer\">\n<p>\ud83e\udd16 <strong>Automated Wednesday Follow-up</strong> \u2022 Portfolio Analysis Workflow</p>\n<p>\u23f0 Will wait 24 hours for response \u2022 Generated: Wednesday 12:00 PM EST</p>\n</div>\n</div>\n</body>\n</html>",
        "options": {},
        "subject": "\ud83d\udcca Mid-Week Stock Analysis Follow-up Check"
      },
      "typeVersion": 2
    },
    {
      "id": "408b8c45-9fbe-4241-b500-15b67940b6eb",
      "name": "Read Stocks - Follow-up1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        768,
        624
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1832493459,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1EA7hgz1NRLlV9eseAXKl6feooDAVwr7LOdFsW51C8gE/edit#gid=1832493459",
          "cachedResultName": "Stocks"
        },
        "documentId": "YOUR_DOCUMENTID_ID"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "94ce9612-38b1-4f8e-ae8f-f5c1d51adf8f",
      "name": "Prepare Stock Data - Follow-up1",
      "type": "n8n-nodes-base.code",
      "position": [
        976,
        624
      ],
      "parameters": {
        "jsCode": "// Get all items from stocks sheet\nconst items = $input.all();\n\n// Extract cash amount from row with \"Account cash\" or similar\nconst cashRow = items.find(item => \n  item.json['Stock Name'] && \n  item.json['Stock Name'].toLowerCase().includes('cash') &&\n  !item.json['Stock Symbol'] // Empty stock symbol indicates cash row\n);\nconst availableCash = cashRow ? parseFloat(cashRow.json['Buy In Price (Full ammount invested including multiple shares']) || 0 : 0;\n\n// Extract tickers from Stocks - UPDATED FOR FRACTIONAL SHARES AND WATCHING\nconst stocks = items\n  .filter(item => {\n      const symbol = item.json['Stock Symbol'] ? item.json['Stock Symbol'].toString().trim() : '';\n      const hasSymbol = symbol.length > 0;\n      const hasBuyPrice = !!item.json['Buy In Price (Full ammount invested including multiple shares'];\n      const isWatching = item.json['Watching (No Buy)'] === true || item.json['Watching (No Buy)'] === 'TRUE' || item.json['Watching (No Buy)'] === '1';\n      return hasSymbol && (hasBuyPrice || isWatching);\n  })\n  .map(item => {\n    const amountSpent = parseFloat(item.json['Buy In Price (Full ammount invested including multiple shares']) || 0; // Column D\n    const priceAtPurchase = parseFloat(item.json['Price at time of purchase']) || 0; // Column E\n    const isFractional = item.json['Fractional?'] === true || item.json['Fractional?'] === 'TRUE' || item.json['Fractional?'] === '1'; // Column F\n    const isWatching = item.json['Watching (No Buy)'] === true || item.json['Watching (No Buy)'] === 'TRUE'; // Column G\n    const watchDate = item.json['Date Started Watching']; // Column H\n    const watchPrice = parseFloat(item.json['Price at time of Watch Start']) || 0; // Column I\n\n    const sharesOwned = priceAtPurchase > 0 ? (amountSpent / priceAtPurchase) : 0;\n    \n    return {\n      ticker: item.json['Stock Symbol'],\n      name: item.json['Stock Name'],\n      buyDate: item.json['Buy In Date'],\n      amountSpent: amountSpent, // Dollar amount invested\n      priceAtPurchase: priceAtPurchase, // Stock price when purchased\n      sharesOwned: sharesOwned, // Calculated shares (fractional or whole)\n      isFractional: isFractional,\n      isWatching: isWatching,\n      watchDate: watchDate,\n      watchPrice: watchPrice,\n      type: isWatching ? 'watching' : 'stock'\n    };\n  });\n\n// Get unique list of all tickers for API call\nconst allTickers = [...new Set(stocks.map(s => s.ticker))];\n\n// Calculate total invested amount (exclude watching)\nconst totalInvested = stocks.filter(s => !s.isWatching).reduce((sum, stock) => sum + stock.amountSpent, 0);\n\nreturn [{\n  json: {\n    stocks,\n    allTickers: allTickers.join(','),\n    availableCash: availableCash,\n    totalInvested: totalInvested,\n    totalPortfolioValue: totalInvested + availableCash\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "d889a34b-bbb0-4439-a0a6-25e7d54c5af6",
      "name": "Build Follow-up Fundamental Prompt1",
      "type": "n8n-nodes-base.code",
      "position": [
        1184,
        624
      ],
      "parameters": {
        "jsCode": "// Get user input data (from form trigger or webhook)\nconst inputData = $input.first().json;\n\n// Handle form trigger data (direct from n8n form)\nif (inputData['Analysis Notes & Questions'] || inputData['Market Observations']) {\n  var userInput = `Analysis Notes: ${inputData['Analysis Notes & Questions'] || ''}\\n\\nMarket Observations: ${inputData['Market Observations'] || ''}`;\n  var attachments = inputData['Upload Documents (optional)'] ? [inputData['Upload Documents (optional)']] : [];\n}\n// Handle webhook data (from external form)\nelse {\n  var userInput = inputData.body || inputData.text || '';\n  var attachments = inputData.attachments || [];\n}\n\n// Get stock data from the previous node\nconst stockData = $input.last().json;\nconst stocks = stockData.stocks\n  .filter(item => item.type === 'stock')\n  .map(item => {\n    const shareDisplay = item.isFractional ? `${item.sharesOwned.toFixed(3)} shares` : `${Math.floor(item.sharesOwned)} shares`;\n    return `${item.ticker} (${item.name}): ${shareDisplay} - Invested $${item.amountSpent} on ${item.buyDate} at $${item.priceAtPurchase}/share${item.isFractional ? ' (fractional)' : ''}`;\n  })\n  .join('\\n');\n\nconst watchingStocks = stockData.stocks\n  .filter(item => item.type === 'watching')\n  .map(item => {\n    return `${item.ticker} (${item.name}): Watching since ${item.watchDate} at $${item.watchPrice}/share`;\n  })\n  .join('\\n');\n\n// Build follow-up context prompt with cash information\nconst followupPrompt = `You are a systematic fundamental analyst conducting a MID-WEEK FOLLOW-UP ANALYSIS. Current date: ${new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}.\n\n**CONTEXT: This is a Wednesday follow-up to Monday's original analysis.**\n\n# ORIGINAL MONDAY ANALYSIS REFERENCE\nThis analysis was generated this past Monday as part of our weekly stock review process. You should reference that Monday analysis was already completed and this is additional follow-up work.\n\n# CURRENT PORTFOLIO (Same as Monday)\n\n## \ud83d\udcb0 CASH POSITION\n**Available Cash:** $${stockData.availableCash}\n\n## \ud83d\udcca STOCK HOLDINGS\n${stocks.length > 0 ? stocks : 'No current stock holdings.'}\n\n## \ud83d\udc40 STOCKS I'M WATCHING (No Buy Yet)\n${watchingStocks.length > 0 ? watchingStocks : 'No stocks currently being watched.'}\n\n## \ud83d\udcbc PORTFOLIO SUMMARY\n- **Total Invested in Stocks:** $${stockData.totalInvested}\n- **Available Cash:** $${stockData.availableCash}\n- **Total Portfolio Value:** $${stockData.totalPortfolioValue}\n- **Cash Allocation:** ${((stockData.availableCash / stockData.totalPortfolioValue) * 100).toFixed(1)}%\n\n# USER'S FOLLOW-UP INPUT\n\nThe user has provided additional analysis, documents, or insights for follow-up review:\n\n**User's Input:**\n${userInput}\n\n${attachments.length > 0 ? `**Attached Documents:** ${attachments.length} files provided` : ''}\n\n# YOUR FOLLOW-UP ANALYSIS MANDATE\n\n**CRITICAL CONTEXT:** You are building upon the Monday analysis that was already completed. Reference that this is a FOLLOW-UP analysis, not the initial review.\n\n**Modified Analysis Requirements:**\n\n1. **Acknowledge Monday's Work**: Reference that fundamental/technical analysis was completed Monday\n2. **Incorporate User Input**: Analyze the user's additional insights, documents, or questions  \n3. **Updated Market Context**: Check for any significant market changes since Monday\n4. **Refined Cash Deployment**: Consider if the $${stockData.availableCash} cash position should be adjusted based on user input\n5. **Refined Recommendations**: Adjust or refine Monday's recommendations based on new input, including decisions on \"Watching\" stocks (Buy, Keep Watching, Stop Watching).\n\n**Cash Deployment Considerations:**\n- Available Cash: $${stockData.availableCash}\n- User's input may suggest urgency or caution in deployment\n- Incorporate user observations about market conditions\n\n**Output Modifications:**\n- Start with \"\ud83d\udcc5 **MID-WEEK FOLLOW-UP ANALYSIS - Wednesday**\"\n- Include section: \"\ud83d\udd04 Changes Since Monday\"\n- Reference user's input throughout recommendations\n- Update cash deployment recommendations based on user input\n- End with \"\ud83c\udfaf **Updated Action Items Based on Follow-up**\"\n- Explicitly address \"Watching\" stocks and recommend actions for them.\n\n**CRITICAL:** This is supplemental analysis building on Monday's foundation, not a complete restart. Focus on the DELTA (what's changed) and how the user's input affects the previous recommendations, especially regarding the $${stockData.availableCash} in available cash, and provide clear recommendations for \"Watching\" stocks.\n\nGenerate your follow-up fundamental analysis report.`;\n\nreturn [{ json: { prompt: followupPrompt, userInput, stocks, availableCash: stockData.availableCash } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "07e6a00b-4c90-4eda-af09-a3b492a38670",
      "name": "Claude Follow-up Fundamental Analysis1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1392,
        624
      ],
      "parameters": {
        "url": "https://api.anthropic.com/v1/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"claude-sonnet-4-5-20250929\",\n  \"max_tokens\": 20000,\n  \"temperature\": 0.3,\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": {{ JSON.stringify($json.prompt) }}\n    }\n  ],\n  \"tools\": [\n    {\n      \"type\": \"web_search_20250305\",\n      \"name\": \"web_search\",\n      \"max_uses\": 20\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "YOUR_AUTHENTICATION_ID",
        "headerParameters": {
          "parameters": [
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4
    },
    {
      "id": "7dcf64fd-42a7-4c08-9bec-301d120b2ac4",
      "name": "Build Follow-up Technical Prompt1",
      "type": "n8n-nodes-base.code",
      "position": [
        1600,
        624
      ],
      "parameters": {
        "jsCode": "const fundamentalResponse = $input.first().json;\n\n// Extract Claude's fundamental analysis\nconst content = fundamentalResponse.content;\nconst textBlocks = content.filter(block => block.type === 'text');\nconst fundamentalAnalysis = textBlocks.map(block => block.text).join('\\n\\n');\n\n// Extract usage stats for reference\nconst fundamentalUsage = fundamentalResponse.usage || {};\nconst searchCount = content.filter(block => block.type === 'tool_use' && block.name === 'web_search').length;\n\n// Get cash data from the stock data preparation node\nconst stockDataNode = $('Prepare Stock Data - Follow-up1').first();\nconst cashData = stockDataNode ? stockDataNode.json : { availableCash: 0, totalInvested: 0, totalPortfolioValue: 0 };\n\n// Build technical prompt for follow-up with cash information\nconst technicalPrompt = `You are an independent technical analyst conducting a MID-WEEK FOLLOW-UP. Current date: ${new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}.\n\n**CONTEXT:** This is a Wednesday follow-up analysis. A fundamental analyst has completed their research and updated their Monday recommendations based on new user input.\n\n**YOUR ROLE:** Evaluate the TECHNICAL setup and ENTRY TIMING for the updated recommendations, with focus on changes since Monday.\n\n**CASH CONTEXT FOR TECHNICAL ANALYSIS:**\n- **Available Cash:** $${cashData.availableCash || 'N/A'}\n- **Total Portfolio Value:** $${cashData.totalPortfolioValue || 'N/A'}\n- **Cash Allocation:** ${cashData.totalPortfolioValue > 0 ? ((cashData.availableCash / cashData.totalPortfolioValue) * 100).toFixed(1) : 'N/A'}%\n\n**CRITICAL:** You MUST use web_search to gather current technical data. Focus on what's changed since Monday.\n\n---\n\n# FUNDAMENTAL ANALYST'S UPDATED FOLLOW-UP ANALYSIS\n\n${fundamentalAnalysis}\n\n---\n\n# YOUR TECHNICAL FOLLOW-UP EVALUATION\n\n**Key Focus Areas:**\n1. **What's changed technically since Monday?** (price action, support/resistance breaks)\n2. **Do current technical setups support the updated fundamental recommendations?**\n3. **Any new timing considerations?** (earnings approaching, technical breakouts/breakdowns)\n4. **Cash deployment timing** - Are technical setups good for deploying available cash now?\n\n## MODIFIED TECHNICAL RESEARCH FOR FOLLOW-UP\n\nFor EACH stock mentioned in the fundamental follow-up (including \"Watching\" stocks):\n\n### 1. TECHNICAL CHANGES SINCE MONDAY\n\nSearch \"[TICKER] stock chart this week\" to identify:\n\n**Price Action Since Monday:**\n- Monday close: $XX.XX\n- Current price: $XX.XX  \n- Change: +/-X% since Monday\n- Volume trend: Higher/Lower than usual\n- Any significant intraday moves\n\n**Key Level Updates:**\n- New support/resistance levels formed\n- Moving average status changes\n- Breakouts or breakdowns since Monday\n\n**Momentum Shifts:**\n- RSI changes since Monday\n- Any technical pattern completions (flags, triangles, etc.)\n- Volume confirmation or lack thereof\n\n### 2. UPDATED RISK/REWARD ASSESSMENT WITH CASH DEPLOYMENT\n\n**For New Buy Recommendations:**\n- Entry timing: Now vs wait for pullback\n- Stop-loss levels based on current technicals\n- Target prices based on resistance levels\n- Risk/reward ratio at current prices\n- **Cash deployment sizing** based on technical confidence level\n\n**For Existing Holdings:**\\n- Any technical deterioration since Monday\\n- New exit levels if applicable\\n- Position sizing adjustments warranted\\n\\n**For \"Watching\" Stocks:**\\n- Is the technical setup ready for entry?\\n- Specific entry trigger levels\n- Any technical deterioration since Monday\n- New exit levels if applicable\n- Position sizing adjustments warranted\n\n### 3. MARKET CONTEXT CHANGES\n\nSearch for any significant technical changes since Monday:\n- S&P 500 technical picture changes\n- VIX movements and implications  \n- Sector rotation shifts\n- Any broad market technical breakouts/breakdowns\n\n## TECHNICAL SCORING FOR FOLLOW-UP\n\nAdjust scores based on:\n\n**Positive Technical Changes (+0.5 to +1.5 points):**\n- Breakout above resistance since Monday\n- Volume expansion on strength\n- Moving average reclaim\n- Improved relative strength vs market\n\n**Negative Technical Changes (-0.5 to -1.5 points):**\n- Breakdown below support since Monday  \n- Weak volume on any rallies\n- Moving average breakdown\n- Relative weakness vs market\n\n**CASH DEPLOYMENT TECHNICAL CONFIDENCE:**\n- **High Confidence (Score 8-10):** Deploy larger portions of available cash\n- **Medium Confidence (Score 6-7):** Deploy moderate portions\n- **Low Confidence (Score <6):** Hold cash or deploy minimally\n\n## OUTPUT REQUIREMENTS FOR FOLLOW-UP\n\n### TECHNICAL FOLLOW-UP SUMMARY\n\n\\`\\`\\`\n\ud83d\udcc5 WEDNESDAY TECHNICAL FOLLOW-UP\n\nCash Deployment Context:\n- Available for Investment: $${cashData.availableCash || 'N/A'}\n- Technical Confidence Level: [HIGH/MEDIUM/LOW]\n\nMarket Changes Since Monday:\n- S&P 500: [Change since Monday close]\n- VIX: [Change since Monday]\n- Key Sector Moves: [Any significant sector shifts]\n\nTechnical Assessment of Updated Recommendations:\n[For each stock, provide updated technical score and key changes]\n\\`\\`\\`\n\n### STOCK-BY-STOCK TECHNICAL UPDATES\n\n**[TICKER] - Technical Follow-up**\n\n**Changes Since Monday:**\n- Price: $XX.XX \u2192 $XX.XX (+/-X%)\n- Volume: [Above/Below average]\n- Key Level: [Broke above/below $XX support/resistance]\n\n**Current Technical Setup:**\n- Trend: [Bullish/Bearish/Neutral]\n- Entry Quality: [Good/Wait/Avoid]\n- Stop Level: $XX.XX\n- Target: $XX.XX  \n- Risk/Reward: [X:1]\n\n**Updated Technical Score:** X.X/10 (vs Monday if applicable)\n\n**Cash Deployment Recommendation:**\n- **Suggested Allocation:** $XX from available $${cashData.availableCash || 'N/A'}\n- **Entry Timing:** [BUY NOW / WAIT FOR PULLBACK TO $XX / AVOID]\n- **Technical Rationale:** [Based on technical changes since Monday]\n- **Position Size:** [Full/Half/Quarter position given technical risk]\n\n### TIMING ALERTS\n\n\ud83d\udea8 **Binary Events This Week:**\n- [Any earnings within 3 days]\n- [Fed speeches or economic data]\n- [Options expiration effects]\n\n\u2705 **Clear Technical Setups:**\n- [Stocks with clean entry points]\n- [Good risk/reward setups]\n\n\u26a0\ufe0f **Technical Caution Flags:**\n- [Stocks showing weakness]\n- [Poor technical setups despite fundamental appeal]\n\n## FINAL TECHNICAL VERDICT FOR FOLLOW-UP\n\n**Overall Market Technical Posture:** [BULLISH/NEUTRAL/BEARISH] (vs Monday)\n\n**Cash Deployment Strategy:** \n- **Immediate Deployment:** $XX of $${cashData.availableCash || 'N/A'} (XX%)\n- **Hold for Better Setup:** $XX (XX%)\n- **Technical Rationale:** [Why this split based on current setups]\n\n**Key Changes:** [Most important technical developments since Monday]\n\n**Entry Strategy:** [Aggressive/Selective/Defensive] based on technical picture\n\n**Risk Management:** [Any updated stop-loss levels or position sizing recommendations]\n\n**Next Technical Review:** [What levels/events to watch for next update]\n\nGenerate your technical follow-up analysis report.`;\n\nreturn [{ json: { prompt: technicalPrompt, fundamentalAnalysis, searchCount, cashData } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "d84be3a0-22d4-4b1a-b197-b5623cb7747d",
      "name": "Claude Follow-up Technical Analysis1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1808,
        624
      ],
      "parameters": {
        "url": "https://api.anthropic.com/v1/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"claude-sonnet-4-5-20250929\",\n  \"max_tokens\": 20000,\n  \"temperature\": 0.3,\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": {{ JSON.stringify($json.prompt) }}\n    }\n  ],\n  \"tools\": [\n    {\n      \"type\": \"web_search_20250305\",\n      \"name\": \"web_search\",\n      \"max_uses\": 20\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "YOUR_AUTHENTICATION_ID",
        "headerParameters": {
          "parameters": [
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4
    },
    {
      "id": "6a969a4a-33d3-45c5-b549-54bac70a5bb1",
      "name": "Build Follow-up Synthesis Prompt1",
      "type": "n8n-nodes-base.code",
      "position": [
        2016,
        624
      ],
      "parameters": {
        "jsCode": "// Get the technical analysis response\nconst technicalResponse = $input.first().json;\n\n// Extract Claude's technical analysis\nconst technicalContent = technicalResponse.content;\nconst technicalTextBlocks = technicalContent.filter(block => block.type === 'text');\nconst technicalAnalysis = technicalTextBlocks.map(block => block.text).join('\\n\\n');\n\n// Get fundamental analysis from previous nodes\nconst fundamentalAnalysis = $('Build Follow-up Technical Prompt1').first().json.fundamentalAnalysis;\n\n// Get cash data from the stock data preparation node\nconst stockDataNode = $('Prepare Stock Data - Follow-up1').first();\nconst cashData = stockDataNode ? stockDataNode.json : { availableCash: 0, totalInvested: 0, totalPortfolioValue: 0 };\n\n// Extract usage stats\nconst technicalUsage = technicalResponse.usage || {};\nconst technicalSearchCount = technicalContent.filter(block => block.type === 'tool_use' && block.name === 'web_search').length;\nconst fundamentalSearchCount = $('Build Follow-up Technical Prompt1').first().json.searchCount || 0;\n\n// Build synthesis prompt for follow-up with cash information\nconst synthesisPrompt = `You are the CHIEF INVESTMENT OFFICER conducting a MID-WEEK FOLLOW-UP SYNTHESIS. Current date: ${new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}.\n\n**CONTEXT:** This is a Wednesday follow-up analysis incorporating user input and updated market conditions since Monday's original analysis.\n\n**YOUR ROLE:** Synthesize the fundamental and technical follow-up analyses into final actionable recommendations.\n\n**CASH POSITION CONTEXT:**\n- **Available Cash:** $${cashData.availableCash || 'N/A'}\n- **Total Invested:** $${cashData.totalInvested || 'N/A'}\n- **Total Portfolio Value:** $${cashData.totalPortfolioValue || 'N/A'}\n- **Current Cash Allocation:** ${cashData.totalPortfolioValue > 0 ? ((cashData.availableCash / cashData.totalPortfolioValue) * 100).toFixed(1) : 'N/A'}%\n\n---\n\n# FUNDAMENTAL ANALYST'S FOLLOW-UP ANALYSIS\n\n${fundamentalAnalysis}\n\n---\n\n# TECHNICAL ANALYST'S FOLLOW-UP ANALYSIS\n\n${technicalAnalysis}\n\n---\n\n# YOUR SYNTHESIS MANDATE FOR FOLLOW-UP\n\n## FOLLOW-UP SPECIFIC REQUIREMENTS\n\n1. **Acknowledge Original Monday Analysis**: Reference that this builds on Monday's work\n2. **Highlight Key Changes**: Focus on what's materially different since Monday\n3. **User Input Integration**: Show how user's input influenced the updated recommendations\n4. **Cash-Aware Action Plan**: Provide specific cash deployment recommendations\n5. **Refined Action Plan**: Provide updated/refined recommendations vs Monday\n\n## SYNTHESIS FRAMEWORK (Same as Monday but Modified)\n\n### STEP 1: FOLLOW-UP EXECUTIVE SUMMARY\n\n\\`\\`\\`\n\ud83d\udcc5 WEDNESDAY FOLLOW-UP SYNTHESIS\n\nBuilding on Monday's Analysis + User Input\n\n\ud83d\udd04 KEY CHANGES SINCE MONDAY:\n- [Most important market/technical changes]\n- [User input summary and impact]\n- [Any recommendation changes from Monday]\n\n\ud83d\udcb0 UPDATED ALLOCATION RECOMMENDATION:\nAvailable Cash: $${cashData.availableCash || 'N/A'}\nRecommended Deployment: $XX (XX%) [vs Monday: $XX]\nCash to Hold: $XX (XX%)\n\nMarket Regime: [RISK-ON/TRANSITIONAL/RISK-OFF]\nInvestment Posture: [AGGRESSIVE/BALANCED/DEFENSIVE]\n\n\ud83d\udcca REFINED RECOMMENDATIONS:\n1. [Updated stock recommendations vs Monday]\n2. [Position sizing changes if any]\n3. [New opportunities identified from follow-up]\n\\`\\`\\`\n\n### STEP 2: COMBINED SCORING MATRIX FOR FOLLOW-UP\n\n**Scoring Integration Rules (Same as Monday):**\n\nBased on market regime determined in fundamental analysis:\n\n| Market Regime | Fundamental Weight | Technical Weight | Cash Threshold |\n|---------------|-------------------|------------------|----------------|\n| **Risk-On** | 35-40% | 60-65% | Combined \u2265 6.0 |\n| **Transitional** | 45-50% | 50-55% | Combined \u2265 6.5 |\n| **Risk-Off** | 60-65% | 35-40% | Combined \u2265 7.0 |\n\n**For each stock mentioned in either analysis (including \"Watching\" stocks):**\n\n| Stock | Fundamental Score | Technical Score | Combined Score | Monday vs Wednesday | Action | Cash Allocation |\n|-------|------------------|----------------|---------------|-------------------|--------|-----------------|\n| [TICKER] | X.X/10 | X.X/10 | X.X/10 | [Changed +/-X vs Monday] | [BUY/HOLD/TRIM/PASS] | $XX of $${cashData.availableCash || 'N/A'} |\n\n### STEP 3: FOLLOW-UP CASH DEPLOYMENT STRATEGY\n\n**Available Capital Analysis:**\n- Total Available: $${cashData.availableCash || 'N/A'}\n- Recommended Deployment based on regime and scores\n- Risk-adjusted position sizing\n\n**Cash Allocation Framework:**\n\\`\\`\\`\nAvailable Cash: $${cashData.availableCash || 'N/A'}\n\nDeployment Strategy:\n- High Conviction Picks (Score 8-10): $XX (XX% of cash)\n- Medium Conviction Picks (Score 6.5-7.9): $XX (XX% of cash)  \n- Speculative Plays (Score 6.0-6.4): $XX (XX% of cash)\n- Reserved Cash: $XX (XX% of cash)\n\nRationale: [Based on market regime and opportunity quality]\n\\`\\`\\`\n\n### STEP 4: FOLLOW-UP RISK ASSESSMENT\n\n**Risk Changes Since Monday:**\n- Market regime shifts\n- Technical deterioration/improvement  \n- New event risks identified\n- User input risk factors\n\n**Updated Risk Management:**\n- Modified stop-losses\n- Position sizing adjustments (consider available cash)\n- Portfolio concentration changes\n- Cash allocation rationale\n\n### STEP 5: FINAL FOLLOW-UP RECOMMENDATIONS\n\n**IMMEDIATE ACTIONS (This Week):**\n1. [Specific cash deployment actions with dollar amounts]\n2. [Any position adjustments needed]\n3. [Monitoring tasks/alerts to set]\n\n**CHANGES FROM MONDAY:**\\n- \u2705 **Confirmed**: [Monday recommendations still valid]\\n- \ud83d\udd04 **Modified**: [What changed and why, including cash allocation changes]\\n- \u274c **Cancelled**: [Any Monday recommendations now invalid]\\n- \ud83c\udd95 **New**: [Additional opportunities from follow-up with specific cash amounts]\\n- \ud83d\udc40 **Watching**: [Updates on watching stocks: Buy/Keep Watching/Stop Watching]\n- \u2705 **Confirmed**: [Monday recommendations still valid]\n- \ud83d\udd04 **Modified**: [What changed and why, including cash allocation changes]\n- \u274c **Cancelled**: [Any Monday recommendations now invalid]\n- \ud83c\udd95 **New**: [Additional opportunities from follow-up with specific cash amounts]\n\n**USER INPUT IMPACT:**\n- [How user's analysis/documents changed the outlook]\n- [Specific recommendations influenced by user input]\n- [Cash deployment timing influenced by user input]\n- [Questions answered or new questions raised]\n\n**SPECIFIC CASH DEPLOYMENT PLAN:**\\n\\nTotal Available: $${cashData.availableCash || 'N/A'}\\n\\nRecommended Actions:\\n1. [TICKER]: Buy $XX (X.X shares) - [Entry timing and rationale]\\n2. [TICKER]: Buy $XX (X.X shares) - [Entry timing and rationale]\\n3. [TICKER] (Watching): [Buy/Keep Watching] - [Rationale]\\n4. Hold Cash: $XX - [Rationale for holding vs deploying]\n\\`\\`\\`\n\ud83d\udcb0 THIS WEEK'S CASH DEPLOYMENT\n\nTotal Available: $${cashData.availableCash || 'N/A'}\n\nRecommended Actions:\n1. [TICKER]: Buy $XX (X.X shares) - [Entry timing and rationale]\n2. [TICKER]: Buy $XX (X.X shares) - [Entry timing and rationale]  \n3. Hold Cash: $XX - [Rationale for holding vs deploying]\n\nRisk Management:\n- Stop-loss levels for new positions\n- Position sizing rationale\n- Maximum loss tolerance per position\n\\`\\`\\`\n\n### OUTPUT FORMAT FOR FOLLOW-UP\n\n**Email Subject:** \\`\ud83d\udcca Mid-Week Follow-up Analysis - Wednesday (Updated Cash Deployment)\\`\n\n**Email Structure:**\n1. **Follow-up Executive Summary** (what changed since Monday)\n2. **Updated Combined Analysis** (fundamental + technical synthesis)  \n3. **Specific Cash Deployment Plan** (with dollar amounts and timing)\n4. **Refined Recommendations** (vs Monday)\n5. **User Input Integration** (how it influenced decisions)\n6. **This Week Action Plan** (immediate next steps)\n7. **Risk Updates** (new considerations since Monday)\n\n## CRITICAL SUCCESS FACTORS FOR FOLLOW-UP\n\n\u2705 **Reference Monday's baseline** throughout the analysis\n\u2705 **Highlight deltas** - what's actually changed vs just repeating\n\u2705 **Show user impact** - how their input influenced the outcome\n\u2705 **Provide specific cash amounts** for all deployment recommendations  \n\u2705 **Provide clarity** on updated vs original recommendations\n\u2705 **Focus on actionability** - what to do with the $${cashData.availableCash || 'N/A'} available\n\n**Remember:** This is a REFINEMENT of Monday's work with specific focus on how to deploy the available cash based on updated analysis and user input.\n\nGenerate your follow-up synthesis report with specific cash deployment recommendations.`;\n\nreturn [{ json: { prompt: synthesisPrompt, fundamentalAnalysis, technicalAnalysis, cashData, combinedSearches: fundamentalSearchCount + technicalSearchCount } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "42bfb78c-e035-40e6-b45a-ba8eddaae1c6",
      "name": "Claude Follow-up Synthesis Analysis1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2224,
        624
      ],
      "parameters": {
        "url": "https://api.anthropic.com/v1/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"claude-sonnet-4-5-20250929\",\n  \"max_tokens\": 25000,\n  \"temperature\": 0.2,\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": {{ JSON.stringify($json.prompt) }}\n    }\n  ],\n  \"tools\": [\n    {\n      \"type\": \"web_search_20250305\",\n      \"name\": \"web_search\",\n      \"max_uses\": 25\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "YOUR_AUTHENTICATION_ID",
        "headerParameters": {
          "parameters": [
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4
    },
    {
      "id": "03d9a61f-4e43-44af-8e40-160e67130f5d",
      "name": "Format Follow-up Synthesis Email1",
      "type": "n8n-nodes-base.code",
      "position": [
        2432,
        624
      ],
      "parameters": {
        "jsCode": "user@example.com"
      },
      "typeVersion": 2
    },
    {
      "id": "f3465082-ae45-4e83-af98-39a403c2f51b",
      "name": "Send Follow-up Analysis Email1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2640,
        624
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $json.body }}",
        "options": {},
        "subject": "={{ $json.subject }}"
      },
      "typeVersion": 2
    },
    {
      "id": "589fba61-00ee-4cc7-8eed-168f9580bda2",
      "name": "Wednesday 8AM EST Follow-up1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        32,
        624
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 13 * * 3"
            }
          ]
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4a9c1abc-d953-4604-a3ff-83f496f9cd3d",
  "connections": {
    "Read Stocks2": {
      "main": [
        [
          {
            "node": "Prepare Stock Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every Monday 8AM2": {
      "main": [
        [
          {
            "node": "Read Stocks2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Form Data": {
      "main": [
        [
          {
            "node": "Read Stocks - Follow-up1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Index Funds1": {
      "main": [
        [
          {
            "node": "Prepare Index Fund Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "First day of Month": {
      "main": [
        [
          {
            "node": "Read Index Funds1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Stock Data1": {
      "main": [
        [
          {
            "node": "Build Claude Prompt- Fundemental",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Synthesis Email": {
      "main": [
        [
          {
            "node": "Send Dual Analysis Email",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Dual Analysis Email1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Index Fund Email": {
      "main": [
        [
          {
            "node": "Send Index Fund Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Index Fund Prompt1": {
      "main": [
        [
          {
            "node": "Claude Index Fund Analysis1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Portfolio Follow-up Form": {
      "main": [
        [
          {
            "node": "Read Stocks - Follow-up1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Claude Synthesis": {
      "main": [
        [
          {
            "node": "Claude Synthesis Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Index Fund Data1": {
      "main": [
        [
          {
            "node": "Build Index Fund Prompt1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Stocks - Follow-up1": {
      "main": [
        [
          {
            "node": "Prepare Stock Data - Follow-up1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Synthesis Analysis": {
      "main": [
        [
          {
            "node": "Format Synthesis Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Index Fund Analysis": {
      "main": [
        [
          {
            "node": "Format Index Fund Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Index Fund Analysis1": {
      "main": [
        [
          {
            "node": "Format Index Fund Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Follow-up Email Prompt1": {
      "main": [
        [
          {
            "node": "Wait 24hrs for Form Submission",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wednesday 8AM EST Follow-up1": {
      "main": [
        [
          {
            "node": "Send Follow-up Email Prompt1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 24hrs for Form Submission": {
      "main": [
        [
          {
            "node": "Process Form Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Claude Technical Prompt": {
      "main": [
        [
          {
            "node": "Claude Stock Analysis - Technical",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Stock Data - Follow-up1": {
      "main": [
        [
          {
            "node": "Build Follow-up Fundamental Prompt1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Claude Prompt- Fundemental": {
      "main": [
        [
          {
            "node": "Claude Stock Analysis - Fundemental",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Follow-up Synthesis Prompt1": {
      "main": [
        [
          {
            "node": "Claude Follow-up Synthesis Analysis1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Follow-up Technical Prompt1": {
      "main": [
        [
          {
            "node": "Claude Follow-up Technical Analysis1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Stock Analysis - Technical": {
      "main": [
        [
          {
            "node": "Prepare Claude Synthesis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Follow-up Synthesis Email1": {
      "main": [
        [
          {
            "node": "Send Follow-up Analysis Email1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Follow-up Fundamental Prompt1": {
      "main": [
        [
          {
            "node": "Claude Follow-up Fundamental Analysis1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Stock Analysis - Fundemental": {
      "main": [
        [
          {
            "node": "Prepare Claude Technical Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Follow-up Synthesis Analysis1": {
      "main": [
        [
          {
            "node": "Format Follow-up Synthesis Email1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Follow-up Technical Analysis1": {
      "main": [
        [
          {
            "node": "Build Follow-up Synthesis Prompt1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Follow-up Fundamental Analysis1": {
      "main": [
        [
          {
            "node": "Build Follow-up Technical Prompt1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}