<?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: Jack Chen</title>
    <description>The latest articles on DEV Community by Jack Chen (@jacktrader).</description>
    <link>https://dev.to/jacktrader</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3977439%2Fa3ff3f15-83d5-431a-9276-dac37e13a3f8.png</url>
      <title>DEV Community: Jack Chen</title>
      <link>https://dev.to/jacktrader</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jacktrader"/>
    <language>en</language>
    <item>
      <title>The Fee Assumption Quietly Wrong in Most Backtests</title>
      <dc:creator>Jack Chen</dc:creator>
      <pubDate>Mon, 15 Jun 2026 04:02:57 +0000</pubDate>
      <link>https://dev.to/jacktrader/the-fee-assumption-quietly-wrong-in-most-backtests-1jpa</link>
      <guid>https://dev.to/jacktrader/the-fee-assumption-quietly-wrong-in-most-backtests-1jpa</guid>
      <description>&lt;p&gt;If you've written a crypto backtester, there's a decent chance one line in it is quietly wrong. It's not the slippage model, not the funding rate, not the fill logic. It's the fee.&lt;/p&gt;

&lt;p&gt;I've reviewed a lot of grid-bot and market-making backtests over the past couple of years, and the fee handling falls into three buckets, roughly in order of how common they are:&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;fee&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;              &lt;span class="c1"&gt;# "I'll add fees later" (you won't)
&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="c1"&gt;# 0.1%, the spot default everyone copies
&lt;/span&gt;&lt;span class="n"&gt;fee&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;taker_rate&lt;/span&gt;       &lt;span class="c1"&gt;# better, but still missing two layers
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a low-frequency swing strategy, getting the fee wrong by a few basis points is noise. For anything that churns — grids, scalpers, MM, anything with a high turnover ratio — the fee assumption is one of the largest single error terms in the whole backtest. And it's wrong in a direction that flatters your results, which is the worst kind of wrong.&lt;/p&gt;

&lt;p&gt;Let me break down the four things a realistic fee model needs, then show what happens to net PnL when you actually wire them in.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Maker/taker asymmetry is not a rounding error
&lt;/h2&gt;

&lt;p&gt;The 0.1% default comes from Binance &lt;strong&gt;spot&lt;/strong&gt;, where maker and taker are symmetric at the Regular tier. But most bot volume lives in USDT-M perpetual futures, where the schedule is asymmetric. Per Binance's official fee schedule, USDT-M futures at the Regular tier are roughly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maker: &lt;strong&gt;0.02%&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Taker: &lt;strong&gt;0.05%&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's a 2.5x difference between the two. If your grid uses post-only limit orders for entries and exits (as most well-built grids do), you're paying the maker rate on the bulk of your fills — which means a backtest hardcoded at 0.1% is overcharging you by 5x, and a backtest hardcoded at the taker rate is overcharging you by 2.5x.&lt;/p&gt;

&lt;p&gt;Either way, the point stands: a single &lt;code&gt;fee&lt;/code&gt; constant cannot represent reality. You need to model your &lt;strong&gt;maker share&lt;/strong&gt; — the fraction of fills that rest on the book versus cross the spread:&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;blended_rate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;maker_rate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;taker_rate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;maker_share&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;maker_rate&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;maker_share&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;taker_rate&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;maker_share&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# A tight grid running post-only exits, ~90% maker:
&lt;/span&gt;&lt;span class="nf"&gt;blended_rate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.0002&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0005&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.90&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# -&amp;gt; 0.000230  (2.3 bps)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your maker share is a real, measurable property of your strategy. Pull it from your fill logs. Don't guess it, and definitely don't assume 100% — even post-only grids eat taker fills when the market gaps through a level.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The BNB / token discount
&lt;/h2&gt;

&lt;p&gt;If you pay fees in BNB on Binance, futures fees drop by a further 10% (spot gets 25%), per the exchange's official schedule. OKX has an equivalent mechanic. This is a flat multiplier on the blended rate:&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;after_token_discount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;discount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.10&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;rate&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;discount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Small, but it stacks, and stacking is the whole game here.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. VIP tiers — model the tier you're actually in
&lt;/h2&gt;

&lt;p&gt;Exchange fee schedules step down as 30-day volume climbs. The trap in backtesting is assuming the VIP-9 maker rate while testing a strategy that will never do VIP-9 volume. Model the tier your live volume actually qualifies for. If you're a $20M/month desk, that's roughly VIP 1 territory on Binance futures — meaningful, but not the rebate-on-fills fantasy of the top tiers. Be honest about where you sit.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The rebate layer almost nobody models
&lt;/h2&gt;

&lt;p&gt;This is the one that's genuinely absent from most backtests, because most devs don't know it exists. A meaningful slice of the fee you pay can come back to you as a rebate.&lt;/p&gt;

&lt;p&gt;Exchanges run affiliate / sub-broker programs that pay a share of the fees your account generates. If your account is bound to such a channel, you get a slice back — single-level referral, paid on your own trading volume, typically settled weekly. The headline figure is &lt;strong&gt;up to 40%&lt;/strong&gt; of the affiliate's fee share (the exact number depends on the exchange's official schedule, your account status, review, and your jurisdiction — it's a maximum reference, not a guaranteed return).&lt;/p&gt;

&lt;p&gt;The key insight for a quant: this is not a marketing perk, it's a term in your cost function. It applies &lt;em&gt;after&lt;/em&gt; the discount, on the fees you've already paid:&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;effective_fee&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;notional&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;blended&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;token_discount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rebate&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;gross&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;notional&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;blended&lt;/span&gt;
    &lt;span class="n"&gt;after_discount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gross&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;token_discount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;net&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;after_discount&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;rebate&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;net&lt;/span&gt;

&lt;span class="c1"&gt;# $20M monthly notional, 90% maker, BNB discount, up to 40% rebate
&lt;/span&gt;&lt;span class="nf"&gt;effective_fee&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20_000_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.000230&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.40&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# -&amp;gt; $2,484
# vs the naive 0.1% model on the same notional:
&lt;/span&gt;&lt;span class="mi"&gt;20_000_000&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.001&lt;/span&gt;                                &lt;span class="c1"&gt;# -&amp;gt; $20,000
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The naive model says you'll pay $20k/month in fees. The realistic model says ~$2.5k. That's not a tweak — it's an &lt;strong&gt;8x&lt;/strong&gt; difference in your single largest controllable cost. A strategy that looks marginal at 0.1% can be solidly profitable once you model the fee correctly; conversely, a strategy that looks great at 0-fee can be dead on arrival.&lt;/p&gt;

&lt;h2&gt;
  
  
  Worked example: a 5-bot grid desk
&lt;/h2&gt;

&lt;p&gt;Take a desk running five grid bots at $20M combined monthly notional, split $16M maker / $4M taker. Working it through the official Binance futures schedule:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Monthly cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gross fees (0.02% / 0.05% blended)&lt;/td&gt;
&lt;td&gt;~$5,200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;After BNB discount (−10% futures)&lt;/td&gt;
&lt;td&gt;~$4,680&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;After rebate (up to 40% back, weekly)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~$2,808 net&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Roughly &lt;strong&gt;$1,872/month recovered&lt;/strong&gt; that a naive backtest would have silently expensed — about $22k/year. On a strategy whose edge might be a few hundred bps annually on deployed capital, that rebate layer can be the difference between green and red. The full grid-specific breakdown, including how maker-share optimization interacts with VIP tiers, is laid out here: &lt;a href="https://www.jacktrader.xyz/en/blog/grid-bot-fee-optimization.html" rel="noopener noreferrer"&gt;grid-bot fee optimization&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The practical takeaway
&lt;/h2&gt;

&lt;p&gt;Replace your &lt;code&gt;fee&lt;/code&gt; constant with an effective-fee function:&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;effective&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;blended_rate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&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;maker_share&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;token_discount&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;rebate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then sanity-check it against your real account: pull a month of fills, sum what you actually paid net of any rebate, and reconcile it against what your model predicts. If they don't match, your backtest's PnL is fiction at the margin — and for a high-turnover strategy, the margin is the whole business.&lt;/p&gt;

&lt;p&gt;Two honest caveats. First, rebate eligibility and exact rates depend on the exchange's official program, account review, and your local regulations and KYC — model it as "up to," never as a guaranteed number. Worth noting the channels are single-level referral on your own volume, not anything multi-tier. Second, none of this is investment advice; it's cost modeling. A correctly modeled fee can turn a losing strategy profitable on paper, but it doesn't change the strategy's actual edge — it just stops you from lying to yourself about your costs. If you want the mechanics of how the rebate is structured and settled, the reference I used is here: &lt;a href="https://www.jacktrader.xyz/en/okx-rebate.html" rel="noopener noreferrer"&gt;OKX rebate / sub-broker&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Model your real effective fee. It's the cheapest alpha in your stack — you're already paying for it.&lt;/p&gt;

</description>
      <category>crypto</category>
      <category>trading</category>
      <category>algotrading</category>
    </item>
    <item>
      <title>Grid Bot Fees Are Quietly Eating Your Returns: The Quant Fee Checklist</title>
      <dc:creator>Jack Chen</dc:creator>
      <pubDate>Wed, 10 Jun 2026 10:20:34 +0000</pubDate>
      <link>https://dev.to/jacktrader/grid-bot-fees-are-quietly-eating-your-returns-the-quant-fee-checklist-2cbc</link>
      <guid>https://dev.to/jacktrader/grid-bot-fees-are-quietly-eating-your-returns-the-quant-fee-checklist-2cbc</guid>
      <description>&lt;p&gt;If you run a grid bot or any automated strategy, you've optimized the spacing, the range, the rebalance logic. But the fee side often goes unexamined — and on a high-churn bot it can quietly eat 20-30% of your gross returns. Here's the checklist I use.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Know your &lt;em&gt;effective&lt;/em&gt; fee, not the headline
&lt;/h2&gt;

&lt;p&gt;The exchange shows 0.02% maker / 0.05% taker on futures. Your real cost is the blend:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;effective_fee = maker_share * maker_fee + (1 - maker_share) * taker_fee&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Most bot operators assume they're mostly maker. Verify it. If your grid uses post-only orders you should be 90%+ maker. If you cross the spread to guarantee fills, you're paying taker on those, and it adds up fast.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Three levers that cut the effective fee
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Maker share&lt;/strong&gt; — switch limit orders to post-only (rejected if it would take, so you never accidentally pay taker).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VIP tier&lt;/strong&gt; — your 30-day volume already discounts your base fee; concentrate volume on one venue to climb faster.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fee rebate&lt;/strong&gt; — a referral / sub-broker channel passes back a percentage of the fee you pay. It stacks on top of the VIP tier and token discount (BNB / OKB); it does not replace them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. The rebate is the most-overlooked lever
&lt;/h2&gt;

&lt;p&gt;The standard referral code caps the rebate at ~20%. A sub-broker channel pushes it toward 40%. For a bot doing $5M/month that's a few hundred dollars a month back — pure margin, no strategy change.&lt;/p&gt;

&lt;p&gt;Full grid-bot fee math (worked examples for $5M / $20M / $50M desks, Binance vs OKX vs perp DEX): &lt;a href="https://www.jacktrader.xyz/en/blog/grid-bot-fee-optimization.html" rel="noopener noreferrer"&gt;https://www.jacktrader.xyz/en/blog/grid-bot-fee-optimization.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Free calculator for the effective-fee math on both exchanges: &lt;a href="https://www.jacktrader.xyz/en/" rel="noopener noreferrer"&gt;https://www.jacktrader.xyz/en/&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Up to 40% is a maximum, not guaranteed. Independent referral / sub-broker partner, not affiliated with Binance or OKX. Not financial advice.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>crypto</category>
      <category>trading</category>
      <category>python</category>
    </item>
  </channel>
</rss>
