How to Create the Greenblatt Magic Formula Strategy
The Magic Formula is one of the most-replicated value investing strategies in the academic literature. Joel Greenblatt published it in 2005 and it's been the subject of dozens of papers since. The premise is simple: buy good companies (high return on capital) at cheap prices (high earnings yield), hold around 30 of them, and rebalance once a year (or monthly, in our setup).
This guide walks you through creating the strategy on Seentio using Claude Code in plain English. No code, no math, no spreadsheets.
What you'll learn
How to ask Claude Code to build, preview, save, and activate the Greenblatt Magic Formula strategy on your Seentio account in under 5 minutes.
Prerequisites
Before you start, make sure you have:
- A Seentio account (any tier — Basic works for everything except SMS alerts)
- A Seentio API token from your account page (free, valid 90 days, regenerate anytime)
- Claude Code installed and connected to Seentio's MCP server
- A connected brokerage account at Trade if you want to activate the strategy live (you can also save it as a draft and decide later)
If you haven't connected MCP yet, follow our 5-minute setup guide first.
Step-by-step walkthrough
1. Open Claude Code and ask plainly
Type into your Claude Code prompt:
Build me Greenblatt Magic Formula. Show me the top 30 picks first.
That's it. You don't need to know the factors. You don't need to know the universe filters. Claude handles the lookup.
2. Watch what Claude does
Claude will call three Seentio tools in sequence:
-
lookup_strategy("Greenblatt")— fuzzy-matches your request against built-in templates. The result comes back withconfident_match: greenblatt_magic_formula(score 0.95). This is the safety check that prevents Claude from guessing the strategy spec from its training knowledge. -
get_template("greenblatt_magic_formula")— fetches the full ranking specification: two factors (earnings yield via 1/EV_EBITDA, return on capital via ROA), combined by rank-sum, top 30, equal-weighted, monthly rebalance, US equities ≥ $100M market cap, excluding Financial Services and Utilities (per Greenblatt's textbook spec). -
dry_run_ranking(ranking)— previews which 30 tickers would be selected against today's snapshot. No commitment yet — nothing has been saved.
You'll see a table of 30 stocks with their earnings yield, ROIC, sector, and market cap.
3. Tweak the universe if you want
If you don't like what you see, ask Claude to adjust:
Bump the minimum market cap to $500 million, and exclude Basic Materials too.
Claude re-runs dry_run_ranking with the new universe filter. The list updates. Iterate until you're happy with the picks.
4. Save the strategy
When the picks look right:
Save this as 'Greenblatt Magic Formula' with monthly rebalance.
Claude calls create_strategy(name="Greenblatt Magic Formula", ranking={...}, rebalance="monthly"). The response includes a summary field that Claude will read back to you. It looks like:
Saved 'Greenblatt Magic Formula' as draft. Holds top 30 stocks ranked by earnings_yield (1 / ev_ebitda) + roic (roa) via rank_sum, equal-weighted, monthly rebalance. Universe: US equities ≥ $500M, excluding Financial Services, Utilities, Basic Materials.
Read this summary carefully. If anything's off, ask Claude to update or delete-and-recreate. The summary is the safety check that confirms what was actually saved matches your intent.
The strategy is now in your account as a draft — saved but not running.
5. Optionally backtest before activating
You can preview historical performance before going live:
Backtest this strategy from 2023 to today against SPY.
Claude calls backtest_strategy which now correctly honors the ranking block (a v3.5.21 fix — earlier versions silently fell back to a misleading market-cap default). You'll get an annualized return, Sharpe ratio, max drawdown, and a rebalance log. Note that walk-forward backtests use today's snapshot for the entire historical period, so they don't reflect survivorship bias perfectly — read our backtest guide for the caveats.
6. Activate against your brokerage
When you're ready to go live:
Activate it on my E*Trade account, email alerts only.
Claude will call list_brokerage_accounts to find the right account ID, then activate_strategy(strategy_id, snaptrade_account_id, alert_channels=["email"]). Status flips from draft to active. You'll get a confirmation message telling you when the next rebalance fires.
Important: nothing trades automatically. Activation just means the strategy is wired into our scheduled rebalance system — you'll get a proposal email when it's time, and you have to click through to execute.
Tips & common questions
-
Don't worry about the cookbook. Claude has the cookbook of factor derivations baked into its system prompt. It knows that "EBIT/EV" maps to
1 / ev_ebitda, "ROIC" maps toroa, "FCF yield" maps to1 / price_to_cash, and so on. You ask in plain English; Claude translates. -
Check the summary every time. Whether you're creating, updating, or forking a strategy, the response includes a plain-English summary. Read it. The summary is your protection against subtle mis-interpretation — strategy names are ambiguous and AI lookup beats AI guessing.
-
You can iterate after saving. Want to drop top_n from 30 to 20? Add
exclude_tickersto filter out specific names? Useupdate_strategy— Claude can do this with a single prompt: "Update Magic Formula to top 20 with NVDA and TSLA excluded." No need to delete and recreate. -
Activation is reversible. If you change your mind after activating, ask Claude to
pause_strategyordelete_strategy. Pausing keeps the spec but stops monitoring; deleting removes it permanently. -
Foreign cross-listings are normal. Our universe includes US-listed ADRs of foreign companies. Greenblatt's classic portfolio examples include companies like Equinor and TSMC. If you want pure-US, you can build an exclude list, but it's a moving target — see our name-mapping guide for context.
What's next
- Learn how to run a backtest on any strategy you create to see historical performance before going live.
- Understand how the alert system fires when your monthly rebalance is due.
- Read what "live strategy" actually means and how it interacts with your brokerage type.
Need more help? Visit our Chat page to ask Seentio's AI assistant, or reach out at contact@app-seentio.com.