<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kevin Meneses González</title>
    <description>The latest articles on DEV Community by Kevin Meneses González (@kevin_menesesgonzlez).</description>
    <link>https://dev.to/kevin_menesesgonzlez</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2412421%2F23a50b66-3e3e-4d13-8809-9bc0b03c0f40.png</url>
      <title>DEV Community: Kevin Meneses González</title>
      <link>https://dev.to/kevin_menesesgonzlez</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kevin_menesesgonzlez"/>
    <language>en</language>
    <item>
      <title>8 Best MCP Servers for Financial Data in 2026 (Tested)</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Sun, 15 Nov 2026 22:25:55 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/8-best-mcp-servers-for-financial-data-in-2026-tested-41o1</link>
      <guid>https://dev.to/kevin_menesesgonzlez/8-best-mcp-servers-for-financial-data-in-2026-tested-41o1</guid>
      <description>&lt;p&gt;The best MCP server for financial data in 2026 is &lt;strong&gt;EODHD&lt;/strong&gt;: one hosted endpoint gives Claude, ChatGPT or Cursor global prices, fundamentals, earnings, macro, news and a screener, starting at $19.99/month. If you only need US filings, the free &lt;strong&gt;SEC EDGAR MCP&lt;/strong&gt; is enough. If you need to place trades, &lt;strong&gt;Alpaca&lt;/strong&gt; is the only one here that can.&lt;/p&gt;

&lt;p&gt;That's the short answer.&lt;/p&gt;

&lt;p&gt;The longer one matters more, because most "best MCP servers" lists you'll find are written from the README. Nobody connects anything. Nobody checks whether two servers return the same price for the same stock on the same day.&lt;/p&gt;

&lt;p&gt;So I did.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;building an AI agent that answers market questions,&lt;/li&gt;
&lt;li&gt;giving Claude access to real numbers instead of its training data,&lt;/li&gt;
&lt;li&gt;or picking a data layer before you write a single line of code,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this is the comparison you want before you pay for anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I tested these financial MCP servers
&lt;/h2&gt;

&lt;p&gt;Every server got the same five questions on &lt;strong&gt;November 9, 2026&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Price:&lt;/strong&gt; What did AAPL close at on November 6, 2026?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global coverage:&lt;/strong&gt; Give me 5 years of daily prices for Vodafone on the London Stock Exchange.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fundamentals:&lt;/strong&gt; What is Apple's trailing P/E and revenue?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Events:&lt;/strong&gt; Who reports earnings between November 9 and 13?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Setup:&lt;/strong&gt; How do you connect it, and how does it authenticate?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here's the honest part about &lt;em&gt;how&lt;/em&gt; each one was tested, because it changes how much you should trust each row:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Called through MCP:&lt;/strong&gt; EODHD (its hosted &lt;code&gt;v1&lt;/code&gt; endpoint, first with the public demo key, then with a paid key) and Financial Modeling Prep (its connector inside Claude).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Called through the library the MCP wraps:&lt;/strong&gt; Yahoo Finance (&lt;code&gt;yfinance&lt;/code&gt; 1.8.0) and SEC EDGAR (the official XBRL API).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docs only:&lt;/strong&gt; Alpha Vantage, Massive, Financial Datasets and Alpaca. Alpha Vantage's hosted MCP answered my scripted client with a 403, and the other three need paid or account keys. For those I only report what their official pages say, and I mark it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The raw JSON from every call is saved next to this article. Every number below comes from it. If you're choosing a plain REST API rather than an MCP server, I compared those in &lt;a href="https://kevinmeneses.com/en/articles/best-stock-market-data-api-for-vibe-coding-in-2026" rel="noopener noreferrer"&gt;Best Stock Market Data API for Vibe Coding in 2026&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The results at a glance
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;MCP server&lt;/th&gt;
&lt;th&gt;AAPL close (Nov 6)&lt;/th&gt;
&lt;th&gt;Global stocks&lt;/th&gt;
&lt;th&gt;Fundamentals&lt;/th&gt;
&lt;th&gt;Earnings calendar&lt;/th&gt;
&lt;th&gt;Auth&lt;/th&gt;
&lt;th&gt;Cheapest paid plan&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;EODHD&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;342.37 ✅&lt;/td&gt;
&lt;td&gt;✅ 1,262 rows&lt;/td&gt;
&lt;td&gt;✅ P/E 38.13&lt;/td&gt;
&lt;td&gt;✅ all 5 days (filter by symbol)&lt;/td&gt;
&lt;td&gt;API key or OAuth 2.1&lt;/td&gt;
&lt;td&gt;$19.99/mo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Financial Modeling Prep&lt;/td&gt;
&lt;td&gt;342.37 ✅&lt;/td&gt;
&lt;td&gt;✅ VOD.L returned&lt;/td&gt;
&lt;td&gt;✅ P/E 38.91&lt;/td&gt;
&lt;td&gt;⚠️ capped at 4,000 rows, 2 days missing&lt;/td&gt;
&lt;td&gt;API key&lt;/td&gt;
&lt;td&gt;see pricing page&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Alpha Vantage&lt;/td&gt;
&lt;td&gt;docs only&lt;/td&gt;
&lt;td&gt;✅ per docs&lt;/td&gt;
&lt;td&gt;✅ per docs&lt;/td&gt;
&lt;td&gt;✅ per docs&lt;/td&gt;
&lt;td&gt;API key&lt;/td&gt;
&lt;td&gt;$49.99/mo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Yahoo Finance (open source)&lt;/td&gt;
&lt;td&gt;342.37 ✅&lt;/td&gt;
&lt;td&gt;✅ 1,261 rows&lt;/td&gt;
&lt;td&gt;✅ P/E 39.03&lt;/td&gt;
&lt;td&gt;✅ 21 rows&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;td&gt;free (unofficial)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Massive (ex-Polygon)&lt;/td&gt;
&lt;td&gt;docs only&lt;/td&gt;
&lt;td&gt;US-focused&lt;/td&gt;
&lt;td&gt;paid add-on&lt;/td&gt;
&lt;td&gt;per docs&lt;/td&gt;
&lt;td&gt;API key&lt;/td&gt;
&lt;td&gt;$199/mo (Stocks Advanced)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Financial Datasets&lt;/td&gt;
&lt;td&gt;docs only&lt;/td&gt;
&lt;td&gt;27,530 tickers&lt;/td&gt;
&lt;td&gt;✅ per docs&lt;/td&gt;
&lt;td&gt;not listed&lt;/td&gt;
&lt;td&gt;API key&lt;/td&gt;
&lt;td&gt;$20 one-time credits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;Alpaca&lt;/td&gt;
&lt;td&gt;docs only&lt;/td&gt;
&lt;td&gt;US stocks, crypto, options&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;key + secret&lt;/td&gt;
&lt;td&gt;free paper account&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;SEC EDGAR&lt;/td&gt;
&lt;td&gt;❌ no prices&lt;/td&gt;
&lt;td&gt;US filers only&lt;/td&gt;
&lt;td&gt;✅ revenue from 10-K&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;none (user agent)&lt;/td&gt;
&lt;td&gt;free&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three things jumped out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Prices agree.&lt;/strong&gt; EODHD, FMP and Yahoo all returned exactly &lt;strong&gt;342.37&lt;/strong&gt; for AAPL on November 6.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fundamentals don't.&lt;/strong&gt; The trailing P/E for the same company on the same day was &lt;strong&gt;38.13&lt;/strong&gt; (EODHD), &lt;strong&gt;38.91&lt;/strong&gt; (FMP) and &lt;strong&gt;39.03&lt;/strong&gt; (Yahoo). Each provider uses a different price timestamp and EPS definition. Your agent will quote whichever one you connect, so pick one and stay consistent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Output size matters more than tool count.&lt;/strong&gt; An unfiltered earnings calendar for one week returned &lt;strong&gt;1,047,665 characters&lt;/strong&gt; on EODHD and &lt;strong&gt;611,957&lt;/strong&gt; on FMP. Either one overflows an LLM's context window. Filtering by symbol on EODHD brought it down to &lt;strong&gt;932&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now the details.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. EODHD MCP: best overall financial data MCP server
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://eodhd.com/?via=kmg&amp;amp;ref1=Meneses&amp;amp;utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=best-financial-data-mcp-servers&amp;amp;utm_content=Meneses" rel="noopener noreferrer"&gt;EODHD&lt;/a&gt; runs a hosted MCP server with two endpoints: &lt;code&gt;v1&lt;/code&gt; takes your API key in the URL (Claude Code, ChatGPT, custom agents), and &lt;code&gt;v2&lt;/code&gt; uses OAuth 2.1 (Claude Desktop and claude.ai custom connectors). The &lt;a href="https://eodhd.com/financial-apis/mcp-server-for-financial-data-by-eodhd?via=kmg&amp;amp;ref1=Meneses&amp;amp;utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=best-financial-data-mcp-servers&amp;amp;utm_content=Meneses" rel="noopener noreferrer"&gt;docs page&lt;/a&gt; lists 72 read-only tools. When I connected to &lt;code&gt;v1&lt;/code&gt; and called &lt;code&gt;tools/list&lt;/code&gt;, it returned &lt;strong&gt;100&lt;/strong&gt;, including marketplace datasets like ESG scores, bond analytics and trading hours.&lt;/p&gt;

&lt;p&gt;That breadth is the reason it's #1. In a single connection you get:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;end-of-day, intraday and live prices for 150,000+ tickers worldwide,&lt;/li&gt;
&lt;li&gt;fundamentals, earnings calendars, insider and congressional trades,&lt;/li&gt;
&lt;li&gt;macro indicators, Treasury yields, news with sentiment, and a stock screener.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's the exact client I used to call it. No SDK, just the MCP protocol over HTTP:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;

&lt;span class="no"&gt;URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.eodhd.com/v1/mcp?apikey=demo"&lt;/span&gt;  &lt;span class="c1"&gt;# demo covers AAPL.US; use your own key for the rest&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
               &lt;span class="s2"&gt;"Accept"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json, text/event-stream"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Mcp-Session-Id"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;urlopen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;sid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Mcp-Session-Id"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;"data:"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="c1"&gt;# streamable HTTP can answer as server-sent events&lt;/span&gt;
        &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splitlines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"data:"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sid&lt;/span&gt;

&lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"jsonrpc"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"initialize"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"params"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"protocolVersion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2025-06-18"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"capabilities"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"clientInfo"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"test"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"jsonrpc"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"notifications/initialized"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"jsonrpc"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"tools/call"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"params"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"get_historical_stock_prices"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"arguments"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"ticker"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"AAPL.US"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"start_date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-06"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"end_date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-06"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"result"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[{"date": "2026-11-06", "open": 338.73, "high": 345.79, "low": 338.3, "close": 342.37, "adjusted_close": 342.37, "volume": 44703806}]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Price calls took under a second, and fundamentals under two. Apple's fundamentals came back with a trailing P/E of 38.13 and TTM revenue of $478,833,999,872. I checked that revenue against Apple's own 10-K on SEC EDGAR: &lt;strong&gt;$478,834,000,000&lt;/strong&gt;. Same number, rounded.&lt;/p&gt;

&lt;p&gt;With a paid key, Vodafone (&lt;code&gt;VOD.LSE&lt;/code&gt;) returned &lt;strong&gt;1,262 daily rows&lt;/strong&gt; from November 8, 2021 to November 6, 2026, with a close of 110.96 on the first day and 116.5 on the last, the same as FMP and Yahoo. It also returns an &lt;code&gt;adjusted_close&lt;/code&gt; next to the raw close (78.14 for that first day), so total-return math doesn't need a second call.&lt;/p&gt;

&lt;p&gt;The earnings calendar is where you have to be careful. Asked for November 9 to 13 with no filter, it returned all five days: &lt;strong&gt;5,361 reports and 1,047,665 characters&lt;/strong&gt; in 4.9 seconds. That's complete, and far too big for a model to read. Passing &lt;code&gt;symbols&lt;/code&gt; fixes it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;get_upcoming_earnings(start_date="2026-11-09", end_date="2026-11-13",
                      symbols="CSCO.US,AMAT.US,DIS.US,JD.US,SPOT.US,NU.US,CTVA.US")

CTVA.US  2026-11-11  AfterMarket  est. 0.09
AMAT.US  2026-11-12  AfterMarket  est. 4.06
CSCO.US  2026-11-12  AfterMarket  est. 1.15
NU.US    2026-11-12  AfterMarket  est. 0.22
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;932 characters, 0.8 seconds. The tickers that didn't report that week simply aren't in the list.&lt;/p&gt;

&lt;p&gt;The detail I liked most was the error messages. On the demo key, the Vodafone and earnings-calendar calls returned a 403, with a hint written for an agent to read: a 403 means the plan doesn't cover the data, a 401 means a bad key, a 402 means the daily quota is spent, and &lt;code&gt;get_user_details&lt;/code&gt; tells you which plan you're on without using quota. An agent can recover from that on its own instead of retrying blindly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Widest coverage in one server: global stocks, ETFs, funds, indices, crypto, forex, bonds and macro.&lt;/li&gt;
&lt;li&gt;Hosted, so there's nothing to install. OAuth on &lt;code&gt;v2&lt;/code&gt; means no API key pasted into a config file.&lt;/li&gt;
&lt;li&gt;Every tool is read-only, so the model can't place an order by accident.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sections&lt;/code&gt; filters on fundamentals keep payloads small enough for the context window.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The free plan is for testing (20 calls a day, 1 year of end-of-day data). Agents need a paid plan.&lt;/li&gt;
&lt;li&gt;Pass &lt;code&gt;symbols&lt;/code&gt; on calendar calls, or the full week comes back at once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; anyone who wants one data layer for an AI agent that covers more than US stocks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which plan you need:&lt;/strong&gt; to reproduce the Vodafone and earnings-calendar questions you need a paid plan. EOD Historical All-World ($19.99/month) covers global prices; fundamentals need the Fundamentals Data Feed ($59.99) or All-In-One ($99.99). I covered the full Claude setup in &lt;a href="https://medium.datadriveninvestor.com/how-to-analyze-stocks-with-claude-eodhd-mcp-server-76c5abeae9a3" rel="noopener noreferrer"&gt;How to Analyze Stocks with Claude + EODHD MCP Server&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://eodhd.com/?via=kmg&amp;amp;ref1=Meneses&amp;amp;utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=best-financial-data-mcp-servers&amp;amp;utm_content=Meneses" rel="noopener noreferrer"&gt;Try the EODHD APIs MCP server here&lt;/a&gt;. Use the code &lt;strong&gt;KEVIN10&lt;/strong&gt; at checkout for 10% off.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Financial Modeling Prep MCP: best for deep US fundamentals
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://site.financialmodelingprep.com/" rel="noopener noreferrer"&gt;Financial Modeling Prep&lt;/a&gt; groups its API into a few broad MCP tools (&lt;code&gt;chart&lt;/code&gt;, &lt;code&gt;statements&lt;/code&gt;, &lt;code&gt;calendar&lt;/code&gt;, &lt;code&gt;company&lt;/code&gt;, &lt;code&gt;quote&lt;/code&gt; and more), each with an &lt;code&gt;endpoint&lt;/code&gt; parameter. It's a smart design: Claude sees 27 tools instead of hundreds, but can still reach as-reported statements, revenue segments, DCF models, 13F filings and earnings-call transcripts.&lt;/p&gt;

&lt;p&gt;In my test it returned the same 342.37 close for AAPL, plus a VWAP. Vodafone on the LSE worked as &lt;code&gt;VOD.L&lt;/code&gt;, with the first close of the window at 110.96, which matches Yahoo exactly. Its P/E TTM of 38.91 came with about 60 other ratios in one call.&lt;/p&gt;

&lt;p&gt;Then I asked for the earnings calendar with &lt;code&gt;limit: 5&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It returned &lt;strong&gt;4,000 rows&lt;/strong&gt; and 611,957 characters. The &lt;code&gt;limit&lt;/code&gt; was ignored, and because the response was capped at 4,000 rows, Monday and Tuesday (November 9 and 10) were missing entirely. Only one of the big names I was looking for, Cisco, made it into the result. The EODHD APIs unfiltered answer was even bigger, but it contained all five days, and its &lt;code&gt;symbols&lt;/code&gt; filter shrank it to 932 characters. I didn't find an equivalent filter on FMP's calendar tool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Very deep US fundamentals: as-reported statements, segments, ratios, DCF, transcripts.&lt;/li&gt;
&lt;li&gt;Few, broad tools keep the tool list small.&lt;/li&gt;
&lt;li&gt;Prices matched EODHD and Yahoo to the cent.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calendar endpoints can return payloads far bigger than a context window, and silently drop days.&lt;/li&gt;
&lt;li&gt;Its pricing and MCP docs pages blocked my automated fetch, so check limits yourself before you commit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; equity research agents focused on US company financials.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Alpha Vantage MCP: the best-known name
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.alphavantage.co/" rel="noopener noreferrer"&gt;Alpha Vantage&lt;/a&gt; was one of the first data providers to ship an official &lt;a href="https://mcp.alphavantage.co/" rel="noopener noreferrer"&gt;hosted MCP server&lt;/a&gt;, and it ranks #1 in several other lists. It covers stocks, forex, crypto, commodities, economic indicators and technical indicators.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Docs only.&lt;/em&gt; Its hosted server returned a 403 to my scripted MCP client, so I couldn't run my questions through it. Everything below comes from Alpha Vantage's own pages.&lt;/p&gt;

&lt;p&gt;The appeal is simplicity. It's a remote server, so there's nothing to install: you add the URL from their MCP page to Claude, Cursor or VS Code with your free key and start asking. Under the hood it's the same Alpha Vantage API many developers already know: time series, company overviews, earnings, FX, crypto, economic indicators and technical indicators.&lt;/p&gt;

&lt;p&gt;The catch is the rate limit. The free key allows &lt;strong&gt;25 requests per day&lt;/strong&gt;. Premium removes the daily cap and sells requests per minute instead:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Requests per minute&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;75&lt;/td&gt;
&lt;td&gt;$49.99/month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;150&lt;/td&gt;
&lt;td&gt;$99.99/month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;$149.99/month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;600&lt;/td&gt;
&lt;td&gt;$199.99/month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1,200&lt;/td&gt;
&lt;td&gt;$249.99/month&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Annual billing gives 2 months off, and they offer custom plans above 1,200 requests per minute.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Official, hosted MCP server from an established provider. Nothing to install.&lt;/li&gt;
&lt;li&gt;Strong on technical indicators and macro series, computed server-side.&lt;/li&gt;
&lt;li&gt;Familiar API: if you've used Alpha Vantage in Python, you already know what each tool returns.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;25 calls a day is about one agent conversation. You'll hit it fast.&lt;/li&gt;
&lt;li&gt;The cheapest paid plan costs more than 2x the EODHD APIs entry plan.&lt;/li&gt;
&lt;li&gt;I couldn't reach the server from a plain HTTP client, so test it from your own MCP client before you commit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; prototypes that lean on technical indicators, and developers already paying for Alpha Vantage.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Yahoo Finance MCP: best free option (with a catch)
&lt;/h2&gt;

&lt;p&gt;The most popular open-source &lt;a href="https://github.com/Alex2Yang97/yahoo-finance-mcp" rel="noopener noreferrer"&gt;Yahoo Finance MCP server&lt;/a&gt; (368 GitHub stars, MIT license) wraps the &lt;code&gt;yfinance&lt;/code&gt; Python library in 9 tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;get_historical_stock_prices&lt;/code&gt; and &lt;code&gt;get_stock_actions&lt;/code&gt; (dividends and splits)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_stock_info&lt;/code&gt;, &lt;code&gt;get_financial_statement&lt;/code&gt; and &lt;code&gt;get_holder_info&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_yahoo_finance_news&lt;/code&gt; and &lt;code&gt;get_recommendations&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_option_expiration_dates&lt;/code&gt; and &lt;code&gt;get_option_chain&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It runs locally. One command starts it, straight from GitHub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uvx --from git+https://github.com/Alex2Yang97/yahoo-finance-mcp yahoo-finance-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran my questions through &lt;code&gt;yfinance&lt;/code&gt; 1.8.0, the library it calls under the hood. It passed everything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AAPL close 2026-11-06: 342.37
VOD.L 5 years: 1,261 rows, 2021-11-08 (110.96) to 2026-11-06 (116.5)
AAPL trailing P/E: 39.03
Earnings Nov 9-13: 21 rows (QXO, NU, NBIS, CTVA...)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every call took under a second. Free, no key, global coverage.&lt;/p&gt;

&lt;p&gt;One small difference: EODHD returned 1,262 Vodafone rows and Yahoo 1,261. Yahoo's history is missing July 30, 2026.&lt;/p&gt;

&lt;p&gt;So what's the catch? Yahoo doesn't offer a public API. &lt;code&gt;yfinance&lt;/code&gt; reads Yahoo's website endpoints, and Yahoo's terms limit that to personal use. When Yahoo changes something on their side, the library breaks until a volunteer fixes it, and your agent goes blind in the meantime.&lt;/p&gt;

&lt;p&gt;It also means rate limits you can't see. Yahoo throttles heavy traffic from a single IP, and an agent looping over 50 tickers is exactly that kind of traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Free, no API key, and it worked on every question.&lt;/li&gt;
&lt;li&gt;Good global coverage, options chains included.&lt;/li&gt;
&lt;li&gt;Open source (MIT), so you can read exactly what each tool does.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unofficial: personal use only, no SLA, and it breaks without warning.&lt;/li&gt;
&lt;li&gt;Runs locally (&lt;code&gt;uvx&lt;/code&gt; + Python), so it's not something you can hand to a non-technical user.&lt;/li&gt;
&lt;li&gt;No screener, earnings-calendar or macro tools in this server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; personal projects and quick experiments. Don't build a product on it.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Massive MCP (formerly Polygon.io): best for US real-time and tick data
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://massive.com/" rel="noopener noreferrer"&gt;Massive&lt;/a&gt; is the new name of Polygon.io, and its &lt;a href="https://github.com/massive-com/mcp_massive" rel="noopener noreferrer"&gt;MCP server&lt;/a&gt; (401 stars, MIT, marked "experimental") takes an unusual approach: instead of one tool per endpoint, it exposes three, &lt;code&gt;search_endpoints&lt;/code&gt;, &lt;code&gt;call_api&lt;/code&gt; and &lt;code&gt;query_data&lt;/code&gt;. The model searches the API docs, then calls what it needs. There's also a hosted version at &lt;code&gt;mcp.massive.com&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Docs only.&lt;/em&gt; That three-tool design is worth copying. A server with 100 tools sends 100 tool descriptions to the model before the first question. Massive sends three, and the model discovers the right endpoint on demand. It costs an extra call per question, but it keeps the context window free for the actual data.&lt;/p&gt;

&lt;p&gt;Local setup takes Python 3.12+ and &lt;code&gt;uv&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uv tool install &lt;span class="s2"&gt;"mcp_massive @ git+https://github.com/massive-com/mcp_massive@v0.10.0"&lt;/span&gt;
claude mcp add massive -e &lt;span class="nv"&gt;MASSIVE_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your_api_key_here -- mcp_massive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you still have an old Polygon key in your environment, &lt;code&gt;POLYGON_API_KEY&lt;/code&gt; works as a deprecated alias.&lt;/p&gt;

&lt;p&gt;Massive is built for US market data at high resolution: the pricing page highlights websockets and 20+ years of history. It lists &lt;strong&gt;Stocks Advanced at $199/month&lt;/strong&gt;, with Financials &amp;amp; Ratios as a separate &lt;strong&gt;$29/month&lt;/strong&gt; add-on (individual use only) and extra datasets such as NYSE order imbalances at $49/month.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Three tools instead of hundreds keeps the model's context clean.&lt;/li&gt;
&lt;li&gt;The deepest US real-time data on this list, with websockets.&lt;/li&gt;
&lt;li&gt;Runs hosted, locally or in Docker.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expensive for an agent that mostly needs daily prices and fundamentals.&lt;/li&gt;
&lt;li&gt;Fundamentals are a separate add-on, not part of the stocks plan.&lt;/li&gt;
&lt;li&gt;Experimental status means tool names and behaviour may still change.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; US intraday and high-frequency analysis.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Financial Datasets MCP: built for AI agents from day one
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.financialdatasets.ai/" rel="noopener noreferrer"&gt;Financial Datasets&lt;/a&gt; was designed for LLM agents rather than retrofitted. Its &lt;a href="https://github.com/financial-datasets/mcp-server" rel="noopener noreferrer"&gt;open-source server&lt;/a&gt; (2.3k stars, MIT) has 10 focused tools: income statements, balance sheets, cash flows, prices, news and crypto. There's also a hosted endpoint at &lt;code&gt;mcp.financialdatasets.ai&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Docs only.&lt;/em&gt; The tools are named exactly like the questions an analyst asks: &lt;code&gt;get_income_statements&lt;/code&gt;, &lt;code&gt;get_balance_sheets&lt;/code&gt;, &lt;code&gt;get_cash_flow_statements&lt;/code&gt;, &lt;code&gt;get_current_stock_price&lt;/code&gt;, &lt;code&gt;get_historical_stock_prices&lt;/code&gt; and &lt;code&gt;get_company_news&lt;/code&gt;, plus four crypto tools. That naming makes it easy for a model to pick the right one.&lt;/p&gt;

&lt;p&gt;The site lists &lt;strong&gt;27,530 tickers&lt;/strong&gt; including delisted companies, and 30+ years of history. The pricing is simple:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Plan&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;th&gt;Requests&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Credits&lt;/td&gt;
&lt;td&gt;$20 one-time&lt;/td&gt;
&lt;td&gt;1,000&lt;/td&gt;
&lt;td&gt;1 year of history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Personal&lt;/td&gt;
&lt;td&gt;$200/month&lt;/td&gt;
&lt;td&gt;100,000&lt;/td&gt;
&lt;td&gt;30+ years of core history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Professional&lt;/td&gt;
&lt;td&gt;$2,000/month&lt;/td&gt;
&lt;td&gt;2,000,000&lt;/td&gt;
&lt;td&gt;commercial license, redistribution&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Overage is $10 per 1,000 requests on Personal, and premium datasets cost several requests per call.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Small, clean tool set that an LLM uses well.&lt;/li&gt;
&lt;li&gt;Includes delisted companies, which matters for backtests without survivorship bias.&lt;/li&gt;
&lt;li&gt;Pay-as-you-go credits let you test without a subscription.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No free plan, and the monthly tier jumps straight to $200, 10x the EODHD APIs entry plan.&lt;/li&gt;
&lt;li&gt;The open-source server has no earnings calendar, macro or screener tools.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; fundamentals-driven agents that need clean statements, not breadth.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Alpaca MCP: best for trading, not research
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/alpacahq/alpaca-mcp-server" rel="noopener noreferrer"&gt;Alpaca's official MCP server&lt;/a&gt; (1.1k stars, MIT) is the only one on this list that &lt;strong&gt;writes&lt;/strong&gt;. It can place and cancel orders for stocks, ETFs, options and crypto, manage positions and watchlists, and read market data.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Docs only.&lt;/em&gt; Setup is one command once you have keys from a free paper account:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add alpaca -e &lt;span class="nv"&gt;ALPACA_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your_key -e &lt;span class="nv"&gt;ALPACA_SECRET_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your_secret -- uvx alpaca-mcp-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It defaults to paper trading (&lt;code&gt;ALPACA_PAPER_TRADE=true&lt;/code&gt;). The README warns plainly that the server "can place real trades" once you set that flag to &lt;code&gt;false&lt;/code&gt;. Two more details from the docs: the latest 15 minutes of market data need the Algo Trader Plus plan, and short-selling locates aren't available in paper trading.&lt;/p&gt;

&lt;p&gt;If you connect it, design for mistakes. Keep paper trading on while you test prompts, ask Claude to confirm every order before sending it, and cap position size in your instructions. A model that reads "sell half" as "sell all" is a bad day in a live account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Real order execution from a chat window, with paper trading as the default.&lt;/li&gt;
&lt;li&gt;Stocks, ETFs, options and crypto in one server.&lt;/li&gt;
&lt;li&gt;Free to start.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;US markets only, and no fundamentals or calendars.&lt;/li&gt;
&lt;li&gt;An LLM with order permissions is a risk you have to design around (confirmations, position limits).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; pairing with a research server like EODHD: one MCP to think, one to execute.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. SEC EDGAR MCP: best free source for filings
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/stefanoamorelli/sec-edgar-mcp" rel="noopener noreferrer"&gt;SEC EDGAR MCP server&lt;/a&gt; (387 stars, AGPL-3.0) gives your agent 10-K, 10-Q and 8-K filings, XBRL financial statements and Form 3/4/5 insider trades, straight from the SEC.&lt;/p&gt;

&lt;p&gt;Its tools are grouped by job:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Company:&lt;/strong&gt; CIK lookup, company info and company facts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filings:&lt;/strong&gt; 10-K, 10-Q and 8-K retrieval, with section extraction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Financials:&lt;/strong&gt; balance sheet, income statement and cash flow, parsed from XBRL.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Insider trading:&lt;/strong&gt; Forms 3, 4 and 5.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The quickest way to run it is Docker. The SEC asks for a user agent with your name and email:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run -i --rm -e &lt;span class="s2"&gt;"SEC_EDGAR_USER_AGENT=Your Name (your@email.com)"&lt;/span&gt; stefanoamorelli/sec-edgar-mcp:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I called the SEC's XBRL API it relies on. Apple's FY2026 10-K (filed November 3, 2026) reports revenue of &lt;strong&gt;$478,834,000,000&lt;/strong&gt;, which is the cross-check I used for EODHD above. It answered in half a second, for free.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Primary-source numbers, free, no API key (just a user agent with your name and email).&lt;/li&gt;
&lt;li&gt;Exact values from the filing, not a provider's estimate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No prices at all, and US filers only.&lt;/li&gt;
&lt;li&gt;AGPL license: check it before you ship it inside a commercial product (the author offers commercial licensing).&lt;/li&gt;
&lt;li&gt;It's a community project, not affiliated with the SEC.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; fact-checking fundamentals and reading filings. It pairs well with EODHD: one for prices and coverage, one for the primary source.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where each one breaks
&lt;/h2&gt;

&lt;p&gt;No MCP server makes an agent correct on its own. Here's what I'd still validate by hand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ratios differ by provider.&lt;/strong&gt; A P/E between 38.13 and 39.03 for the same stock on the same day is normal. If your agent compares companies, take every ratio from one source.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payload size is the hidden failure.&lt;/strong&gt; A server can be "right" and still break your agent by returning more text than the model can read. Test the calls your agent will make most, with real date ranges.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Free tiers are for testing, not for agents.&lt;/strong&gt; An agent might make 5 to 20 tool calls per question. The EODHD APIs free plan (20 calls/day) or Alpha Vantage's 25 run out in a single conversation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unofficial sources fail silently.&lt;/strong&gt; Yahoo worked perfectly today. That says nothing about next month.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The data is only half the system.&lt;/strong&gt; An agent still needs rules it can be audited against. I showed one way to do that in &lt;a href="https://kevinmeneses.com/en/articles/ai-stock-picker-python" rel="noopener noreferrer"&gt;How to Build an AI Stock Picker in Python You Can Actually Audit&lt;/a&gt;, and why most strategies look better before you test them in &lt;a href="https://kevinmeneses.com/en/articles/backtesting-python-7-trading-strategies-buy-and-hold" rel="noopener noreferrer"&gt;I Tested 7 Popular Trading Strategies in Python&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Which financial MCP server should you choose?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You want one server that covers almost everything, globally:&lt;/strong&gt; EODHD.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You only analyse US companies and want maximum depth on financials:&lt;/strong&gt; FMP or Financial Datasets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You need tick data and real-time US quotes:&lt;/strong&gt; Massive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You're experimenting for free:&lt;/strong&gt; Yahoo Finance MCP, then move to a paid source before you ship.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want primary-source filings:&lt;/strong&gt; SEC EDGAR MCP, alongside any of the above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want the agent to trade:&lt;/strong&gt; Alpaca, paired with a research server.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is a financial MCP server?&lt;/strong&gt;&lt;br&gt;
It's a server that implements the Model Context Protocol so an AI assistant like Claude, ChatGPT or Cursor can call financial data APIs as tools: prices, fundamentals, news, filings. The model decides which tool to call and reads the result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is there a free MCP server for stock market data?&lt;/strong&gt;&lt;br&gt;
Yes. The open-source Yahoo Finance MCP and the SEC EDGAR MCP are free. EODHD has a free plan (20 calls/day, 1 year of end-of-day data) and Alpha Vantage gives 25 requests/day. All of them run out quickly once an agent starts making several calls per question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which MCP server works with Claude Desktop?&lt;/strong&gt;&lt;br&gt;
All eight do. The EODHD APIs &lt;code&gt;v2&lt;/code&gt; endpoint and the hosted Alpha Vantage, Massive and Financial Datasets servers connect as remote connectors. Yahoo Finance, Alpaca and SEC EDGAR run locally through &lt;code&gt;uvx&lt;/code&gt; or Docker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can an MCP server place trades?&lt;/strong&gt;&lt;br&gt;
Only the ones built for it. Alpaca's MCP can place orders (paper trading by default). The EODHD APIs MCP tools are all read-only, so a research agent can't trade by accident.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do MCP servers return the same numbers?&lt;/strong&gt;&lt;br&gt;
Prices do: EODHD, FMP and Yahoo all returned 342.37 for AAPL on November 6, 2026. Calculated fundamentals like P/E differ by up to about 2.4% between providers, because each one uses a different price and earnings definition.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bottom line
&lt;/h2&gt;

&lt;p&gt;The model is no longer the bottleneck. Claude can reason about a balance sheet just fine.&lt;/p&gt;

&lt;p&gt;What it doesn't have is the data.&lt;/p&gt;

&lt;p&gt;The MCP server you connect decides what your agent knows, how much context it wastes, and whether it still works next month. For most people building with financial data in 2026, that's EODHD: global coverage, one hosted endpoint, read-only by design, and a price that doesn't need a budget meeting.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://eodhd.com/?via=kmg&amp;amp;ref1=Meneses&amp;amp;utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=best-financial-data-mcp-servers&amp;amp;utm_content=Meneses" rel="noopener noreferrer"&gt;Get started with EODHD here&lt;/a&gt;. Use the code &lt;strong&gt;KEVIN10&lt;/strong&gt; at checkout for 10% off.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article compares data tools. It isn't financial advice.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you're a software or API company looking to explain your product through high-quality educational content (not marketing fluff), feel free to connect with me on &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>python</category>
      <category>finance</category>
    </item>
    <item>
      <title>Automating Engagement and Customer Interactions Through Social Media APIs</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Sun, 15 Nov 2026 09:49:09 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/automating-engagement-and-customer-interactions-through-social-media-apis-4c9m</link>
      <guid>https://dev.to/kevin_menesesgonzlez/automating-engagement-and-customer-interactions-through-social-media-apis-4c9m</guid>
      <description>&lt;p&gt;Publishing is a solved problem. Replying isn't.&lt;/p&gt;

&lt;p&gt;Any scheduler can push a post to six networks. Then the comments arrive on Instagram, a DM lands in Messenger, someone asks about shipping on WhatsApp, and a 2-star review shows up on Google. Each one lives in a different app, under a different API, with different rules about when you're allowed to answer.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;building a SaaS that manages social accounts for customers,&lt;/li&gt;
&lt;li&gt;running support for a brand that sells through Instagram and WhatsApp,&lt;/li&gt;
&lt;li&gt;or an agency answering for a dozen clients,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this is where your team's hours actually go.&lt;/p&gt;

&lt;p&gt;(If you'd rather have an AI agent handle publishing too, I covered that in &lt;a href="https://kevinmeneses.com/en/articles/build-ai-social-media-agent-claude-code-postproxy" rel="noopener noreferrer"&gt;Building an AI Social Media Agent with Claude Code and Postproxy MCP&lt;/a&gt;.)&lt;/p&gt;




&lt;h2&gt;
  
  
  Why engagement is harder to automate than publishing
&lt;/h2&gt;

&lt;p&gt;Publishing is outbound. You decide when it happens.&lt;/p&gt;

&lt;p&gt;Engagement is inbound. It happens when the customer decides, on whatever platform they picked. To automate it with native APIs you need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Meta's Graph API for Instagram comments, Facebook comments and Messenger&lt;/li&gt;
&lt;li&gt;The WhatsApp Business Platform, with its own templates and phone numbers&lt;/li&gt;
&lt;li&gt;The Google Business Profile API for reviews&lt;/li&gt;
&lt;li&gt;TikTok, YouTube and Threads APIs for their comment sections&lt;/li&gt;
&lt;li&gt;A webhook receiver for each one, all with different payloads and signatures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And then the rules. Meta only lets you send free-form messages within 24 hours of the customer's last message. A Google review can carry one reply. TikTok lets you pin one comment per video.&lt;/p&gt;

&lt;p&gt;Most teams try this, build two integrations, and go back to answering by hand.&lt;/p&gt;

&lt;p&gt;The problem isn't the replies.&lt;/p&gt;

&lt;p&gt;It's that every inbox speaks a different language.&lt;/p&gt;




&lt;h2&gt;
  
  
  The unified engagement API approach
&lt;/h2&gt;

&lt;p&gt;A unified social media API puts all of those inboxes behind one schema. &lt;a href="https://postproxy.dev/" rel="noopener noreferrer"&gt;Postproxy&lt;/a&gt; is the one I'll use here, because its engagement layer goes further than most: the same API that publishes your posts also handles comments, direct messages and reviews.&lt;/p&gt;

&lt;p&gt;Three parts of the API do the work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Comments API:&lt;/strong&gt; list, reply, hide, delete, like and pin comments on Instagram, Facebook, Threads, YouTube, TikTok and Bluesky&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Direct Messages API:&lt;/strong&gt; chats and messages on Instagram, Facebook Messenger, WhatsApp, Telegram and Bluesky&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Profile Comments API:&lt;/strong&gt; Google Business reviews and Facebook Page recommendations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On top of that, &lt;strong&gt;webhooks&lt;/strong&gt; tell your server the moment something happens: &lt;code&gt;message.received&lt;/code&gt;, &lt;code&gt;comment.created&lt;/code&gt;, &lt;code&gt;profile_comment.created&lt;/code&gt;, and dozens more.&lt;/p&gt;

&lt;p&gt;👉 You can try all of this on &lt;a href="https://postproxy.dev/" rel="noopener noreferrer"&gt;Postproxy's free plan&lt;/a&gt; (10 posts a month, no card). Engagements like comments, DMs and replies are unlimited on the paid plans.&lt;/p&gt;




&lt;h2&gt;
  
  
  The architecture
&lt;/h2&gt;

&lt;p&gt;Here's what we'll build:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjrmdcp782oye1hiy6fjc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjrmdcp782oye1hiy6fjc.png" alt="Architecture of a social media engagement bot: DMs arrive by webhook, comments and reviews are swept by a cron job, and anything uncertain goes to a human" width="800" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DMs go through webhooks, because customers in a chat expect an answer in minutes. Comments and reviews go through a short polling job: they're less urgent, and Google reviews only sync hourly anyway.&lt;/p&gt;

&lt;p&gt;The rule behind the whole design: &lt;strong&gt;automate the obvious, escalate the rest.&lt;/strong&gt; A bot that answers "do you ship to Mexico?" saves hours. A bot that answers an angry customer makes things worse.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1. Register a webhook
&lt;/h2&gt;

&lt;p&gt;You register webhooks through the API. Subscribe only to the events you handle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="no"&gt;API&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://api.postproxy.dev/api"&lt;/span&gt;
&lt;span class="no"&gt;HEADERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Bearer {os.environ['POSTPROXY_API_KEY']}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{API}/webhooks"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://your-app.com/webhooks/postproxy"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"events"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"message.received"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"comment.created"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"profile_comment.created"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Engagement bot"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"secret"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# store it now, e.g. in POSTPROXY_WEBHOOK_SECRET&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the &lt;code&gt;secret&lt;/code&gt; straight away. Postproxy only shows it on creation and when you fetch that single webhook, and you need it to verify every delivery.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2. Receive and verify events
&lt;/h2&gt;

&lt;p&gt;Every delivery carries an &lt;code&gt;X-Postproxy-Signature&lt;/code&gt; header in the format &lt;code&gt;t=&amp;lt;timestamp&amp;gt;,v1=&amp;lt;hmac&amp;gt;&lt;/code&gt;. The signature is an HMAC-SHA256 of &lt;code&gt;{timestamp}.{raw_body}&lt;/code&gt; with your secret. Verify it before you trust anything in the payload.&lt;/p&gt;

&lt;p&gt;A minimal Flask receiver:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;hmac&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="no"&gt;SECRET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"POSTPROXY_WEBHOOK_SECRET"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;verify_webhook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;signature_header&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"="&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;signature_header&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;","&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;signed_payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{parts['t']}.{payload}"&lt;/span&gt;
    &lt;span class="n"&gt;computed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hmac&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;signed_payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sha256&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;hmac&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compare_digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;computed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"v1"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="nd"&gt;@app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/webhooks/postproxy"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;postproxy_webhook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;as_text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;signature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"X-Postproxy-Signature"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;signature&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;verify_webhook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;signature&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;SECRET&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;401&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"message.received"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;handle_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"object"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Return a &lt;code&gt;2xx&lt;/code&gt; fast. Postproxy expects a response within 30 seconds and retries a failed delivery up to 5 times with backoff (1 minute, 5 minutes, 30 minutes, 2 hours). For anything slow, like an LLM call, push the event to a queue and answer the webhook right away.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3. Auto-reply to DMs, and know when not to
&lt;/h2&gt;

&lt;p&gt;First, a setup detail that cost me a few minutes: &lt;strong&gt;direct messages are opt-in&lt;/strong&gt; in Postproxy. Until you enable them at &lt;a href="https://app.postproxy.dev/chats" rel="noopener noreferrer"&gt;app.postproxy.dev/chats&lt;/a&gt;, the chat endpoints return &lt;code&gt;422&lt;/code&gt; with a message telling you to do exactly that.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;message.received&lt;/code&gt; event includes the &lt;code&gt;chat_id&lt;/code&gt; and the customer's &lt;code&gt;body&lt;/code&gt;. That's all you need to answer. Add this to the same file as the receiver:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;API&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://api.postproxy.dev/api"&lt;/span&gt;
&lt;span class="no"&gt;HEADERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Bearer {os.environ['POSTPROXY_API_KEY']}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="no"&gt;FAQ&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ship"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"shipping"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"envío"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"envios"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Yes, we ship worldwide. Orders leave within 48h."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"return"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"refund"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"devolución"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"You have 30 days to return any order: https://shop.example.com/returns"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"hours"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"open"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"horario"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Support is online Monday to Friday, 9:00 to 18:00 CET."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;notify_human&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"NEEDS A HUMAN:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# replace with Slack, email or your helpdesk&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;classify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;keywords&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;FAQ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;keywords&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;handle_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;classify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;notify_human&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;

    &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{API}/chats/{message['chat_id']}/messages"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The send returns &lt;code&gt;202 Accepted&lt;/code&gt; with &lt;code&gt;status: "pending"&lt;/code&gt;. Delivery is asynchronous, and the result arrives later as &lt;code&gt;message.sent&lt;/code&gt;, &lt;code&gt;message.delivered&lt;/code&gt; or &lt;code&gt;message.failed&lt;/code&gt; webhooks.&lt;/p&gt;

&lt;p&gt;The keyword matcher is deliberately dumb. Swap &lt;code&gt;classify()&lt;/code&gt; for an LLM call when you outgrow it, but keep the same contract: return an answer only when you're confident, return &lt;code&gt;None&lt;/code&gt; otherwise. Every &lt;code&gt;None&lt;/code&gt; goes to a person.&lt;/p&gt;

&lt;p&gt;On Instagram and Messenger you can also send quick replies, so the customer taps instead of typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{API}/chats/{chat_id}/messages"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"What can I help with?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"quick_replies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Track order"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"payload"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"TRACK"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Talk to support"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"payload"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"HELP"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 4. The 24-hour rule (read this before you ship)
&lt;/h2&gt;

&lt;p&gt;This is where most engagement bots get accounts restricted.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Instagram and Facebook:&lt;/strong&gt; Meta only allows free-form messages within &lt;strong&gt;24 hours&lt;/strong&gt; of the customer's last inbound message. After that, a human agent can still answer for up to &lt;strong&gt;7 days&lt;/strong&gt; by sending with &lt;code&gt;"tag": "HUMAN_AGENT"&lt;/code&gt;. Postproxy doesn't enforce the 7-day limit; a late message is passed to Meta, rejected, and ends up as &lt;code&gt;failed&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Two rules for that tag:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Only a real person should use it. Never put it on bot messages.&lt;/li&gt;
&lt;li&gt;Never send promotional content with it. Postproxy's docs warn this can get your Page's or Instagram account's messaging suspended.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;WhatsApp:&lt;/strong&gt; no tag. Outside the window you need an approved template. Each chat carries a &lt;code&gt;within_messaging_window&lt;/code&gt; flag you can check before sending.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Telegram:&lt;/strong&gt; no window, but your bot can only message users who have written to it first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bluesky:&lt;/strong&gt; no window either, but the recipient must have DMs enabled.&lt;/p&gt;

&lt;p&gt;Build these into the bot from day one. If a webhook arrives for a 3-day-old chat, the bot shouldn't answer it. A person should.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5. Reply to comments on a schedule
&lt;/h2&gt;

&lt;p&gt;Comments are less urgent than DMs, so a polling job every 15 minutes works well. &lt;code&gt;GET /api/comments&lt;/code&gt; returns comments across all your posts, newest first, with the &lt;code&gt;post_id&lt;/code&gt; and &lt;code&gt;profile_id&lt;/code&gt; you need to reply.&lt;/p&gt;

&lt;p&gt;One trap I hit while testing this: the &lt;code&gt;from&lt;/code&gt; filter works on &lt;code&gt;created_at&lt;/code&gt;, which is when Postproxy &lt;strong&gt;synced&lt;/strong&gt; the comment, not when the person wrote it. When you connect an account, Postproxy imports its existing comments. On my YouTube channel, the first sync brought in comments from 2020, all with today's &lt;code&gt;created_at&lt;/code&gt;. A bot that trusts &lt;code&gt;from&lt;/code&gt; alone would answer five-year-old comments on its first run.&lt;/p&gt;

&lt;p&gt;So the sweep also checks &lt;code&gt;posted_at&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timezone&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;

&lt;span class="no"&gt;SEEN_FILE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"seen_comments.json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="no"&gt;OUR_USERNAMES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"@acmeshop"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"acme_shop"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;  &lt;span class="c1"&gt;# as each platform shows it; YouTube adds "@"&lt;/span&gt;
&lt;span class="no"&gt;MAX_AGE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;load_seen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;SEEN_FILE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="no"&gt;SEEN_FILE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;is_recent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"posted_at"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;
    &lt;span class="n"&gt;posted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromisoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"posted_at"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"+00:00"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timezone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;utc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;posted&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;MAX_AGE&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;sweep_comments&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;seen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;load_seen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;since&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timezone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;utc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="no"&gt;MAX_AGE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{API}/comments"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"from"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;since&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"per_page"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;is_top_level&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"parent_external_id"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;
        &lt;span class="n"&gt;is_ours&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"author_username"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;OUR_USERNAMES&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;seen&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;is_top_level&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;is_ours&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;is_recent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;

        &lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;classify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{API}/posts/{comment['post_id']}/comments"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"profile_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"profile_id"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"parent_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;notify_human&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="no"&gt;SEEN_FILE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each comment also carries &lt;code&gt;metadata&lt;/code&gt; such as &lt;code&gt;follower_count&lt;/code&gt; and &lt;code&gt;is_verified_user&lt;/code&gt; on Instagram. That's useful for routing: a comment from an account with 50k followers probably deserves a human.&lt;/p&gt;

&lt;p&gt;For spam, &lt;code&gt;POST /api/posts/:post_id/comments/:id/hide&lt;/code&gt; hides a comment without deleting it. That works on Instagram, Facebook, Threads and TikTok.&lt;/p&gt;

&lt;p&gt;And if a question in public deserves a private answer, Instagram and Facebook support a &lt;strong&gt;private reply&lt;/strong&gt;: a DM to the comment's author, sent through &lt;code&gt;POST /api/posts/:post_id/comments/:id/private_reply&lt;/code&gt;. You get one per comment, and it works on comments up to 7 days old.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 6. Handle Google reviews (carefully)
&lt;/h2&gt;

&lt;p&gt;Reviews are the most public thing your bot will ever touch. Treat them differently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;sweep_reviews&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;profile_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{API}/profiles/{profile_id}/comments"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"per_page"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;review&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"replies"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;  &lt;span class="c1"&gt;# already answered&lt;/span&gt;

        &lt;span class="n"&gt;stars&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"platform_data"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"star_rating"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;stars&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;stars&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;notify_human&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# never auto-reply to a bad review&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;

        &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{API}/profiles/{profile_id}/comments"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="s2"&gt;"parent_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"external_id"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s2"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Thank you for the review! We're glad you enjoyed it."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few details the API handles that you'd otherwise discover the hard way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Google reviews can be &lt;strong&gt;star-only&lt;/strong&gt;, with &lt;code&gt;body&lt;/code&gt; set to &lt;code&gt;null&lt;/code&gt;. The code above doesn't depend on the text.&lt;/li&gt;
&lt;li&gt;A Google review takes &lt;strong&gt;one&lt;/strong&gt; reply. Replying again updates it.&lt;/li&gt;
&lt;li&gt;Google can reject a reply for policy reasons. &lt;code&gt;platform_data.reply_state&lt;/code&gt; tells you if it's &lt;code&gt;PENDING&lt;/code&gt;, &lt;code&gt;APPROVED&lt;/code&gt; or &lt;code&gt;REJECTED&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Nobody can delete a review through the API, only their own reply. That's a platform rule.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Positive reviews get a fast thank-you. Anything at 3 stars or below goes to a person who can actually fix the problem.&lt;/p&gt;




&lt;h2&gt;
  
  
  What each platform supports
&lt;/h2&gt;

&lt;p&gt;Not every action exists everywhere. Here's the comments support according to Postproxy's reference:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;th&gt;Instagram&lt;/th&gt;
&lt;th&gt;Facebook&lt;/th&gt;
&lt;th&gt;Threads&lt;/th&gt;
&lt;th&gt;Bluesky&lt;/th&gt;
&lt;th&gt;YouTube&lt;/th&gt;
&lt;th&gt;TikTok&lt;/th&gt;
&lt;th&gt;LinkedIn&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;List&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Coming soon&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reply&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Coming soon&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hide&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Coming soon&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Coming soon&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pin&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Calling an unsupported action returns &lt;code&gt;405 Method Not Allowed&lt;/code&gt;, so your code can try and fall back cleanly.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Engagement is an inbound, event-driven problem. Use webhooks for DMs and a short polling job for comments and reviews.&lt;/li&gt;
&lt;li&gt;Automate only the questions you can answer with confidence. Everything else, and every bad review, goes to a human.&lt;/li&gt;
&lt;li&gt;The platform rules (24h window, &lt;code&gt;HUMAN_AGENT&lt;/code&gt;, one reply per review) are part of the design, not edge cases.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Most brands don't lose customers because of their posts.&lt;/p&gt;

&lt;p&gt;They lose them in the replies nobody sent.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://postproxy.dev/" rel="noopener noreferrer"&gt;Build your engagement bot on Postproxy&lt;/a&gt;: one API for comments, DMs and reviews across every platform, with a free plan to start.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>api</category>
      <category>python</category>
      <category>automation</category>
      <category>socialmedia</category>
    </item>
    <item>
      <title>I Tested Claude's Stock Rules on 10 Popular Stocks</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Sat, 14 Nov 2026 16:28:58 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/i-tested-claudes-stock-rules-on-10-popular-stocks-1c89</link>
      <guid>https://dev.to/kevin_menesesgonzlez/i-tested-claudes-stock-rules-on-10-popular-stocks-1c89</guid>
      <description>&lt;p&gt;In August I published &lt;a href="https://medium.datadriveninvestor.com/i-asked-claude-to-find-the-best-investment-opportunities-right-now-heres-what-it-found-3c72be5a2f55" rel="noopener noreferrer"&gt;a five-prompt screen&lt;/a&gt; that sorted stocks into "fresh setups" and "already extended, avoid chasing".&lt;/p&gt;

&lt;p&gt;It's easy to publish a screen. Going back to grade it is the part most people skip.&lt;/p&gt;

&lt;p&gt;So three months later I went back. I wrote the rules down as code, ran them on ten popular stocks as of the close of August 7, 2026, and measured what each one did over the next one, two and three months.&lt;/p&gt;

&lt;p&gt;The labels mattered much less than I thought. The stop mattered more.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;using an AI to screen stocks and wondering whether the output holds up,&lt;/li&gt;
&lt;li&gt;building a screener and deciding which rules deserve to stay,&lt;/li&gt;
&lt;li&gt;or just tired of stock lists nobody ever revisits,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;keep reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I said in August
&lt;/h2&gt;

&lt;p&gt;The original article named three stocks. Microsoft and Meta were "fresh setups": strong earnings reactions, sitting near support. Palantir was "already extended, avoid chasing", after a jump of more than 30% in a few sessions.&lt;/p&gt;

&lt;p&gt;It also set three rules I said I follow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;flag anything that moved more than 20% in three trading days,&lt;/li&gt;
&lt;li&gt;define the stop before the entry, and get out on a close below it,&lt;/li&gt;
&lt;li&gt;treat these as one to two month trades.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Three names is not enough to grade anything. And the full list of ten from that Saturday was never published, so grading it now would be asking you to take my word for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test
&lt;/h2&gt;

&lt;p&gt;So I did something stricter. I turned the August prompts into fixed rules and applied them to ten stocks picked for one reason only: almost everyone owns or watches them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stocks: Apple, Microsoft, Nvidia, Amazon, Alphabet, Meta, Tesla, Palantir, AMD and Netflix. I chose them in November, which is a limitation I'll come back to.&lt;/li&gt;
&lt;li&gt;Screen date: the close of Friday, August 7, 2026, the last close before the original article.&lt;/li&gt;
&lt;li&gt;Data: daily prices from the EODHD APIs end-of-day endpoint. Returns use &lt;code&gt;adjusted_close&lt;/code&gt;, as of November 11, 2026. Adjusted values shift after each dividend.&lt;/li&gt;
&lt;li&gt;Benchmark: SPY over the same dates.&lt;/li&gt;
&lt;li&gt;Checkpoints: one month (September 8), two months (October 7) and the latest close (November 11).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The rules, as code can read them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extended: gained 20% or more in any three sessions of the last week, or closed more than 15% above its 50-day average, or closed within 2% of its 52-week high.&lt;/li&gt;
&lt;li&gt;Fresh setup: not extended, up over the last five sessions, and above its 200-day average.&lt;/li&gt;
&lt;li&gt;No setup: everything else.&lt;/li&gt;
&lt;li&gt;Stop: the lowest low of the five sessions up to and including the screen date. Exit on the first close below it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The August article gave the 20% rule. The other thresholds are mine. The original prompts said "near support" and "room to run", and a model can interpret that. Code needs a number, so I picked them before computing the forward returns for the seven stocks I hadn't looked at yet.&lt;/p&gt;

&lt;p&gt;Here's the classification:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="no"&gt;KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"EODHD_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="no"&gt;TICKERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"AAPL"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"MSFT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"NVDA"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"AMZN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"GOOGL"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"META"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"TSLA"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"PLTR"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"AMD"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"NFLX"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="no"&gt;SCREEN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"2026-08-07"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"https://eodhd.com/api/eod/{symbol}.US"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"api_token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"fmt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"from"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2025-06-01"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"to"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-11"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"date"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"date"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"date"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort_index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;label&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;px&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"adjusted_close"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="no"&gt;SCREEN&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;c0&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;iloc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;gain3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;iloc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;iloc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ret5&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;c0&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;iloc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="n"&gt;vs50&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;c0&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;iloc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="n"&gt;vs200&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;c0&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;iloc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="n"&gt;vs_high&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;c0&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"2025-08-08"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;gain3&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.20&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;vs50&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;0.15&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;vs_high&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.02&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"extended"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;ret5&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;vs200&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"fresh setup"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"no setup"&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;TICKERS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;px&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"adjusted_close"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;c0&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;SCREEN&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;two_months&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2026-10-07"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;iloc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;c0&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{t:6}{label(df):12}{two_months * 100:7.2f}%"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AAPL  fresh setup    7.54%
MSFT  extended       6.15%
NVDA  fresh setup    6.15%
AMZN  fresh setup   -5.30%
GOOGL no setup      -1.01%
META  no setup      21.92%
TSLA  no setup      14.98%
PLTR  extended      12.85%
AMD   fresh setup   33.62%
NFLX  no setup      -5.99%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The first surprise: my rules disagree with August
&lt;/h2&gt;

&lt;p&gt;Look at Microsoft and Meta.&lt;/p&gt;

&lt;p&gt;In August, Claude called both of them fresh setups. My fixed rules call Microsoft extended, because on August 7 it closed 22.84% above its 50-day average after its earnings jump. They give Meta no setup at all, because it was still 6.08% below its 200-day average.&lt;/p&gt;

&lt;p&gt;Palantir is the only one of the three where code and conversation agree. It had gained 28.74% in three sessions and sat 29.72% above its 50-day average.&lt;/p&gt;

&lt;p&gt;One detail from August does check out: I wrote that Meta was roughly 25% below its 52-week high. On adjusted closes it was 24.80% below.&lt;/p&gt;

&lt;p&gt;So the August labels were a judgment call by the model, made with earnings context that a threshold doesn't see. That's not a flaw in itself. But it means the screen can't be reproduced by someone else with a formula, and I should have said so at the time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually happened
&lt;/h2&gt;

&lt;p&gt;Returns from the August 7 close, adjusted prices as of November 11, 2026:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stock&lt;/th&gt;
&lt;th&gt;Label on Aug 7&lt;/th&gt;
&lt;th&gt;1 month&lt;/th&gt;
&lt;th&gt;2 months&lt;/th&gt;
&lt;th&gt;To Nov 11&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Apple&lt;/td&gt;
&lt;td&gt;Fresh setup&lt;/td&gt;
&lt;td&gt;+1.01%&lt;/td&gt;
&lt;td&gt;+7.54%&lt;/td&gt;
&lt;td&gt;+13.60%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nvidia&lt;/td&gt;
&lt;td&gt;Fresh setup&lt;/td&gt;
&lt;td&gt;+0.79%&lt;/td&gt;
&lt;td&gt;+6.15%&lt;/td&gt;
&lt;td&gt;-22.34%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon&lt;/td&gt;
&lt;td&gt;Fresh setup&lt;/td&gt;
&lt;td&gt;-6.38%&lt;/td&gt;
&lt;td&gt;-5.30%&lt;/td&gt;
&lt;td&gt;-3.03%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AMD&lt;/td&gt;
&lt;td&gt;Fresh setup&lt;/td&gt;
&lt;td&gt;+4.63%&lt;/td&gt;
&lt;td&gt;+33.62%&lt;/td&gt;
&lt;td&gt;+14.39%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Microsoft&lt;/td&gt;
&lt;td&gt;Extended&lt;/td&gt;
&lt;td&gt;-1.02%&lt;/td&gt;
&lt;td&gt;+6.15%&lt;/td&gt;
&lt;td&gt;+4.42%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Palantir&lt;/td&gt;
&lt;td&gt;Extended&lt;/td&gt;
&lt;td&gt;-0.99%&lt;/td&gt;
&lt;td&gt;+12.85%&lt;/td&gt;
&lt;td&gt;+0.23%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alphabet&lt;/td&gt;
&lt;td&gt;No setup&lt;/td&gt;
&lt;td&gt;-4.44%&lt;/td&gt;
&lt;td&gt;-1.01%&lt;/td&gt;
&lt;td&gt;-17.12%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Meta&lt;/td&gt;
&lt;td&gt;No setup&lt;/td&gt;
&lt;td&gt;+3.61%&lt;/td&gt;
&lt;td&gt;+21.92%&lt;/td&gt;
&lt;td&gt;+6.28%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tesla&lt;/td&gt;
&lt;td&gt;No setup&lt;/td&gt;
&lt;td&gt;+12.05%&lt;/td&gt;
&lt;td&gt;+14.98%&lt;/td&gt;
&lt;td&gt;+18.95%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Netflix&lt;/td&gt;
&lt;td&gt;No setup&lt;/td&gt;
&lt;td&gt;+3.55%&lt;/td&gt;
&lt;td&gt;-5.99%&lt;/td&gt;
&lt;td&gt;-12.95%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SPY&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;-0.94%&lt;/td&gt;
&lt;td&gt;+0.76%&lt;/td&gt;
&lt;td&gt;-1.50%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv7neesx8n5240ip2wo9m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv7neesx8n5240ip2wo9m.png" alt="Return of each of the ten stocks two months after August 7, 2026, colored by label" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And by group:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Group&lt;/th&gt;
&lt;th&gt;Stocks&lt;/th&gt;
&lt;th&gt;1 month avg&lt;/th&gt;
&lt;th&gt;2 months avg&lt;/th&gt;
&lt;th&gt;To Nov 11 avg&lt;/th&gt;
&lt;th&gt;Beat SPY at 2 months&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Fresh setup&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;+0.01%&lt;/td&gt;
&lt;td&gt;+10.50%&lt;/td&gt;
&lt;td&gt;+0.66%&lt;/td&gt;
&lt;td&gt;3 of 4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Extended&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;-1.00%&lt;/td&gt;
&lt;td&gt;+9.50%&lt;/td&gt;
&lt;td&gt;+2.33%&lt;/td&gt;
&lt;td&gt;2 of 2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No setup&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;+3.69%&lt;/td&gt;
&lt;td&gt;+7.47%&lt;/td&gt;
&lt;td&gt;-1.21%&lt;/td&gt;
&lt;td&gt;2 of 4&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Seven of the ten beat SPY at two months. That says more about those two months than about any label.&lt;/p&gt;

&lt;p&gt;The fresh setups did lead at two months, 10.50% against 9.50% and 7.47%. But one stock, AMD, supplies most of that average, and the "avoid chasing" group was right behind. With four, two and four stocks per group, I can't call that a difference.&lt;/p&gt;

&lt;h2&gt;
  
  
  The stop is what separated them
&lt;/h2&gt;

&lt;p&gt;The label didn't sort these stocks. The stop came closer.&lt;/p&gt;

&lt;p&gt;Within the two-month window, a close below the stop happened in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1 of 4 fresh setups (Amazon, on August 12, at -2.62%)&lt;/li&gt;
&lt;li&gt;0 of 2 extended stocks&lt;/li&gt;
&lt;li&gt;3 of 4 with no setup (Alphabet on August 11 at -2.96%, Meta on August 18 at -8.18%, Netflix on September 18 at -3.17%)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Amazon and Netflix, getting out early was the better outcome at two months: both were lower on October 7 than at their exit. Alphabet was slightly higher at two months (-1.01% against an exit at -2.96%) and much lower by November 11 (-17.12%).&lt;/p&gt;

&lt;p&gt;Meta is the one that hurts. The stop took it out at -8.18% seven sessions after the screen, and by October 7 it was up 21.92%. A rule that helps twice, breaks even once and costs you the second-best performer of the ten is still a rule I'd keep, but I'd stop describing it as free.&lt;/p&gt;

&lt;h2&gt;
  
  
  The window mattered more than the label
&lt;/h2&gt;

&lt;p&gt;Nvidia was up 6.15% at two months and is down 22.34% as of November 11. AMD went from +33.62% to +14.39%, and inside that it closed at 404.40 on November 5 and 552.90 four sessions later.&lt;/p&gt;

&lt;p&gt;In August I wrote that these were one to two month trades. The data agrees with that line more than with anything else in the article. At two months, the ten averaged a gain and seven beat the index. Hold the same ten to November 11 and four of them are below their August price.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where EODHD fits into this workflow
&lt;/h2&gt;

&lt;p&gt;Everything here came from one endpoint. The EODHD APIs end-of-day API returned raw and adjusted OHLC for each ticker, which is all the moving averages, 52-week highs and stops need.&lt;/p&gt;

&lt;p&gt;The script requests about 17 months of daily history for 11 symbols: a year before the screen for the 52-week high, plus everything since. The free plan returns one year, so this takes the EOD Historical All-World plan, at $19.99 a month.&lt;/p&gt;

&lt;p&gt;From here you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;swap in your own watchlist and screen date,&lt;/li&gt;
&lt;li&gt;change a threshold and see which labels flip,&lt;/li&gt;
&lt;li&gt;add the news or fundamentals endpoints to give the rules some of the context the model had.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to grade your own screens, &lt;a href="https://eodhd.com/?via=kmg&amp;amp;ref1=Meneses&amp;amp;utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=august-screen-rules-10-stocks&amp;amp;utm_content=Meneses" rel="noopener noreferrer"&gt;get an EODHD API key here&lt;/a&gt; and use the code &lt;strong&gt;KEVIN10&lt;/strong&gt; at checkout for 10% off.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd actually trust from this
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The stop.&lt;/strong&gt; It fired mostly on the stocks with no setup. Of the four exits, three were in stocks that sit lower today than where the stop took them out. The fourth cost Meta's rally.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The time limit.&lt;/strong&gt; One to two months was the stated horizon, and the results fall apart when you stretch it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not the labels, yet.&lt;/strong&gt; Ten stocks, one date. Fresh setups and extended names ended within a point of each other at two months.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not my stock selection.&lt;/strong&gt; I picked ten famous names in November. That's hindsight in the choice of universe, even if the rules only saw data up to August 7. A fair version of this test uses a list fixed in advance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What would change this.&lt;/strong&gt; More dates. One screen day in the middle of an earnings season is a single draw. The same rules on a different Friday could look better or much worse, and I'd want at least a year of them before changing how I trade.&lt;/p&gt;

&lt;p&gt;None of this is financial advice. It's me checking my own homework in public, which I should probably do more often.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd change in the five prompts
&lt;/h2&gt;

&lt;p&gt;Two things, both cheap:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ask Claude to state the number behind each label. "Near support" should come back as "1.4% above the five-day low", so the same screen can be rerun by code.&lt;/li&gt;
&lt;li&gt;Save the full output the day you run it. I'm testing ten popular stocks instead of the original ten because only three made it into the article.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  FAQs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Did the August picks work?&lt;/strong&gt;&lt;br&gt;
The three named stocks all beat SPY at two months: Microsoft +6.15%, Meta +21.92% and Palantir +12.85%, against +0.76%. Palantir was the one flagged as "avoid chasing".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do "fresh setup" stocks beat "extended" ones?&lt;/strong&gt;&lt;br&gt;
Not clearly in this sample. Four fresh setups averaged +10.50% at two months and two extended stocks averaged +9.50%.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Did the stop-loss help?&lt;/strong&gt;&lt;br&gt;
In three of the four cases where it fired within two months, the stock was lower by November 11 than at the exit. In the fourth, Meta, it exited at -8.18% before a rally to +21.92%.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I run this on my own list?&lt;/strong&gt;&lt;br&gt;
Yes. Change the tickers and the screen date in the script. It needs daily adjusted prices going back 12 months before your screen date.&lt;/p&gt;

&lt;p&gt;Want to check your own calls against real prices?&lt;br&gt;
&lt;a href="https://eodhd.com/?via=kmg&amp;amp;ref1=Meneses&amp;amp;utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=august-screen-rules-10-stocks&amp;amp;utm_content=Meneses" rel="noopener noreferrer"&gt;Start with EODHD APIs here&lt;/a&gt; and use the code &lt;strong&gt;KEVIN10&lt;/strong&gt; at checkout for 10% off.&lt;/p&gt;

&lt;p&gt;More breakdowns like this one at &lt;a href="https://kevinmeneses.com/en" rel="noopener noreferrer"&gt;kevinmeneses.com&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>ai</category>
      <category>finance</category>
      <category>investing</category>
    </item>
    <item>
      <title>7 Best Social Media MCP Servers for Claude and ChatGPT (2026)</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Sat, 14 Nov 2026 09:04:15 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/7-best-social-media-mcp-servers-for-claude-and-chatgpt-2026-45a5</link>
      <guid>https://dev.to/kevin_menesesgonzlez/7-best-social-media-mcp-servers-for-claude-and-chatgpt-2026-45a5</guid>
      <description>&lt;p&gt;Most people still copy a caption from Claude, open five tabs and paste it into each network by hand.&lt;/p&gt;

&lt;p&gt;That workflow is over.&lt;/p&gt;

&lt;p&gt;A social media MCP server lets Claude or ChatGPT publish, schedule and read analytics on your accounts directly. You write one prompt and the post goes out on LinkedIn, Instagram, TikTok and YouTube.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a founder posting every day,&lt;/li&gt;
&lt;li&gt;an agency managing dozens of client accounts,&lt;/li&gt;
&lt;li&gt;or a developer building an AI agent that needs to post,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;you need to pick the right server. They are not all the same.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick answer:&lt;/strong&gt; &lt;a href="https://blotato.com/?ref=kevinqy" rel="noopener noreferrer"&gt;Blotato&lt;/a&gt; is the best social media MCP server if you want AI content creation and publishing in one place. &lt;a href="https://zernio.link/kevin-meneses" rel="noopener noreferrer"&gt;Zernio&lt;/a&gt; is the best if your agent also has to answer comments and DMs, and its free tier covers 2 accounts. &lt;a href="https://buffer.com/mcp" rel="noopener noreferrer"&gt;Buffer&lt;/a&gt; is the easiest free start.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pricing and features checked on 2026-11-09 on each vendor's official pages.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What a social media MCP server actually does
&lt;/h2&gt;

&lt;p&gt;MCP (Model Context Protocol) is the standard that lets an AI assistant call external tools. A social media MCP server exposes tools like &lt;code&gt;create_post&lt;/code&gt;, &lt;code&gt;schedule_post&lt;/code&gt; or &lt;code&gt;get_analytics&lt;/code&gt; to Claude, ChatGPT, Cursor or any MCP client.&lt;/p&gt;

&lt;p&gt;The difference between servers is not the protocol. It's four things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Publish or only read.&lt;/strong&gt; Some servers only pull analytics. All 7 in this list publish.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hosted or local.&lt;/strong&gt; Hosted servers give you a URL and an OAuth login. Local ones run with &lt;code&gt;npx&lt;/code&gt; on your machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reads beyond posts.&lt;/strong&gt; Analytics, comments and DMs. This is what lets an agent actually manage an account, not just push content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pricing unit.&lt;/strong&gt; Per account, per channel or per "profile" (a group of accounts). This changes the bill a lot once you pass 5 accounts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you need the raw REST APIs instead of MCP, I compared those in &lt;a href="https://dev.to/kevin_menesesgonzlez/top-5-social-media-apis-for-developers-in-2026-140i"&gt;Top 5 Social Media APIs for Developers in 2026&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Social media MCP servers compared
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;MCP server&lt;/th&gt;
&lt;th&gt;Hosting / auth&lt;/th&gt;
&lt;th&gt;Networks it publishes to&lt;/th&gt;
&lt;th&gt;Reads&lt;/th&gt;
&lt;th&gt;Cheapest plan with MCP&lt;/th&gt;
&lt;th&gt;Free option&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;a href="https://blotato.com/?ref=kevinqy" rel="noopener noreferrer"&gt;Blotato&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Hosted, OAuth or API key&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;Analytics, IG/FB comments and DMs&lt;/td&gt;
&lt;td&gt;$29/mo (20 accounts)&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;a href="https://zernio.link/kevin-meneses" rel="noopener noreferrer"&gt;Zernio&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Hosted, OAuth 2.1 or API key&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;Analytics, comments, DMs&lt;/td&gt;
&lt;td&gt;$6 per account after 2 free&lt;/td&gt;
&lt;td&gt;2 accounts free&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;&lt;a href="https://vistasocial.com" rel="noopener noreferrer"&gt;Vista Social&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Hosted, OAuth&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;Analytics, inbox (comments, DMs, reviews)&lt;/td&gt;
&lt;td&gt;$99/mo (15 profiles)&lt;/td&gt;
&lt;td&gt;14-day trial&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.ayrshare.com" rel="noopener noreferrer"&gt;Ayrshare&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Hosted, API key&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;Analytics, history, comments, DMs&lt;/td&gt;
&lt;td&gt;$149/mo (1 profile)&lt;/td&gt;
&lt;td&gt;28-day trial (Launch)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;&lt;a href="https://buffer.com/mcp" rel="noopener noreferrer"&gt;Buffer&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Hosted, OAuth&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;Post metrics&lt;/td&gt;
&lt;td&gt;$5 per channel/mo&lt;/td&gt;
&lt;td&gt;3 channels free&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.upload-post.com/?linkId=lp_144414&amp;amp;sourceId=kevin-meneses&amp;amp;tenantId=upload-post-app" rel="noopener noreferrer"&gt;Upload-Post&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Hosted or local &lt;code&gt;npx&lt;/code&gt;, open source&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;Analytics, comments, DMs&lt;/td&gt;
&lt;td&gt;$16/mo yearly (5 profiles)&lt;/td&gt;
&lt;td&gt;10 uploads/mo, no TikTok&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;&lt;a href="https://postfa.st" rel="noopener noreferrer"&gt;PostFast&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Hosted or local &lt;code&gt;npx&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;Analytics, comment inbox&lt;/td&gt;
&lt;td&gt;€12.50/mo yearly (4 accounts)&lt;/td&gt;
&lt;td&gt;7-day trial&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  1. Blotato: best for creating and publishing content from one prompt
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://blotato.com/?ref=kevinqy" rel="noopener noreferrer"&gt;Blotato&lt;/a&gt; is an AI content studio with a hosted MCP server at &lt;code&gt;mcp.blotato.com/mcp&lt;/code&gt;. It exposes 35 tools and connects with OAuth in Claude and ChatGPT, or with an API key header in other clients. It's listed in Claude's connector directory.&lt;/p&gt;

&lt;p&gt;It publishes to X, LinkedIn, Facebook, Instagram, TikTok, YouTube, Threads, Bluesky and Pinterest. Analytics cover 8 of those networks, and comments and DMs work on Instagram and Facebook.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing, image and video generation live in the same tool the agent publishes from&lt;/li&gt;
&lt;li&gt;20 accounts on the $29 Starter plan, with API and MCP on every paid plan&lt;/li&gt;
&lt;li&gt;Native n8n and Make nodes if you also run workflows outside Claude&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No free plan, and the 7-day trial excludes the API and MCP&lt;/li&gt;
&lt;li&gt;No analytics for LinkedIn through the server&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; creators and small teams who want the agent to make the content &lt;em&gt;and&lt;/em&gt; post it.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Zernio: best for agents that also answer comments and DMs
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://zernio.link/kevin-meneses" rel="noopener noreferrer"&gt;Zernio&lt;/a&gt; is a unified API for social, ads and messaging, with a hosted MCP server at &lt;code&gt;mcp.zernio.com/mcp&lt;/code&gt; (OAuth 2.1 or API key).&lt;/p&gt;

&lt;p&gt;It publishes to 14 channels: Instagram, TikTok, YouTube, X, LinkedIn, Facebook, Threads, Pinterest, Bluesky, Google Business, Snapchat, WhatsApp, Telegram and Discord. Reddit publishing is temporarily unavailable.&lt;/p&gt;

&lt;p&gt;What sets it apart is the inbox. The agent can read and reply to comments on 8 networks and handle DMs on Instagram, Facebook, X, WhatsApp, Telegram, Bluesky and Reddit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First 2 accounts free with every feature, MCP included, no card&lt;/li&gt;
&lt;li&gt;Pay per account: $6 each for accounts 3 to 10, then $3, then $1. Ten accounts cost $48/mo&lt;/li&gt;
&lt;li&gt;The widest channel list here, including messaging apps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Messages above 10,000/mo and automation runs above 2,000/mo cost extra&lt;/li&gt;
&lt;li&gt;X API calls are passed through at X's own rates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; AI agents and SaaS products that need to publish &lt;em&gt;and&lt;/em&gt; run the conversation afterwards.&lt;/p&gt;

&lt;p&gt;I use Zernio myself to schedule my Instagram reels. &lt;a href="https://zernio.link/kevin-meneses" rel="noopener noreferrer"&gt;Start free with 2 accounts here&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Vista Social: best for agencies that live in the dashboard
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://vistasocial.com" rel="noopener noreferrer"&gt;Vista Social&lt;/a&gt; is a full social media management platform. Its MCP server is added as a custom connector with OAuth and exposes more than 100 tools, covering scheduling, analytics, reporting and the social inbox (comments, DMs and reviews).&lt;/p&gt;

&lt;p&gt;It works across Facebook, LinkedIn, Instagram, X, Google Business, YouTube, TikTok, Reddit, Pinterest, Snapchat, Tumblr, Threads and Bluesky.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The deepest tool set in this list: publishing, inbox, reviews and reports&lt;/li&gt;
&lt;li&gt;MCP included on every paid plan&lt;/li&gt;
&lt;li&gt;14-day trial with no card&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Starts at $99/mo (Professional, 15 profiles, 2 users)&lt;/li&gt;
&lt;li&gt;X is a $29/mo add-on on every plan&lt;/li&gt;
&lt;li&gt;Claude and ChatGPT need a paid plan of their own to use custom connectors&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; agencies that want the agent to work inside the same tool the team and clients already use.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Ayrshare: best for SaaS products that post for their users
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.ayrshare.com" rel="noopener noreferrer"&gt;Ayrshare&lt;/a&gt; is a social media API built for developers. Its action MCP server (&lt;code&gt;api.ayrshare.com/mcp&lt;/code&gt;) uses a Bearer API key and exposes 33 tools for publishing, post history, analytics, comments, DMs and moderation.&lt;/p&gt;

&lt;p&gt;It covers 14 networks, including Reddit, Telegram, Snapchat and WhatsApp (beta).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mature API: SDKs for Node.js, Python, PHP, Go, Java, Ruby and C#&lt;/li&gt;
&lt;li&gt;One of the few servers here that publishes to Reddit&lt;/li&gt;
&lt;li&gt;Built for multi-tenant products (one profile per end customer)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The most expensive entry point: $149/mo for 1 profile&lt;/li&gt;
&lt;li&gt;Profiles and sub-profiles need the Business plan ($599/mo)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; SaaS teams adding "post to social" for their own customers.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Buffer: best free starting point
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://buffer.com/mcp" rel="noopener noreferrer"&gt;Buffer&lt;/a&gt; shipped an official MCP server at &lt;code&gt;mcp.buffer.com/mcp&lt;/code&gt;, with OAuth for most clients. It's included on every plan, including Free.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;create_post&lt;/code&gt; reaches Instagram, Facebook, X, LinkedIn, Pinterest, YouTube, Google Business, Mastodon, TikTok, Threads, Bluesky, Substack and Buffer's Start Page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Free plan with MCP: 3 channels, 10 scheduled posts per channel&lt;/li&gt;
&lt;li&gt;Paid plans from $5 per channel/mo&lt;/li&gt;
&lt;li&gt;The brand most teams already use&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No comment or inbox tools in the server, only post metrics&lt;/li&gt;
&lt;li&gt;Free plan keeps 30 days of insights, and the MCP shares Buffer's API quotas&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; anyone who wants to test Claude-to-social posting today without paying.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Upload-Post: best open-source option for video
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.upload-post.com/?linkId=lp_144414&amp;amp;sourceId=kevin-meneses&amp;amp;tenantId=upload-post-app" rel="noopener noreferrer"&gt;Upload-Post&lt;/a&gt; offers a hosted server (&lt;code&gt;mcp.upload-post.com/mcp&lt;/code&gt;) and a local one (&lt;code&gt;npx @upload-post/mcp&lt;/code&gt;), both MIT-licensed. It's in Claude's connector directory.&lt;/p&gt;

&lt;p&gt;It publishes to TikTok, Instagram, YouTube, LinkedIn, Facebook, X, Threads, Pinterest, Reddit, Bluesky, Google Business, Discord and Telegram, and it reads analytics, comments and DMs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Free plan with API and MCP: 10 uploads/mo on 2 profiles, no card&lt;/li&gt;
&lt;li&gt;Open source and runnable locally&lt;/li&gt;
&lt;li&gt;Publishes to Reddit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TikTok is not on the free plan&lt;/li&gt;
&lt;li&gt;Priced per profile, so check how your accounts group before you scale&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; developers posting short-form video who want an open-source server.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. PostFast: best low-cost plan with a comment inbox
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://postfa.st" rel="noopener noreferrer"&gt;PostFast&lt;/a&gt; has a hosted server (&lt;code&gt;mcp.postfa.st/mcp&lt;/code&gt;, OAuth, 38 tools) and a local one (&lt;code&gt;npx -y postfast-mcp&lt;/code&gt;). It's in Claude's connector directory.&lt;/p&gt;

&lt;p&gt;It publishes to Instagram, Facebook, TikTok, LinkedIn, YouTube, Threads, Pinterest, Bluesky, Telegram, X and Google Business. The agent can reply to, hide or delete comments on TikTok, Instagram, Facebook and Threads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;€12.50/mo on the yearly Starter plan (€15 monthly)&lt;/li&gt;
&lt;li&gt;MCP works during the 7-day trial, no card needed&lt;/li&gt;
&lt;li&gt;Comment inbox included on every plan&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Starter is limited to 4 accounts, 2 X accounts and 1 user&lt;/li&gt;
&lt;li&gt;No free plan after the trial&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; solo creators and small businesses on a tight budget.&lt;/p&gt;




&lt;h2&gt;
  
  
  Best MCP server by network
&lt;/h2&gt;

&lt;h3&gt;
  
  
  LinkedIn MCP
&lt;/h3&gt;

&lt;p&gt;LinkedIn has no official MCP server. All 7 servers here publish to LinkedIn through LinkedIn's official API, which is safer than the open-source scrapers that log in with your session. Blotato publishes to LinkedIn but doesn't return LinkedIn analytics.&lt;/p&gt;

&lt;h3&gt;
  
  
  Instagram MCP
&lt;/h3&gt;

&lt;p&gt;All 7 publish to Instagram Business and Creator accounts. For comments and DMs, use Zernio, Vista Social, Ayrshare, Upload-Post or Blotato. PostFast handles comments but not DMs.&lt;/p&gt;

&lt;h3&gt;
  
  
  TikTok MCP
&lt;/h3&gt;

&lt;p&gt;All 7 publish to TikTok. On Upload-Post, TikTok needs a paid plan. For TikTok comments, look at Zernio or PostFast.&lt;/p&gt;

&lt;h3&gt;
  
  
  YouTube MCP
&lt;/h3&gt;

&lt;p&gt;All 7 upload to YouTube. Zernio, Ayrshare and Upload-Post can also read YouTube comments.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reddit MCP
&lt;/h3&gt;

&lt;p&gt;Only Ayrshare, Upload-Post and Vista Social publish to Reddit today. Zernio lists Reddit as temporarily unavailable.&lt;/p&gt;

&lt;h3&gt;
  
  
  X (Twitter) MCP
&lt;/h3&gt;

&lt;p&gt;All 7 post to X. Watch the extra cost: Vista Social charges a $29/mo add-on and Zernio passes through X's API rates.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to connect a social media MCP server to Claude
&lt;/h2&gt;

&lt;p&gt;In the Claude app, open &lt;strong&gt;Settings → Connectors&lt;/strong&gt;, search for the server in the directory (Blotato, Upload-Post and PostFast are listed) or click &lt;strong&gt;Add custom connector&lt;/strong&gt; and paste the server URL. Then sign in with OAuth.&lt;/p&gt;

&lt;p&gt;In Claude Code, add a hosted server with one line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add --transport http zernio https://mcp.zernio.com/mcp
claude mcp add --transport http buffer https://mcp.buffer.com/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In ChatGPT, add it as a custom connector (developer mode) with the same URL.&lt;/p&gt;

&lt;p&gt;Then test with a prompt like: &lt;em&gt;"Schedule this LinkedIn post for tomorrow at 9:00 and show me last week's analytics."&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  How to choose
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You want the agent to write and post:&lt;/strong&gt; Blotato.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want the agent to answer comments and DMs too:&lt;/strong&gt; Zernio.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You're an agency with clients in one dashboard:&lt;/strong&gt; Vista Social.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You're building a SaaS that posts for your users:&lt;/strong&gt; Ayrshare.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want to try it free today:&lt;/strong&gt; Buffer or Zernio.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want open source:&lt;/strong&gt; Upload-Post.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want the cheapest paid plan:&lt;/strong&gt; PostFast.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is a social media MCP server?
&lt;/h3&gt;

&lt;p&gt;It's an MCP server that gives an AI assistant like Claude or ChatGPT tools to publish posts, schedule content and read analytics on your social media accounts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is there an official LinkedIn MCP server?
&lt;/h3&gt;

&lt;p&gt;No. LinkedIn doesn't offer one. Servers like Blotato, Zernio and Buffer publish to LinkedIn through LinkedIn's official API.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which social media MCP server is free?
&lt;/h3&gt;

&lt;p&gt;Buffer includes MCP on its free plan (3 channels). Zernio gives 2 accounts free with every feature. Upload-Post has a free plan with 10 uploads per month.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can Claude post to Instagram and TikTok?
&lt;/h3&gt;

&lt;p&gt;Yes, once you connect a social media MCP server. All 7 servers in this list publish to both.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can an MCP server reply to comments and DMs?
&lt;/h3&gt;

&lt;p&gt;Some can. Zernio, Vista Social, Ayrshare and Upload-Post handle comments and DMs. PostFast handles comments. Buffer doesn't.&lt;/p&gt;




&lt;p&gt;The bottleneck in social media was never writing the post.&lt;/p&gt;

&lt;p&gt;It was everything after it. A good MCP server takes that part off your plate.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure: the Blotato, Zernio and Upload-Post links are affiliate links.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Are you building a social media MCP server? This list is updated every quarter. &lt;a href="https://kevinmeneses.com/en#contact" rel="noopener noreferrer"&gt;Get in touch&lt;/a&gt; if you'd like yours reviewed.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>automation</category>
      <category>socialmedia</category>
    </item>
    <item>
      <title>5 Best Web Scraping APIs for AI Agents in 2026</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Fri, 13 Nov 2026 08:58:53 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/5-best-web-scraping-apis-for-ai-agents-in-2026-4aj3</link>
      <guid>https://dev.to/kevin_menesesgonzlez/5-best-web-scraping-apis-for-ai-agents-in-2026-4aj3</guid>
      <description>&lt;p&gt;Your AI agent doesn't need a browser. It needs the page.&lt;/p&gt;

&lt;p&gt;That sounds like a small distinction, but it decides which web scraping API you should pay for. An agent that answers questions, monitors competitors or feeds a RAG pipeline wants clean text from a URL, fast, without a captcha page pretending to be content. Anything else is overhead you pay for in tokens and latency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt; for most AI agents in 2026, &lt;a href="https://www.context.dev/" rel="noopener noreferrer"&gt;Context.dev&lt;/a&gt; is the best web scraping API to start with: one call returns LLM-ready Markdown, JS rendering and proxies are always on, it ships a hosted MCP server, and it passed 93.0% of requests on 100 bot-protected sites in String's October benchmark. Pick &lt;a href="https://www.firecrawl.dev/" rel="noopener noreferrer"&gt;Firecrawl&lt;/a&gt; if your team already lives in its ecosystem, &lt;a href="https://scrapfly.io/" rel="noopener noreferrer"&gt;Scrapfly&lt;/a&gt; or &lt;a href="https://scrape.do/" rel="noopener noreferrer"&gt;Scrape.do&lt;/a&gt; if raw unblocking at scale matters more than agent tooling, and &lt;a href="https://www.scrapingbee.com/" rel="noopener noreferrer"&gt;ScrapingBee&lt;/a&gt; if you want a mature API with simple, published credit costs.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  building AI agents that read the web,&lt;/li&gt;
&lt;li&gt;  feeding LLMs or RAG pipelines with fresh pages,&lt;/li&gt;
&lt;li&gt;  or replacing a self-hosted Playwright scraper that keeps getting blocked,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this comparison is for you.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; Context.dev sponsored its placement in this list. The tests, the pricing checks and the pros and cons are mine.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What an AI Agent Actually Needs From a Scraping API
&lt;/h2&gt;

&lt;p&gt;Classic scraping APIs were built for data teams. You sent a URL, got raw HTML back and wrote the parser yourself.&lt;/p&gt;

&lt;p&gt;Agents changed the job. Today a scraping API for AI agents has to handle five things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;LLM-ready output.&lt;/strong&gt; Markdown or structured JSON, not a full HTML page your model has to chew through.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;JavaScript rendering.&lt;/strong&gt; Many modern pages are empty shells until JS runs.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Anti-bot handling.&lt;/strong&gt; A 200 response with a captcha page is worse than an error, because the agent believes it.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;An MCP server or a clean SDK.&lt;/strong&gt; So Claude, Cursor or your own agent loop can call it as a tool.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Predictable cost per successful page.&lt;/strong&gt; Credits that multiply 25x when you turn on premium proxies are a budgeting problem.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The fourth point is the one most comparison lists skip.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Tested
&lt;/h2&gt;

&lt;p&gt;This round, I ran my own test on Context.dev and Gaffa: 10 URLs, 3 attempts each, in each vendor's strongest documented anti-bot setting. Firecrawl, Scrapfly, ScrapingBee and Scrape.do go through the same script in the next quarterly update; for now, their reliability numbers come from String's benchmark below. The test set:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  4 JavaScript-heavy pages (React docs, a JS-rendered quotes page, an infinite-scroll page, a JS product grid),&lt;/li&gt;
&lt;li&gt;  2 static pages (Hacker News, Books to Scrape),&lt;/li&gt;
&lt;li&gt;  4 bot-protected pages (two anti-bot challenge pages, a G2 reviews page and a job-board listing).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A request only passed if the response contained a marker string that exists only on the real page. A 200 with a challenge page counted as a failure. The script is a single Python file and you can rerun it on your own URLs.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;API&lt;/th&gt;
&lt;th&gt;Passed&lt;/th&gt;
&lt;th&gt;Median latency&lt;/th&gt;
&lt;th&gt;Credits per request&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Context.dev&lt;/td&gt;
&lt;td&gt;27/30 (90%)&lt;/td&gt;
&lt;td&gt;2.1 s&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gaffa (bonus)&lt;/td&gt;
&lt;td&gt;27/30 (90%)&lt;/td&gt;
&lt;td&gt;12.4 s&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Context.dev ran with caching turned off (&lt;code&gt;maxAgeMs: 0&lt;/code&gt;) so every request hit the live page. The free plan allows 10 requests a minute, so I spaced requests 7 seconds apart and left that pause out of the latency. Its only failures were the three attempts on a G2 reviews page, one of the most aggressively protected sites in the set.&lt;/p&gt;

&lt;p&gt;For a bigger sample, and for the four APIs I haven't run yet, I cite String's &lt;a href="https://usestring.ai/benchmark" rel="noopener noreferrer"&gt;web data benchmark&lt;/a&gt; (run completed October 30, 2026: 17 providers, 100 bot-protected sites, 500 requests each). String built that benchmark and ranks itself first, so read it as a vendor benchmark with a public harness, not a neutral verdict.&lt;/p&gt;

&lt;h2&gt;
  
  
  Web Scraping APIs for AI Agents: Comparison Table
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Pricing checked on November 12, 2026.&lt;/em&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Context.dev&lt;/th&gt;
&lt;th&gt;Firecrawl&lt;/th&gt;
&lt;th&gt;Scrapfly&lt;/th&gt;
&lt;th&gt;ScrapingBee&lt;/th&gt;
&lt;th&gt;Scrape.do&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Free tier&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1,000 credits/month, no card&lt;/td&gt;
&lt;td&gt;1,000 credits/month, no card&lt;/td&gt;
&lt;td&gt;1,000 credits, no card&lt;/td&gt;
&lt;td&gt;1,000 credits, no card&lt;/td&gt;
&lt;td&gt;1,000 successful credits, no card&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Entry paid plan&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$20/month&lt;/td&gt;
&lt;td&gt;$19/month (5,000 credits)&lt;/td&gt;
&lt;td&gt;$30/month (200,000 credits)&lt;/td&gt;
&lt;td&gt;$19/month (75,000 credits)&lt;/td&gt;
&lt;td&gt;$29/month (250,000 credits)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Basic page cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1 credit (JS + proxies included)&lt;/td&gt;
&lt;td&gt;1 credit&lt;/td&gt;
&lt;td&gt;1 credit (+5 with JS)&lt;/td&gt;
&lt;td&gt;1 credit (5 with JS)&lt;/td&gt;
&lt;td&gt;1 credit (5 with JS)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Hard anti-bot page&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1 credit (always on)&lt;/td&gt;
&lt;td&gt;Not listed&lt;/td&gt;
&lt;td&gt;25 (residential); ASP varies&lt;/td&gt;
&lt;td&gt;10–25 credits&lt;/td&gt;
&lt;td&gt;10–25 credits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Markdown output&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Hosted MCP server&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Not found&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Official SDKs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Python, TS, Ruby, Go, PHP&lt;/td&gt;
&lt;td&gt;Python, Node&lt;/td&gt;
&lt;td&gt;Python, TS, Go, Rust&lt;/td&gt;
&lt;td&gt;Python, Node&lt;/td&gt;
&lt;td&gt;HTTP only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;String benchmark (Oct 2026)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;93.0%&lt;/td&gt;
&lt;td&gt;81.2%&lt;/td&gt;
&lt;td&gt;86.8%&lt;/td&gt;
&lt;td&gt;85.2%&lt;/td&gt;
&lt;td&gt;94.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;My test (30 requests)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;27/30, 2.1 s&lt;/td&gt;
&lt;td&gt;Next update&lt;/td&gt;
&lt;td&gt;Next update&lt;/td&gt;
&lt;td&gt;Next update&lt;/td&gt;
&lt;td&gt;Next update&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best for&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Agents that need page content, no browser&lt;/td&gt;
&lt;td&gt;Firecrawl-native agent stacks&lt;/td&gt;
&lt;td&gt;High-volume unblocking&lt;/td&gt;
&lt;td&gt;Simple, published credit costs&lt;/td&gt;
&lt;td&gt;Most credits per dollar on entry plan&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  1. Context.dev
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.context.dev/" rel="noopener noreferrer"&gt;Context.dev&lt;/a&gt; is a web context API built for software and AI agents. You send a URL and get back Markdown, rendered HTML, a screenshot or structured JSON in one call. The browser, the proxies and the retries are its problem, not yours.&lt;/p&gt;

&lt;p&gt;What makes it the #1 pick here is the pricing model as much as the tech. JavaScript rendering, anti-bot handling and proxy escalation are always on and included in the 1-credit base price. On most other APIs those are the add-ons that multiply your bill by 5 or 25.&lt;/p&gt;

&lt;p&gt;Around scraping, it covers the rest of an agent's web toolbox under the same key: crawl a site (up to 500 pages to Markdown), map its URLs, run a web search with page content, get a sourced answer to a question, monitor pages with webhooks, and pull company and brand data from a domain.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dev&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;ContextDev&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ContextDev&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"CONTEXT_DEV_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;web&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scrape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;formats&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"markdown"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;shared_params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"main_content_only"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Claude Code, Cursor or Codex there's a hosted MCP server at &lt;code&gt;https://mcp.context.dev/mcp&lt;/code&gt; with OAuth sign-in, so you don't paste an API key into a URL.&lt;/p&gt;

&lt;p&gt;In String's October 2026 benchmark it passed 465 of 500 requests (93.0%), third of 17 providers, with a 10.96 s latency score. In my own test it passed 27 of 30 requests with a 2.1 s median, at 1 credit each. The three misses were all on the same G2 reviews page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  JS rendering, anti-bot and proxies included in the base credit, so cost per page stays flat on hard sites&lt;/li&gt;
&lt;li&gt;  Hosted MCP server with OAuth, plus SDKs in five languages&lt;/li&gt;
&lt;li&gt;  Crawl, search, answers, monitors and brand data under one key&lt;/li&gt;
&lt;li&gt;  Y Combinator-backed and SOC 2 Type 2 compliant&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Slower than the fastest APIs in String's benchmark (10.96 s latency score vs 5.08 s for Scrape.do)&lt;/li&gt;
&lt;li&gt;  AI answers cost 10–100 credits, so mixed workloads need a look at the credit table&lt;/li&gt;
&lt;li&gt;  Hosted only, no self-host edition&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; AI agents and LLM pipelines that need reliable page content from JavaScript-heavy or bot-protected sites, without running a browser or managing proxy tiers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Building an API or developer tool?&lt;/strong&gt;&lt;br&gt;
I write hands-on, SEO-focused content like this for API companies, not marketing fluff.&lt;br&gt;
&lt;strong&gt;→&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;&lt;strong&gt;Let's talk on LinkedIn&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  2. Firecrawl
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.firecrawl.dev/" rel="noopener noreferrer"&gt;Firecrawl&lt;/a&gt; is the name most developers already associate with "scraping for LLMs". It turns URLs into Markdown or JSON, crawls whole sites, runs web searches and, with its newer &lt;code&gt;/agent&lt;/code&gt; endpoint (in preview), takes a prompt and navigates on its own.&lt;/p&gt;

&lt;p&gt;The developer experience is the strongest part. The Python SDK is a two-liner and there's a keyless remote MCP server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;firecrawl&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Firecrawl&lt;/span&gt;

&lt;span class="n"&gt;firecrawl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Firecrawl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"fc-YOUR_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;firecrawl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scrape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;formats&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"markdown"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where it trails is unblocking. In String's benchmark it passed 81.2% of requests on protected sites, below every other numbered pick in this list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Best-known LLM scraping API, with lots of examples and integrations&lt;/li&gt;
&lt;li&gt;  Remote MCP server you can try without a key&lt;/li&gt;
&lt;li&gt;  Scrape, crawl, search and an experimental agent endpoint in one product&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Lowest anti-bot pass rate of the numbered picks in String's benchmark (81.2%)&lt;/li&gt;
&lt;li&gt;  Small entry plan: $19/month buys 5,000 credits&lt;/li&gt;
&lt;li&gt;  JSON extraction adds 4 credits per page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; teams already building on Firecrawl's SDK or MCP who mostly scrape sites without aggressive bot protection.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Scrapfly
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://scrapfly.io/" rel="noopener noreferrer"&gt;Scrapfly&lt;/a&gt; is a scraping API built around unblocking. Its Anti Scraping Protection (ASP) mode upgrades the proxy and browser setup when a site fights back, and a &lt;code&gt;cost_budget&lt;/code&gt; parameter caps how many credits a single request can burn.&lt;/p&gt;

&lt;p&gt;It has quietly become agent-friendly too: &lt;code&gt;format=markdown&lt;/code&gt; returns clean Markdown, its docs list an MCP server, LLM extraction with a prompt, and SDKs for Python, TypeScript, Go and Rust.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://api.scrapfly.io/scrape"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"YOUR_KEY"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"render_js"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"true"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"asp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"true"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"format"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"markdown"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"result"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It passed 86.8% in String's benchmark.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Strong unblocking with a per-request cost cap&lt;/li&gt;
&lt;li&gt;  Large credit pools: $30/month buys 200,000 credits&lt;/li&gt;
&lt;li&gt;  Markdown output, LLM extraction and an MCP server&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Credit cost varies a lot: 1 base credit, +5 with JS, 25 for residential proxies, and a variable cost with ASP&lt;/li&gt;
&lt;li&gt;  More parameters to learn before you get a predictable bill&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; high-volume agents and data pipelines that hit hard targets and want to cap spend per request.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. ScrapingBee
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.scrapingbee.com/" rel="noopener noreferrer"&gt;ScrapingBee&lt;/a&gt; is one of the veterans. It handles headless browsers and rotating proxies behind one GET request and has added the pieces agents need: &lt;code&gt;return_page_markdown&lt;/code&gt;, natural-language extraction with &lt;code&gt;ai_query&lt;/code&gt;, and a hosted MCP server.&lt;/p&gt;

&lt;p&gt;The credit math is simple and published: 1 credit for a plain request, 5 with JS rendering, 10 or 25 with premium proxies. In a 10-request smoke test, every request that reported its cost charged 25 credits for JS rendering plus premium proxies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;scrapingbee&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;ScrapingBeeClient&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ScrapingBeeClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"return_page_markdown"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"True"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It passed 85.2% in String's benchmark.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Simple, published credit costs&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;ai_query&lt;/code&gt; extraction and a hosted MCP server&lt;/li&gt;
&lt;li&gt;  Generous entry plan: $19/month for 75,000 credits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Hard sites cost 25 credits per request, so the 75,000 credits become 3,000 protected pages&lt;/li&gt;
&lt;li&gt;  The MCP server takes the API key in the URL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; developers who want a mature API with simple credit costs and don't need crawl or search built in.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Scrape.do
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://scrape.do/" rel="noopener noreferrer"&gt;Scrape.do&lt;/a&gt; is the least known name on this list and the most interesting number. It placed second of 17 in String's benchmark, with a 94.0% pass rate and a 5.08 s latency score, ahead of every other API here.&lt;/p&gt;

&lt;p&gt;It's a plain HTTP API: a token, a URL, and flags for rendering (&lt;code&gt;render=true&lt;/code&gt;), residential or mobile proxies (&lt;code&gt;super=true&lt;/code&gt;) and Markdown output (&lt;code&gt;output=markdown&lt;/code&gt;). It only charges for successful responses.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://api.scrape.do/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"YOUR_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"render"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"true"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"super"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"true"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"output"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"markdown"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Highest pass rate and fastest latency score of this list in String's benchmark&lt;/li&gt;
&lt;li&gt;  Charges only for successful responses&lt;/li&gt;
&lt;li&gt;  Cheap at volume: $29/month for 250,000 credits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  No official SDK or MCP server that I could find: you write the tool wrapper yourself&lt;/li&gt;
&lt;li&gt;  Some domains carry custom prices (from 1 to 200 credits per request)&lt;/li&gt;
&lt;li&gt;  I didn't find crawl, search or AI extraction endpoints in its docs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; teams with their own agent tooling who want a high pass rate and a large credit pool for the money.&lt;/p&gt;

&lt;h2&gt;
  
  
  BONUS: Gaffa
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://gaffa.dev/" rel="noopener noreferrer"&gt;Gaffa&lt;/a&gt; takes a different route: every request runs in a real browser, and you describe what to do with actions (click, scroll, wait, capture the DOM, generate Markdown). That makes it closer to a browser automation API than a pure scraping API, which is why it's a bonus pick here.&lt;/p&gt;

&lt;p&gt;Pricing follows that model: 1 credit per 30 seconds of browser time, plus 750 credits per GB if you route through residential proxies. Plans start at $29/month for 9,000 credits, with 500 free credits to try it.&lt;/p&gt;

&lt;p&gt;In my test it passed 27 of 30 requests, with a 12.4 s median (the async flow plus a 3-second wait I added before capturing the page) and 2 credits for most requests. The misses were one attempt each on the G2 page, an anti-bot challenge page and the job board.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Real browser on every request, with step-by-step actions for interactive pages&lt;/li&gt;
&lt;li&gt;  Cost tied to browser time, not to request type&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Residential proxy traffic is billed on top (750 credits per GB)&lt;/li&gt;
&lt;li&gt;  No official SDK&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; agents that need to interact with a page (fill a form, click through filters) before reading it.&lt;/p&gt;

&lt;h2&gt;
  
  
  BONUS: Zyte API
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.zyte.com/" rel="noopener noreferrer"&gt;Zyte&lt;/a&gt; is one of the oldest names in web scraping, and its API is priced by how hard each site is: from $0.13 per 1,000 plain HTTP responses on simple sites up to $16.08 per 1,000 browser-rendered responses on the hardest tier (pay-as-you-go). It also has automatic extraction and a remote MCP server that works with Claude Code.&lt;/p&gt;

&lt;p&gt;It passed 79.6% in String's benchmark. It's a bonus pick because the per-site tiers make it harder to estimate cost for an agent that visits unpredictable URLs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; data teams scraping a known list of sites at enterprise volume.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Choose a Web Scraping API for Your AI Agent
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Your agent visits unpredictable URLs and you want flat cost per page:&lt;/strong&gt; Context.dev.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;You're already on Firecrawl's SDK or MCP and your targets are friendly:&lt;/strong&gt; Firecrawl.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;You hit hard targets at volume and want a per-request cost cap:&lt;/strong&gt; Scrapfly.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;You want a mature API with simple, published credit costs:&lt;/strong&gt; ScrapingBee.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;You have your own tooling and want the most credits per dollar:&lt;/strong&gt; Scrape.do.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;The agent has to click or type before it reads:&lt;/strong&gt; Gaffa.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Run your own URLs before you commit. Every API on this list has a free tier, and ten real pages tell you more than any table.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is the best web scraping API for AI agents in 2026?&lt;/strong&gt;&lt;br&gt;
For most agents, Context.dev: it returns LLM-ready Markdown in one call, includes JS rendering and anti-bot in the base price, and has a hosted MCP server. Firecrawl, Scrapfly, ScrapingBee and Scrape.do are strong alternatives depending on your stack and targets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which scraping APIs have an MCP server?&lt;/strong&gt;&lt;br&gt;
Context.dev, Firecrawl, Scrapfly, ScrapingBee and Zyte all offer one. I couldn't find an official MCP server for Scrape.do.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's a good Firecrawl alternative?&lt;/strong&gt;&lt;br&gt;
Context.dev if you want the same "URL to Markdown" workflow with anti-bot included in the base credit, Scrapfly or Scrape.do if unblocking hard sites is the priority.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's the cheapest web scraping API for LLMs?&lt;/strong&gt;&lt;br&gt;
Of the five, Scrape.do ($29 for 250,000 credits) and Scrapfly ($30 for 200,000) give the most headline credits on entry plans, but credits aren't the same unit across vendors. On protected sites, compare cost per successful page, not credits: premium proxies cost 10–25 credits per request on most APIs and 1 credit on Context.dev.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do I need a scraping API if I already use Playwright?&lt;/strong&gt;&lt;br&gt;
Not for friendly sites. You need one when pages start returning captchas, when you need residential IPs, or when you don't want to run and patch browsers in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  Context.dev is the strongest default for AI agents in 2026: Markdown in one call, anti-bot and JS included at 1 credit, and a hosted MCP server.&lt;/li&gt;
&lt;li&gt;  Scrape.do had the best numbers of the five main picks in String's benchmark, but you build the agent tooling yourself.&lt;/li&gt;
&lt;li&gt;  Compare cost per successful page on your own URLs, not headline credits.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Building a developer tool?&lt;/strong&gt;&lt;br&gt;
I create technical, SEO-focused content like this comparison for API and infrastructure companies. If that's useful for your product, let's talk.&lt;br&gt;
&lt;strong&gt;→&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;&lt;strong&gt;Connect with me on LinkedIn&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;More technical writing and projects:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;→&lt;/strong&gt; &lt;a href="https://kevinmeneses.com/en" rel="noopener noreferrer"&gt;&lt;strong&gt;kevinmeneses.com&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webscraping</category>
      <category>ai</category>
      <category>api</category>
      <category>python</category>
    </item>
    <item>
      <title>Building an AI Social Media Agent with Claude Code and Postproxy MCP</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Wed, 11 Nov 2026 08:58:31 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/building-an-ai-social-media-agent-with-claude-code-and-postproxy-mcp-2n9l</link>
      <guid>https://dev.to/kevin_menesesgonzlez/building-an-ai-social-media-agent-with-claude-code-and-postproxy-mcp-2n9l</guid>
      <description>&lt;p&gt;Most "AI social media agents" are a cron job with a prompt.&lt;/p&gt;

&lt;p&gt;The model writes a caption, and then a human copies it into five different apps. The writing got automated. The work didn't.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;running social for a product and tired of rewriting the same update five times,&lt;/li&gt;
&lt;li&gt;building agent workflows on top of Claude Code,&lt;/li&gt;
&lt;li&gt;or managing several brands from one terminal,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this is the setup I'd use.&lt;/p&gt;

&lt;p&gt;An AI social media agent needs two things: a brain and hands. Claude Code is the brain. The hands are the hard part, because every platform has its own OAuth flow, app review, media rules and rate limits. Wiring a tool for each one is weeks of work before the agent posts anything.&lt;/p&gt;

&lt;p&gt;The model was never the bottleneck.&lt;/p&gt;

&lt;p&gt;The integrations were.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why the Postproxy MCP server is the missing piece
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://postproxy.dev/" rel="noopener noreferrer"&gt;Postproxy&lt;/a&gt; is a unified social media API. One endpoint publishes to Instagram, Facebook, Threads, TikTok, X, YouTube, LinkedIn, Pinterest, Bluesky, Telegram and Google Business. Postproxy handles the platform app reviews and OAuth on its side.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F51y7xdzi11z84k3vfayj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F51y7xdzi11z84k3vfayj.png" alt="Postproxy: one API for every social platform"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The part that matters for agents is the hosted MCP server. Connect it once, and Claude Code gets more than 100 tools it can call by itself. When I listed them, the server returned 117. These are the ones this tutorial uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Posts:&lt;/strong&gt; &lt;code&gt;post_publish&lt;/code&gt;, &lt;code&gt;post_update&lt;/code&gt;, &lt;code&gt;post_publish_draft&lt;/code&gt;, &lt;code&gt;post_status&lt;/code&gt;, &lt;code&gt;post_delete&lt;/code&gt;, &lt;code&gt;history_list&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scheduling:&lt;/strong&gt; &lt;code&gt;queues_create&lt;/code&gt;, &lt;code&gt;queues_list&lt;/code&gt;, &lt;code&gt;queues_next_slot&lt;/code&gt; (posting queues with weekly timeslots)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analytics:&lt;/strong&gt; &lt;code&gt;post_stats&lt;/code&gt;, &lt;code&gt;profiles_stats&lt;/code&gt;, and &lt;code&gt;summary_get&lt;/code&gt;, which gives one snapshot of what went out, how it performed and what's waiting for a reply&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Engagement:&lt;/strong&gt; &lt;code&gt;comments_list&lt;/code&gt;, &lt;code&gt;comments_create&lt;/code&gt;, &lt;code&gt;comments_hide&lt;/code&gt;, plus direct messages (&lt;code&gt;dm_chats_list&lt;/code&gt;, &lt;code&gt;dm_message_send&lt;/code&gt;) and Google Business review replies (&lt;code&gt;profile_comments_create&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accounts:&lt;/strong&gt; &lt;code&gt;auth_status&lt;/code&gt;, &lt;code&gt;profiles_list&lt;/code&gt;, &lt;code&gt;profile_groups_list&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's an agent that can draft, schedule, publish, measure and reply. Not just write captions.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://postproxy.dev/" rel="noopener noreferrer"&gt;Postproxy has a free plan&lt;/a&gt; with 10 posts a month and no credit card, which is enough to build everything in this tutorial.&lt;/p&gt;




&lt;h2&gt;
  
  
  What we're building
&lt;/h2&gt;

&lt;p&gt;A Claude Code agent that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Takes a source (a blog post, a changelog, a product update)&lt;/li&gt;
&lt;li&gt;Writes a version adapted to each platform&lt;/li&gt;
&lt;li&gt;Saves them as &lt;strong&gt;drafts&lt;/strong&gt; in Postproxy for you to approve&lt;/li&gt;
&lt;li&gt;Schedules approved posts into a weekly queue&lt;/li&gt;
&lt;li&gt;Reports every Monday on what performed and what needs a reply&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Human approval stays in the loop. More on why at the end.&lt;/p&gt;




&lt;h2&gt;
  
  
  On Claude web or Claude Desktop: skip steps 1 and 2
&lt;/h2&gt;

&lt;p&gt;This tutorial is built around Claude Code, which connects to Postproxy with an API key. If you use Claude on the web, in Claude Desktop or on mobile, there's a shorter path: add the &lt;a href="https://claude.ai/directory/postproxy" rel="noopener noreferrer"&gt;Postproxy connector&lt;/a&gt; from Claude's connector directory and sign in. No API key, no terminal command. Claude gets the same Postproxy tools.&lt;/p&gt;

&lt;p&gt;Everything after step 2 still applies. The only difference is where the rules go: instead of a CLAUDE.md file, paste the rules from step 3 into a Claude Project's instructions. Step 7 (running headless on a schedule) is the one part that needs Claude Code.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1. Get your Postproxy API key
&lt;/h2&gt;

&lt;p&gt;Create an account at &lt;a href="https://app.postproxy.dev/users/sign_up" rel="noopener noreferrer"&gt;app.postproxy.dev&lt;/a&gt;, connect the social profiles you want the agent to use, and generate an API key.&lt;/p&gt;

&lt;p&gt;Postproxy has two key types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Full access:&lt;/strong&gt; every profile group in your account&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Profile group scoped:&lt;/strong&gt; limited to one brand or client&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you manage more than one brand, give the agent a scoped key per brand. An agent working on client A should never be able to post to client B.&lt;/p&gt;

&lt;p&gt;Before you hand the key to an agent, check that it works. A quick Python sanity check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="no"&gt;API_KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"POSTPROXY_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"https://api.postproxy.dev/api/profiles"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Bearer {API_KEY}"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;profile&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s1"&gt;'{profile["platform"]:&amp;lt;12} {profile["name"]:&amp;lt;25} {profile["status"]}'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see one line per connected account. On my test account, which only has my YouTube channel connected, it printed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;youtube      Kevin Meneses González    active
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a profile shows as expired, reconnect it now rather than finding out when the agent fails at 9am.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2. Connect the Postproxy MCP server to Claude Code
&lt;/h2&gt;

&lt;p&gt;One command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add --transport http postproxy \
  https://mcp.postproxy.dev/mcp?api_key=YOUR_KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the hosted server. Nothing to install.&lt;/p&gt;

&lt;p&gt;The key travels in the URL there, so keep it out of screen recordings and shared configs. If you prefer it in an environment variable, Postproxy also ships a local package (Node.js 18+):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install -g postproxy-mcp

claude mcp add --transport stdio postproxy-mcp \
  --env &lt;span class="nv"&gt;POSTPROXY_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-api-key \
  --env &lt;span class="nv"&gt;POSTPROXY_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;https://api.postproxy.dev/api \
  -- postproxy-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now open Claude Code and ask:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Check my Postproxy authentication status and list my connected profiles.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude calls &lt;code&gt;auth_status&lt;/code&gt; and &lt;code&gt;profiles_list&lt;/code&gt;. If you see your accounts, the agent has hands.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3. Give the agent rules in CLAUDE.md
&lt;/h2&gt;

&lt;p&gt;An agent without rules will happily publish whatever it writes. Claude Code reads &lt;code&gt;CLAUDE.md&lt;/code&gt; at the start of every session, so that's where the guardrails go.&lt;/p&gt;

&lt;p&gt;Create a folder for the agent and add this file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;# Social media agent
&lt;/span&gt;
&lt;span class="gu"&gt;## Brand
&lt;/span&gt;&lt;span class="k"&gt;- &lt;/span&gt;Product: Acme Analytics, a dashboard for Shopify stores
&lt;span class="k"&gt;- &lt;/span&gt;Voice: direct, practical, no hype words ("revolutionary", "game-changer")
&lt;span class="k"&gt;- &lt;/span&gt;Audience: store owners doing $10k–$500k/month

&lt;span class="gu"&gt;## Platform rules
&lt;/span&gt;&lt;span class="k"&gt;- &lt;/span&gt;LinkedIn: 80–150 words, one insight, no hashtags in the body
&lt;span class="k"&gt;- &lt;/span&gt;X: under 260 characters, one idea per post
&lt;span class="k"&gt;- &lt;/span&gt;Threads and Bluesky: casual, can ask a question
&lt;span class="k"&gt;- &lt;/span&gt;Instagram: needs an image; caption under 125 words, 3–5 hashtags at the end

&lt;span class="gu"&gt;## Hard rules
&lt;/span&gt;&lt;span class="k"&gt;- &lt;/span&gt;ALWAYS create posts as drafts. Never publish directly.
&lt;span class="k"&gt;- &lt;/span&gt;Never publish a draft unless I approve it in this conversation.
&lt;span class="k"&gt;- &lt;/span&gt;Never delete posts.
&lt;span class="k"&gt;- &lt;/span&gt;Before scheduling, check queues_next_slot instead of picking a time yourself.
&lt;span class="k"&gt;- &lt;/span&gt;X is limited to 20 posts per 24h per account. Never plan more than 3 X posts a day.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The hard rules are the important part. The rest is taste.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4. Turn one source into platform-ready drafts
&lt;/h2&gt;

&lt;p&gt;Now the real workflow. Paste a changelog or point Claude at a file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Read ./changelog/2026-11.md. Write one post per platform for LinkedIn, X,
Threads and Bluesky following CLAUDE.md. Create each one as a draft in
Postproxy and give me a table with the draft IDs and the text.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Behind the scenes, Claude:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Reads the file&lt;/li&gt;
&lt;li&gt;Calls &lt;code&gt;profiles_list&lt;/code&gt; to find your LinkedIn, X, Threads and Bluesky profiles&lt;/li&gt;
&lt;li&gt;Writes four different versions&lt;/li&gt;
&lt;li&gt;Calls &lt;code&gt;post_publish&lt;/code&gt; once per platform with the post as a draft&lt;/li&gt;
&lt;li&gt;Returns the table for review&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Nothing is public yet. You read the drafts, ask for changes ("make the X one less salesy"), and Claude updates them with &lt;code&gt;post_update&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;When you're happy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Approved. Publish the LinkedIn and Bluesky drafts now.
Schedule the X and Threads ones into the next free slots of my weekly queue.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude calls &lt;code&gt;post_publish_draft&lt;/code&gt; for the first two and uses the queue for the rest. Then &lt;code&gt;post_status&lt;/code&gt; tells you, per platform, whether each one went out or failed and why.&lt;/p&gt;

&lt;p&gt;From here you can build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a weekly content batch from your last three blog posts&lt;/li&gt;
&lt;li&gt;launch-day posting across every network from one prompt&lt;/li&gt;
&lt;li&gt;a "repurpose this YouTube video" flow from a transcript&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 5. Set up a posting queue
&lt;/h2&gt;

&lt;p&gt;Picking times by hand is the kind of work the agent should take off your plate. Postproxy queues hold weekly timeslots, and the agent drops posts into the next free one.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create a Postproxy queue called "Weekday mornings" with slots
Monday to Friday at 09:30 and 13:00, Europe/Madrid timezone.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude calls &lt;code&gt;queues_create&lt;/code&gt; with the timezone and the timeslots. The tool also accepts a &lt;code&gt;jitter&lt;/code&gt; of up to 60 minutes, so posts don't land at exactly 09:30:00 every day. From then on, "schedule it in the queue" is enough, and the agent asks &lt;code&gt;queues_next_slot&lt;/code&gt; where the next post goes.&lt;/p&gt;

&lt;p&gt;The rule in CLAUDE.md about not picking times by itself matters here. It keeps the agent from stacking five posts at 9:00 on Monday.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 6. Close the loop: stats and replies
&lt;/h2&gt;

&lt;p&gt;Publishing is half of social media. The other half is noticing what worked and answering people.&lt;/p&gt;

&lt;p&gt;Every Monday:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Give me last week's Postproxy summary. Which 3 posts performed best,
which comments are waiting for a reply, and draft a reply to each one
for me to approve.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;summary_get&lt;/code&gt; gives the agent one snapshot of posts, performance and pending replies. This is part of what it returned for my YouTube channel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"comments"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"received"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;26&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"awaiting_reply"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"by_platform"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"youtube"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;26&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Seventeen comments waiting for a reply, which I'd never have counted by hand. &lt;code&gt;post_stats&lt;/code&gt; adds the numbers per post, and &lt;code&gt;comments_list&lt;/code&gt; pulls the comments. The agent drafts replies, and after you approve them it posts them with &lt;code&gt;comments_create&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It can also hide spam with &lt;code&gt;comments_hide&lt;/code&gt; (Instagram, Facebook and Threads) and reply to Google Business reviews with &lt;code&gt;profile_comments_create&lt;/code&gt;. On Google, a review can have only one reply, so replying again updates it.&lt;/p&gt;

&lt;p&gt;This is the part most "AI social media" setups skip, and it's where an agent saves the most time.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 7. Run it headless on a schedule
&lt;/h2&gt;

&lt;p&gt;Everything so far happens in an interactive session. Claude Code also has a headless mode (&lt;code&gt;claude -p&lt;/code&gt;), so the Monday report can run without you opening a terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude -p &lt;span class="s2"&gt;"Give me last week's Postproxy summary: top 3 posts, comments \
waiting for a reply, and draft replies. Do not publish or post anything."&lt;/span&gt; \
  --allowedTools &lt;span class="s2"&gt;"mcp__postproxy__summary_get,mcp__postproxy__post_stats,mcp__postproxy__comments_list"&lt;/span&gt; \
  &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; reports/weekly-&lt;span class="nv"&gt;$(&lt;/span&gt;date +%F&lt;span class="o"&gt;)&lt;/span&gt;.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look at &lt;code&gt;--allowedTools&lt;/code&gt;. The headless run can only read. It can't publish, schedule or reply, even if the prompt goes wrong. Write actions stay in interactive sessions, where you approve them.&lt;/p&gt;

&lt;p&gt;Put that command in cron or a GitHub Actions schedule, and the report is waiting for you every Monday morning.&lt;/p&gt;




&lt;h2&gt;
  
  
  Guardrails that actually matter
&lt;/h2&gt;

&lt;p&gt;An agent with publishing access is a real risk to a brand. These are the rules I'd treat as non-negotiable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Drafts by default.&lt;/strong&gt; The agent creates drafts. You publish them. &lt;code&gt;post_publish_draft&lt;/code&gt; exists for exactly this.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One scoped key per brand.&lt;/strong&gt; A profile-group key means a confused agent can't post to the wrong client.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read-only automation.&lt;/strong&gt; Anything that runs without you gets &lt;code&gt;--allowedTools&lt;/code&gt; with read tools only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Respect platform limits.&lt;/strong&gt; X caps at 20 posts per 24h per account on Postproxy. Write that into CLAUDE.md so the agent plans around it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test in a sandbox first.&lt;/strong&gt; Postproxy has a sandbox mode, so you can test the whole flow before anything reaches a real account.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The hard part of an AI social media agent is the platform integrations, not the model. The Postproxy MCP server solves that with one command.&lt;/li&gt;
&lt;li&gt;Claude Code plus CLAUDE.md gives you an agent with rules: drafts only, approval before publishing, no guessing at schedules.&lt;/li&gt;
&lt;li&gt;The best results come from closing the loop: stats and replies, not just publishing.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;You don't need a bigger model to run your social media.&lt;/p&gt;

&lt;p&gt;You need an agent with hands and a short leash.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://postproxy.dev/" rel="noopener noreferrer"&gt;Start with Postproxy for free&lt;/a&gt;: 10 posts a month and no card, enough to build and test this whole agent.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>ai</category>
      <category>mcp</category>
      <category>socialmedia</category>
    </item>
    <item>
      <title>Backtrader vs vectorbt vs Backtesting.py: I Ran the Same Strategy on 10 Years of Data</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Tue, 10 Nov 2026 08:56:20 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/backtrader-vs-vectorbt-vs-backtestingpy-i-ran-the-same-strategy-on-10-years-of-data-14hb</link>
      <guid>https://dev.to/kevin_menesesgonzlez/backtrader-vs-vectorbt-vs-backtestingpy-i-ran-the-same-strategy-on-10-years-of-data-14hb</guid>
      <description>&lt;p&gt;Backtrader and vectorbt agree to the cent on the same strategy, and Backtesting.py lands within $45, with every dollar of the gap explained.&lt;/p&gt;

&lt;p&gt;But only after you align a few rules that each library handles differently out of the box. Run each one with its out-of-the-box settings and the same moving-average crossover on the same data gives you three different answers, with a 5.5% gap between them.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;choosing a Python backtesting library for your first serious project,&lt;/li&gt;
&lt;li&gt;moving a strategy from one engine to another,&lt;/li&gt;
&lt;li&gt;or wondering why your backtest doesn't match someone else's,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this matters.&lt;/p&gt;

&lt;p&gt;I ran one strategy through all three on 10 years of daily SPY data, then ran an 80-pair parameter sweep in each one. Here's what matched, what didn't, and why.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;Everything below is reproducible:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; SPY.US daily bars from EODHD, October 28, 2016 to October 28, 2026 (2,513 bars), adjusted for splits and dividends&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strategy:&lt;/strong&gt; SMA 50/200 crossover, long only. Buy when the 50-day average crosses above the 200-day, sell when it crosses below&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Account:&lt;/strong&gt; $10,000, all in, whole shares, 0.1% commission per trade&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Libraries:&lt;/strong&gt; backtrader 1.9.78.123, vectorbt 1.2.0, backtesting 0.6.6, on Python 3.12 and pandas 3.1&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run:&lt;/strong&gt; October 29, 2026&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm not looking for a good strategy here. I want to give three engines the same job and see whether they agree.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: one clean data source for all three
&lt;/h2&gt;

&lt;p&gt;Engines can only agree if they read the same numbers. So the data comes from one place, adjusted once, and saved to a CSV that every script reads.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"https://eodhd.com/api/eod/SPY.US"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"api_token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"EODHD_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"fmt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"from"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2016-10-28"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"to"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-10-28"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"date"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# One adjustment factor per day, applied to every price&lt;/span&gt;
&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"adjusted_close"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"close"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"Open"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"open"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"High"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Low"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"low"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Close"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"adjusted_close"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Volume"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"volume"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"spy.csv"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The adjustment step matters more than it looks. EODHD returns the raw &lt;code&gt;close&lt;/code&gt; and a split- and dividend-adjusted &lt;code&gt;adjusted_close&lt;/code&gt;. If you feed raw prices to a backtest, every split looks like a crash and every dividend like a small loss. Applying the same daily factor to open, high and low keeps the whole bar consistent, which matters here because all three engines fill orders at the open.&lt;/p&gt;

&lt;p&gt;That's one API call for ten years of data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: the same crossover in three libraries
&lt;/h2&gt;

&lt;p&gt;Here are the three versions with the rules aligned. The next section explains each choice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backtrader&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;backtrader&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;bt&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="no"&gt;FEE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.001&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"spy.csv"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index_col&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;parse_dates&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SmaCross&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Strategy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cross&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CrossOver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SMA&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                      &lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SMA&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;next_open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Runs before today's bar is processed: cross[0] is yesterday's signal&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;position&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cross&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;broker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getcash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;FEE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;buy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;position&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cross&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="n"&gt;cerebro&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Cerebro&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cheat_on_open&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cerebro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;adddata&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;feeds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;PandasData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dataname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cerebro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addstrategy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;SmaCross&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cerebro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;broker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setcash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10_000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cerebro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;broker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setcommission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;commission&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;FEE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cerebro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Backtrader final value: {cerebro.broker.getvalue():,.2f}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;vectorbt&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;vectorbt&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;vbt&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"spy.csv"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index_col&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;parse_dates&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;fast&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vbt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;MA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Close"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;slow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vbt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;MA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Close"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;entries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ma_crossed_above&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;shift&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fill_value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# act on the next bar&lt;/span&gt;
&lt;span class="n"&gt;exits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ma_crossed_below&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;shift&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fill_value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;pf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vbt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Portfolio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_signals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Close"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exits&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Open"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;# fill at the next open, not at the signal close&lt;/span&gt;
    &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;inf&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size_granularity&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# all in, whole shares&lt;/span&gt;
    &lt;span class="n"&gt;init_cash&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fees&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.001&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1D"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"vectorbt final value: {pf.final_value():,.2f}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Backtesting.py&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;backtesting&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Backtest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Strategy&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;backtesting&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;crossover&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;backtesting&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;test&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="no"&gt;SMA&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"spy.csv"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index_col&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;parse_dates&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SmaCross&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Strategy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fast&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;I&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;SMA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;I&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;SMA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;crossover&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;buy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="nf"&gt;crossover&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;position&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="n"&gt;stats&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Backtest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;SmaCross&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cash&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;commission&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.001&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;finalize_trades&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Backtesting.py final value: {stats['Equity Final [$]']:,.2f}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3ewua21wnqvi16w15xeh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3ewua21wnqvi16w15xeh.png" alt="The three scripts print the same final value on the same EODHD data" width="799" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Backtrader and vectorbt end at exactly $21,263.19. Backtesting.py ends at $21,218.60, and the next section shows where that $44.59 comes from.&lt;/p&gt;

&lt;p&gt;Not counting blank lines and comments, that's 23 lines for Backtrader, 15 for vectorbt and 16 for Backtesting.py.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the defaults don't match
&lt;/h2&gt;

&lt;p&gt;Now the version most people actually run: each library with its out-of-the-box settings. For vectorbt that's a plain &lt;code&gt;from_signals(close, entries, exits)&lt;/code&gt;. For Backtrader I used its &lt;code&gt;AllInSizerInt&lt;/code&gt; sizer, which sizes the order on the signal bar's close. Backtesting.py ran with a plain &lt;code&gt;buy()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1e2jtn9mia5zfwirix8p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1e2jtn9mia5zfwirix8p.png" alt="Default settings versus aligned rules in all three engines" width="799" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Run (no fees)&lt;/th&gt;
&lt;th&gt;Backtrader&lt;/th&gt;
&lt;th&gt;vectorbt&lt;/th&gt;
&lt;th&gt;Backtesting.py&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Defaults&lt;/td&gt;
&lt;td&gt;$21,231.58&lt;/td&gt;
&lt;td&gt;$22,395.33&lt;/td&gt;
&lt;td&gt;$21,325.07&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Aligned rules&lt;/td&gt;
&lt;td&gt;$21,348.83&lt;/td&gt;
&lt;td&gt;$21,348.83&lt;/td&gt;
&lt;td&gt;$21,325.07&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;With defaults, vectorbt comes out 5.5% ahead of Backtrader. Same strategy, same data, same four trades. To see which settings cause the gap, I changed them one at a time in vectorbt:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;vectorbt run (no fees)&lt;/th&gt;
&lt;th&gt;Final value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Defaults: fill at the signal close, fractional shares&lt;/td&gt;
&lt;td&gt;$22,395.33&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Whole shares only&lt;/td&gt;
&lt;td&gt;$22,223.85&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Next-open fill only&lt;/td&gt;
&lt;td&gt;$21,613.44&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Next-open fill and whole shares&lt;/td&gt;
&lt;td&gt;$21,348.83&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The last row is exactly Backtrader's aligned result. Here's what each change does.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. When the order fills.&lt;/strong&gt; With defaults, vectorbt's first entry came on March 26, 2019 at $251.97, the close of the signal day. Backtrader and Backtesting.py entered on March 27 at the open, $251.96. Filling at the signal close means buying at the price you used to decide, which you can't do in real life. Shifting the signals one bar and passing &lt;code&gt;price=df["Open"]&lt;/code&gt; puts vectorbt on the next-open rule.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Fractional shares.&lt;/strong&gt; With defaults, vectorbt bought 39.6881 shares on that first entry. The other two bought 39. &lt;code&gt;size_granularity=1&lt;/code&gt; makes vectorbt trade whole shares.&lt;/p&gt;

&lt;p&gt;Backtrader's own default result is lower than its aligned one for a related reason: &lt;code&gt;AllInSizerInt&lt;/code&gt; sizes the order on the signal bar's close, but the order fills at the next open. On the second entry that meant 30 shares instead of 31.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. How the last open trade is handled.&lt;/strong&gt; This one remains after aligning, and it explains every dollar Backtesting.py is away from the other two. All three engines take the same four trades at the same prices. The fourth trade is still open at the end of the data. vectorbt and Backtrader value it at the final close, $772.31, without selling. Backtesting.py, with the &lt;code&gt;finalize_trades=True&lt;/code&gt; setting I passed, actually closes it at the final bar's open, $771.43:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Without fees, that's 27 shares times $0.88, or $23.76.&lt;/li&gt;
&lt;li&gt;With 0.1% fees, Backtesting.py also pays the commission on that closing sale: 27 shares times $771.43 times 0.1%, or $20.83. Add the $23.76 and you get the full $44.59.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So once fills and share rounding match, Backtrader and vectorbt agree to the cent, and Backtesting.py differs only by how it settles the final open trade.&lt;/p&gt;

&lt;p&gt;I checked that with a more active strategy too. On a 10/30 crossover, with 36 trades in ten years, all three ended at exactly $20,254.43.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two Backtrader traps that cost me a trade
&lt;/h2&gt;

&lt;p&gt;Backtrader took the most code and both of my mistakes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Trap 1: an all-in order that can't pay its commission
&lt;/h3&gt;

&lt;p&gt;My first sizing rule was &lt;code&gt;floor(cash / open)&lt;/code&gt;. Without fees, that works. With a 0.1% commission, the order costs slightly more than the cash on hand, and Backtrader's broker rejects it with a Margin status.&lt;/p&gt;

&lt;p&gt;Nothing crashes. The order just doesn't happen.&lt;/p&gt;

&lt;p&gt;On the 70/250 crossover that skipped the third entry, on March 23, 2023. Backtrader finished with 3 trades and a 65.8% return, while vectorbt and Backtesting.py took 4 trades and returned 149%. Sizing with &lt;code&gt;floor(cash / (open * (1 + fee)))&lt;/code&gt; fixed it, and the three engines lined up again. If you size all in, count rejected orders in &lt;code&gt;notify_order&lt;/code&gt;, or you won't notice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Trap 2: &lt;code&gt;next_open&lt;/code&gt; reads yesterday's indicators
&lt;/h3&gt;

&lt;p&gt;To trade at the open with whole shares sized on that open, Backtrader offers &lt;code&gt;cheat_on_open=True&lt;/code&gt; and a &lt;code&gt;next_open()&lt;/code&gt; method. Inside &lt;code&gt;next_open&lt;/code&gt;, the indicators haven't been updated with the new bar yet. So &lt;code&gt;self.cross[0]&lt;/code&gt; is still the previous bar's signal.&lt;/p&gt;

&lt;p&gt;I first wrote &lt;code&gt;cross[-1]&lt;/code&gt;, assuming &lt;code&gt;[0]&lt;/code&gt; would be today's value. Every trade came one day late: the first entry landed on March 28, 2019 instead of March 27, and the result drifted away from the other two engines. Printing both values around that crossover date showed the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Speed: where vectorbt is in a different league
&lt;/h2&gt;

&lt;p&gt;One backtest takes a fraction of a second in any of the three. The difference shows up when you test many parameter sets.&lt;/p&gt;

&lt;p&gt;I ran the same sweep in each engine: fast averages from 10 to 100 and slow averages from 50 to 250, 80 valid pairs, 0.1% fees.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft2kxfwi6pujw29z5bqg6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft2kxfwi6pujw29z5bqg6.png" alt="80-pair parameter sweep: time and results in each engine" width="800" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Engine&lt;/th&gt;
&lt;th&gt;80 backtests&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;vectorbt, first call&lt;/td&gt;
&lt;td&gt;5.09 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;vectorbt, already warmed up&lt;/td&gt;
&lt;td&gt;0.08 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backtesting.py&lt;/td&gt;
&lt;td&gt;3.23 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backtrader&lt;/td&gt;
&lt;td&gt;19.27 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;vectorbt's first call includes compiling its numba functions, so a one-off sweep isn't faster than Backtesting.py. Once it's warm, it runs all 80 portfolios as one vectorized computation, about 40 times faster than Backtesting.py and about 250 times faster than Backtrader.&lt;/p&gt;

&lt;p&gt;All three found the same best pair, 80/250. Across the 80 pairs, vectorbt and Backtrader returned identical results, and Backtesting.py was never more than 0.545 percentage points away, consistent with how it settles the final open trade.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this breaks, and what I'd actually trust
&lt;/h2&gt;

&lt;p&gt;The engines agree. The strategy is a different story.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb2qrv6eoxasymmu5hqch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb2qrv6eoxasymmu5hqch.png" alt="SMA 50/200 and SMA 10/30 against buy and hold, same data and fees" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Over the same ten years, buying SPY and holding it turned $10,000 into $42,429.98, a 324.30% return. Even buying only on August 16, 2017, the first day a 200-day average exists, returned 260.49%. The 50/200 crossover returned 112.63%. Even the best of the 80 pairs, 80/250, returned 158.40%. None of them came close.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkg4jyab75plvmdo6w7mk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkg4jyab75plvmdo6w7mk.png" alt="SMA 10/30 results and buy and hold" width="799" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The crossovers did one thing better: the 10/30 version cut the maximum drawdown to 17.44%, against 33.72% for buy and hold. Whether that's worth giving up two thirds of the return is a question for your own risk tolerance, not for a backtest.&lt;/p&gt;

&lt;p&gt;Three more caveats:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Picking the best of 80 is overfitting.&lt;/strong&gt; 80/250 won on this decade of SPY. Choosing it because it won, then reporting its return, tells you about the past, not the next ten years. Test the chosen pair on data it hasn't seen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;0.1% commission isn't the whole cost.&lt;/strong&gt; There's no slippage or spread in these runs. With four trades in ten years that barely matters. With a strategy that trades daily, it does.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agreement between engines isn't proof of correctness.&lt;/strong&gt; All three can agree on a backtest that uses the wrong prices. That's why the data step comes first. I went deeper into this in &lt;a href="https://medium.com/python-in-plain-english/backtesting-in-python-why-most-backtests-lie-2026-d0600dd75f72" rel="noopener noreferrer"&gt;Backtesting in Python: Why Most Backtests Lie&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Which one should you use?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Backtrader&lt;/th&gt;
&lt;th&gt;vectorbt&lt;/th&gt;
&lt;th&gt;Backtesting.py&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Style&lt;/td&gt;
&lt;td&gt;Event-driven, broker simulation&lt;/td&gt;
&lt;td&gt;Vectorized arrays&lt;/td&gt;
&lt;td&gt;Event-driven, compact API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lines for this strategy&lt;/td&gt;
&lt;td&gt;23&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80-run sweep&lt;/td&gt;
&lt;td&gt;19.27 s&lt;/td&gt;
&lt;td&gt;0.08 s warm, 5.09 s cold&lt;/td&gt;
&lt;td&gt;3.23 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fills in my default run&lt;/td&gt;
&lt;td&gt;Next open&lt;/td&gt;
&lt;td&gt;Signal-bar close&lt;/td&gt;
&lt;td&gt;Next open&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fractional shares in my default run&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latest PyPI release&lt;/td&gt;
&lt;td&gt;April 19, 2023&lt;/td&gt;
&lt;td&gt;October 19, 2026&lt;/td&gt;
&lt;td&gt;July 22, 2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gotcha to watch&lt;/td&gt;
&lt;td&gt;Commission can reject all-in orders; &lt;code&gt;next_open&lt;/code&gt; indexing&lt;/td&gt;
&lt;td&gt;Shift signals and set the fill price&lt;/td&gt;
&lt;td&gt;With &lt;code&gt;finalize_trades=True&lt;/code&gt;, the final trade closes at the last open&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Backtrader&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A full broker model: order types, commissions, margin checks, multiple data feeds&lt;/li&gt;
&lt;li&gt;The event loop reads like live trading code, so moving to a broker is easier&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The slowest of the three on parameter sweeps&lt;/li&gt;
&lt;li&gt;No release on PyPI since April 2023. It still ran fine on Python 3.12 and pandas 3.1 here&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; strategies with realistic order handling, multiple instruments, or a path to live trading.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;vectorbt&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;80 backtests in 0.08 seconds once compiled&lt;/li&gt;
&lt;li&gt;The shortest code in this test, by one line&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Defaults that differ from the other two (signal-bar fills, fractional shares)&lt;/li&gt;
&lt;li&gt;Path-dependent logic, like a trailing stop that depends on every previous bar, is harder to express than in an event loop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; research, parameter sweeps and comparing many signals quickly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backtesting.py&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A small, readable API and a built-in stats table&lt;/li&gt;
&lt;li&gt;80 backtests in about 3 seconds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One instrument per backtest&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;finalize_trades=True&lt;/code&gt;, it closes the final open trade at the last bar's open and charges the commission, which shifts the reported result slightly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; single-asset strategies where you want clear code and quick results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting the data
&lt;/h2&gt;

&lt;p&gt;The ten years of SPY in this test came from one call to EODHD's end-of-day API, with &lt;code&gt;adjusted_close&lt;/code&gt; doing the adjustment work.&lt;/p&gt;

&lt;p&gt;The free plan covers one year of end-of-day history and 20 API calls a day, so it's enough to try the code on a short range. Ten years of history needs the EOD Historical All-World plan or higher.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://eodhd.com/?via=kmg&amp;amp;ref1=Meneses&amp;amp;utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=backtrader-vs-vectorbt-vs-backtesting-py&amp;amp;utm_content=Meneses" rel="noopener noreferrer"&gt;Get your EODHD API key here&lt;/a&gt;. Use the code &lt;strong&gt;KEVIN10&lt;/strong&gt; at checkout for 10% off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;With the same fill timing and share rounding, Backtrader and vectorbt agree to the cent on the same data, and Backtesting.py differs only by how it settles the final open trade.&lt;/li&gt;
&lt;li&gt;With defaults, the same crossover differs by 5.5%, mostly because vectorbt fills at the signal-bar close.&lt;/li&gt;
&lt;li&gt;None of 80 SMA crossovers beat buy and hold on SPY over the last ten years. The engine you pick matters less than the question you test.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQs
&lt;/h2&gt;

&lt;p&gt;❓ &lt;strong&gt;Is Backtrader still maintained?&lt;/strong&gt;&lt;br&gt;
✅ Its latest release on PyPI is 1.9.78.123, from April 19, 2023, with none since. It still installed and ran correctly on Python 3.12 with pandas 3.1 in this test, and matched vectorbt to the cent once the rules were aligned.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Is vectorbt faster than Backtrader?&lt;/strong&gt;&lt;br&gt;
✅ For parameter sweeps, by a wide margin. In this test, 80 backtests took 0.08 seconds in vectorbt once warmed up, against 19.27 seconds in Backtrader. The first vectorbt call took 5.09 seconds because it compiles its functions.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Why do my backtest results differ between libraries?&lt;/strong&gt;&lt;br&gt;
✅ Usually because of fill timing, share rounding or how the last open trade is handled. In this test, vectorbt's defaults filled at the signal-bar close with fractional shares, while Backtrader and Backtesting.py filled at the next open with whole shares.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Which Python backtesting library is best for beginners?&lt;/strong&gt;&lt;br&gt;
✅ Backtesting.py has the smallest API and a readable stats report, and it ran this strategy in 16 lines. vectorbt is shorter still, but its defaults need care to match realistic fills.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Should I use adjusted prices for backtesting?&lt;/strong&gt;&lt;br&gt;
✅ Yes. Raw prices turn splits into fake crashes and leave dividends out of the return. Apply the adjustment factor to open, high and low as well as close, so orders filled at the open use consistent prices.&lt;/p&gt;




&lt;p&gt;The three engines aren't the hard part. Once the rules are aligned they agree, and every remaining dollar has a reason.&lt;/p&gt;

&lt;p&gt;The hard part is the question you ask them, and whether the answer beats doing nothing.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>backtesting</category>
      <category>algotrading</category>
      <category>finance</category>
    </item>
    <item>
      <title>I Tested 72 Financial Data Tools in EODHD's MCP Server. These 7 Were the Best.</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Mon, 09 Nov 2026 09:26:57 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/i-tested-72-financial-data-tools-in-eodhds-mcp-server-these-7-were-the-best-4lbh</link>
      <guid>https://dev.to/kevin_menesesgonzlez/i-tested-72-financial-data-tools-in-eodhds-mcp-server-these-7-were-the-best-4lbh</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Out of the 72 tools on the EODHD MCP server, seven do most of the work: &lt;code&gt;stock_screener&lt;/code&gt;, &lt;code&gt;get_fundamentals_data&lt;/code&gt;, &lt;code&gt;get_historical_stock_prices&lt;/code&gt;, &lt;code&gt;get_live_price_data&lt;/code&gt;, &lt;code&gt;get_technical_indicators&lt;/code&gt;, &lt;code&gt;get_upcoming_earnings&lt;/code&gt; and &lt;code&gt;get_sentiment_data&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;I ran every one against the live API on 8 November 2026. All outputs, charts and code below are real.&lt;/li&gt;
&lt;li&gt;Six of the seven work with EODHD's free demo key on AAPL, TSLA and AMZN. The screener, and fundamentals for your own tickers, need a paid plan.&lt;/li&gt;
&lt;li&gt;The traps: &lt;code&gt;close&lt;/code&gt; vs &lt;code&gt;adjusted_close&lt;/code&gt;, an empty RSI when you pass dates, sentiment scores built on 13 articles, and a screener signal that returns OTC listings first.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Connecting Claude to the EODHD MCP server takes five minutes. Then the trouble starts.&lt;/p&gt;

&lt;p&gt;You ask a simple question, "is Nvidia expensive right now?", and Claude stares at 72 tool names. It picks one. It burns 5 API calls on a news request you didn't need. With the free plan's 20 calls a day, four of those and you're done until midnight GMT. You ask for an RSI over the last two weeks and get an empty list. You ask for the yearly return and it reads the wrong price column. The answer sounds confident. Half of it is guessed.&lt;/p&gt;

&lt;p&gt;I've been testing MCP servers all year. I ranked nine of them in an earlier piece, and EODHD's is the one I connect to Claude most. I've hit every one of those walls.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;connecting Claude to market data for the first time,&lt;/li&gt;
&lt;li&gt;building an agent that has to answer real investing questions,&lt;/li&gt;
&lt;li&gt;or tired of paying for calls that return nothing,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this is the short list. Seven tools, what they return, and where they trip you up.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I tested the 7 best EODHD MCP tools
&lt;/h2&gt;

&lt;p&gt;Each MCP tool on the EODHD server calls one REST endpoint underneath. So instead of showing you screenshots of a chat, I called each endpoint directly, saved the raw JSON, and quote it below. You can run the same calls yourself.&lt;/p&gt;

&lt;p&gt;The setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Date run: 8 November 2026 (US market data up to the close of Friday, 6 November)&lt;/li&gt;
&lt;li&gt;Keys: EODHD's public demo key for everything it covers (AAPL, TSLA, AMZN, VTI), a paid key for the screener&lt;/li&gt;
&lt;li&gt;Tickers: AAPL.US for most tests, TSLA.US and AMZN.US for earnings, the 10 largest US tech stocks for the screener&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. stock_screener: the question before the question
&lt;/h2&gt;

&lt;p&gt;Most investing questions start with "which stocks?". The screener answers that in one call, and it's the tool I'd keep if I could only keep one.&lt;/p&gt;

&lt;p&gt;I asked for the 10 largest US technology stocks by market cap. Each row comes back with price, market cap, EPS, dividend yield and returns over 1 day and 5 days. That last column told the story of the week on its own:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc3vhxcx78xsxftwpa1et.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc3vhxcx78xsxftwpa1et.png" alt="5-day return of the 10 largest US tech stocks from one stock_screener call" width="800" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Micron fell 22.0% in five days, SK Hynix 14.7%, AMD 11.1%. Microsoft was the only one up (+1.7%). Apple barely moved (-0.7%). One request, and you can see the chip sell-off before reading a single headline.&lt;/p&gt;

&lt;p&gt;Two things to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ASML shows up twice (ASML and ASMLF), because both US listings pass the filter. Deduplicate before you count.&lt;/li&gt;
&lt;li&gt;Signals are powerful but noisy. When I swapped the sector filter for the &lt;code&gt;200d_new_hi&lt;/code&gt; signal across all US stocks above $10 billion, all five results were foreign OTC listings (Postal Savings Bank of China, BCE, Amundi…) with a 0% 5-day move. Sanity-check the tickers before you hand the list to Claude.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It costs 5 API calls per request and needs the EOD + Intraday All-World Extended plan or higher. The demo key returns 403.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; building a shortlist, watchlists, "what moved this week?".&lt;/p&gt;

&lt;h2&gt;
  
  
  2. get_fundamentals_data: the whole company in one call
&lt;/h2&gt;

&lt;p&gt;This is the tool Claude calls most when I ask "is this stock expensive?". One request returns valuation, margins, growth, analyst estimates and more.&lt;/p&gt;

&lt;p&gt;For AAPL.US, filtered to the Highlights and Valuation sections:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Market cap&lt;/td&gt;
&lt;td&gt;$4.98 trillion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;P/E (trailing)&lt;/td&gt;
&lt;td&gt;38.13&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;P/E (forward)&lt;/td&gt;
&lt;td&gt;35.71&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Profit margin&lt;/td&gt;
&lt;td&gt;27.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Quarterly revenue growth (YoY)&lt;/td&gt;
&lt;td&gt;11.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Quarterly earnings growth (YoY)&lt;/td&gt;
&lt;td&gt;14.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Analyst target price&lt;/td&gt;
&lt;td&gt;$339.04&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Most recent quarter&lt;/td&gt;
&lt;td&gt;2026-09-30&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The useful detail: the analyst target ($339.04) sits slightly below the last close ($342.37). You notice that because both numbers arrive in the same payload.&lt;/p&gt;

&lt;p&gt;The catch is cost. Each fundamentals request is 10 API calls. Filter to the sections you need, and tell Claude not to call it for every ticker on a list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; valuation questions, quick company summaries, checking a shortlist by hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. get_historical_stock_prices: the backbone of every backtest
&lt;/h2&gt;

&lt;p&gt;Daily, weekly or monthly OHLCV, with both the raw close and the adjusted close. I asked for monthly bars over the last year:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Month&lt;/th&gt;
&lt;th&gt;Close&lt;/th&gt;
&lt;th&gt;Adjusted close&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2025-11&lt;/td&gt;
&lt;td&gt;278.85&lt;/td&gt;
&lt;td&gt;278.09&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2026-01&lt;/td&gt;
&lt;td&gt;259.48&lt;/td&gt;
&lt;td&gt;258.78&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2026-05&lt;/td&gt;
&lt;td&gt;312.06&lt;/td&gt;
&lt;td&gt;311.79&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2026-09&lt;/td&gt;
&lt;td&gt;333.02&lt;/td&gt;
&lt;td&gt;333.02&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2026-11 (partial)&lt;/td&gt;
&lt;td&gt;342.37&lt;/td&gt;
&lt;td&gt;342.37&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On adjusted prices, that's a 23.1% gain from November 2025 to now. On raw closes it's 22.8%. The gap is the dividends.&lt;/p&gt;

&lt;p&gt;Pick the right column. If Claude reads &lt;code&gt;close&lt;/code&gt; instead of &lt;code&gt;adjusted_close&lt;/code&gt;, it understates the return on any stock that pays dividends. On a stock that split, the gap is much larger. I tell Claude explicitly to use &lt;code&gt;adjusted_close&lt;/code&gt; for returns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; returns, drawdowns, charts, backtests.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. get_live_price_data: what's the price right now
&lt;/h2&gt;

&lt;p&gt;The simplest tool on the list, and the one that stops Claude from guessing a price from its training data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"AAPL.US"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1794000540&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"open"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;338.73&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;345.79&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"low"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;338.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"close"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;342.37&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"previousClose"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;344.17&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"change"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;-1.8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"change_p"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;-0.523&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The timestamp converts to 6 November 2026, 21:29 UTC, after Friday's close. Live prices are 15-minute delayed on the EOD plans. Fine for analysis, wrong for trading.&lt;/p&gt;

&lt;p&gt;The cross-check I liked: the live close (342.37) matches the November bar from tool 3 and the screener row from tool 1. Three tools, one number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; anchoring any analysis to today's price.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. get_technical_indicators: RSI, SMA and more without writing the maths
&lt;/h2&gt;

&lt;p&gt;RSI, SMA, EMA, MACD, Bollinger Bands, ATR, ADX and others, computed server-side. Each request costs 5 API calls.&lt;/p&gt;

&lt;p&gt;For AAPL.US on 6 November:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RSI(14): 51.46, neutral, neither overbought nor oversold&lt;/li&gt;
&lt;li&gt;SMA(200): 298.54, so the price sits 14.7% above its long-term trend&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The trap I fell into: when I passed a two-week &lt;code&gt;from&lt;/code&gt;/&lt;code&gt;to&lt;/code&gt; window to the RSI request, it came back as an empty list. Without the date range, sorted descending (&lt;code&gt;order=d&lt;/code&gt;), it returned the full series. If Claude reports "no data" for an indicator, ask it to retry without the dates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; trend and momentum checks, signal scripts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run it yourself
&lt;/h2&gt;

&lt;p&gt;Here's the four-tool snapshot I now use before reading any stock. It ran as-is with the demo key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;API&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://eodhd.com/api&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;demo&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;  &lt;span class="c1"&gt;# covers AAPL.US, TSLA.US, AMZN.US, VTI.US
&lt;/span&gt;&lt;span class="n"&gt;TICKER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AAPL.US&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;API&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;api_token&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fmt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;json&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;live&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;real-time/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;TICKER&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;rsi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;technical/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;TICKER&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rsi&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;d&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;sma&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;technical/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;TICKER&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sma&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;d&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;val&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fundamentals/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;TICKER&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;filter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Valuation&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Price      &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;live&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;close&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; (&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;live&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;change_p&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;%)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;RSI(14)    &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;rsi&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;rsi&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;  on &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;rsi&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;date&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SMA(200)   &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sma&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sma&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;  -&amp;gt; price &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;live&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;close&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;sma&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sma&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; vs trend&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;P/E        &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;val&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;TrailingPE&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; trailing, &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;val&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ForwardPE&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; forward&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Price      342.37 (-0.52%)
RSI(14)    51.5  on 2026-11-06
SMA(200)   298.54  -&amp;gt; price +14.7% vs trend
P/E        38.1 trailing, 35.7 forward
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you'd rather ask Claude in plain English than write the script, the same four tools are one prompt away once the MCP server is connected. 👉 &lt;a href="https://eodhd.com/?via=kmg&amp;amp;ref1=Meneses&amp;amp;utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=i-tested-72-financial-data-tools-in-eodhd-mcp-server&amp;amp;utm_content=Meneses" rel="noopener noreferrer"&gt;Get your EODHD key here&lt;/a&gt;. Use the code &lt;strong&gt;KEVIN10&lt;/strong&gt; at checkout for 10% off.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. get_upcoming_earnings: dates, beats and misses
&lt;/h2&gt;

&lt;p&gt;The name undersells it. Besides dates, it returns the EPS estimate, the actual figure and the surprise. I asked for AAPL, TSLA and AMZN from July 2026 to March 2027:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Few25iux7j2br0vs63fl9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Few25iux7j2br0vs63fl9.png" alt="EPS surprise for AAPL, AMZN and TSLA over the last two reports" width="800" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Ticker&lt;/th&gt;
&lt;th&gt;Report date&lt;/th&gt;
&lt;th&gt;EPS estimate&lt;/th&gt;
&lt;th&gt;EPS actual&lt;/th&gt;
&lt;th&gt;Surprise&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;AAPL&lt;/td&gt;
&lt;td&gt;2026-07-30&lt;/td&gt;
&lt;td&gt;1.88&lt;/td&gt;
&lt;td&gt;2.02&lt;/td&gt;
&lt;td&gt;+7.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AAPL&lt;/td&gt;
&lt;td&gt;2026-11-02&lt;/td&gt;
&lt;td&gt;1.98&lt;/td&gt;
&lt;td&gt;2.05&lt;/td&gt;
&lt;td&gt;+3.5%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TSLA&lt;/td&gt;
&lt;td&gt;2026-07-22&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;td&gt;0.33&lt;/td&gt;
&lt;td&gt;-38.9%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TSLA&lt;/td&gt;
&lt;td&gt;2026-10-21&lt;/td&gt;
&lt;td&gt;0.22&lt;/td&gt;
&lt;td&gt;0.48&lt;/td&gt;
&lt;td&gt;+118.2%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AMZN&lt;/td&gt;
&lt;td&gt;2026-07-30&lt;/td&gt;
&lt;td&gt;1.83&lt;/td&gt;
&lt;td&gt;1.88&lt;/td&gt;
&lt;td&gt;+2.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AMZN&lt;/td&gt;
&lt;td&gt;2026-10-29&lt;/td&gt;
&lt;td&gt;2.01&lt;/td&gt;
&lt;td&gt;1.89&lt;/td&gt;
&lt;td&gt;-6.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Look at Tesla. A 38.9% miss followed by a 118.2% beat. The second number is mostly the estimate collapsing from 0.54 to 0.22, not earnings exploding. Claude explains that well, but only when it has the raw estimate next to the actual.&lt;/p&gt;

&lt;p&gt;One limit: my window ran to March 2027, but no future dates came back for these three. Upcoming dates appear once they're scheduled, so a query far ahead can return only past quarters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; earnings-season prep, "did they beat?" questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. get_sentiment_data: a daily mood score from the news
&lt;/h2&gt;

&lt;p&gt;A daily sentiment score per ticker, plus the number of articles behind it. For AAPL.US, the last two weeks ranged from 0.18 to 0.91.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9upvl0ckovk1enb3shwy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9upvl0ckovk1enb3shwy.png" alt="AAPL daily news sentiment score with the number of articles behind each day" width="800" height="569"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The bottom panel matters as much as the top one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1 November: score 0.18, from 13 articles&lt;/li&gt;
&lt;li&gt;3 November: score 0.54, from 119 articles&lt;/li&gt;
&lt;li&gt;7 November: score 0.91, from 13 articles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A 0.91 built on 13 articles over a weekend is weaker evidence than a 0.54 built on 119. I ask Claude to always report both numbers. It doesn't by default.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; spotting a shift in coverage around an event.&lt;/p&gt;

&lt;h2&gt;
  
  
  The ones that didn't make the cut
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;get_historical_dividends&lt;/code&gt; nearly did. It has the cleanest output on the server: ex-date, record date, payment date and amount. For AAPL you can read the May 2026 raise straight off it ($0.26 to $0.27 a quarter), and the 16 November payment was already listed. It lost its spot to the screener because fewer of my questions need it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;get_insider_transactions&lt;/code&gt; is the one I expected to rank. For the window I asked (November 2025 to November 2026), AAPL returned no filings, and for NVDA and TSLA the most recent entries were from March 2026. If you use it for "recent insider buying", check the filing dates before you trust the word "recent".&lt;/p&gt;

&lt;p&gt;&lt;code&gt;get_company_news&lt;/code&gt; works, but when I asked for AAPL.US news, most headlines were about other companies (Marvell, Gildan, Cisco) that only mention Apple in passing. Use the sentiment tool for the trend, and ask Claude to keep only headlines that name the company in the title.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which EODHD plan you need
&lt;/h2&gt;

&lt;p&gt;To reproduce tools 2 to 7 for AAPL, TSLA or AMZN, you don't need a plan. The demo key covers them.&lt;/p&gt;

&lt;p&gt;For your own tickers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Free plan: 20 API calls a day and 1 year of end-of-day history. No fundamentals.&lt;/li&gt;
&lt;li&gt;EOD Historical All-World ($19.99/month): prices, live prices, dividends, news and sentiment, with 30+ years of history.&lt;/li&gt;
&lt;li&gt;EOD + Intraday All-World Extended ($29.99/month): adds technical indicators and the screener.&lt;/li&gt;
&lt;li&gt;Fundamentals Data Feed ($59.99/month) or All-In-One ($99.99/month): needed for &lt;code&gt;get_fundamentals_data&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Watch the call costs. Fundamentals cost 10 calls per request. News, technicals and the screener cost 5. A Claude session that checks ten stocks can eat a free plan's daily allowance in a couple of questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  One more thing: it isn't 72 anymore
&lt;/h2&gt;

&lt;p&gt;When I first mapped the server, it had 72 tools. The version I'm connected to today lists around 100: new families for credit spreads, Treasury yields, US options, SEC filings and more. I haven't tested those yet, so they're not in this ranking. They're next on my list.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is the EODHD MCP server?&lt;/strong&gt;&lt;br&gt;
A Model Context Protocol server that lets Claude, ChatGPT or your own agent call EODHD's financial data APIs as tools. The tools fetch data; none of them places orders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which EODHD MCP tools are the most useful?&lt;/strong&gt;&lt;br&gt;
In my tests: the stock screener, fundamentals, historical prices, live prices, technical indicators, the earnings calendar and news sentiment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does the EODHD MCP server work with the free plan?&lt;/strong&gt;&lt;br&gt;
Yes, within the free plan's limits: 20 calls a day and 1 year of history, without fundamentals. The demo key covers a few tickers with no sign-up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can Claude trade through the EODHD MCP server?&lt;/strong&gt;&lt;br&gt;
No. The tools only read data. There's no order path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final take
&lt;/h2&gt;

&lt;p&gt;Seventy-two tools is a menu. You don't need the whole menu.&lt;/p&gt;

&lt;p&gt;Start with these seven. Look at what each one returns, and tell Claude which column to trust. That gets you most of the way.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://eodhd.com/financial-apis/mcp-server-for-financial-data-by-eodhd?via=kmg&amp;amp;ref1=Meneses&amp;amp;utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=i-tested-72-financial-data-tools-in-eodhd-mcp-server&amp;amp;utm_content=Meneses" rel="noopener noreferrer"&gt;Set up the EODHD MCP server with your key&lt;/a&gt;. Use the code &lt;strong&gt;KEVIN10&lt;/strong&gt; at checkout for 10% off.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Not financial advice. The tickers are examples to show what each tool returns.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>python</category>
      <category>fintech</category>
    </item>
    <item>
      <title>Backtrader vs vectorbt vs Backtesting.py: I Ran the Same Strategy on 10 Years of Data</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Sat, 07 Nov 2026 12:21:03 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/backtrader-vs-vectorbt-vs-backtestingpy-i-ran-the-same-strategy-on-10-years-of-data-2166</link>
      <guid>https://dev.to/kevin_menesesgonzlez/backtrader-vs-vectorbt-vs-backtestingpy-i-ran-the-same-strategy-on-10-years-of-data-2166</guid>
      <description>&lt;p&gt;Backtrader and vectorbt agree to the cent on the same strategy, and Backtesting.py lands within $45, with every dollar of the gap explained.&lt;/p&gt;

&lt;p&gt;But only after you align a few rules that each library handles differently out of the box. Run each one with its out-of-the-box settings and the same moving-average crossover on the same data gives you three different answers, with a 5.5% gap between them.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;choosing a Python backtesting library for your first serious project,&lt;/li&gt;
&lt;li&gt;moving a strategy from one engine to another,&lt;/li&gt;
&lt;li&gt;or wondering why your backtest doesn't match someone else's,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this matters.&lt;/p&gt;

&lt;p&gt;I ran one strategy through all three on 10 years of daily SPY data, then ran an 80-pair parameter sweep in each one. Here's what matched, what didn't, and why.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;Everything below is reproducible:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; SPY.US daily bars from EODHD, October 28, 2016 to October 28, 2026 (2,513 bars), adjusted for splits and dividends&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strategy:&lt;/strong&gt; SMA 50/200 crossover, long only. Buy when the 50-day average crosses above the 200-day, sell when it crosses below&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Account:&lt;/strong&gt; $10,000, all in, whole shares, 0.1% commission per trade&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Libraries:&lt;/strong&gt; backtrader 1.9.78.123, vectorbt 1.2.0, backtesting 0.6.6, on Python 3.12 and pandas 3.1&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run:&lt;/strong&gt; October 29, 2026&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm not looking for a good strategy here. I want to give three engines the same job and see whether they agree.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: one clean data source for all three
&lt;/h2&gt;

&lt;p&gt;Engines can only agree if they read the same numbers. So the data comes from one place, adjusted once, and saved to a CSV that every script reads.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://eodhd.com/api/eod/SPY.US&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;api_token&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;EODHD_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fmt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;json&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;from&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2016-10-28&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;to&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2026-10-28&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()).&lt;/span&gt;&lt;span class="nf"&gt;set_index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;date&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# One adjustment factor per day, applied to every price
&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;adjusted_close&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;close&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Open&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;open&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;High&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;high&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Low&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;low&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Close&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;adjusted_close&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Volume&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;volume&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;spy.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The adjustment step matters more than it looks. EODHD returns the raw &lt;code&gt;close&lt;/code&gt; and a split- and dividend-adjusted &lt;code&gt;adjusted_close&lt;/code&gt;. If you feed raw prices to a backtest, every split looks like a crash and every dividend like a small loss. Applying the same daily factor to open, high and low keeps the whole bar consistent, which matters here because all three engines fill orders at the open.&lt;/p&gt;

&lt;p&gt;That's one API call for ten years of data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: the same crossover in three libraries
&lt;/h2&gt;

&lt;p&gt;Here are the three versions with the rules aligned. The next section explains each choice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backtrader&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;backtrader&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;bt&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="n"&gt;FEE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.001&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;spy.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index_col&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;parse_dates&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SmaCross&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Strategy&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cross&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CrossOver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SMA&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                                      &lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SMA&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;next_open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c1"&gt;# Runs before today's bar is processed: cross[0] is yesterday's signal
&lt;/span&gt;        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;position&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cross&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;broker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getcash&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;FEE&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;buy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;position&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cross&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;


&lt;span class="n"&gt;cerebro&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Cerebro&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cheat_on_open&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cerebro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;adddata&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;feeds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;PandasData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dataname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;cerebro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addstrategy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SmaCross&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cerebro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;broker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setcash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10_000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cerebro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;broker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setcommission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;commission&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;FEE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cerebro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Backtrader final value: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;cerebro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;broker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getvalue&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;,.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;vectorbt&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;vectorbt&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;vbt&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;spy.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index_col&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;parse_dates&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;fast&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vbt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Close&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;slow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vbt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Close&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;entries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ma_crossed_above&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;shift&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fill_value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# act on the next bar
&lt;/span&gt;&lt;span class="n"&gt;exits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ma_crossed_below&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;shift&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fill_value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;pf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vbt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Portfolio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_signals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Close&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exits&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Open&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;      &lt;span class="c1"&gt;# fill at the next open, not at the signal close
&lt;/span&gt;    &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;inf&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size_granularity&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# all in, whole shares
&lt;/span&gt;    &lt;span class="n"&gt;init_cash&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fees&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.001&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1D&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;vectorbt final value: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;pf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;final_value&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;,.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Backtesting.py&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;backtesting&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Backtest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Strategy&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;backtesting.lib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;crossover&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;backtesting.test&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SMA&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;spy.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index_col&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;parse_dates&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SmaCross&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Strategy&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fast&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;I&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SMA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;I&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SMA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;crossover&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;buy&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="nf"&gt;crossover&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slow&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;position&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;


&lt;span class="n"&gt;stats&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Backtest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SmaCross&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cash&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;commission&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.001&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;finalize_trades&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Backtesting.py final value: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;stats&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Equity Final [$]&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;,.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3ewua21wnqvi16w15xeh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3ewua21wnqvi16w15xeh.png" alt="The three scripts print the same final value on the same EODHD data" width="799" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Backtrader and vectorbt end at exactly $21,263.19. Backtesting.py ends at $21,218.60, and the next section shows where that $44.59 comes from.&lt;/p&gt;

&lt;p&gt;Not counting blank lines and comments, that's 23 lines for Backtrader, 15 for vectorbt and 16 for Backtesting.py.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the defaults don't match
&lt;/h2&gt;

&lt;p&gt;Now the version most people actually run: each library with its out-of-the-box settings. For vectorbt that's a plain &lt;code&gt;from_signals(close, entries, exits)&lt;/code&gt;. For Backtrader I used its &lt;code&gt;AllInSizerInt&lt;/code&gt; sizer, which sizes the order on the signal bar's close. Backtesting.py ran with a plain &lt;code&gt;buy()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1e2jtn9mia5zfwirix8p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1e2jtn9mia5zfwirix8p.png" alt="Default settings versus aligned rules in all three engines" width="799" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Run (no fees)&lt;/th&gt;
&lt;th&gt;Backtrader&lt;/th&gt;
&lt;th&gt;vectorbt&lt;/th&gt;
&lt;th&gt;Backtesting.py&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Defaults&lt;/td&gt;
&lt;td&gt;$21,231.58&lt;/td&gt;
&lt;td&gt;$22,395.33&lt;/td&gt;
&lt;td&gt;$21,325.07&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Aligned rules&lt;/td&gt;
&lt;td&gt;$21,348.83&lt;/td&gt;
&lt;td&gt;$21,348.83&lt;/td&gt;
&lt;td&gt;$21,325.07&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;With defaults, vectorbt comes out 5.5% ahead of Backtrader. Same strategy, same data, same four trades. To see which settings cause the gap, I changed them one at a time in vectorbt:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;vectorbt run (no fees)&lt;/th&gt;
&lt;th&gt;Final value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Defaults: fill at the signal close, fractional shares&lt;/td&gt;
&lt;td&gt;$22,395.33&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Whole shares only&lt;/td&gt;
&lt;td&gt;$22,223.85&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Next-open fill only&lt;/td&gt;
&lt;td&gt;$21,613.44&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Next-open fill and whole shares&lt;/td&gt;
&lt;td&gt;$21,348.83&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The last row is exactly Backtrader's aligned result. Here's what each change does.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. When the order fills.&lt;/strong&gt; With defaults, vectorbt's first entry came on March 26, 2019 at $251.97, the close of the signal day. Backtrader and Backtesting.py entered on March 27 at the open, $251.96. Filling at the signal close means buying at the price you used to decide, which you can't do in real life. Shifting the signals one bar and passing &lt;code&gt;price=df["Open"]&lt;/code&gt; puts vectorbt on the next-open rule.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Fractional shares.&lt;/strong&gt; With defaults, vectorbt bought 39.6881 shares on that first entry. The other two bought 39. &lt;code&gt;size_granularity=1&lt;/code&gt; makes vectorbt trade whole shares.&lt;/p&gt;

&lt;p&gt;Backtrader's own default result is lower than its aligned one for a related reason: &lt;code&gt;AllInSizerInt&lt;/code&gt; sizes the order on the signal bar's close, but the order fills at the next open. On the second entry that meant 30 shares instead of 31.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. How the last open trade is handled.&lt;/strong&gt; This one remains after aligning, and it explains every dollar Backtesting.py is away from the other two. All three engines take the same four trades at the same prices. The fourth trade is still open at the end of the data. vectorbt and Backtrader value it at the final close, $772.31, without selling. Backtesting.py, with the &lt;code&gt;finalize_trades=True&lt;/code&gt; setting I passed, actually closes it at the final bar's open, $771.43:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Without fees, that's 27 shares times $0.88, or $23.76.&lt;/li&gt;
&lt;li&gt;With 0.1% fees, Backtesting.py also pays the commission on that closing sale: 27 shares times $771.43 times 0.1%, or $20.83. Add the $23.76 and you get the full $44.59.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So once fills and share rounding match, Backtrader and vectorbt agree to the cent, and Backtesting.py differs only by how it settles the final open trade.&lt;/p&gt;

&lt;p&gt;I checked that with a more active strategy too. On a 10/30 crossover, with 36 trades in ten years, all three ended at exactly $20,254.43.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two Backtrader traps that cost me a trade
&lt;/h2&gt;

&lt;p&gt;Backtrader took the most code and both of my mistakes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Trap 1: an all-in order that can't pay its commission
&lt;/h3&gt;

&lt;p&gt;My first sizing rule was &lt;code&gt;floor(cash / open)&lt;/code&gt;. Without fees, that works. With a 0.1% commission, the order costs slightly more than the cash on hand, and Backtrader's broker rejects it with a Margin status.&lt;/p&gt;

&lt;p&gt;Nothing crashes. The order just doesn't happen.&lt;/p&gt;

&lt;p&gt;On the 70/250 crossover that skipped the third entry, on March 23, 2023. Backtrader finished with 3 trades and a 65.8% return, while vectorbt and Backtesting.py took 4 trades and returned 149%. Sizing with &lt;code&gt;floor(cash / (open * (1 + fee)))&lt;/code&gt; fixed it, and the three engines lined up again. If you size all in, count rejected orders in &lt;code&gt;notify_order&lt;/code&gt;, or you won't notice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Trap 2: &lt;code&gt;next_open&lt;/code&gt; reads yesterday's indicators
&lt;/h3&gt;

&lt;p&gt;To trade at the open with whole shares sized on that open, Backtrader offers &lt;code&gt;cheat_on_open=True&lt;/code&gt; and a &lt;code&gt;next_open()&lt;/code&gt; method. Inside &lt;code&gt;next_open&lt;/code&gt;, the indicators haven't been updated with the new bar yet. So &lt;code&gt;self.cross[0]&lt;/code&gt; is still the previous bar's signal.&lt;/p&gt;

&lt;p&gt;I first wrote &lt;code&gt;cross[-1]&lt;/code&gt;, assuming &lt;code&gt;[0]&lt;/code&gt; would be today's value. Every trade came one day late: the first entry landed on March 28, 2019 instead of March 27, and the result drifted away from the other two engines. Printing both values around that crossover date showed the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Speed: where vectorbt is in a different league
&lt;/h2&gt;

&lt;p&gt;One backtest takes a fraction of a second in any of the three. The difference shows up when you test many parameter sets.&lt;/p&gt;

&lt;p&gt;I ran the same sweep in each engine: fast averages from 10 to 100 and slow averages from 50 to 250, 80 valid pairs, 0.1% fees.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft2kxfwi6pujw29z5bqg6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft2kxfwi6pujw29z5bqg6.png" alt="80-pair parameter sweep: time and results in each engine" width="800" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Engine&lt;/th&gt;
&lt;th&gt;80 backtests&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;vectorbt, first call&lt;/td&gt;
&lt;td&gt;5.09 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;vectorbt, already warmed up&lt;/td&gt;
&lt;td&gt;0.08 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backtesting.py&lt;/td&gt;
&lt;td&gt;3.23 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backtrader&lt;/td&gt;
&lt;td&gt;19.27 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;vectorbt's first call includes compiling its numba functions, so a one-off sweep isn't faster than Backtesting.py. Once it's warm, it runs all 80 portfolios as one vectorized computation, about 40 times faster than Backtesting.py and about 250 times faster than Backtrader.&lt;/p&gt;

&lt;p&gt;All three found the same best pair, 80/250. Across the 80 pairs, vectorbt and Backtrader returned identical results, and Backtesting.py was never more than 0.545 percentage points away, consistent with how it settles the final open trade.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this breaks, and what I'd actually trust
&lt;/h2&gt;

&lt;p&gt;The engines agree. The strategy is a different story.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb2qrv6eoxasymmu5hqch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb2qrv6eoxasymmu5hqch.png" alt="SMA 50/200 and SMA 10/30 against buy and hold, same data and fees" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Over the same ten years, buying SPY and holding it turned $10,000 into $42,429.98, a 324.30% return. Even buying only on August 16, 2017, the first day a 200-day average exists, returned 260.49%. The 50/200 crossover returned 112.63%. Even the best of the 80 pairs, 80/250, returned 158.40%. None of them came close.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkg4jyab75plvmdo6w7mk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkg4jyab75plvmdo6w7mk.png" alt="SMA 10/30 results and buy and hold" width="799" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The crossovers did one thing better: the 10/30 version cut the maximum drawdown to 17.44%, against 33.72% for buy and hold. Whether that's worth giving up two thirds of the return is a question for your own risk tolerance, not for a backtest.&lt;/p&gt;

&lt;p&gt;Three more caveats:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Picking the best of 80 is overfitting.&lt;/strong&gt; 80/250 won on this decade of SPY. Choosing it because it won, then reporting its return, tells you about the past, not the next ten years. Test the chosen pair on data it hasn't seen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;0.1% commission isn't the whole cost.&lt;/strong&gt; There's no slippage or spread in these runs. With four trades in ten years that barely matters. With a strategy that trades daily, it does.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agreement between engines isn't proof of correctness.&lt;/strong&gt; All three can agree on a backtest that uses the wrong prices. That's why the data step comes first. I went deeper into this in &lt;a href="https://medium.com/python-in-plain-english/backtesting-in-python-why-most-backtests-lie-2026-d0600dd75f72" rel="noopener noreferrer"&gt;Backtesting in Python: Why Most Backtests Lie&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Which one should you use?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Backtrader&lt;/th&gt;
&lt;th&gt;vectorbt&lt;/th&gt;
&lt;th&gt;Backtesting.py&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Style&lt;/td&gt;
&lt;td&gt;Event-driven, broker simulation&lt;/td&gt;
&lt;td&gt;Vectorized arrays&lt;/td&gt;
&lt;td&gt;Event-driven, compact API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lines for this strategy&lt;/td&gt;
&lt;td&gt;23&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80-run sweep&lt;/td&gt;
&lt;td&gt;19.27 s&lt;/td&gt;
&lt;td&gt;0.08 s warm, 5.09 s cold&lt;/td&gt;
&lt;td&gt;3.23 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fills in my default run&lt;/td&gt;
&lt;td&gt;Next open&lt;/td&gt;
&lt;td&gt;Signal-bar close&lt;/td&gt;
&lt;td&gt;Next open&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fractional shares in my default run&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latest PyPI release&lt;/td&gt;
&lt;td&gt;April 19, 2023&lt;/td&gt;
&lt;td&gt;October 19, 2026&lt;/td&gt;
&lt;td&gt;July 22, 2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gotcha to watch&lt;/td&gt;
&lt;td&gt;Commission can reject all-in orders; &lt;code&gt;next_open&lt;/code&gt; indexing&lt;/td&gt;
&lt;td&gt;Shift signals and set the fill price&lt;/td&gt;
&lt;td&gt;With &lt;code&gt;finalize_trades=True&lt;/code&gt;, the final trade closes at the last open&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Backtrader&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A full broker model: order types, commissions, margin checks, multiple data feeds&lt;/li&gt;
&lt;li&gt;The event loop reads like live trading code, so moving to a broker is easier&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The slowest of the three on parameter sweeps&lt;/li&gt;
&lt;li&gt;No release on PyPI since April 2023. It still ran fine on Python 3.12 and pandas 3.1 here&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; strategies with realistic order handling, multiple instruments, or a path to live trading.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;vectorbt&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;80 backtests in 0.08 seconds once compiled&lt;/li&gt;
&lt;li&gt;The shortest code in this test, by one line&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Defaults that differ from the other two (signal-bar fills, fractional shares)&lt;/li&gt;
&lt;li&gt;Path-dependent logic, like a trailing stop that depends on every previous bar, is harder to express than in an event loop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; research, parameter sweeps and comparing many signals quickly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backtesting.py&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A small, readable API and a built-in stats table&lt;/li&gt;
&lt;li&gt;80 backtests in about 3 seconds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One instrument per backtest&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;finalize_trades=True&lt;/code&gt;, it closes the final open trade at the last bar's open and charges the commission, which shifts the reported result slightly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; single-asset strategies where you want clear code and quick results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting the data
&lt;/h2&gt;

&lt;p&gt;The ten years of SPY in this test came from one call to EODHD's end-of-day API, with &lt;code&gt;adjusted_close&lt;/code&gt; doing the adjustment work.&lt;/p&gt;

&lt;p&gt;The free plan covers one year of end-of-day history and 20 API calls a day, so it's enough to try the code on a short range. Ten years of history needs the EOD Historical All-World plan or higher.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://eodhd.com/?via=kmg&amp;amp;ref1=Meneses&amp;amp;utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=backtrader-vs-vectorbt-vs-backtesting-py&amp;amp;utm_content=Meneses" rel="noopener noreferrer"&gt;Get your EODHD API key here&lt;/a&gt;. Use the code &lt;strong&gt;KEVIN10&lt;/strong&gt; at checkout for 10% off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;With the same fill timing and share rounding, Backtrader and vectorbt agree to the cent on the same data, and Backtesting.py differs only by how it settles the final open trade.&lt;/li&gt;
&lt;li&gt;With defaults, the same crossover differs by 5.5%, mostly because vectorbt fills at the signal-bar close.&lt;/li&gt;
&lt;li&gt;None of 80 SMA crossovers beat buy and hold on SPY over the last ten years. The engine you pick matters less than the question you test.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQs
&lt;/h2&gt;

&lt;p&gt;❓ &lt;strong&gt;Is Backtrader still maintained?&lt;/strong&gt;&lt;br&gt;
✅ Its latest release on PyPI is 1.9.78.123, from April 19, 2023, with none since. It still installed and ran correctly on Python 3.12 with pandas 3.1 in this test, and matched vectorbt to the cent once the rules were aligned.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Is vectorbt faster than Backtrader?&lt;/strong&gt;&lt;br&gt;
✅ For parameter sweeps, by a wide margin. In this test, 80 backtests took 0.08 seconds in vectorbt once warmed up, against 19.27 seconds in Backtrader. The first vectorbt call took 5.09 seconds because it compiles its functions.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Why do my backtest results differ between libraries?&lt;/strong&gt;&lt;br&gt;
✅ Usually because of fill timing, share rounding or how the last open trade is handled. In this test, vectorbt's defaults filled at the signal-bar close with fractional shares, while Backtrader and Backtesting.py filled at the next open with whole shares.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Which Python backtesting library is best for beginners?&lt;/strong&gt;&lt;br&gt;
✅ Backtesting.py has the smallest API and a readable stats report, and it ran this strategy in 16 lines. vectorbt is shorter still, but its defaults need care to match realistic fills.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Should I use adjusted prices for backtesting?&lt;/strong&gt;&lt;br&gt;
✅ Yes. Raw prices turn splits into fake crashes and leave dividends out of the return. Apply the adjustment factor to open, high and low as well as close, so orders filled at the open use consistent prices.&lt;/p&gt;




&lt;p&gt;The three engines aren't the hard part. Once the rules are aligned they agree, and every remaining dollar has a reason.&lt;/p&gt;

&lt;p&gt;The hard part is the question you ask them, and whether the answer beats doing nothing.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>backtesting</category>
      <category>algotrading</category>
      <category>finance</category>
    </item>
    <item>
      <title>Web Scraping with Claude Code: A Working Workflow with Gaffa</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Fri, 06 Nov 2026 16:13:12 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/web-scraping-with-claude-code-a-working-workflow-with-gaffa-11po</link>
      <guid>https://dev.to/kevin_menesesgonzlez/web-scraping-with-claude-code-a-working-workflow-with-gaffa-11po</guid>
      <description>&lt;p&gt;Scraping scripts rarely fail on day one.&lt;/p&gt;

&lt;p&gt;They fail quietly on day ten.&lt;/p&gt;

&lt;p&gt;The script runs. No exception. A CSV appears. And somewhere in it, 24 rows are missing. Nobody notices until the data is already in a dashboard.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;collecting product, pricing or catalogue data,&lt;/li&gt;
&lt;li&gt;using Claude Code to write your scrapers,&lt;/li&gt;
&lt;li&gt;or tired of scripts that "work" but return half the data,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This matters.&lt;/p&gt;

&lt;p&gt;I gave Claude Code a plain-language scraping goal and Gaffa's AI skills, then let it go from zero to a working web scraping workflow: discovery, a paginated scraper, CSV export and verification. Then I tried to break it.&lt;/p&gt;

&lt;p&gt;Every number, error and output below comes from real runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The real problem with AI-written scrapers
&lt;/h2&gt;

&lt;p&gt;Writing a scraper is the easy part. Claude can do it in one shot.&lt;/p&gt;

&lt;p&gt;The hard part is everything around it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pagination that stops one page early&lt;/li&gt;
&lt;li&gt;Pages that load slowly some of the time&lt;/li&gt;
&lt;li&gt;Errors that only happen once in a while&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these throw an error. The script finishes, the CSV looks fine, and the data is wrong.&lt;/p&gt;

&lt;p&gt;You don't find these bugs by reading code. You find them by running the scraper against the real site and checking the output against something you trust.&lt;/p&gt;

&lt;h2&gt;
  
  
  A scraper needs proof, not just code
&lt;/h2&gt;

&lt;p&gt;The fix isn't a smarter prompt.&lt;/p&gt;

&lt;p&gt;It's a workflow where the agent can &lt;strong&gt;discover&lt;/strong&gt; the site, &lt;strong&gt;build&lt;/strong&gt; against the real pages, and &lt;strong&gt;debug&lt;/strong&gt; failures from real request data. With checks that tell you when the output is wrong.&lt;/p&gt;

&lt;p&gt;Gaffa's AI skills cover exactly those three steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/gaffa-find&lt;/code&gt;&lt;/strong&gt;: give it a URL and a goal, and it explores the site with a credit budget until it finds the answer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;gaffa-authoring&lt;/code&gt;&lt;/strong&gt;: loads automatically whenever you ask for scraping code, and makes Claude capture the real page before writing a selector&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/gaffa-debug&lt;/code&gt;&lt;/strong&gt;: pass it a failing request id (&lt;code&gt;brq_...&lt;/code&gt;) and it diagnoses what went wrong&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Under the hood, &lt;a href="https://gaffa.dev" rel="noopener noreferrer"&gt;Gaffa&lt;/a&gt; is a browser automation REST API: you send a URL and a list of actions (&lt;code&gt;click&lt;/code&gt;, &lt;code&gt;wait&lt;/code&gt;, &lt;code&gt;capture_element&lt;/code&gt;, &lt;code&gt;loop&lt;/code&gt;...) and it runs them in a real browser.&lt;/p&gt;

&lt;p&gt;👉 You can create an account at &lt;a href="https://gaffa.dev" rel="noopener noreferrer"&gt;gaffa.dev&lt;/a&gt; and follow along.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup in one command
&lt;/h2&gt;

&lt;p&gt;If you read my previous article on &lt;a href="https://kevinmeneses.com/en/articles/connect-claude-code-gaffa-browser-automation" rel="noopener noreferrer"&gt;connecting Claude Code to Gaffa&lt;/a&gt;, you already have this. If not, it's one command in your project folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @gaffa-dev/cli &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;claude-code &lt;span class="nt"&gt;--scope&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;project &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Installed the gaffa skills (version 0.9.0) into 1 place:
  ./.claude\skills  (project)  gaffa-authoring, gaffa-debug, gaffa-find, gaffa-support

Registered the gaffa-docs MCP server:
  Claude Code  ./.mcp.json  added
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then set &lt;code&gt;GAFFA_API_KEY&lt;/code&gt; as an environment variable. The skills never read the key from anywhere else.&lt;/p&gt;

&lt;p&gt;The target for this test is &lt;a href="https://books.toscrape.com" rel="noopener noreferrer"&gt;books.toscrape.com&lt;/a&gt;, a sandbox catalogue built for scraping practice: 1,000 books, 50 categories, classic "next" pagination.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 1: Discover the site with /gaffa-find
&lt;/h2&gt;

&lt;p&gt;I didn't give Claude a URL for the category, a selector or a page count. Just the homepage and a goal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/gaffa-find https://books.toscrape.com/ — Goal: I want to collect every book
in the 'Mystery' category. Find the category page URL, how many books it
contains, how many listing pages it spans and how pagination works, and which
fields each book card exposes (title, price, rating, availability, link).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fymat2p5nof6ffhzcjby9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fymat2p5nof6ffhzcjby9.png" alt="Claude Code running /gaffa-find: the skill captures the homepage as Markdown and finds the Mystery category link" width="799" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Rendered from the real session transcript.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The skill runs a loop: recon, hypothesis, targeted extraction, validation. With hard caps: 15 requests and 50 credits per run, 5 iterations maximum.&lt;/p&gt;

&lt;p&gt;For recon, it sent a browser request that turns the homepage into Markdown. 3 credits, 5.8 seconds, and the answer was in the sidebar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- [Mystery](catalogue/category/books/mystery_3/index.html)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From there it captured the category page twice: once as Markdown (to read "32 results" and "Page 1 of 2") and once as raw HTML (to see the markup the Markdown strips out, like the star rating). Then it checked page 2 to confirm where pagination ends.&lt;/p&gt;

&lt;p&gt;It also wrote a reasoning log to disk, &lt;code&gt;.gaffa-find-&amp;lt;timestamp&amp;gt;.log&lt;/code&gt;, one entry per iteration: hypothesis, request id, credits, decision. You can audit exactly how it reached its answer.&lt;/p&gt;

&lt;p&gt;The final result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ficmylqqkwlleiyso57ig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ficmylqqkwlleiyso57ig.png" alt="The /gaffa-find success summary: 32 books, 2 pages, pagination mechanism and the selector for each field" width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Rendered from the real session transcript.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Terminal state: success.&lt;/strong&gt; 32 books, 2 pages, pagination through a relative &lt;code&gt;li.next a&lt;/code&gt; link that disappears on the last page, and a selector for each field. One detail I wouldn't have caught: the visible title text is truncated with "…", so the full title has to come from the link's &lt;code&gt;title&lt;/code&gt; attribute.&lt;/p&gt;

&lt;p&gt;Cost of discovery: &lt;strong&gt;9 credits.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 2: Turn the findings into a workflow
&lt;/h2&gt;

&lt;p&gt;Same Claude session, so it kept everything it had learned. This time I asked for a real workflow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rewrite it as books_to_csv.py: one single Gaffa browser request that
paginates with the loop action. Price as a number, rating as an integer
1-5, absolute product URL. Write a CSV. Add --category-url. Run it on
Mystery, verify 32 rows with no duplicates, then run it on a category
with 3+ pages and verify the count matches the 'N results' text.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude pulled the &lt;code&gt;loop&lt;/code&gt; reference through the Gaffa docs MCP server (approved this time), then built the request.&lt;/p&gt;

&lt;h3&gt;
  
  
  One request, every page
&lt;/h3&gt;

&lt;p&gt;This is the heart of the workflow. Instead of one request per page, a single request captures the results banner once and then loops: capture the product grid, click "next", repeat until there is no "next" link.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;actions&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;capture_element&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;selector&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;form.form-horizontal&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;custom_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;results-banner&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;loop&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;custom_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pagination-loop&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;max_iterations&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;max_pages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;timeout&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;loop_timeout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;stop_on_fail&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;continue_on_fail&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# the last page has no "next": that's how the loop ends
&lt;/span&gt;        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;actions&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;wait&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;time&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;custom_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;settle&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;capture_element&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;selector&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ol.row&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;custom_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;page-cards&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;click&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;selector&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;li.next a&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;custom_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;next-page&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;timeout&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15000&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Parsing happens in plain Python with regular expressions over the captured HTML. No LLM extraction. The skill steers Claude away from Gaffa's &lt;code&gt;parse_json&lt;/code&gt; action for structured pages like this one, because a deterministic parser is cheaper and returns the same output every run.&lt;/p&gt;

&lt;h3&gt;
  
  
  The check that caught a bug
&lt;/h3&gt;

&lt;p&gt;The most valuable line in the script is not the scraper. It's this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OK&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;reported_total&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MISMATCH&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;page says &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;reported_total&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; results; scraped &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; -&amp;gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MISMATCH&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The workflow compares its own output with the number the website reports. If they differ, it fails loudly.&lt;/p&gt;

&lt;p&gt;Here is how phase 2 went:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Attempt 1: Mystery.&lt;/strong&gt; 32 of 32 books, 32 unique URLs, banner matched. 3 credits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Attempt 2: Nonfiction (110 books, 6 pages).&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;request: brq_VzZhqRu7EsTn47GhMyLqkSN76iJDA6
pages captured: 6
books written: 86 -&amp;gt; nonfiction.csv
page says 110 results; scraped 86 -&amp;gt; MISMATCH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All 6 pages were captured, but 24 books were missing. Claude broke it down page by page:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;page 1: articles=20
page 2: articles=20
page 3: articles=20
page 4: articles=12
page 5: articles=14
page 6: articles=2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pages 4 to 6 were captured while the browser was still loading them, right after the click. Claude added a short &lt;code&gt;wait&lt;/code&gt; at the start of each iteration and re-ran: &lt;strong&gt;110 of 110&lt;/strong&gt;. Then re-ran Mystery to make sure nothing regressed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyww6w9g3rf6hidbhoe7t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyww6w9g3rf6hidbhoe7t.png" alt="Terminal output: the Nonfiction run returns 86 of 110 books and the script flags a MISMATCH" width="799" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Rendered from the real session transcript.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Without that count check, the script would have exited 0 and handed me a CSV missing 22% of the data.&lt;/p&gt;

&lt;p&gt;Cost of phase 2: &lt;strong&gt;6 billed requests, 18 credits.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Then I tried to break it
&lt;/h2&gt;

&lt;p&gt;Claude said it was done. I didn't take its word for it. I ran the script myself on categories it had never seen.&lt;/p&gt;

&lt;p&gt;Travel (11 books) and Fiction (65 books, 4 pages) both matched their counts. Then I ran Nonfiction again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pages captured: 2
books written: 40 -&amp;gt; nonfiction.csv
page says 110 results; scraped 40 -&amp;gt; MISMATCH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The loop stopped after page 2. The count check caught it again.&lt;/p&gt;

&lt;p&gt;Failed and partial requests are part of scraping any live website. Pages get slow, layouts change, content loads late. What matters is how quickly you find out why. That's the job of the third skill.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 3: Diagnose with /gaffa-debug
&lt;/h2&gt;

&lt;p&gt;I passed the request id to Claude:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/gaffa-debug brq_VzZj6m1Mqsb31bZEevh2ZHdUNVFxyh — it only got 40 of 110
books (MISMATCH). Diagnose why the loop stopped early, apply a minimal fix
that does not rely on luck, then verify on Nonfiction twice and Mystery once.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3nxivp5mbgaqfgjc68g4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3nxivp5mbgaqfgjc68g4.png" alt="Claude Code running /gaffa-debug: diagnosis of the loop that stopped early, the patch and the verification table" width="800" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Rendered from the real session transcript.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The diagnosis was precise:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The request data showed the loop ran &lt;strong&gt;2 iterations&lt;/strong&gt;, and the second "next" click failed with &lt;code&gt;action_timed_out&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Was page 2 really the last page? Claude fetched &lt;code&gt;page-2.html&lt;/code&gt; directly (free, no Gaffa call). It has a "next" link to page 3. &lt;strong&gt;So the loop stopped early by mistake.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Why? On that run the target page took &lt;strong&gt;27.9 seconds&lt;/strong&gt; to load, against about 2 seconds on every other run. Live sites have slow moments, and the click only waited 5 seconds before giving up.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The patch was one value: raise the click's &lt;code&gt;timeout&lt;/code&gt; from 5,000 to 15,000 ms, the same value Gaffa's own pagination examples use. A real last page still ends the loop, just 15 seconds later.&lt;/p&gt;

&lt;p&gt;Verification: Nonfiction 110 of 110 twice in a row with identical rows, Mystery 32 of 32. &lt;strong&gt;13 credits.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The final result
&lt;/h2&gt;

&lt;p&gt;I ran the final script one last time on my own:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd19nmd4hb7zk915l6dgj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd19nmd4hb7zk915l6dgj.png" alt="Final verification runs: Nonfiction 110 of 110 and Fiction 65 of 65, both OK" width="799" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Pages&lt;/th&gt;
&lt;th&gt;Books scraped&lt;/th&gt;
&lt;th&gt;Page says&lt;/th&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;th&gt;Credits&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Mystery&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;OK&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Travel&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;OK&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fiction&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;65&lt;/td&gt;
&lt;td&gt;65&lt;/td&gt;
&lt;td&gt;OK&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nonfiction&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;110&lt;/td&gt;
&lt;td&gt;110&lt;/td&gt;
&lt;td&gt;OK&lt;/td&gt;
&lt;td&gt;3 to 5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;218 books, 4 categories, 0 duplicates.&lt;/strong&gt; Nonfiction, 6 pages in a single request, takes about 42 seconds end to end.&lt;/p&gt;

&lt;p&gt;The CSV is clean, typed data ready for pandas or a spreadsheet:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyxeaogha0mlf839bkwcx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyxeaogha0mlf839bkwcx.png" alt="The Nonfiction CSV with title, price, rating, availability and absolute URL columns" width="799" height="326"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;title,price,rating,availability,url
Worlds Elsewhere: Journeys Around Shakespeare’s Globe,40.3,5,In stock,https://books.toscrape.com/catalogue/worlds-elsewhere-journeys-around-shakespeares-globe_972/index.html
The Five Love Languages: How to Express Heartfelt Commitment to Your Mate,31.05,3,In stock,https://books.toscrape.com/catalogue/the-five-love-languages-how-to-express-heartfelt-commitment-to-your-mate_969/index.html
Reasons to Stay Alive,26.41,2,In stock,https://books.toscrape.com/catalogue/reasons-to-stay-alive_959/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What the whole thing cost
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Phase&lt;/th&gt;
&lt;th&gt;Gaffa credits&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/gaffa-find&lt;/code&gt; discovery&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Building the workflow&lt;/td&gt;
&lt;td&gt;18&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/gaffa-debug&lt;/code&gt; fix and verification&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Claude Code total&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;40&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;My own test runs&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Claude Code ran on my Claude Pro subscription.&lt;/p&gt;

&lt;p&gt;From here you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;schedule it with cron or Windows Task Scheduler, since it exits 1 on a mismatch&lt;/li&gt;
&lt;li&gt;loop over all 50 category URLs to build the full 1,000-book catalogue&lt;/li&gt;
&lt;li&gt;point the same pattern at any paginated listing: job boards, product grids, directories&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I'd do differently next time
&lt;/h2&gt;

&lt;p&gt;Three lessons from this run, all of which apply outside Gaffa:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Put the verification in the script, not in your head.&lt;/strong&gt; The "N results" check caught two silent failures that would otherwise have shipped. If the site tells you how many items it has, use it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Debug from request data, not from guesses.&lt;/strong&gt; &lt;code&gt;/gaffa-debug&lt;/code&gt; didn't guess. It read how many iterations ran, which action failed and how long the page took to load, then checked the live page before changing a single value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fixed waits are guesses.&lt;/strong&gt; The 800 ms &lt;code&gt;wait&lt;/code&gt; happened to work, and the 5 s click timeout didn't when the site was slow. When you can, wait on a selector or give timeouts real margin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/gaffa-find&lt;/code&gt; turned "collect every Mystery book" into URLs, selectors and pagination rules in 9 credits.&lt;/li&gt;
&lt;li&gt;One Gaffa request with &lt;code&gt;loop&lt;/code&gt; scraped a 6-page category in about 42 seconds, and a built-in count check caught two silent data losses.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/gaffa-debug&lt;/code&gt; traced a stopped loop to a 27.9-second page load and fixed it with a single timeout change.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;Claude Code writes scrapers fast. That was never the bottleneck.&lt;/p&gt;

&lt;p&gt;The bottleneck was knowing whether the data is right.&lt;/p&gt;

&lt;p&gt;Give the agent a real browser, skills that force it to look before it writes, and a workflow that checks its own output, and web scraping with Claude Code becomes something you can actually trust.&lt;/p&gt;

&lt;p&gt;👉 Try it: create an account at &lt;a href="https://gaffa.dev" rel="noopener noreferrer"&gt;gaffa.dev&lt;/a&gt;, run &lt;code&gt;npx @gaffa-dev/cli install&lt;/code&gt;, and start with &lt;code&gt;/gaffa-find&lt;/code&gt; on a site you need data from.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>webscraping</category>
      <category>python</category>
      <category>ai</category>
    </item>
    <item>
      <title>7 Best SERP APIs in 2026: Price per 1,000 Searches Compared</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Fri, 06 Nov 2026 08:05:28 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/7-best-serp-apis-in-2026-price-per-1000-searches-compared-441a</link>
      <guid>https://dev.to/kevin_menesesgonzlez/7-best-serp-apis-in-2026-price-per-1000-searches-compared-441a</guid>
      <description>&lt;p&gt;Google just closed its own search API.&lt;/p&gt;

&lt;p&gt;The Custom Search JSON API is "closed to new customers," and existing users have until &lt;strong&gt;January 1, 2027&lt;/strong&gt; to move to something else. If your rank tracker, AI agent or lead-gen script still calls it, the clock is running.&lt;/p&gt;

&lt;p&gt;The replacement is a &lt;strong&gt;SERP API&lt;/strong&gt;: a service that runs the Google search for you, deals with proxies and CAPTCHAs, and returns the results page as clean JSON.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;migrating off Google's Custom Search JSON API,&lt;/li&gt;
&lt;li&gt;giving an AI agent live Google results,&lt;/li&gt;
&lt;li&gt;or tracking rankings for thousands of keywords,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this comparison is for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt; pick &lt;strong&gt;Serper&lt;/strong&gt; for the cheapest real-time Google results ($0.30–$1.00 per 1,000). Pick &lt;strong&gt;SerpApi&lt;/strong&gt; if you need the widest set of engines and a legal shield. Pick &lt;strong&gt;DataForSEO&lt;/strong&gt; for bulk SEO data that can wait a few minutes ($0.60 per 1,000). Pick &lt;strong&gt;SearchApi&lt;/strong&gt; if your agent needs Google's AI Overview and AI Mode answers as structured data.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How this comparison was made:&lt;/strong&gt; prices come from each vendor's official pricing page, checked on &lt;strong&gt;November 4, 2026&lt;/strong&gt;. I didn't run a new benchmark for this edition. For SerpApi and DataForSEO, I link to the in-depth reviews where I tested each one on the same 10 queries. Anything a vendor doesn't publish is marked "not stated."&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What a SERP API actually does
&lt;/h2&gt;

&lt;p&gt;You send a query (&lt;code&gt;"best crm for startups"&lt;/code&gt;, country &lt;code&gt;us&lt;/code&gt;, language &lt;code&gt;en&lt;/code&gt;). The SERP API sends it to Google from a rotating pool of residential IPs, solves whatever blocks it hits, parses the results page, and returns JSON:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Organic results:&lt;/strong&gt; position, title, link, snippet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SERP features:&lt;/strong&gt; People Also Ask, knowledge graph, local pack, shopping, news.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI answers:&lt;/strong&gt; on some providers, Google's AI Overview and AI Mode text.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Doing this yourself means maintaining proxies, headless browsers and parsers that break every time Google changes its HTML. (If you want to try anyway, my guide to the &lt;a href="https://kevinmeneses.com/en/articles/best-proxies-for-web-scraping" rel="noopener noreferrer"&gt;best proxies for web scraping&lt;/a&gt; covers that side.)&lt;/p&gt;

&lt;p&gt;Every vendor here sells the same promise.&lt;/p&gt;

&lt;p&gt;The price per 1,000 searches is where they split.&lt;/p&gt;




&lt;h2&gt;
  
  
  SERP APIs compared
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;SERP API&lt;/th&gt;
&lt;th&gt;Best for&lt;/th&gt;
&lt;th&gt;Free tier&lt;/th&gt;
&lt;th&gt;Entry price&lt;/th&gt;
&lt;th&gt;$/1k at entry&lt;/th&gt;
&lt;th&gt;$/1k at top volume&lt;/th&gt;
&lt;th&gt;Failed requests billed?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://serper.dev/" rel="noopener noreferrer"&gt;Serper&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Cheapest real-time Google&lt;/td&gt;
&lt;td&gt;2,500 queries, no card&lt;/td&gt;
&lt;td&gt;$50 pack (50k)&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$0.30&lt;/td&gt;
&lt;td&gt;Credits deducted on successful responses&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://serpapi.com/" rel="noopener noreferrer"&gt;SerpApi&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Most engines, legal shield&lt;/td&gt;
&lt;td&gt;250 searches/month&lt;/td&gt;
&lt;td&gt;$25/month (1k)&lt;/td&gt;
&lt;td&gt;$25.00&lt;/td&gt;
&lt;td&gt;$1.96&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dataforseo.com/" rel="noopener noreferrer"&gt;DataForSEO&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Bulk SEO data&lt;/td&gt;
&lt;td&gt;Not stated on pricing page&lt;/td&gt;
&lt;td&gt;Pay as you go&lt;/td&gt;
&lt;td&gt;$0.60 (Standard) / $2.00 (Live)&lt;/td&gt;
&lt;td&gt;$0.60&lt;/td&gt;
&lt;td&gt;Failed tasks were billed in my test&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.scrapingdog.com/" rel="noopener noreferrer"&gt;Scrapingdog&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Low cost at scale&lt;/td&gt;
&lt;td&gt;100 credits, no card&lt;/td&gt;
&lt;td&gt;$40/month (40k searches)&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$0.14&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.searchapi.io/" rel="noopener noreferrer"&gt;SearchApi&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;AI Overview + AI Mode&lt;/td&gt;
&lt;td&gt;100 requests&lt;/td&gt;
&lt;td&gt;$40/month (10k)&lt;/td&gt;
&lt;td&gt;$4.00&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://brightdata.com/products/serp-api" rel="noopener noreferrer"&gt;Bright Data&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Enterprise, pay as you go&lt;/td&gt;
&lt;td&gt;5,000 requests/month, no card&lt;/td&gt;
&lt;td&gt;$1.50/1k, no monthly fee&lt;/td&gt;
&lt;td&gt;$1.50&lt;/td&gt;
&lt;td&gt;~$1.31&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://cloro.dev/" rel="noopener noreferrer"&gt;cloro&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Google + ChatGPT/Perplexity answers&lt;/td&gt;
&lt;td&gt;500 credits/month&lt;/td&gt;
&lt;td&gt;$30/month (~12.5k searches)&lt;/td&gt;
&lt;td&gt;$2.40&lt;/td&gt;
&lt;td&gt;~$0.92&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Pricing checked on 2026-11-04. Scrapingdog counts one Google search as 5 credits (Light API); cloro counts 3 credits per Google search. The per-1,000 figures above already include that.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What 100,000 searches a month really costs
&lt;/h2&gt;

&lt;p&gt;Per-1,000 prices hide plan minimums, credit multipliers and expiry dates. So here's one workload priced on all seven: &lt;strong&gt;100,000 Google searches a month&lt;/strong&gt;, using the cheapest published plan that covers it.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;SERP API&lt;/th&gt;
&lt;th&gt;Monthly cost&lt;/th&gt;
&lt;th&gt;How&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;DataForSEO (Standard queue)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$60&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$0.0006 per SERP; results in minutes, not seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Serper&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$75&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$375 pack for 500k credits, valid 6 months&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scrapingdog&lt;/td&gt;
&lt;td&gt;$90&lt;/td&gt;
&lt;td&gt;Standard plan, 1M credits (200k Light searches)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bright Data&lt;/td&gt;
&lt;td&gt;$150&lt;/td&gt;
&lt;td&gt;Pay as you go at $1.50/1k&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DataForSEO (Live)&lt;/td&gt;
&lt;td&gt;$200&lt;/td&gt;
&lt;td&gt;$0.002 per SERP, real time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SearchApi&lt;/td&gt;
&lt;td&gt;$250&lt;/td&gt;
&lt;td&gt;BigData plan, 100k searches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cloro&lt;/td&gt;
&lt;td&gt;$250&lt;/td&gt;
&lt;td&gt;Starter plan, 650k credits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SerpApi&lt;/td&gt;
&lt;td&gt;$725&lt;/td&gt;
&lt;td&gt;Searcher plan, 100k searches&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The spread is almost 12x for the same 100,000 searches.&lt;/p&gt;

&lt;p&gt;That's the number to check before you sign up for anything.&lt;/p&gt;




&lt;h2&gt;
  
  
  The 7 best SERP APIs in 2026
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Serper
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://serper.dev/" rel="noopener noreferrer"&gt;Serper&lt;/a&gt; does one thing: Google results, fast and cheap. It sells prepaid credit packs instead of subscriptions, from $1.00 per 1,000 queries down to $0.30 at the largest pack, and says it returns results "in 1-2 seconds."&lt;/p&gt;

&lt;p&gt;It covers Google Search, Images, News, Maps, Places, Videos, Shopping, Scholar, Patents and Autocomplete.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://google.serper.dev/search&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;X-API-KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_SERPER_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Content-Type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;application/json&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;q&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;best serp api&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gl&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;us&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hl&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;en&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;organic&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][:&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;position&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;title&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;link&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From here you can build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a rank tracker that runs every morning,&lt;/li&gt;
&lt;li&gt;a search tool for an AI agent,&lt;/li&gt;
&lt;li&gt;a lead list from Google Maps results.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2,500 free queries with no credit card&lt;/li&gt;
&lt;li&gt;No subscription: packs from $50, credits valid for 6 months&lt;/li&gt;
&lt;li&gt;50 to 300 queries per second depending on the pack&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Google only: no Bing, Baidu or other engines&lt;/li&gt;
&lt;li&gt;Credits expire after 6 months, so big packs only pay off if you use them&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; developers and AI agents that need real-time Google results at the lowest price.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. SerpApi
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://serpapi.com/" rel="noopener noreferrer"&gt;SerpApi&lt;/a&gt; is the most established SERP API, and the one most "alternatives" articles measure against. It parses Google into detailed JSON and covers many other engines, including Bing, Yahoo, DuckDuckGo and Baidu.&lt;/p&gt;

&lt;p&gt;In my &lt;a href="https://gologin.com/blog/serpapi-review/" rel="noopener noreferrer"&gt;full SerpApi review&lt;/a&gt;, the Google API returned fresh results in 1.07s at the median across 10 queries, and SerpApi runs an official hosted MCP server for AI agents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Widest engine coverage and the most detailed parsing&lt;/li&gt;
&lt;li&gt;U.S. Legal Shield on every plan; failed and cached searches aren't counted&lt;/li&gt;
&lt;li&gt;Official MCP server at mcp.serpapi.com&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The most expensive here: $25 per 1,000 on Starter, $725/month for 100k searches&lt;/li&gt;
&lt;li&gt;Free plan is 250 searches a month with 50 per hour of throughput&lt;/li&gt;
&lt;li&gt;Subscription only, with no per-search overage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; teams that need many engines, rich parsing and legal cover, and can pay for it.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. DataForSEO
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dataforseo.com/" rel="noopener noreferrer"&gt;DataForSEO&lt;/a&gt; is the wholesale option. You pay per SERP with no subscription, and the price depends on how long you can wait: $0.60 per 1,000 in the Standard queue, $1.20 in Priority and $2.00 in Live mode.&lt;/p&gt;

&lt;p&gt;It covers Google (including AI Mode, Maps, News and Ads), Bing, YouTube, Yahoo, Baidu, Naver and Seznam. In my &lt;a href="https://gologin.com/blog/dataforseo-review/" rel="noopener noreferrer"&gt;full DataForSEO review&lt;/a&gt;, Live mode answered in 4.9s at the median, and the JSON was the most compact of any API I tested.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$0.60 per 1,000 SERPs in the Standard queue, the lowest list price here&lt;/li&gt;
&lt;li&gt;Huge engine and SEO-data coverage, plus an MCP server&lt;/li&gt;
&lt;li&gt;Prepaid balance with no monthly plan&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Live mode costs $2.00 per 1,000 and was slower than Serper or SerpApi in my test&lt;/li&gt;
&lt;li&gt;Failed tasks were billed in my test (6 of 22 Live calls)&lt;/li&gt;
&lt;li&gt;Per my review, a $50 minimum top-up after the $1 trial credit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; SEO tools and rank trackers that process keywords in bulk and don't need answers in real time.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Scrapingdog
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.scrapingdog.com/" rel="noopener noreferrer"&gt;Scrapingdog&lt;/a&gt; is a web scraping API with dedicated Google endpoints. Its plans sell credits that work across all its APIs: a Google search costs 5 credits on the Light API and 10 on the Advance API or AI Mode.&lt;/p&gt;

&lt;p&gt;That makes it cheap at volume: $1.00 per 1,000 searches on the $40 Lite plan, falling to about $0.14 on the largest plans.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;About $0.14 per 1,000 searches at top volume, the lowest per-search price here&lt;/li&gt;
&lt;li&gt;Failed requests are never charged&lt;/li&gt;
&lt;li&gt;The same credits cover its other scraping APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Credit multipliers make the real price harder to read&lt;/li&gt;
&lt;li&gt;Free tier is 100 credits, only 20 Google searches&lt;/li&gt;
&lt;li&gt;Monthly subscription, no pay as you go&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; teams already scraping other sites that want Google results on the same bill.&lt;/p&gt;




&lt;h3&gt;
  
  
  5. SearchApi
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.searchapi.io/" rel="noopener noreferrer"&gt;SearchApi&lt;/a&gt; is built for the AI era. Besides Google Search, Maps, News and Shopping, it has dedicated &lt;strong&gt;Google AI Overview&lt;/strong&gt; and &lt;strong&gt;Google AI Mode&lt;/strong&gt; APIs, plus Bing, Yahoo, DuckDuckGo, Baidu, Yandex and YouTube.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI Overview and AI Mode as structured endpoints&lt;/li&gt;
&lt;li&gt;Pay per success: only HTTP 200 responses are billed&lt;/li&gt;
&lt;li&gt;Legal Protection Guarantee with up to $2M in coverage on paid plans above Developer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$4 per 1,000 on the entry plan&lt;/li&gt;
&lt;li&gt;Monthly subscription; the free tier is 100 requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; AI agents and GEO tools that need to read what Google's AI answers say.&lt;/p&gt;




&lt;h3&gt;
  
  
  6. Bright Data
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://brightdata.com/products/serp-api" rel="noopener noreferrer"&gt;Bright Data&lt;/a&gt; runs one of the largest proxy networks, and its SERP API sits on top of it. It's the only option here with a recurring free tier of &lt;strong&gt;5,000 requests a month&lt;/strong&gt; and true pay as you go at $1.50 per 1,000, with no monthly fee.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;5,000 free requests every month, no credit card&lt;/li&gt;
&lt;li&gt;Pay as you go with spend limits and unlimited concurrency&lt;/li&gt;
&lt;li&gt;"Only pay for successful requests"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Volume discounts start at the $499/month Scale plan&lt;/li&gt;
&lt;li&gt;Built for enterprises: more setup than Serper or SerpApi for a quick test&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; companies that want to start free and scale on one enterprise-grade vendor.&lt;/p&gt;




&lt;h3&gt;
  
  
  7. cloro
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://cloro.dev/" rel="noopener noreferrer"&gt;cloro&lt;/a&gt; covers Google Search, News, AI Mode and AI Overview, and also returns answers from &lt;strong&gt;ChatGPT, Perplexity, Gemini and Copilot&lt;/strong&gt;. That makes it a SERP API and an AI-visibility tool in one.&lt;/p&gt;

&lt;p&gt;Pricing is credit-based: a Google search costs 3 credits ($2.40 per 1,000 searches on the Lite plan, about $0.92 at the top tier).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Google results and AI chatbot answers from one API&lt;/li&gt;
&lt;li&gt;500 free credits every month&lt;/li&gt;
&lt;li&gt;Failed extractions don't consume credits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Subscription only: no pay as you go, and unused credits expire each month&lt;/li&gt;
&lt;li&gt;Synchronous requests cost 2 extra credits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; SEO and GEO teams tracking brand visibility in Google and in AI chatbots.&lt;/p&gt;




&lt;h3&gt;
  
  
  Also worth a look
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://apiserpent.com/" rel="noopener noreferrer"&gt;Serpent API&lt;/a&gt;:&lt;/strong&gt; low-cost Google SERP API with a free start and no subscription.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://oxylabs.io/" rel="noopener noreferrer"&gt;Oxylabs&lt;/a&gt;:&lt;/strong&gt; enterprise SERP scraper from a large proxy provider.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.scrapingbee.com/" rel="noopener noreferrer"&gt;ScrapingBee&lt;/a&gt;:&lt;/strong&gt; web scraping API with a Google search endpoint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://brave.com/search/api/" rel="noopener noreferrer"&gt;Brave Search API&lt;/a&gt;:&lt;/strong&gt; results from Brave's own independent index, not Google. Useful when you don't need Google specifically.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Replacing Google's Custom Search JSON API
&lt;/h2&gt;

&lt;p&gt;Google's own API isn't a long-term option anymore. Its documentation says the Custom Search JSON API is closed to new customers and that existing customers have until January 1, 2027 to move. Until then it gives 100 free queries a day and charges $5 per 1,000, capped at 10,000 queries a day.&lt;/p&gt;

&lt;p&gt;Google points to &lt;strong&gt;Vertex AI Search&lt;/strong&gt;, which searches up to 50 domains you choose. That's fine for a site search box, not for searching the whole web.&lt;/p&gt;

&lt;p&gt;For full-web Google results:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lowest price, real time:&lt;/strong&gt; Serper ($1.00 down to $0.30 per 1,000).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Closest drop-in for a small project:&lt;/strong&gt; Bright Data's 5,000 free requests a month.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Same JSON shape across many engines:&lt;/strong&gt; SerpApi or SearchApi.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How to choose a SERP API
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Real time or batch?&lt;/strong&gt; If results can wait minutes, DataForSEO's Standard queue is the cheapest. If an agent or user is waiting, look at Serper, SerpApi or SearchApi.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google only or many engines?&lt;/strong&gt; Serper is Google only. SerpApi, SearchApi, DataForSEO and Bright Data cover more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do you need AI answers?&lt;/strong&gt; SearchApi and cloro return Google's AI Overview and AI Mode; cloro adds ChatGPT, Perplexity, Gemini and Copilot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subscription or credits?&lt;/strong&gt; Serper, DataForSEO and Bright Data let you pay as you go. SerpApi, SearchApi, Scrapingdog and cloro are monthly plans.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Are failures billed?&lt;/strong&gt; Most vendors here don't charge for failed requests. In my test, DataForSEO did.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;❓ &lt;strong&gt;What is a SERP API?&lt;/strong&gt;&lt;br&gt;
✅ A SERP API runs a search on Google (or another engine) on your behalf and returns the results page as structured JSON: organic results, ads, People Also Ask, local results and, on some providers, AI Overview text. It handles the proxies, CAPTCHAs and HTML parsing for you.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;What is the cheapest SERP API?&lt;/strong&gt;&lt;br&gt;
✅ For real-time Google results, Serper is the cheapest of the big names at $0.30 to $1.00 per 1,000 queries. DataForSEO's Standard queue is $0.60 per 1,000 if you can wait a few minutes, and Scrapingdog drops to about $0.14 per 1,000 searches on its largest plans.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;How much does SerpApi cost?&lt;/strong&gt;&lt;br&gt;
✅ SerpApi starts at $25 a month for 1,000 searches, $725 a month for 100,000 and $1.96 per 1,000 on its largest Cloud plan. The free plan includes 250 searches a month.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;What is the best SerpApi alternative?&lt;/strong&gt;&lt;br&gt;
✅ Serper if you want the same Google results for less (25x cheaper per search at entry level: $1.00 vs $25 per 1,000). SearchApi if you need many engines plus AI Overview. DataForSEO if you process keywords in bulk.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Is there a free SERP API?&lt;/strong&gt;&lt;br&gt;
✅ Every vendor here has a free tier. The most generous are Bright Data (5,000 requests a month, recurring), Serper (2,500 queries once, no card) and SerpApi (250 searches a month).&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Is Google's Custom Search JSON API being discontinued?&lt;/strong&gt;&lt;br&gt;
✅ Yes. Google's documentation says it is closed to new customers, and existing customers have until January 1, 2027 to move to an alternative.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;Every SERP API on this list returns the same Google results page.&lt;/p&gt;

&lt;p&gt;What you're really choosing is a billing model: pay as you go or subscription, real time or queue, and whether failures count. Price your real monthly volume first, then pick.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Are you a vendor in this space?&lt;/strong&gt; This list is updated every quarter with new pricing and new providers. If your SERP API should be here, or something above is out of date, &lt;a href="https://kevinmeneses.com/en#contact" rel="noopener noreferrer"&gt;get in touch&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>api</category>
      <category>webscraping</category>
      <category>seo</category>
      <category>python</category>
    </item>
    <item>
      <title>7 Best Code Sandboxes for AI Agents in 2026 (E2B Alternatives Compared)</title>
      <dc:creator>Kevin Meneses González</dc:creator>
      <pubDate>Thu, 05 Nov 2026 08:05:01 +0000</pubDate>
      <link>https://dev.to/kevin_menesesgonzlez/7-best-code-sandboxes-for-ai-agents-in-2026-e2b-alternatives-compared-9k0</link>
      <guid>https://dev.to/kevin_menesesgonzlez/7-best-code-sandboxes-for-ai-agents-in-2026-e2b-alternatives-compared-9k0</guid>
      <description>&lt;p&gt;Your AI agent just wrote 40 lines of Python. Someone has to run them.&lt;/p&gt;

&lt;p&gt;It shouldn't be your production server.&lt;/p&gt;

&lt;p&gt;The moment an agent can write and execute code, you need somewhere to run it that can't touch your secrets, your database or your other customers' data. That place is an &lt;strong&gt;AI agent sandbox&lt;/strong&gt;: an isolated machine you spin up through an API, use for seconds or hours, and throw away.&lt;/p&gt;

&lt;p&gt;If you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;building a coding agent or a "code interpreter" feature,&lt;/li&gt;
&lt;li&gt;giving an LLM a computer to analyze files and data,&lt;/li&gt;
&lt;li&gt;or looking for E2B alternatives because of pricing or session limits,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this comparison is for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt; pick &lt;strong&gt;E2B&lt;/strong&gt; if you want the safest default for code-interpreter agents. Pick &lt;strong&gt;Daytona&lt;/strong&gt; for long-lived, stateful agent workspaces. Pick &lt;strong&gt;Blaxel&lt;/strong&gt; for bursty agents that sit idle most of the time. Already on Vercel or Cloudflare? Use the sandbox your platform already ships. Need it in your own cloud? &lt;strong&gt;Northflank&lt;/strong&gt;, with the caveat explained in its section.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How this comparison was made:&lt;/strong&gt; this edition is based on each vendor's official docs and pricing pages, checked on &lt;strong&gt;November 2, 2026&lt;/strong&gt;. I didn't run hands-on tests for this edition, so there are no cold-start or latency numbers here, only what each vendor documents publicly. Anything I couldn't confirm in the docs is marked as "not stated" instead of guessed.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What an AI sandbox actually does
&lt;/h2&gt;

&lt;p&gt;An AI sandbox gives your agent a disposable computer. Your code calls an API, gets a fresh Linux environment, and sends it commands: install a package, run a script, read a file back.&lt;/p&gt;

&lt;p&gt;Three things separate a good one from a risky one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Isolation:&lt;/strong&gt; a microVM (own kernel) is a much stronger wall than a shared-kernel container.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lifecycle:&lt;/strong&gt; how long a sandbox can live, and whether it can pause and resume without losing state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Billing unit:&lt;/strong&gt; per second of vCPU and RAM, per GB of memory, or per active CPU time. Same workload, very different invoices.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The feature lists look alike.&lt;/p&gt;

&lt;p&gt;The billing units and session limits don't.&lt;/p&gt;

&lt;p&gt;Sandboxes run code. If your agent also has to drive a real browser, that's a different layer: see my comparison of the &lt;a href="https://kevinmeneses.com/en/articles/best-5-browser-automation-api-for-ai-agents-in-2026" rel="noopener noreferrer"&gt;best browser automation APIs for AI agents&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  AI agent sandboxes compared
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Sandbox&lt;/th&gt;
&lt;th&gt;Best for&lt;/th&gt;
&lt;th&gt;Free tier&lt;/th&gt;
&lt;th&gt;Published price&lt;/th&gt;
&lt;th&gt;Max session&lt;/th&gt;
&lt;th&gt;Isolation (as documented)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://e2b.dev/" rel="noopener noreferrer"&gt;E2B&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Code-interpreter agents&lt;/td&gt;
&lt;td&gt;$100 one-off credits, no card&lt;/td&gt;
&lt;td&gt;$0.000014/vCPU-s + $0.0000045/GiB-s&lt;/td&gt;
&lt;td&gt;1 h (Hobby) / 24 h (Pro)&lt;/td&gt;
&lt;td&gt;Firecracker microVM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.daytona.io/" rel="noopener noreferrer"&gt;Daytona&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Stateful, long-lived workspaces&lt;/td&gt;
&lt;td&gt;$200 in compute, no card&lt;/td&gt;
&lt;td&gt;$0.0504/vCPU-h + $0.0162/GiB-h&lt;/td&gt;
&lt;td&gt;No cap ("run indefinitely")&lt;/td&gt;
&lt;td&gt;Container, or full VM with its own kernel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://blaxel.ai/" rel="noopener noreferrer"&gt;Blaxel&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Bursty, mostly-idle agents&lt;/td&gt;
&lt;td&gt;Up to $200 in credits&lt;/td&gt;
&lt;td&gt;$0.0000115/GB RAM-s&lt;/td&gt;
&lt;td&gt;No hard cap ("seconds to days")&lt;/td&gt;
&lt;td&gt;microVM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://modal.com/" rel="noopener noreferrer"&gt;Modal&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Python/ML teams already on Modal&lt;/td&gt;
&lt;td&gt;$30/month (Starter)&lt;/td&gt;
&lt;td&gt;$0.00003942/core-s + $0.00000667/GiB-s&lt;/td&gt;
&lt;td&gt;5 min default, up to 24 h&lt;/td&gt;
&lt;td&gt;gVisor, or VM with its own kernel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://vercel.com/docs/vercel-sandbox" rel="noopener noreferrer"&gt;Vercel Sandbox&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Apps already on Vercel&lt;/td&gt;
&lt;td&gt;5 h active CPU/month (Hobby)&lt;/td&gt;
&lt;td&gt;$0.128/h active CPU + $0.0212/GB-h&lt;/td&gt;
&lt;td&gt;45 min (Hobby) / 24 h (Pro)&lt;/td&gt;
&lt;td&gt;Not stated on pricing page&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://developers.cloudflare.com/sandbox/" rel="noopener noreferrer"&gt;Cloudflare Sandboxes&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Agents running on Workers&lt;/td&gt;
&lt;td&gt;None (needs Workers Paid, $5/mo)&lt;/td&gt;
&lt;td&gt;$0.000020/vCPU-s + $0.0000025/GiB-s&lt;/td&gt;
&lt;td&gt;Not stated&lt;/td&gt;
&lt;td&gt;microVM with its own kernel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="https://northflank.com/" rel="noopener noreferrer"&gt;Northflank&lt;/a&gt; ⚠️&lt;/td&gt;
&lt;td&gt;BYOC and lowest published compute&lt;/td&gt;
&lt;td&gt;Up to $20/month of resources, no card&lt;/td&gt;
&lt;td&gt;$0.01667/vCPU-h + $0.00833/GB-h&lt;/td&gt;
&lt;td&gt;Always on&lt;/td&gt;
&lt;td&gt;microVM + gVisor&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;⚠️ Northflank has an open security incident as of November 2, 2026. Details in its section.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pricing checked on 2026-11-02. Rates are the published list rates; regions, plans and discounts change them.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What the same workload costs on each one
&lt;/h2&gt;

&lt;p&gt;Per-second rates are hard to compare in your head, so here's one workload priced on all seven: &lt;strong&gt;one sandbox with 2 vCPU and 4 GiB of RAM, busy 1 hour a day for 30 days&lt;/strong&gt;, CPU counted as fully busy (worst case).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Sandbox&lt;/th&gt;
&lt;th&gt;Monthly usage cost&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Northflank&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$2.00&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Lowest published compute rate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E2B&lt;/td&gt;
&lt;td&gt;$4.97&lt;/td&gt;
&lt;td&gt;Hobby plan; Pro adds $150/month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Daytona&lt;/td&gt;
&lt;td&gt;$4.97&lt;/td&gt;
&lt;td&gt;Same hourly rates as E2B&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Blaxel&lt;/td&gt;
&lt;td&gt;$4.97&lt;/td&gt;
&lt;td&gt;Billed per GB of RAM; suspended time isn't billed as compute&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cloudflare&lt;/td&gt;
&lt;td&gt;$5.88 + $5 plan&lt;/td&gt;
&lt;td&gt;Closest instance type is standard-3 (2 vCPU, 8 GiB), after included usage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Modal&lt;/td&gt;
&lt;td&gt;$7.14&lt;/td&gt;
&lt;td&gt;Sandboxes are billed at 3x list price&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vercel Sandbox&lt;/td&gt;
&lt;td&gt;$10.22&lt;/td&gt;
&lt;td&gt;Pro rates in iad1; Pro plan fee not included&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Free credits aren't subtracted, since they're one-off for some vendors and monthly for others. With credits, this workload is free on E2B, Daytona and Blaxel for months.&lt;/p&gt;

&lt;p&gt;At this size the price gap is a few dollars.&lt;/p&gt;

&lt;p&gt;At 500 agent sessions a day, it's your margin.&lt;/p&gt;




&lt;h2&gt;
  
  
  The 7 best sandboxes for AI agents
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. E2B
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://e2b.dev/" rel="noopener noreferrer"&gt;E2B&lt;/a&gt; is the sandbox most AI agent tutorials reach for first. Each sandbox is an isolated machine your agent can run code in, browse from, and pause or fork, with SDKs for Python (&lt;code&gt;pip install e2b&lt;/code&gt;) and JavaScript (&lt;code&gt;npm install e2b&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Here's what the integration looks like with the Python SDK:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;e2b&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Sandbox&lt;/span&gt;

&lt;span class="n"&gt;sbx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sbx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;python3 -c &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;import platform; print(platform.platform())&lt;/span&gt;&lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;sbx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;kill&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Swap the command for whatever your agent generated, and read the files it writes back with &lt;code&gt;sbx.files.read()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$100 in credits with no credit card&lt;/li&gt;
&lt;li&gt;Python and JavaScript SDKs, 1–8 vCPU and 1–8 GiB per sandbox&lt;/li&gt;
&lt;li&gt;24-hour sessions and 100 concurrent sandboxes on Pro&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hobby sandboxes stop after 1 hour&lt;/li&gt;
&lt;li&gt;Pro is $150/month before usage, the steepest plan fee on this list&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; code-interpreter agents and teams that want the most widely used default.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Daytona
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.daytona.io/" rel="noopener noreferrer"&gt;Daytona&lt;/a&gt; describes its sandboxes as "full composable computers" with a dedicated kernel, filesystem and network stack, and its homepage says they "run indefinitely" for long-running tasks and persistent agents. You choose between container sandboxes and full VM sandboxes with their own kernel.&lt;/p&gt;

&lt;p&gt;Its published hourly rates match E2B's exactly ($0.0504/vCPU-h and $0.0162/GiB-h), billed per second. The difference is the starting balance: $200 in free compute, double E2B's.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$200 in free compute, no credit card, and no documented session cap&lt;/li&gt;
&lt;li&gt;SDKs for Python, TypeScript, Ruby, Go and Java, the widest list here&lt;/li&gt;
&lt;li&gt;Per-second billing with no monthly plan fee, plus startup credits up to $50k&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The default sandbox class is a container; you have to pick the VM class for a kernel-level boundary&lt;/li&gt;
&lt;li&gt;No published self-serve plan tiers, just pay-as-you-go or Enterprise&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; agents that need a persistent workspace across many steps, and the biggest free runway.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Blaxel
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://blaxel.ai/" rel="noopener noreferrer"&gt;Blaxel&lt;/a&gt; is built around one idea: most agent sandboxes do nothing most of the time. Its sandboxes suspend after about 5 seconds of inactivity and resume in about 25 ms, and suspended time isn't billed as compute.&lt;/p&gt;

&lt;p&gt;Each agent runs in its own hardware-isolated microVM, and the published rate is per GB of RAM per second, with no separate vCPU charge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Suspend and resume in ~25 ms, so idle agents cost almost nothing&lt;/li&gt;
&lt;li&gt;microVM isolation, documented on the pricing page&lt;/li&gt;
&lt;li&gt;Up to $200 in free credits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Billing per GB of RAM makes direct comparisons harder&lt;/li&gt;
&lt;li&gt;Support plans start at $800/month + 3% of usage&lt;/li&gt;
&lt;li&gt;Free tier caps you at 10 concurrent sandboxes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; chat-style agents that run a command, wait for the user, then run another.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Modal
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://modal.com/" rel="noopener noreferrer"&gt;Modal&lt;/a&gt; is a serverless platform for Python and GPU workloads, and Sandboxes are one of its primitives. If your team already runs inference or batch jobs on Modal, the sandbox lives next to them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$30/month in free credits that renew every month (Starter)&lt;/li&gt;
&lt;li&gt;Same platform for sandboxes, GPU jobs and web endpoints&lt;/li&gt;
&lt;li&gt;gVisor or VM runtime, with SDKs for Python, JavaScript and Go&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sandboxes are billed at 3x Modal's list price, the highest published vCPU rate here&lt;/li&gt;
&lt;li&gt;Default lifetime is 5 minutes; you raise it per sandbox, up to 24 hours&lt;/li&gt;
&lt;li&gt;Team plan is $250/month + compute&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Python and ML teams who already use Modal and want one bill.&lt;/p&gt;




&lt;h3&gt;
  
  
  5. Vercel Sandbox
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://vercel.com/docs/vercel-sandbox" rel="noopener noreferrer"&gt;Vercel Sandbox&lt;/a&gt; gives Vercel projects an isolated environment to run untrusted or AI-generated code without leaving the platform. Usage on Pro draws from the plan's monthly $20 credit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Native to Vercel projects: no new vendor, no new bill&lt;/li&gt;
&lt;li&gt;Hobby includes 5 hours of active CPU and 5,000 sandbox creations a month&lt;/li&gt;
&lt;li&gt;Hobby never overcharges: sandbox creation pauses when you hit the quota&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hobby sessions stop at 45 minutes, and the default timeout is 5 minutes&lt;/li&gt;
&lt;li&gt;$0.128/h of active CPU makes it the most expensive option for sustained workloads&lt;/li&gt;
&lt;li&gt;Hobby is capped at 10 concurrent sandboxes and 4 vCPUs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Next.js teams adding an AI feature to an app that already ships on Vercel.&lt;/p&gt;




&lt;h3&gt;
  
  
  6. Cloudflare Sandboxes
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://developers.cloudflare.com/sandbox/" rel="noopener noreferrer"&gt;Cloudflare Sandboxes&lt;/a&gt; run on Cloudflare Containers. Each instance is a microVM with its own kernel and network, and Cloudflare bills it every 10 ms while it's actively running. For lighter jobs, Dynamic Workers run untrusted JavaScript, Python or WebAssembly without a full container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;microVM with its own kernel, documented on the overview page&lt;/li&gt;
&lt;li&gt;CPU billed on active usage only, every 10 ms&lt;/li&gt;
&lt;li&gt;Workers Paid includes 375 vCPU-minutes and 25 GiB-hours of memory a month&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No free tier: requires Workers Paid ($5/month), plus Workers and Durable Objects usage&lt;/li&gt;
&lt;li&gt;Fixed instance types, so you can't size memory exactly&lt;/li&gt;
&lt;li&gt;The older Sandbox SDK 0.x is legacy: new projects should start on Sandboxes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; agents that already run on Workers and need code execution next to them.&lt;/p&gt;




&lt;h3&gt;
  
  
  7. Northflank
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://northflank.com/" rel="noopener noreferrer"&gt;Northflank&lt;/a&gt; is a general deployment platform (services, jobs, databases) with sandboxing built in. It isolates workloads with microVMs and gVisor on every plan, and it can run in your own cloud account (BYOC). Its published compute rate is the lowest on this list.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Security incident (open as of November 2, 2026).&lt;/strong&gt; On October 30, 2026, Northflank reported a security incident on its &lt;a href="https://status.northflank.com/cmvv0rn5a092f14rutwccodpp" rel="noopener noreferrer"&gt;status page&lt;/a&gt;. The company says evidence points to secrets held in its control plane, and some customers reported unauthorized use of AI API keys stored on the platform. Northflank says running workloads were unaffected and that customers on dedicated control planes weren't affected. It asks all customers to rotate their secrets, and a root-cause analysis hasn't been published yet. Check the status page before you store credentials there.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$0.01667/vCPU-h, the cheapest published compute here&lt;/li&gt;
&lt;li&gt;microVM and gVisor isolation on every plan, including free&lt;/li&gt;
&lt;li&gt;Bring your own cloud, plus a free Sandbox plan with no card&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The open security incident above&lt;/li&gt;
&lt;li&gt;A full platform rather than a sandbox SDK, so there's more to set up for a simple agent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; teams that need sandboxes inside their own cloud for compliance, and lowest cost at scale.&lt;/p&gt;




&lt;h3&gt;
  
  
  Also worth a look
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.freestyle.sh/" rel="noopener noreferrer"&gt;Freestyle&lt;/a&gt;:&lt;/strong&gt; full Linux VMs for agents that run for hours, days or weeks, with pause/resume and live cloning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.runloop.ai/" rel="noopener noreferrer"&gt;Runloop&lt;/a&gt;:&lt;/strong&gt; micro-VM sandboxes and devboxes built for coding agents.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://sandbox0.ai/" rel="noopener noreferrer"&gt;Sandbox0&lt;/a&gt;:&lt;/strong&gt; agent sandboxes with a persistent root filesystem that pause between tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.beam.cloud/" rel="noopener noreferrer"&gt;Beam&lt;/a&gt;:&lt;/strong&gt; compute for agents on bare metal, with sandboxes that start in about half a second.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  E2B vs Daytona vs Modal: which one should you pick?
&lt;/h2&gt;

&lt;p&gt;These three come up in almost every "E2B alternatives" thread. The choice usually comes down to how long your agent lives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Short, one-shot code execution&lt;/strong&gt; (an LLM runs a script and returns a chart): &lt;strong&gt;E2B&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workspaces that keep state for hours or days&lt;/strong&gt;: &lt;strong&gt;Daytona&lt;/strong&gt;, or &lt;strong&gt;Blaxel&lt;/strong&gt; if the agent is idle most of that time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPU work, or you already deploy on Modal&lt;/strong&gt;: &lt;strong&gt;Modal&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your app already lives on Vercel or Cloudflare&lt;/strong&gt;: the sandbox your platform ships.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compliance, or it has to run in your own cloud&lt;/strong&gt;: &lt;strong&gt;Northflank&lt;/strong&gt; (after checking the incident status).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;E2B and Daytona charge the same hourly rates. The real E2B vs Daytona decision is about session limits, free credits ($100 vs $200) and the workspace model, not price.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to choose an AI sandbox
&lt;/h2&gt;

&lt;p&gt;Before you pick one, answer these five questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;What's the isolation boundary?&lt;/strong&gt; For untrusted, AI-generated code, prefer a microVM or gVisor over a plain container.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How long does a session need to live?&lt;/strong&gt; 45 minutes, 1 hour and 24 hours are all real limits on this list.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does your agent sit idle?&lt;/strong&gt; If yes, suspend-and-resume billing (Blaxel) or active-CPU billing (Vercel, Cloudflare) changes the math.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Which language is your agent written in?&lt;/strong&gt; Daytona has the widest SDK list (Python, TypeScript, Ruby, Go, Java); Vercel and Cloudflare are TypeScript-first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What does 30 days cost at your real volume?&lt;/strong&gt; Run your own numbers through the cost table above, then multiply by your sessions per day.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;❓ &lt;strong&gt;What is an AI sandbox?&lt;/strong&gt;&lt;br&gt;
✅ An AI sandbox is an isolated computing environment, usually a microVM or container created through an API, where an AI agent can run code it generated without access to your servers, secrets or other users' data.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Do AI agents need a sandbox to run code?&lt;/strong&gt;&lt;br&gt;
✅ Any agent that executes code it wrote itself should run it in a sandbox. LLM-generated code can be wrong, malicious through prompt injection, or simply resource-hungry, and a sandbox contains all three.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;What is the best E2B alternative?&lt;/strong&gt;&lt;br&gt;
✅ It depends on why you're leaving. Daytona has the same hourly rates and double the free credits. Blaxel is cheaper for agents that sit idle. Northflank has the lowest published compute rate and runs in your own cloud.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;E2B vs Daytona: what's the difference?&lt;/strong&gt;&lt;br&gt;
✅ Both publish $0.0504 per vCPU-hour and $0.0162 per GiB-hour. E2B gives $100 in credits and documents Firecracker microVM isolation with 1-hour (Hobby) or 24-hour (Pro) sessions. Daytona gives $200 in credits, documents no session cap, and offers container or full-VM sandboxes for persistent, stateful agents.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Is there a free sandbox for AI agents?&lt;/strong&gt;&lt;br&gt;
✅ Yes. E2B ($100), Daytona ($200) and Blaxel (up to $200) give free credits, Modal gives $30 a month, Vercel Hobby includes 5 hours of active CPU a month, and Northflank has a free Sandbox plan. Cloudflare requires the $5 Workers Paid plan.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;Firecracker microVM vs container: which is safer for AI-generated code?&lt;/strong&gt;&lt;br&gt;
✅ A microVM. Each one runs its own kernel, so code that escapes the process still hits a hardware virtualization boundary. Containers share the host kernel, which is a thinner wall. gVisor sits in between by intercepting system calls in user space.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;Every sandbox on this list can run your agent's code.&lt;/p&gt;

&lt;p&gt;What separates them is what happens when it runs for 3 hours, sits idle for 20 minutes, or runs 10,000 times a day. Pick the billing model that matches how your agent actually behaves, not the one with the nicest landing page.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Are you a vendor in this space?&lt;/strong&gt; This list is updated every quarter with new pricing and new platforms. If your sandbox product should be here, or something above is out of date, &lt;a href="https://kevinmeneses.com/en#contact" rel="noopener noreferrer"&gt;get in touch&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Looking for technical content for your company? I can help — &lt;a href="https://www.linkedin.com/in/kevin-meneses-gonzalez/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="mailto:kevinmenesesgonzalez@gmail.com"&gt;kevinmenesesgonzalez@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>python</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
