Automating US Stock Investing with AI: My Claude + IBKR Workbench (Full Prompts Included)

@rollingSirius
中国語1 日前 · 2026年7月13日
185K
592
128
14
1.4K

TL;DR

This guide explains how to use Claude's MCP and artifacts to build a custom US stock trading dashboard integrated with Interactive Brokers, covering research, monitoring, and decision-making.

Most people investing in US stocks spend their time on two things: flipping through news, digging through financial reports, and comparing option chains before the market opens; and staring at the red and green numbers in their accounts after the market opens, repeatedly doubting their own judgment. Over the past two months, I have handed over all these repetitive tasks to AI.

Now my daily routine looks like this: if I want to research a stock, I enter a command and get a research report with valuation ranges and long/short logic in a few minutes; if I want to know how much profit I've realized this year, I click a panel in the sidebar and the numbers are right at the top; if the market drops, the valuation panel tells me where it stands historically and whether I should be greedy or fearful; if I want to sell options, the radar has already sorted ten targets by annualized return; and if I'm about to place an order, the decision system scores the trade first—if it doesn't reach the required score, it simply displays "Do Not Buy."

I didn't write a single line of code or rent a single server for this. It's all generated by Claude in conversations and pinned to the sidebar. This article shares the setup method and all the prompts, so you can build your own personal trading system in an hour.

The image below shows the full view of this workbench:

Sirius - inline image

1. Why IBKR + Claude

To make AI truly participate in investing rather than just staying at the chat level of "help me analyze the trend," two conditions are needed: the AI must have access to your real data, and the analysis results must be turned into readily available tools.

The first condition is best answered by IBKR among current brokers. Interactive Brokers provides an official MCP server—you can think of MCP as a standard interface for AI. Claude uses it to directly call real-time quotes, historical K-lines, account holdings, transaction records, pending orders, and option chains. No web scraping, no manual API integration, and no worrying about token expiration.

The second condition relies on a feature of the Claude desktop app: pinning generated HTML panels (Artifacts) to the sidebar. The panel is essentially a single-file webpage with built-in logic to call back to IBKR, automatically pulling the latest data every time it's opened. In other words, Claude is only responsible for "building the tool"; once built, the tool runs on its own without needing a new conversation or consuming tokens every time.

Combining these two points eliminates the part that discourages most ordinary people: deployment. With other routes, you'd likely need to run your own server, maintain API keys, and handle login expirations—most people get stuck there. In this setup, a prompt is a trading tool.

Sirius - inline image

There is only one preparation step: add the Interactive Brokers connector in the Claude desktop app and authorize your IBKR account. Then, paste the prompts from the following sections into the chat, and pin the panel once it's generated.

2. Stock Research: One Command, One Professional Report

Let's talk about the research phase. Retail investors are often in an awkward position: free information is fragmented and often not real-time. Furthermore, when doing it manually, the biggest problem is unconsciously collecting only evidence that supports buying.

I wrote the entire research process into a Skill named /equity-research. You can think of a Skill as a preset Standard Operating Procedure (SOP): enter a company name or ticker, and it automatically fetches data in parallel—IBKR pulls real-time prices and 52-week ranges, it searches the web for Morningstar fair value and moat ratings, latest financial reports, segment revenue, management guidance, and sell-side target price distributions—then it produces a research report with nine sections, cross-validating with at least three valuation methods, and finally saves it as a timestamped file.

The most valuable part of this process isn't the data fetching; it's the discipline. AI has two well-known flaws: agreeing with whatever you say and making up data confidently. Therefore, the prompt must enforce several rules: separate facts from judgments, and judgments must be labeled "My Judgment"; every key data point must have a source and timestamp; explain discrepancies between different sources; write "Not Obtained" for unavailable data and forbid fabrication. These rules are the source of the report's credibility.

The core prompt is as follows (the full Skill is long; this condensed version works when pasted directly into Claude):

Help me research [Company Name/Ticker] and produce an institutional-grade research report for real decision-making. Requirements:

Collection: Use IBKR to get real-time price, 52-week high/low, and YTD performance; search the web for Morningstar fair value, moat rating, and star rating; search for latest quarterly report highlights, segment revenue breakdown, management guidance, sell-side ratings and target price distribution, news and catalysts from the last three months; financial history (last 5 years revenue/gross margin/FCF/ROIC) based on SEC filings.

Discipline: Separate facts from judgments; your inferences must be labeled "My Judgment" with supporting evidence; every key data point must have a source and time; list differences and explain the reasoning for the chosen data when sources conflict; write "Not Obtained" for missing data, do not fill with memory; present both bull and bear arguments.

Valuation: Cross-validate with at least three methods (relative valuation, DCF, industry-specific metrics), summarize the valuation range and upside/downside relative to current price; list key DCF assumptions and perform sensitivity analysis.

Conclusion: Clearly state Undervalued/Fair/Overvalued and Buy/Watch/Avoid; answer "If this were cash today, would I buy it?"; provide 3-5 follow-up monitoring indicators. Finally, save as a timestamped Markdown file.

Sirius - inline image

3. Account Monitoring: Digging Out Hidden Numbers

Anyone who has used IBKR knows: it's powerful but the interface is discouraging. A basic question like "How much profit have I actually realized this year?" requires going to the report center, selecting types and ranges, exporting, and then finding it in the document yourself. The desktop software also doesn't sort option positions by expiration date, making it easy to miss contracts nearing expiration when you have many positions.

So the first panel I made was for account monitoring. The logic is simple: IBKR has all the data; it's just not displayed the way I want. I let Claude rearrange it. Now, when I open the panel, the top shows net liquidity, cash, and excess margin; the middle has asset allocation pie charts and net liquidity trends (it automatically takes a snapshot every time it's opened, building a performance curve over time); the bottom has separate P&L summaries for stocks and options—both realized and unrealized, supporting toggles for the last 7 days, 30 days, 90 days, this month, and this year. Option positions are sorted by expiration, with those expiring within 30 days highlighted in red.

Prompt:

Use the IBKR connector to create an account analysis panel for me (single-file HTML, made as a pinnable artifact that pulls real-time data automatically):

1. Top KPIs: Net Liquidity, Cash, Available Margin, Daily P&L; 2. Asset allocation pie chart (market value of each stock + cash); Net liquidity trend chart, automatically recording a snapshot each time the panel is opened (using localStorage); 3. P&L Summary: Separate statistics for stocks and options, showing both realized and unrealized; 4. Stock holdings table; Option holdings table sorted by expiration date, highlighting those within 30 days in red; 5. Realized P&L based on transaction records, supporting toggles for last 7/30/90 days/this month/YTD; 6. Current pending orders list.

Chinese interface, light theme, use monospaced fonts for numbers, green for profit and red for loss. Note data source and delay at the bottom.

Sirius - inline image

4. Market Monitoring: Giving a Number to "Should I Be Greedy?"

During a crash, you need to stay calm, but that's exactly when people are least calm. My solution is to write the judgment rules into code beforehand. When the market drops, I don't make judgments; I just look at the numbers.

This panel has three layers. The first layer looks at position: use IBKR to pull historical data for VIX, S&P 500, and Nasdaq 100, calculating the current price's percentile deviation from the long-term trend, with lookback windows switchable between 1, 3, 5, and 10 years. The second layer looks at valuation: S&P 500 TTM P/E, forward earnings yield, and the Equity Risk Premium (ERP) compared to the 10-year Treasury yield. The third layer looks at sentiment: CNN Fear & Greed Index. These three layers combine into a buy-point score from 0 to 100.

It's important to emphasize that the scoring rules are completely transparent, written on the panel, explainable, and traceable. It doesn't predict tomorrow's rise or fall—nothing can—it only answers one question: based on history, is the current position relatively expensive or cheap?

Create a market valuation percentile monitoring panel for me (single-file HTML artifact for the sidebar):

1. Use IBKR to pull real-time and historical data for VIX, S&P 500, and Nasdaq 100, calculating the current price's percentile deviation from the long-term trend line, supporting 1/3/5/10 year lookback windows; 2. Valuation layer: S&P 500 TTM P/E, forward earnings yield, and Equity Risk Premium (ERP) compared to the 10-year Treasury yield; 3. Sentiment layer: CNN Fear & Greed Index snapshot; 4. Combine the above indicators into a 0-100 "Buy Point Score" based on fixed weights. The scoring rules must be written on the panel, explainable, and traceable—no black boxes; 5. Use color bars for each indicator to show the current percentile; provide a one-sentence conclusion at the top: whether to be greedy or fearful right now.

Sirius - inline image

5. Options Radar: See Premium Value at a Glance

If you are also an options seller, this panel might be the biggest time-saver. When IV is high, premiums are expensive and worth selling. But in practice, you have to open option chains one by one, check IV, look up percentiles, calculate annualized returns, and compare with other targets—pure manual labor, and the market often closes while you're still comparing.

The radar panel turns this into a single table: for the ten tickers I trade most often, it shows the current price, 52-week position, real-time IV, and IV percentile. It estimates theoretical premiums, annualized returns, and delta-based probability of profit for long-term (over one year) Sell Puts and short-term (within 45 days) Covered Calls, sorted by annualized return. Tickers with high IV percentiles are highlighted. It also reads my holdings and marks tickers I've already sold options on to prevent duplicate selling.

Create an options opportunity radar panel for me (single-file HTML artifact). Coverage: [List your frequently traded tickers]:

1. For each ticker: Current price, 52-week position, real-time IV, and IV percentile; 2. Long-term (1+ year) Sell Put: Estimate theoretical premium, annualized return, and delta-based probability of profit at a certain discount to current price (e.g., 15% OTM), sorted by annualized return; 3. Short-term (within 45 days) Covered Sell Call: Similarly provide premium, annualized return, and probability of profit; 4. Use IBKR to read my holdings and automatically mark existing short option positions to avoid duplicate selling; 5. Highlight tickers with IV percentiles over 70%—it's only worth being a seller when premiums are expensive.

Sirius - inline image

6. Trading Decisions: Putting Every Trade Through a Process

The first four tools solve information problems. But honestly, most people lose money not because of lack of information, but because emotion takes over the brain the moment they place an order. No matter how good the research is, they still chase highs when they should be fearful.

So this last panel is for self-control. The buy side is a six-layer funnel: Do I understand it (Circle of Competence) → Why will it rise (write falsifiable hypotheses) → Is it expensive/where is the cycle → How to buy (technical structure) → How much to buy (position and risk) → When to admit being wrong (preset exit conditions). The first and sixth layers are hard gates; if either fails, the trade is rejected. The middle four layers are scored; if the score is too low, the panel directly displays "Do Not Buy," no exceptions. The sell side has six triggers; if any are triggered, action is taken: Is the logic falsified? Is the valuation in a bubble? Has the mechanical trim point been reached? Has the stop loss been hit? Is there a higher-certainty opportunity? Is the position unbalanced?

Prioritize logic over price.

It also manages positions: it pulls IBKR holdings in real-time, converts short options into notional exposure, calculates implied leverage, and looks at concentration by correlation clusters—people with a full portfolio of AI stocks often don't realize they are betting on a single sector. Every trade's score, reasoning, and emotional state at the time are recorded in a trading log saved to Google Drive. During review, the data speaks: which trades violated your own rules and how much those violations cost.

Create a general trading decision system panel for me (single-file HTML artifact) to control my trading hand:

1. Buy Point · Six-layer Funnel: ① Understand (Circle of Competence, hard gate) → ② Logic and Quality (Why it will rise, write the most critical falsifiable hypothesis) → ③ Valuation and Cycle Position → ④ Technicals and Buy Structure → ⑤ Position and Risk → ⑥ Exit Conditions (Falsification point + mechanical trim rules + stop loss, hard gate). Score the middle four layers 0/1/2: if any hard gate fails, reject; soft score ≥6 can buy (in batches); 4–5 watch or test position; <4 reject, panel displays "Do Not Buy"; 2. Sell Point · Six Triggers (action if any triggered, review weekly): Logic falsified/fundamentals deteriorated, valuation bubble/cycle peak, mechanical trim reached, stop loss/max drawdown hit, opportunity cost (better target appears), risk/position imbalance. Prioritize logic over price; 3. Position Module: Pull holdings from IBKR in real-time, parse notional exposure and implied leverage of short options, support manual merging of holdings outside the broker, calculate concentration by correlation clusters; 4. Trading Log: Record the buy score, logic, exit conditions, emotional state, and rule compliance for each trade; save locally with one-click backup to Google Drive; 5. Discipline Review: Count how many trades violated rules and how much was lost on those trades.

Sirius - inline image

7. Final Thoughts

Looking back, this workbench does three things: compresses the cost of researching a stock from hours to minutes, turns "how much did I make this year" from digging through reports to a single glance, and turns trading discipline from self-will into a process.

Investing is ultimately about judgment, not moving information. The meaning of tools is to ensure every judgment happens on more complete information and with calmer emotions—the time and energy saved are the capital for making those judgments.

The setup cost is about an hour. The five prompts are above; just paste them to use. You can adjust the look of the panels or add fields in the conversation at any time. Note that due to space limits, only the core prompts are provided here. I will upload the full prompts for this trading system to GitHub; please follow the account and DM for the specific address.

ワンクリック保存

YouMindでバイラル記事をAI深読み

ソースを保存し、的を絞った質問をし、主張を要約して、バイラル記事を再利用できるノートに変えます。すべてを1つのAIワークスペースで行えます。

YouMindを探索
クリエイターのために

あなたの Markdown をきれいな 𝕏 記事に

自分の長文を投稿するとき、画像・表・コードブロックを 𝕏 向けに整形するのは手間がかかります。YouMind は Markdown 全体を、そのまま投稿できるきれいな 𝕏 記事に変換します。

Markdown → 𝕏 を試す

解読すべきパターンをもっと

最近のバイラル記事

バイラル記事をもっと見る