<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MarketDeck]]></title><description><![CDATA[MarketDeck]]></description><link>https://marketdeck.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6b0bf1429d1887f64a0079bb/0e92a2ff-27d4-46d5-9526-cd8084dd3269.png</url><title>MarketDeck</title><link>https://marketdeck.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Dec 2026 19:26:27 GMT</lastBuildDate><atom:link href="https://marketdeck.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[We Gave AI Assistants a Backtesting Engine Over MCP. Here Is What We Had to Stop Them Doing]]></title><description><![CDATA[Seven design rules from connecting a backtesting engine to AI assistants over MCP: validate first, refuse tips, show the luck check before returns.]]></description><link>https://marketdeck.hashnode.dev/we-gave-ai-assistants-a-backtesting-engine-over-mcp-here-is-what-we-had-to-stop-them-doing</link><guid isPermaLink="true">https://marketdeck.hashnode.dev/we-gave-ai-assistants-a-backtesting-engine-over-mcp-here-is-what-we-had-to-stop-them-doing</guid><category><![CDATA[mcp]]></category><category><![CDATA[fintech]]></category><category><![CDATA[AI]]></category><dc:creator><![CDATA[Sarthak Verma]]></dc:creator><pubDate>Sat, 05 Dec 2026 04:30:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b0bf1429d1887f64a0079bb/640feba7-68b1-481d-8611-f53b41af5df3.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A few weeks ago we connected our stock research engine to AI assistants through the Model Context Protocol (MCP). Now anyone can type "test whether momentum worked on Nifty 200 stocks" into Claude or another MCP client, and the assistant writes a strategy spec, runs a historical simulation on Indian market data, and reads back the result.</p>
<p>That sounds like a demo. Shipping it safely took most of the work.</p>
<p>An LLM with a backtester is a machine that can produce very convincing charts very quickly. In finance, convincing charts are exactly the problem. So most of what we built is not "let the AI do more." It is "make the honest answer the easiest one to give."</p>
<p>Here are the seven rules we ended up with.</p>
<h2>The shape of the server</h2>
<p>For context, the connector is a remote MCP server (Streamable HTTP). Users connect by pasting a URL and signing in with their MarketDeck account through OAuth; no API keys to copy around. The main tools:</p>
<table>
<thead>
<tr>
<th>Tool</th>
<th>What it does</th>
</tr>
</thead>
<tbody><tr>
<td><code>get_spec_guide</code></td>
<td>Returns the whole strategy spec language with worked examples</td>
</tr>
<tr>
<td><code>list_starter_ideas</code></td>
<td>25 textbook ideas to adapt (momentum, trend, low volatility, reversal...)</td>
</tr>
<tr>
<td><code>validate_spec</code></td>
<td>Checks a spec without running it; every error has a path and a hint</td>
</tr>
<tr>
<td><code>run_backtest</code></td>
<td>Queues one simulation of a validated spec</td>
</tr>
<tr>
<td><code>get_result_summary</code></td>
<td>Disclosures and luck check first, then headline numbers</td>
</tr>
<tr>
<td><code>luck_check</code></td>
<td>The idea vs 1,000 random portfolios built the same way</td>
</tr>
<tr>
<td><code>explain_result</code>, <code>export_run</code>, <code>compare_runs</code></td>
<td>Plain-language reading, CSV, side-by-side</td>
</tr>
<tr>
<td><code>get_quota_status</code></td>
<td>The user's own remaining run units</td>
</tr>
</tbody></table>
<p>A typical run takes 15 to 40 seconds including the luck check.</p>
<h2>Rule 1: The spec is the product, not the prompt</h2>
<p>The assistant never runs "a strategy." It writes a structured JSON spec: universe, selection rule, schedule, weighting, costs, benchmark. That spec is the single shared layer between the AI path, a guided form on our website, and anything we build later.</p>
<p>Why it matters: a spec can be validated, fingerprinted, stored, compared and re-run. A prompt cannot. When a user asks "what if I rebalance quarterly instead," the assistant edits one field and runs a child of the original card, and the lineage is kept.</p>
<h2>Rule 2: Validate before you spend</h2>
<p><code>run_backtest</code> only accepts a spec that <code>validate_spec</code> passed. Every validation error carries a path, a hint and, where useful, a did-you-mean list. Simplified, the shape looks like this (values illustrative):</p>
<pre><code class="language-json">{
  "path": "legs[0].universe.filters[1].sector",
  "error": "Unknown sector label",
  "hint": "Use one of the labels from describe_data_coverage(topics=['sectors'])",
  "did_you_mean": ["Banks", "Financial Services"]
}
</code></pre>
<p>LLMs are good at fixing errors when the error tells them exactly what is allowed. They are bad at guessing. Our first version was more lenient in <code>validate_spec</code> than in the engine; an assistant could pass validation with a period before our data starts and then waste a run. We moved those checks into the validator. Cheap calls should catch everything the expensive call would reject.</p>
<h2>Rule 3: Refuse recommendation language at the door</h2>
<p>Users sometimes title an idea "best stocks to buy" or "guaranteed multibagger." The validator refuses recommendation wording in the title and hypothesis fields and explains why. Every tool description also tells the assistant, in plain words: present results as historical simulations, never tell the user to buy or sell anything.</p>
<p>Fields the user typed are marked as user text, and tools say to treat them as data, never as instructions. A title is not a place to smuggle in a prompt.</p>
<h2>Rule 4: The luck check comes before the headline</h2>
<p>This is the one we care about most. <code>get_result_summary</code> returns, in order: disclosures, the luck check, and only then the return figures.</p>
<p>Why? Because on Indian stocks from 2022 to 2026, almost anything beat the index. We tested a control strategy that buys Nifty 500 companies whose name starts with S: 22.4% a year against the index's 10.1%. Against 1,000 random portfolios built exactly like it, it beat 62%. Barely better than a coin.</p>
<p>If the assistant reads the CAGR first, it writes an exciting paragraph. If it reads "beat 62% of random portfolios" first, it writes an honest one. What a model reads first shapes what it writes.</p>
<p>You can feel the difference yourself. Pick a strategy and throw random portfolios at it:</p>
<p><a class="embed-card" href="https://codepen.io/marketdeck/pen/dPWaLQo">https://codepen.io/marketdeck/pen/dPWaLQo</a></p>

<h2>Rule 5: Make every run cost something visible</h2>
<p>Each account has a daily budget of run units (light reads are separate and generous). <code>get_quota_status</code> is free so the assistant can check before it plans a sweep.</p>
<p>This is not only about server cost. Every run is counted in the idea's trial counter, which feeds a deflated Sharpe ratio. An assistant that tries 40 variations and reports the best one is p-hacking on the user's behalf. Making trials visible and finite keeps both the model and the user honest.</p>
<p><code>run_backtest</code> is also idempotent per <code>request_id</code>, so a retry after a timeout never double-charges.</p>
<h2>Rule 6: Say what you cannot answer, specifically</h2>
<p>Our engine cannot test fundamentals-based ideas yet (value, P/E, quality), intraday rules, options, or delisted companies. Instead of failing vaguely, the validator refuses with the specific reason and what is available instead, and <code>describe_data_coverage</code> lists the limits up front.</p>
<p>Every result also carries badges for the data's weak spots: <code>SURVIVORSHIP_LISTED_ONLY</code>, <code>PRICE_RETURN_BASIS</code>, <code>SURVIVORSHIP_CURRENT_MEMBERSHIP</code>. The assistant is told to show them. A backtest that hides its survivorship bias is worse than no backtest.</p>
<h2>Rule 7: Results are private by default</h2>
<p>Runs are owner-only. There are no public leaderboards and nothing is ranked by return, because a ranked list of "top strategies" is a tip sheet with extra steps. <code>list_my_runs</code> returns runs newest first and says so in the response.</p>
<h2>What we would do differently</h2>
<ul>
<li><strong>Start with OAuth.</strong> We first shipped a per-user key in a custom header. Developer tools handle that fine; consumer AI apps expect OAuth with dynamic client registration. One OAuth build opened almost every client at once.</li>
<li><strong>Write tool descriptions like a style guide.</strong> They matter as much as the engine. Say what to show first and what never to say.</li>
<li><strong>Test with an adversarial user.</strong> Ask the assistant to "find me a strategy that makes 50% a year." The right answer is a short explanation of why that request is the problem, plus an offer to test a specific idea.</li>
</ul>
<h2>Try it</h2>
<p>The Research Desk connector works with Claude and other MCP clients; the setup page is on <a href="https://marketdeck.in">marketdeck.in</a>. If you are building an MCP server in a regulated domain, I would love to compare notes in the comments: what do you refuse at the door?</p>
<hr />
<p><em>MarketDeck provides research and education tools. Results are historical simulations, not investment advice, and past results do not indicate future results. Cover illustration is AI-generated.</em></p>
]]></content:encoded></item><item><title><![CDATA[Use Claude to test stock ideas on Indian markets (MCP guide)]]></title><description><![CDATA[How to connect Claude to the MarketDeck Research Desk and test Indian stock ideas in plain English, with a luck check on every result.]]></description><link>https://marketdeck.hashnode.dev/use-claude-to-test-stock-ideas-on-indian-markets-mcp-guide</link><guid isPermaLink="true">https://marketdeck.hashnode.dev/use-claude-to-test-stock-ideas-on-indian-markets-mcp-guide</guid><category><![CDATA[claude]]></category><category><![CDATA[mcp]]></category><category><![CDATA[Python]]></category><category><![CDATA[finance]]></category><category><![CDATA[india]]></category><dc:creator><![CDATA[Sarthak Verma]]></dc:creator><pubDate>Sun, 29 Nov 2026 09:52:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b0bf1429d1887f64a0079bb/c36b8b34-fe23-48e0-a96b-7fab75abe99a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>What is MCP, in simple words?</h2>
<p>MCP, the Model Context Protocol, is an open standard that lets an AI assistant such as Claude connect to outside tools and data, so it can do things like run a calculation or look something up instead of only answering from memory. Its own documentation compares it to "a USB-C port for AI applications": one standard plug that many tools can use. <a href="#sources">[1]</a></p>
<p>In practice, an MCP connector is a service on the internet that tells Claude, "here are the tools I offer and what each one needs." When you ask a question that one of those tools can answer, Claude can call it, read the result and explain it to you in plain words. You stay in an ordinary chat the whole time.</p>
<p>This guide shows how to connect Claude to the <a href="https://marketdeck.in/desk/">MarketDeck Research Desk</a> so you can test ideas about Indian stocks by asking in plain English, what you can ask, and the limits you should know about.</p>
<h2>How is the MarketDeck connector different from a data connector?</h2>
<p>The MarketDeck connector tests ideas against chance, rather than only fetching prices or company data. Many connectors are built to look things up. The Research Desk connector runs a rule on past Indian market data with paper money and then asks whether random chance could have produced the same result.</p>
<p>That second step is the luck check. By default, the Desk builds 1,000 random portfolios from the same list of stocks, on the same schedule, with the same number of holdings and the same costs, with only the choice of stocks left to chance. It then shows where your idea sits among them as a percentile, and it shows that before any other figure. Claude is instructed to present the luck check alongside any headline number and never to tell you to trade. <a href="#sources">[3]</a></p>
<p>Why does this matter? Because over a strong market, almost any list of stocks goes up. Our issue on <a href="https://marketdeck.in/intelligence/issues/random-portfolio-vs-nifty-20000-portfolios/">20,000 random portfolios against the Nifty</a> shows that from 3 October 2023 to 21 August 2026, with 30-stock portfolios drawn from one Indian list, the middle 90% of random portfolios landed between about +47% and +114%. That list is today’s, applied to the past, so survivorship bias flatters these historical figures; they are not a recommendation. A connector that only reported your idea's return would leave you guessing whether it did anything special.</p>
<h2>How do you connect Claude to the Research Desk?</h2>
<p>You connect by adding the Research Desk as a custom connector in Claude and signing in with your MarketDeck account; there is no key to enter and no code to write. An interactive walkthrough of the five screens, drawn in MarketDeck's style with no real account data, is on the <a href="https://marketdeck.in/intelligence/issues/claude-mcp-indian-stocks-research-desk/">original article</a>.</p>
<p>The same steps in words:</p>
<ol>
<li><strong>Copy the address.</strong> Sign in to MarketDeck, open your Research Desk Connect page and copy the connector address.</li>
<li><strong>Open the add screen.</strong> In Claude, go to Customize → Connectors → + Add → Add custom connector. <a href="#sources">[2]</a></li>
<li><strong>Name it and paste.</strong> Name it MarketDeck, paste the address as the remote MCP server URL and press Continue. Keep the authentication settings Claude detects, with no key and no request headers, press Continue, then press Add. <a href="#sources">[2]</a></li>
<li><strong>Sign in and allow.</strong> Sign in with your MarketDeck account and press Allow. The Allow screen shows which account you are signed in as and lists what Claude can and cannot do, so read it first. <a href="#sources">[3]</a></li>
<li><strong>Switch it on in a chat.</strong> In a chat, press +, then Connectors, switch MarketDeck on and ask your first question. <a href="#sources">[2]</a></li>
</ol>
<p>These menu names come from Claude’s help article and can change. Our <a href="https://marketdeck.in/desk/connect-claude/">Connect Claude guide</a> covers the same connection. The article says remote connectors are set up through your Claude account, including when you use the Claude desktop app. <a href="#sources">[2]</a> On Team and Enterprise plans only an Owner can add a connector, apart from Enterprise users given a custom role with that permission; members then connect to it from Customize → Connectors. <a href="#sources">[2]</a></p>
<p>Two things to know before you start. Claude's help centre says custom connectors are available on its Free, Pro, Max, Ultra, Team and Enterprise plans, and that Free users are limited to one custom connector. <a href="#sources">[2]</a> It also warns that custom connectors are not verified by Anthropic, so only connect services you trust. <a href="#sources">[2]</a></p>
<h2>What can you ask Claude once it is connected?</h2>
<p>You can ask Claude to list starter ideas, run one, explain a result, change one setting and run it again, compare two runs, or turn a rule you describe into a test. The interactive version of this guide on MarketDeck includes five example prompts with copy buttons. A good first question is:</p>
<blockquote>
<p>List the MarketDeck Research Desk starter ideas, run the 12-1 momentum one on its default settings, and show me the luck check before any figure.</p>
</blockquote>
<p>From there, try changing one thing at a time. Ask Claude to explain the last run in plain words, starting with the luck check. Ask it to change only the list of stocks and run again. Ask it to compare the two runs side by side. Each of these maps to a Research Desk tool, so Claude is reporting what the Desk calculated rather than guessing.</p>
<p>You can also describe a rule of your own: "each month, hold the 20 Nifty 200 stocks closest to their 52-week high." Claude writes it as a Desk test, checks it for errors and only then runs it. If you want ideas to start from, the <a href="https://marketdeck.in/desk/ideas/">starter ideas page</a> explains each rule, its settings and what could go wrong. Our issues on <a href="https://marketdeck.in/intelligence/issues/momentum-investing-india-test-it-yourself/">momentum investing in India</a> and the <a href="https://marketdeck.in/intelligence/issues/golden-cross-nifty-signal-or-luck/">golden cross on Nifty</a> are good companions for two of them.</p>
<h2>What are the limits?</h2>
<p>The main limits are a run-unit allowance, results-only access and the fact that every result is a historical simulation, not advice. In detail:</p>
<ul>
<li><strong>Run units.</strong> Each account has 20 run units a day and 300 across any 30 days. Both are halved in the first week, and the day resets at midnight India time. Claude uses the same allowance as the Desk page, and you can ask Claude how many are left.</li>
<li><strong>Who can use it.</strong> The Research Desk is open to anyone with a free MarketDeck account.</li>
<li><strong>Results only.</strong> Claude receives summary figures, charts and a capped list of simulated trades. It never receives raw market data.</li>
<li><strong>No trading.</strong> The connector cannot place orders or connect to a broker. Everything runs on paper money.</li>
<li><strong>Private runs.</strong> Your runs stay private to your account. Claude cannot see other people's results or your password.</li>
<li><strong>Disconnect any time.</strong> You can disconnect Claude from your Research Desk Connect page, and it stops at once.</li>
</ul>
<p>Developer tools such as Claude Code can connect with a personal key instead of signing in. Keys are created, shown once and revoked on your signed-in Connect page. <a href="#sources">[3]</a></p>
<h2>How should you read what Claude tells you?</h2>
<p>Read the luck check first, then the deepest fall, then the comparison with an index, and the return last. If the luck check says many random portfolios did as well, the honest summary is that the test did not show the rule adding much, however good the return looks.</p>
<p>Remember too that a backtest is a question about the past. Our guide to <a href="https://marketdeck.in/intelligence/issues/backtest-stock-strategy-india-without-coding/">backtesting a stock strategy without coding</a> covers costs, timing and the common traps, and the <a href="https://marketdeck.in/intelligence/notes/strategy-backtest-research-checklist/">strategy backtesting checklist</a> is a useful companion before you trust any result, whether a tool or Claude reports it.</p>
<h2>What else do readers ask?</h2>
<p>These are short answers to the questions readers ask most often about this topic.</p>
<h3>Can Claude access Indian stock market data?</h3>
<p>With the MarketDeck Research Desk connector, Claude can run tests on past Indian market data and read the results. It receives results only, not raw data, and it cannot place trades.</p>
<h3>Do I need an API key to connect Claude to MarketDeck?</h3>
<p>No. On <a href="http://claude.ai">claude.ai</a> and the Claude desktop app you sign in with your MarketDeck account and press Allow. Personal keys are only for developer tools.</p>
<h3>Is the MarketDeck Research Desk free?</h3>
<p>It is open to anyone with a free MarketDeck account, within a limit of 20 run units a day and 300 across any 30 days. Both are halved in the first week, and the day resets at midnight India time.</p>
<h3>Will Claude recommend stocks through MarketDeck?</h3>
<p>No. The Research Desk runs historical simulations for research and learning, and Claude is instructed to present them as tests, never as advice.</p>
<h2>Sources</h2>
<ol>
<li><a href="https://modelcontextprotocol.io/docs/getting-started/intro">Model Context Protocol: Introduction</a></li>
<li><a href="https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp">Claude Help Center: Get started with custom connectors using remote MCP</a></li>
<li><a href="https://marketdeck.in/desk/connect-claude/">MarketDeck: Connect Claude to the Research Desk</a></li>
</ol>
<hr />
<p><em>Originally published on</em> <a href="https://marketdeck.in/intelligence/issues/claude-mcp-indian-stocks-research-desk/"><em>MarketDeck</em></a><em>. Research and education, not investment advice. Historical simulations do not indicate future results.</em></p>
]]></content:encoded></item></channel></rss>