{
  "name": "Log congress stock trades for your ticker watchlist to Google Sheets with Apify",
  "nodes": [
    {
      "id": "9a1f4c60-0001-4d01-d001-000000000001",
      "name": "Every Monday morning",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        460
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9a1f4c60-0005-4d05-d005-000000000005",
      "name": "Set your ticker watchlist",
      "type": "n8n-nodes-base.set",
      "position": [
        260,
        460
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9a1f4c60-0002-4d02-d+1234567890",
              "name": "watchlist",
              "type": "array",
              "value": "[\"NVDA\", \"MSFT\", \"AMZN\", \"AAPL\"]"
            },
            {
              "id": "9a1f4c60-0003-4d03-d+1234567890",
              "name": "lookbackDays",
              "type": "number",
              "value": 180
            },
            {
              "id": "9a1f4c60-0004-4d04-d+1234567890",
              "name": "maxResultsPerTicker",
              "type": "number",
              "value": 100
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9a1f4c60-0006-4d06-d006-000000000006",
      "name": "One search per ticker",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        520,
        460
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "watchlist"
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-0007-4d07-d007-000000000007",
      "name": "Fetch congress trade disclosures",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        780,
        460
      ],
      "parameters": {
        "memory": 1024,
        "actorId": "johnvc~us-congress-financial-disclosures-and-stock-trading-data",
        "resource": "Actors",
        "operation": "Run actor and get dataset",
        "customBody": "={{ JSON.stringify({ Stock_Symbol: $json.watchlist, Start_Date: $now.minus({ days: $json.lookbackDays }).format('yyyy-MM-dd'), End_Date: $now.format('yyyy-MM-dd'), Max_Results: $json.maxResultsPerTicker }) }}"
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-000a-4d0a-d00a-00000000000a",
      "name": "Keep rows with a ticker and a date",
      "type": "n8n-nodes-base.filter",
      "position": [
        1040,
        460
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "9a1f4c60-0008-4d08-d+1234567890",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.Ticker }}",
              "rightValue": ""
            },
            {
              "id": "9a1f4c60-0009-4d09-d+1234567890",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.Date }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "9a1f4c60-0016-4d16-d016-000000000016",
      "name": "Pick fields for the sheet",
      "type": "n8n-nodes-base.set",
      "position": [
        1300,
        460
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9a1f4c60-000b-4d0b-d00b-+1234567890b",
              "name": "Transaction date",
              "type": "string",
              "value": "={{ $json.Date }}"
            },
            {
              "id": "9a1f4c60-000c-4d0c-d00c-+1234567890c",
              "name": "Disclosed date",
              "type": "string",
              "value": "={{ $json.Notification_Date }}"
            },
            {
              "id": "9a1f4c60-000d-4d0d-d00d-+1234567890d",
              "name": "Member",
              "type": "string",
              "value": "={{ (($json.First_Name || '') + ' ' + ($json.Last_Name || '')).trim() }}"
            },
            {
              "id": "9a1f4c60-000e-4d0e-d00e-+1234567890e",
              "name": "Chamber",
              "type": "string",
              "value": "={{ $json.House }}"
            },
            {
              "id": "9a1f4c60-000f-4d0f-d00f-+1234567890f",
              "name": "State and district",
              "type": "string",
              "value": "={{ $json.State_District }}"
            },
            {
              "id": "9a1f4c60-0010-4d10-d010-+1234567890",
              "name": "Ticker",
              "type": "string",
              "value": "={{ $json.Ticker }}"
            },
            {
              "id": "9a1f4c60-0011-4d11-d011-+1234567890",
              "name": "Asset",
              "type": "string",
              "value": "={{ $json.Asset }}"
            },
            {
              "id": "9a1f4c60-0012-4d12-d012-+1234567890",
              "name": "Transaction",
              "type": "string",
              "value": "={{ /partial/i.test($json.Transaction_Type || '') ? 'Partial sale' : /^p/i.test($json.Transaction_Type || '') ? 'Purchase' : /^s/i.test($json.Transaction_Type || '') ? 'Sale' : /^e/i.test($json.Transaction_Type || '') ? 'Exchange' : $json.Transaction_Type }}"
            },
            {
              "id": "9a1f4c60-0013-4d13-d013-+1234567890",
              "name": "Amount range",
              "type": "string",
              "value": "={{ $json.Amount_Range }}"
            },
            {
              "id": "9a1f4c60-0015-4d15-d015-+1234567890",
              "name": "Filing",
              "type": "string",
              "value": "={{ $json.House === 'House' ? 'https://disclosures-clerk.house.gov/public_disc/ptr-pdfs/' + $json.Year + '/' + $json.DocID + '.pdf' : '' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9a1f4c60-0017-4d17-d017-000000000017",
      "name": "Append trades to sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1560,
        460
      ],
      "parameters": {
        "columns": {
          "value": {},
          "mappingMode": "autoMapInputData",
          "matchingColumns": []
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "9a1f4c60-0018-4d18-d018-000000000018",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -620,
        40
      ],
      "parameters": {
        "width": 520,
        "height": 1080,
        "content": "## Log congress stock trades for your ticker watchlist to Google Sheets with Apify\n\nNo Firecrawl API key and no OpenAI key. Every Monday this workflow checks whether any member of Congress disclosed a trade in the stocks you follow, and appends one row per transaction to your sheet: member, chamber, ticker, buy or sell, dollar range, and a link to the filing.\n\nEvery row traces back to a Periodic Transaction Report the member filed with their own chamber under the STOCK Act. No language model reads or rewrites anything, so nothing is summarized away.\n\n**Who's it for**\nInvestors following congressional activity in their own holdings, reporters covering a member or a company, and compliance teams that need an auditable record instead of a daily email.\n\n**How it works**\n1. A schedule trigger fires once a week\n2. One Set node holds your tickers and how far back to look\n3. The Apify node runs one disclosure search per ticker\n4. Each transaction becomes a row, with the codes decoded\n\n**Setup**\n1. Create a free Apify account and add your API token to the Apify credential\n2. Connect your Google account in the Sheets node and pick a spreadsheet\n3. Replace the example tickers with the ones you follow\n\n**Good to know**\nA weekly four-ticker run costs around 15 cents. Pay per use, no subscription."
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-0019-4d19-d019-000000000019",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        60
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 240,
        "content": "### 1. Schedule\nRuns every Monday morning. Change the cadence or swap in a manual trigger."
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-001a-4d1a-d01a-00000000001a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        60
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 240,
        "content": "### 2. Your watchlist\nThe tickers you follow and the lookback window. This is the only node you edit."
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-001b-4d1b-d01b-00000000001b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        60
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 240,
        "content": "### 3. Fan out\nTurns your watchlist into one disclosure search per ticker."
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-001c-4d1c-d01c-00000000001c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        60
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 240,
        "content": "### 4. Search\nRuns the Congress disclosures API actor across both chambers. Add your Apify credential here."
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-001d-4d1d-d01d-00000000001d",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        60
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 240,
        "content": "### 5. Clean\nDrops rows with no ticker, such as bonds and funds, and any row missing a date."
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-001e-4d1e-d01e-00000000001e",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1260,
        60
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 240,
        "content": "### 6. Shape\nChoose your sheet columns. Filing codes become Purchase, Sale, or Partial sale."
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-001f-4d1f-d01f-00000000001f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        60
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 240,
        "content": "### 7. Deliver\nPick your spreadsheet and tab. Columns map automatically."
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-0020-4d20-d020-000000000020",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        760
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 240,
        "content": "### Why look back 180 days?\nMembers have up to 45 days to report a trade, and filings often land later than that. A short window would miss trades that were only just disclosed."
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-0021-4d21-d021-000000000021",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        760
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 240,
        "content": "### Watching a member instead?\nAdd `Last_Name` to the input in the search node to follow one member across every holding."
      },
      "typeVersion": 1
    },
    {
      "id": "9a1f4c60-0022-4d22-d022-000000000022",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1060,
        760
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 240,
        "content": "### Self-hosting n8n?\nThere is also a dedicated community node for this actor: `n8n-nodes-congress-trades-api` on npm."
      },
      "typeVersion": 1
    }
  ],
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Every Monday morning": {
      "main": [
        [
          {
            "node": "Set your ticker watchlist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One search per ticker": {
      "main": [
        [
          {
            "node": "Fetch congress trade disclosures",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pick fields for the sheet": {
      "main": [
        [
          {
            "node": "Append trades to sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set your ticker watchlist": {
      "main": [
        [
          {
            "node": "One search per ticker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch congress trade disclosures": {
      "main": [
        [
          {
            "node": "Keep rows with a ticker and a date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep rows with a ticker and a date": {
      "main": [
        [
          {
            "node": "Pick fields for the sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}