Build an Insider Trading Newsletter with n8n (Free Workflow)

Build an Insider Trading Newsletter with n8n (Free Workflow)
Tested in n8n 2.49.9 against Edgrapi's insider endpoints on December 1, 2026.

On December 1, 2026, my n8n workflow sent me an email with the subject "2 insider buys: YUMC $201,621 leads." It had a Yum China director's purchase, Plug Power's CEO buying company stock, and six companies where several insiders bought within two weeks.

An insider trading newsletter in n8n is a six-node workflow: a weekday schedule, two HTTP Request nodes that pull open-market insider buys and cluster buys, a Code node that filters them and builds an HTML email, and a Send Email node. If nothing clears your filter, no email goes out. This guide gives you the workflow file, tested in n8n 2.49.9 against live data.

Key takeaway: An insider trading newsletter in n8n is six nodes: a weekday 7am schedule, two HTTP Request nodes for open-market insider buys and cluster buys, a Code node that filters to buys over $100,000 and builds the HTML, and a Send Email node. No qualifying buys means no email. It costs 10 credits a run, about 220 a month.
Edgrapi serves SEC filings and US federal data as clean JSON, plus an MCP server for AI agents. Free key, no card.Get a free API key

How do you build an insider trading newsletter in n8n?

Chain six nodes: a Schedule Trigger for weekday mornings, an HTTP Request node for the day's open-market insider buys, a second one for cluster buys, a Code node that filters and formats the email, and a Send Email node over SMTP. A Manual Trigger lets you test it on demand. Import the template below, add two credentials, and it runs.

The six nodes, and what each one does:

NodeTypeWhat it does
Weekdays at 7amSchedule TriggerRuns Monday to Friday at 7am (cron 0 7 * * 1-5)
Test nowManual TriggerLets you run it on demand while you set it up
Latest insider buysHTTP RequestGET /v1/insider/latest: open-market buys from about the last day
Cluster buysHTTP RequestGET /v1/insider/clusters: companies where 3+ insiders bought in 15 days
Build digestCodeFilters, builds the subject and HTML, or returns nothing
Email digestSend EmailSends the HTML email over SMTP

The data comes from Edgrapi's insider endpoints, which is my own API, so weigh that, but the n8n side is plain HTTP and JavaScript and works with any feed that returns insider buys as JSON. Both endpoints read the SEC's live Form 4 stream and keep only open-market purchases, transaction code P.

Download the workflow template, a 5 KB JSON file with no keys in it, then use Import from File in n8n's workflow menu, which n8n's import docs describe.

The n8n insider newsletter workflow
Six nodes; the Manual Trigger is for testing.

What does the insider trading newsletter send?

One email per weekday with two sections: open-market insider buys over $100,000 from about the last 24 hours, with the company, the insider, their role, the dollar amount and a link to the Form 4, and a list of cluster buys, companies where three or more insiders bought within 15 days. The subject line names the biggest buy, so you can decide from your inbox whether to open it.

On the run I'm quoting, the feed had 6 open-market buys of at least $50,000. Three were over $100,000, and one of those was a 10% owner buying Workhorse Group, which the filter drops. That left two:

CompanyInsiderRoleBought
Yum China (YUMC)Alexander DimitriefDirector$201,621
Plug Power (PLUG)Jose Luis CrespoCEO and President$108,500

The cluster section listed six companies, led by Global Net Lease with 8 insiders buying $701,271 and Suncrete with 7 insiders buying $1,298,741.

Days vary a lot, and even hours do: earlier the same evening the feed held 10 buys over $50,000, and the newsletter would have had five, led by a $4.29 million purchase by Biglari Holdings' chairman and CEO.

If you'd rather get each buy the moment it's filed, the Slack version of this alert posts one message per buy, while a daily digest is the calmer choice.

The insider newsletter email from the test run
The December 1, 2026 test email, as the local mail server captured it.

How do you set up the Edgrapi credential in n8n?

Use n8n's Header Auth credential. Create it once with the header name X-API-Key and your Edgrapi key as the value, then select it in both HTTP Request nodes under Authentication, Generic Credential Type, Header Auth. Credentials live in n8n's encrypted store, not in the workflow, so the template file has no key in it and is safe to share.

n8n's HTTP Request credentials docs describe Header Auth as a header Name plus a Value, which is exactly what Edgrapi expects.

Each HTTP Request node is a GET with two query parameters:

The first one asks for buys from $50,000 up and leaves the $100,000 cut to the Code node, so you can change the floor in one place without touching the API call.

Get the key from the Edgrapi dashboard. Each call costs 5 credits.

What does the Code node do?

The Code node reads both HTTP responses, keeps buys of $100,000 or more, drops buyers whose only role is "10% owner" (mostly funds), and builds one HTML email with a subject line naming the biggest buy. If there are no buys and no clusters, it returns an empty list, and n8n doesn't run the Send Email node at all, so a quiet day sends nothing.

Paste this into the Code node, mode Run Once for All Items:

// n8n Code node: "Build digest". Mode: Run Once for All Items.
// Reads the two HTTP Request nodes and returns one item with the email subject + HTML,
// or no items at all when there's nothing worth sending (so the Send Email node doesn't run).
const MIN_VALUE = 100000;
const buys = $('Latest insider buys').first().json.buys || [];
const clusters = $('Cluster buys').first().json.clusters || [];

const esc = s => String(s ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
const usd = n => '$' + Math.round(n).toLocaleString('en-US');

// Officers and directors only: drop buyers whose only role is "10% owner" (mostly funds)
const keep = buys.filter(b => b.buy_value >= MIN_VALUE &&
  !((b.relationship || []).length === 1 && b.relationship[0] === '10% owner'));

if (keep.length === 0 && clusters.length === 0) return [];

const rows = keep.map(b => `<tr>
  <td><b>${esc(b.ticker)}</b><br><span style="color:#666">${esc(b.company)}</span></td>
  <td>${esc(b.owner)}<br><span style="color:#666">${esc(b.officer_title || (b.relationship || []).join(', '))}</span></td>
  <td style="text-align:right">${usd(b.buy_value)}</td>
  <td><a href="${esc(b.filed_url)}">Form 4</a></td></tr>`).join('');

const clusterRows = clusters.slice(0, 10).map(c => `<li><b>${esc(c.ticker)}</b> ${esc(c.company)}:
  ${c.insider_count} insiders, ${usd(c.total_value)}</li>`).join('');

const html = `<h2 style="font-family:sans-serif">Insider buys, last 24 hours</h2>
${keep.length ? `<table cellpadding="6" style="border-collapse:collapse;font-family:sans-serif;font-size:14px">
<tr style="background:#eee"><th align="left">Company</th><th align="left">Insider</th><th>Bought</th><th></th></tr>
${rows}</table>` : '<p>No open-market buys over $100,000 today.</p>'}
<h3 style="font-family:sans-serif">Cluster buys, last 15 days</h3>
<ul style="font-family:sans-serif;font-size:14px">${clusterRows || '<li>None.</li>'}</ul>
<p style="color:#888;font-size:12px;font-family:sans-serif">Open-market purchases (Form 4, code P) from SEC EDGAR.
Not investment advice.</p>`;

const top = keep[0];
const subject = keep.length
  ? `${keep.length} insider buy${keep.length > 1 ? 's' : ''}: ${top.ticker} ${usd(top.buy_value)} leads`
  : `${clusters.length} cluster buys this fortnight`;

return [{ json: { subject, html, buys: keep.length, clusters: clusters.length } }];

The subject line does the triage for you. On a day with buys it reads like "2 insider buys: YUMC $201,621 leads," naming the count and the biggest purchase. On a day with no qualifying buys but some clusters, it switches to "6 cluster buys this fortnight," so you can tell the two kinds of email apart without opening either one.

$('Latest insider buys') reads another node's output by name, so keep the node names the same as in the template, or change them here too.

The esc() function escapes &, < and > before they go into the HTML. Company names like "Babcock & Wilcox" turn up in this data, and a stray < would break the email.

The 10% owner filter is a judgment call. Hedge funds that own more than 10% of a company file Form 4s too, and on a busy day they can crowd the list, so delete that line if you want them.

How do you change what the newsletter includes?

Edit the one keep filter line in the Code node. To keep only officers such as CEOs and CFOs, filter on officer_title. To follow a watchlist, check the ticker against a set. To make the email shorter or longer, change MIN_VALUE. Each change stays inside the Code node, so the API calls and their cost don't change.

Officers only, which drops directors and funds:

const keep = buys.filter(b => b.buy_value >= MIN_VALUE && b.officer_title);

A watchlist, keeping the 10% owner rule:

const WATCH = new Set(['BH', 'PLUG', 'NVDA']);
const keep = buys.filter(b => WATCH.has(b.ticker) && b.buy_value >= MIN_VALUE &&
  !((b.relationship || []).length === 1 && b.relationship[0] === '10% owner'));

I ran both against the busier feed from earlier that evening. The default filter kept five buys, officers only kept four (it dropped the Yum China director), and the three-ticker watchlist kept two, the Biglari and Plug Power buys.

A watchlist makes quiet days common, and on those days the Code node returns nothing and no email goes out, which is usually what you want from a watchlist.

How the newsletter filter cuts the feed
The same day's feed, an hour or two apart.
Try it on real data. Parsed Form 4 insider trades for a ticker:
curl -H "X-API-Key: edgr_your_key" "https://api.edgrapi.com/v1/insider/AAPL"
Get a free API key  50 free credits, no card.

How do you send the digest by email?

Use n8n's Send Email node with an SMTP credential, set Email Format to HTML, and map the subject and HTML from the Code node with the expressions {{ $json.subject }} and {{ $json.html }}. Any SMTP account works, including Gmail with an app password, a Microsoft 365 mailbox or a sending service. Turn off the n8n attribution option so the email doesn't end with an n8n footer.

The Send Email node docs say it "sends emails using an SMTP email server," with fields named From Email, To Email, Subject and Email Format.

I didn't expect the footer. Node version 2.1 adds "This email was sent automatically with n8n" to every message unless you switch off Append n8n Attribution under the node's options, and the template already has it off.

To send to a few colleagues, put several addresses in To Email, separated by commas. For a real newsletter with subscribers, send through your email platform's API instead, since SMTP from a personal account isn't built for lists.

How do you schedule the newsletter?

The Schedule Trigger in the template runs at 7am Monday to Friday, using the cron expression 0 7 * * 1-5 and the workflow time zone, set to America/New_York. Insider buys are filed through the trading day and evening, so a morning digest catches the previous day. The schedule only fires once you save and publish the workflow.

The publish step is easy to miss, and n8n's Schedule Trigger docs say: "If a workflow uses the Schedule node as a trigger, make sure that you save and publish the workflow."

On time zones, the docs say n8n uses the workflow's time zone if set, otherwise the instance's, and that self-hosted n8n defaults to America/New_York. The template sets it explicitly, so 7am means 7am Eastern on any server; change it under Workflow Settings if you're elsewhere.

The Edgrapi feed holds roughly the last 24 hours of buys, so one run a day picks up each buy once, and two runs a day would show some buys twice.

n8n schedule settings for the newsletter
Cron, time zone and publish all have to be right.

How did I test the n8n workflow?

I installed n8n 2.49.9 locally, imported the workflow and both credentials from the command line, and ran it with n8n's execute command. The email went to a test mail server on my own machine, so I could read exactly what n8n sent without emailing anyone. I also ran a copy whose Code node returns nothing, to check the no-email case.

What happened:

Two things I found along the way. The command-line execute won't start from a Schedule Trigger, which is one reason the template has the Manual Trigger. And n8n's static data, the usual place to remember what you've already sent, isn't saved during test runs, per n8n's docs, which is why this workflow leans on the feed's 24-hour window instead of keeping its own memory.

How much does the n8n insider newsletter cost?

Each run makes two Edgrapi calls at 5 credits each, so 10 credits a run. Weekday runs come to about 220 credits a month, which fits Edgrapi's $3 Lite plan of 1,500 credits with plenty left. Self-hosted n8n is free to run, while n8n Cloud is a paid plan. SMTP is whatever your mail provider charges, usually nothing at this volume.

The math:

ScheduleRuns a monthCredits a monthFits on
Weekdays at 7am22220Lite, $3
Every day at 7am30300Lite, $3
Weekdays, 7am and 5pm44440Lite, $3

One plan caveat: on Free, Lite and Starter the market-wide insider feeds (/v1/insider/latest and /v1/insider/clusters) run 24 hours behind, so alerts on those plans arrive a day late. Pro ($29/month) and above get them in real time. Per-ticker lookups are current on every plan.

The free tier's 50 credits cover five test runs. Failed calls cost nothing, so a typo in a URL won't eat credits.

If you only want cluster buys, delete the first HTTP Request node and you halve the cost, but remove its line from the Code node too.

Monthly credit cost of the n8n newsletter
Every schedule here fits the $3 Lite plan.

What are the limits of this newsletter?

It shows open-market purchases only, not sales, option exercises or grants. Insiders have two business days to file Form 4, so a buy reaches you a day or more after it happened. The feed is a rolling window of about 24 hours, so if your n8n instance is down for a day, that day's buys are gone. And a newsletter built on insider buys is a research prompt, not a trading signal.

A few specifics:

As for why buys and not sales, research by Jeng, Metrick and Zeckhauser found insider purchases earn abnormal returns of more than 6% a year, while insider sales don't earn significant abnormal returns. Those are averages across thousands of trades, not a promise about any one buy.

Import the template and send yourself one test

Download the template, import it into n8n, add an Edgrapi Header Auth credential and an SMTP credential, put your address in To Email, and click Test now. Check the email, change the $100,000 floor if it's too busy or too quiet, then publish the workflow so the weekday schedule takes over.

The free tier's 50 credits cover five test runs before you pay anything, and you can get a key here.

Frequently asked questions

How do I make my own insider trading newsletter?

Use an automation tool like n8n with an insider trading API. Schedule a daily run, fetch the previous day's open-market insider buys, filter them by size and role, format an HTML email and send it over SMTP. The template in this guide does all of that with six nodes, at about 220 API credits a month for weekday emails.

Is there a free n8n template for stock or insider alerts?

Yes. This guide's template is a free n8n workflow that emails a daily digest of insider buys and cluster buys. Import it with Import from File, add your API key as a Header Auth credential and an SMTP credential, and it runs on a weekday schedule. It contains no keys, so it's safe to share.

How do I call an API with an API key in n8n?

Use the HTTP Request node with Authentication set to Generic Credential Type and Header Auth. Create a credential with the header name your API expects, such as X-API-Key, and your key as the value. n8n stores the credential encrypted and adds the header to every request from nodes that use it.

Why doesn't my n8n schedule trigger run?

Usually because the workflow isn't published. n8n's docs say a workflow using the Schedule node as a trigger must be saved and published before it runs on schedule. Also check the time zone: n8n uses the workflow's time zone if set, otherwise the instance's, which defaults to America/New_York when self-hosted.

How do I stop n8n adding a footer to emails?

Open the Send Email node, add the option Append n8n Attribution and switch it off. Send Email node version 2.1 adds "This email was sent automatically with n8n" by default. The workflow template in this guide already has the option turned off.

What is a cluster buy?

A cluster buy is when several insiders at one company buy shares within a short window, usually three or more within 15 days. Edgrapi's /v1/insider/clusters endpoint returns these companies with the insider count and total value. On December 1, 2026 it listed six, led by Global Net Lease with eight insiders buying.

Related guides: Insider trades and fund holdings

Get a free API key