<?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: rytjy</title>
    <description>The latest articles on DEV Community by rytjy (@rytjy).</description>
    <link>https://dev.to/rytjy</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%2F4189121%2Fa81098d2-2207-4d74-b752-d6325e9b79ef.png</url>
      <title>DEV Community: rytjy</title>
      <link>https://dev.to/rytjy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rytjy"/>
    <language>en</language>
    <item>
      <title>Four ways your backtest lies — and a dependency-free Python kit that catches them</title>
      <dc:creator>rytjy</dc:creator>
      <pubDate>Fri, 16 Oct 2026 15:03:28 +0000</pubDate>
      <link>https://dev.to/rytjy/four-ways-your-backtest-lies-and-a-dependency-free-python-kit-that-catches-them-3p8n</link>
      <guid>https://dev.to/rytjy/four-ways-your-backtest-lies-and-a-dependency-free-python-kit-that-catches-them-3p8n</guid>
      <description>&lt;p&gt;My strategy looked fine in the backtest and lost money live.\n\nIf you've done this for a while, you already know the suspects. What surprised me is how &lt;em&gt;mechanical&lt;/em&gt; they are — each one is a specific, checkable defect, not a vague "the market changed":\n\n- &lt;strong&gt;Look-ahead&lt;/strong&gt; — signals silently shifted onto future bars.\n- &lt;strong&gt;A ledger that doesn't balance&lt;/strong&gt; — cash/position conservation breaks, and the PnL is fiction.\n- &lt;strong&gt;Fees and funding counted zero times (or twice)&lt;/strong&gt; — the cost model quietly drops out.\n- &lt;strong&gt;Exit logic that scans the whole window&lt;/strong&gt; instead of the current bar.\n\nI packaged those four checks into a small, dependency-free Python toolkit (no numpy, no pandas):\n\n&lt;br&gt;
&lt;br&gt;
&lt;code&gt;\npip install backtest-audit-kit\n&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
\n\n- a look-ahead detector\n- ledger invariants (cash/position conservation)\n- a fee / funding double-count detector\n- mutation testing, to find blind spots in your own test suite\n\n*&lt;em&gt;A worked example.&lt;/em&gt;* &lt;code&gt;cases/&lt;/code&gt; ships a real BTC backtest whose cost model was zero — reported PnL came out at roughly &lt;strong&gt;5.7x the principal&lt;/strong&gt;. But the structural problem was worse than the bug: the take-profit needed &lt;strong&gt;+0.08%&lt;/strong&gt; while a round-trip taker fee is &lt;strong&gt;0.10%&lt;/strong&gt;, so every winning trade net-loses &lt;em&gt;by construction&lt;/em&gt;. No amount of parameter tuning fixes that.\n\nRepo: &lt;a href="https://github.com/rytjy/backtest-audit-kit%5Cn%5Cn**What" rel="noopener noreferrer"&gt;https://github.com/rytjy/backtest-audit-kit\n\n**What&lt;/a&gt; check would you add?** I'm collecting the ones I haven't automated yet.&lt;/p&gt;

</description>
      <category>python</category>
      <category>trading</category>
      <category>showdev</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
