<?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: Sergei B</title>
    <description>The latest articles on DEV Community by Sergei B (@sergei_b).</description>
    <link>https://dev.to/sergei_b</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%2F4202784%2F8730e4d2-7216-4059-8567-786529cc541d.jpg</url>
      <title>DEV Community: Sergei B</title>
      <link>https://dev.to/sergei_b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sergei_b"/>
    <language>en</language>
    <item>
      <title>Why Our Trading Bot's Worst Drawdown Didn't Happen on Crash Day</title>
      <dc:creator>Sergei B</dc:creator>
      <pubDate>Thu, 05 Nov 2026 05:06:41 +0000</pubDate>
      <link>https://dev.to/sergei_b/why-our-trading-bots-worst-drawdown-didnt-happen-on-crash-day-k0k</link>
      <guid>https://dev.to/sergei_b/why-our-trading-bots-worst-drawdown-didnt-happen-on-crash-day-k0k</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: this article was drafted with AI assistance from our archived backtest results. The charts and numerical examples are calculated from data, not generated illustrations.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;October 10, 2025 looks like the obvious date to investigate a crypto trading system. A market-wide liquidation event is difficult to miss. Yet the lowest point in one of our stress tests occurred on July 20, while the market benchmark was above its level at the start of the test.&lt;/p&gt;

&lt;p&gt;The useful engineering question was not "Did the bot survive the crash?" It was: &lt;strong&gt;which account series are we measuring, and what happens between closed trades?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We develop several automated strategies. Here, Mars and Neptune are labels for two selected versions, not coins. Everything below is a historical simulation, not a live account record.&lt;/p&gt;

&lt;h2&gt;
  
  
  A date is not a risk metric
&lt;/h2&gt;

&lt;p&gt;Both stress tests began with 2,500 USDT on June 25 and ended on October 24, 2025. In Mars, the recorded account value fell as low as 842.96 USDT. Its maximum marked-to-market drawdown was 70.00% from the preceding peak, not 70% of the initial deposit.&lt;/p&gt;

&lt;p&gt;Now take one specific interval: October 10 at 00:00 UTC to October 11 at 00:00 UTC.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Series&lt;/th&gt;
&lt;th&gt;Change during that interval&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Market benchmark&lt;/td&gt;
&lt;td&gt;−10.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mars account value&lt;/td&gt;
&lt;td&gt;+2.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Neptune account value&lt;/td&gt;
&lt;td&gt;−22.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;But over the &lt;strong&gt;whole stress window&lt;/strong&gt;, Mars finished at −4.08%, while Neptune finished at +20.74%. Those final returns include the model's end-of-test closure of remaining positions. The plotted account series includes positions still open at each observation; it is not the same output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0qztujgg1yfnhcfknv9i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0qztujgg1yfnhcfknv9i.png" alt="Mars and Neptune during the stress window, with a separate market benchmark. Historical backtest, not a live account." width="800" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The benchmark is a capitalization-weighted basket reconstructed from Open Crypto Pricing's daily market factor. It is not total crypto market capitalization. None of these comparisons isolates the cause of the strategy's losses.&lt;/p&gt;

&lt;h2&gt;
  
  
  A closed-balance curve can hide an open loss
&lt;/h2&gt;

&lt;p&gt;Consider a deliberately small, fictional account. There are no deposits or withdrawals. "Settled balance" means account cash after realized results and already-booked charges; "open P&amp;amp;L" is the unrealized result of positions that remain open.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Observation&lt;/th&gt;
&lt;th&gt;Settled balance&lt;/th&gt;
&lt;th&gt;Open P&amp;amp;L&lt;/th&gt;
&lt;th&gt;Account equity&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;2,500&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;2,500&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;2,800&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;2,800&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2,800&lt;/td&gt;
&lt;td&gt;−200&lt;/td&gt;
&lt;td&gt;2,600&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;2,800&lt;/td&gt;
&lt;td&gt;−1,000&lt;/td&gt;
&lt;td&gt;1,800&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;2,900&lt;/td&gt;
&lt;td&gt;−700&lt;/td&gt;
&lt;td&gt;2,200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;2,900&lt;/td&gt;
&lt;td&gt;−100&lt;/td&gt;
&lt;td&gt;2,800&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The settled balance never decreases. Its drawdown is zero. Equity falls from 2,800 to 1,800: a 35.71% drawdown.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flfdzmxe9zg3vq12wmm8n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flfdzmxe9zg3vq12wmm8n.png" alt="Fictional example: an increasing settled balance alongside a falling account-equity series." width="800" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is not evidence that our particular closed-balance curve hid exactly these losses. It is a minimal example of why a closed-trades-only metric cannot answer the same question as marked-to-market account equity.&lt;/p&gt;

&lt;p&gt;Here is the complete calculation for ordered, nonnegative observations with positive initial equity:&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="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;isfinite&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;max_drawdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;values&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;empty series&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;isfinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;non-finite or negative account value&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;initial value must be positive&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;peak&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;worst&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;peak&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;peak&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;worst&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;worst&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;peak&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;peak&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;worst&lt;/span&gt;

&lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2900&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2900&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;equity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2800&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="nf"&gt;max_drawdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;balance&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;max_drawdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;equity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2800&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mf"&gt;1e-12&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;max_drawdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;equity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# 35.71%
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function does not infer missing observations, account for external cash flows, or support negative-equity accounts. Those need explicit treatment, not a silent patch to the denominator.&lt;/p&gt;

&lt;h2&gt;
  
  
  What our archives establish, and what they do not
&lt;/h2&gt;

&lt;p&gt;The runs use fixed historical Bybit candles and one-minute execution detail. Fees and recorded funding payments are part of the simulation. Account-value observations are recorded at fixed intervals.&lt;/p&gt;

&lt;p&gt;That last distinction matters: &lt;strong&gt;one-minute execution detail does not turn a periodically sampled account series into a continuous risk measurement.&lt;/strong&gt; A deeper move between observations can be missed.&lt;/p&gt;

&lt;p&gt;We read the account series from the archived result, calculate the running high-water mark, and keep the peak and trough timestamps with the drawdown. We keep the final backtest return separate, because end-of-window closures can change the reported result.&lt;/p&gt;

&lt;p&gt;Fixed inputs make a replay more reproducible. They do not prove absence of overfitting, establish that an interval was held out, or simulate exchange order queues and crash-day liquidity.&lt;/p&gt;

&lt;p&gt;We also run annual and uninterrupted multi-year windows. In a separate Mars run from January 1, 2024 to September 25, 2026, final return was +711.28% and sampled marked-to-market drawdown was 22.71%. It used different capital-accounting settings from the stress run. It is not a curve we can splice onto the stress test.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A crash-day result tells you what happened on crash day. A drawdown calculation tells you how far the account fell from its own prior peak. Neither should be substituted for the other.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For developers building similar reports: does your displayed drawdown come from closed trades, settled balance, or account equity? And is its sampling interval visible beside the number?&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;Strategy figures come from our archived result reports and sampled account-value series. The toy example is fictional. No strategy entry rules or parameters are required to reproduce the toy calculation.&lt;/p&gt;

&lt;p&gt;Market benchmark: Sebastian Stoeckl and Moritz Pukrop (2026), &lt;a href="https://opencryptopricing.com/download.html" rel="noopener noreferrer"&gt;Open Crypto Pricing&lt;/a&gt;, &lt;a href="https://creativecommons.org/licenses/by/4.0/" rel="noopener noreferrer"&gt;CC BY 4.0&lt;/a&gt;. We add RF back to CMKT, compound the daily returns, and normalize to 100 at the window's start. End-of-day dates are aligned to the following midnight UTC.&lt;/p&gt;

</description>
      <category>python</category>
      <category>testing</category>
      <category>datascience</category>
    </item>
    <item>
      <title>A Good Fill Price. What About the Fee?</title>
      <dc:creator>Sergei B</dc:creator>
      <pubDate>Tue, 27 Oct 2026 12:51:23 +0000</pubDate>
      <link>https://dev.to/sergei_b/a-good-fill-price-what-about-the-fee-41mh</link>
      <guid>https://dev.to/sergei_b/a-good-fill-price-what-about-the-fee-41mh</guid>
      <description>&lt;p&gt;A limit order. You bought at exactly the price you specified, or even a little cheaper. So far, so good. But there is another line worth checking: what did the exchange charge for that fill?&lt;/p&gt;

&lt;p&gt;You can get a good price and still pay the taker fee. There is no contradiction.&lt;/p&gt;

&lt;p&gt;I develop software for automated trading. In the comments on my &lt;a href="https://dev.to/sergei_b/a-good-price-is-not-yet-a-trade-1mab"&gt;previous article&lt;/a&gt;, a reader corrected our explanation: a fill better than the limit can mean that the order took an offer already resting in the book. I agreed. Then I wanted to check the next question: what if the fill is not better, but exactly at the limit? How often do we still pay as takers?&lt;/p&gt;

&lt;p&gt;For a bot, this is more than a terminology issue. It buys and sells repeatedly. Get the fee assumption wrong in a backtest, and the same mistake is repeated with every trade.&lt;/p&gt;

&lt;h2&gt;
  
  
  I Got My Price. Why Am I the Taker?
&lt;/h2&gt;

&lt;p&gt;Suppose I am willing to buy at no more than 100. A seller is already offering 99 in the order book, the list of other participants' orders. My limit order buys from that seller at 99.&lt;/p&gt;

&lt;p&gt;The price is fine: I was willing to pay up to 100 and got 99. But I did not post an order and wait for someone to trade against it. I traded against someone who was already there. That makes me the taker in this fill. The maker was the participant whose offer was waiting for me.&lt;/p&gt;

&lt;p&gt;Now replace 99 with 100. The seller is already offering 100, and I buy at 100. The fill matches my limit, but my role has not changed. I am still taking an existing offer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The limit says, "Don't pay more than this." It does not say, "Charge me the lower fee."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgfu8lmbvdekhlirnjwn2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgfu8lmbvdekhlirnjwn2.jpg" alt="A limit caps the price, not the fee: buying from a seller already in the book at 99 or at 100 makes you the taker either way" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Instead of Debating the Terms, Check the Records
&lt;/h2&gt;

&lt;p&gt;I took two exports from live accounts running our bots: Bybit perpetual futures, from August 29 to the morning of October 25, 2026, in UTC. Not demo trades or a backtest.&lt;/p&gt;

&lt;p&gt;They contain 6,237 individual trade executions. Of these, 327 came from market orders and 5,910 from limit orders. The latter are what matters here. One order could fill in several parts, so we are counting fills, not orders.&lt;/p&gt;

&lt;p&gt;The sources differ slightly. In the first, the exchange records each fill's role with the &lt;code&gt;isMaker&lt;/code&gt; field. The second is a spreadsheet export without that flag, so I classified fills by their fee rate. Only two rates appeared: the account's 0.036% maker rate and 0.1% taker rate. That is a fee-based classification, not an explicit exchange flag. On the first account I also checked the fee rate against the exchange flag: there were no mismatches.&lt;/p&gt;

&lt;p&gt;For a buy, a price below the limit was better; for a sell, a price above it was better. I compared against the order price in the exchange record, not an assumed market quote.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Fill price&lt;/th&gt;
&lt;th&gt;Maker&lt;/th&gt;
&lt;th&gt;Taker&lt;/th&gt;
&lt;th&gt;Taker share&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Better than limit&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1,218&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;At the limit&lt;/td&gt;
&lt;td&gt;1,257&lt;/td&gt;
&lt;td&gt;3,435&lt;/td&gt;
&lt;td&gt;73.21%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;All limit-order fills&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1,257&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4,653&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;78.73%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;All 1,218 fills better than the limit were classified as taker under these two methods. But here is the row I wanted to investigate: of the 4,692 fills exactly at the limit, 3,435 were taker fills. Roughly three out of four.&lt;/p&gt;

&lt;p&gt;The accounts show a similar pattern separately: 72.57% on the first, using the exchange's explicit flag, and 73.88% on the second, using fee-rate classification.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd3d2fgep1gua49kqin9e.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd3d2fgep1gua49kqin9e.jpg" alt="Fills exactly at the limit: 73.21% taker, 26.79% maker; all 1,218 fills better than the limit were taker" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is not a proportion for bots in general. It is what we found on two accounts over this period. The exports do not explain exactly how the bots produced that mix: they contain no order-book snapshot from when an order was submitted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Now for the Money
&lt;/h2&gt;

&lt;p&gt;To calculate the average fee, I added the trading fees paid and divided by the total traded value of purchases and sales in USDT. Not by the deposit or the number of trades: a small fill should not carry the same weight as a large one.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Included executions&lt;/th&gt;
&lt;th&gt;Average fee on executed turnover&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Limit-order fills only&lt;/td&gt;
&lt;td&gt;0.07918%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;All fills, including market orders&lt;/td&gt;
&lt;td&gt;0.08022%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;There is real money behind those small percentages. The exchange charged &lt;strong&gt;483.56 USDT&lt;/strong&gt; for the two accounts' limit-order fills. Apply the 0.036% maker rate to exactly the same turnover and the bill would be &lt;strong&gt;219.85 USDT&lt;/strong&gt;. The difference is &lt;strong&gt;263.71 USDT&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxu4u363qgh31s8af88rf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxu4u363qgh31s8af88rf.jpg" alt="Fees on limit-order fills: 483.56 USDT charged vs 219.85 USDT at the maker rate on the same turnover, a 263.71 USDT difference" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is why the check matters. Seeing Limit in a bot's settings is not enough reason to put the maker rate into a backtest. Otherwise, the savings exist only on paper.&lt;/p&gt;

&lt;p&gt;This compares fees on fills that already happened. It is not a loss of account capital or the result of another backtest. A different order-placement method could also change which trades happened.&lt;/p&gt;

&lt;p&gt;Our earlier backtests used 0.06%, not 0.036%. The maker-only assumption here is a hypothetical example. Those rates also apply to the accounts examined; another account's rates need to be checked separately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Not Just Rule Out Taker Fills?
&lt;/h2&gt;

&lt;p&gt;That is what Post-Only is for. On Bybit, such an order is cancelled if it would immediately take an existing offer when placed. It does not become a cheaper filled order: instead of a purchase, you may get a cancellation.&lt;/p&gt;

&lt;p&gt;Trying again requires another order. Meanwhile, the market may move away. So "turn on Post-Only and keep the same trades at lower fees" is still a claim to test. The comparison needs prices, partial fills and trades that never happened, not just the fee rate.&lt;/p&gt;

&lt;p&gt;I did not test that change here. We counted how the existing orders filled, rather than establishing that they should be placed differently.&lt;/p&gt;

&lt;p&gt;You can check your own account without another backtest: take the execution export, check the roles and rates, add the trading fees and divide by the total traded value. Choosing between ordinary limit orders and Post-Only takes a separate test.&lt;/p&gt;

&lt;p&gt;A good fill price is still a good fill price. Execution just has two separate characteristics: the price you got and what the exchange charged. One does not tell you the other.&lt;/p&gt;

&lt;p&gt;The limit order did its job: it capped the price. It never promised the maker fee.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Method note: funding, the separate payments associated with holding perpetual positions, was excluded. The exports do not reconstruct order-revision history or time spent in the queue. No fills worse than the recorded limit were found; that is a consistency check, not evidence of zero slippage relative to the market. Bybit documents &lt;code&gt;isMaker&lt;/code&gt; in its &lt;a href="https://bybit-exchange.github.io/docs/v5/order/execution" rel="noopener noreferrer"&gt;execution-history reference&lt;/a&gt; and Post-Only in its &lt;a href="https://www.bybit.com/en/help-center/article/Post-Only-Order" rel="noopener noreferrer"&gt;help centre&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Prepared with AI assistance; all figures checked against exchange records.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>trading</category>
      <category>finance</category>
      <category>datascience</category>
      <category>cryptocurrency</category>
    </item>
    <item>
      <title>The backtest used a 0.06% fee. What was my account actually paying?</title>
      <dc:creator>Sergei B</dc:creator>
      <pubDate>Mon, 26 Oct 2026 16:33:28 +0000</pubDate>
      <link>https://dev.to/sergei_b/the-backtest-used-a-006-fee-what-was-my-account-actually-paying-flb</link>
      <guid>https://dev.to/sergei_b/the-backtest-used-a-006-fee-what-was-my-account-actually-paying-flb</guid>
      <description>&lt;p&gt;I develop trading bots. Our historical tests used a fee of 0.06% per side. When I checked the executions from one of my live accounts, though, the volume-weighted fee rate actually paid was about 0.0801%.&lt;/p&gt;

&lt;p&gt;That looks like a small difference. But fees apply to every fill, and a bot can generate a lot of them. I wanted to answer two questions: where did the different rate come from, and how much would it change one backtest?&lt;/p&gt;

&lt;h2&gt;
  
  
  What the account actually paid
&lt;/h2&gt;

&lt;p&gt;I took a Bybit crypto futures execution export covering August 29 to October 25, 2026. It contained 3,204 trade executions. Those are fills, not completed trades: a single order can fill in several parts.&lt;/p&gt;

&lt;p&gt;The executed notional was about 323,731.67 USDT. Trading fees totalled about 259.44 USDT.&lt;/p&gt;

&lt;p&gt;To calculate the average rate, I divided the fees paid by the executed notional:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;259.44 / 323,731.67 × 100% ≈ 0.0801%.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Funding payments for holding futures positions were excluded from that calculation. I used the fees charged on exchange executions, rather than adding up selected fee-related fields in the bot's database.&lt;/p&gt;

&lt;p&gt;This account had two rates: 0.036% for maker fills and 0.1% for taker fills. Maker executions add liquidity to the order book; taker executions remove it. Roughly 31% of the executed notional was maker and 69% taker. That mix produced the average fee rate.&lt;/p&gt;

&lt;p&gt;A limit order does not necessarily pay the maker rate. If it executes immediately against orders already resting in the book, it can be a taker execution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0cwizw3j27n780mkdr73.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0cwizw3j27n780mkdr73.png" alt="One Bybit account's fee schedule and its separately calculated volume-weighted fee rate" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Unchanged excerpt from my Bybit fee page, English interface, October 26, 2026: futures, standard crypto, Regular User. The average rate below was calculated separately from executions, August 29 – October 25. MNT discount display is off.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  One account is not the whole exchange
&lt;/h2&gt;

&lt;p&gt;Bybit says that rates may vary by region and VIP level, and directs users to their own fee page after identity verification. &lt;a href="https://www.bybit.com/en/help-center/article/Trading-Fee-Structure" rel="noopener noreferrer"&gt;Bybit's fee schedule and explanation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One more detail. Bybit's fee page shows rates in two places. The "My fee level" card for futures shows 0.036% maker and 0.1% taker for my account — the same rates recorded on the trade executions in the period I checked. But the general fee table in the English interface lists 0.02% and 0.055% for the same "Regular User" tier. It is easy to look at the wrong place, which is why I check my account's rate against executions.&lt;/p&gt;

&lt;p&gt;My result does not mean that every customer pays 0.0801%. Another account, with a different fee schedule and execution mix, may pay less.&lt;/p&gt;

&lt;p&gt;Freqtrade had not calculated some incorrect global average, either. We had explicitly supplied 0.06%, and it used that value. Custom backtest fees are documented in the &lt;a href="https://www.freqtrade.io/en/2026.8/backtesting/#supplying-custom-fee-value" rel="noopener noreferrer"&gt;Freqtrade manual&lt;/a&gt;. The question was whether the assumption matched the account, not whether the software could do the arithmetic.&lt;/p&gt;

&lt;h2&gt;
  
  
  One strategy, three fee rates
&lt;/h2&gt;

&lt;p&gt;For the experiment, I used one strategy, a starting balance of 2,500 USDT and the same historical dataset with one-minute detail. The window ran from January 1, 2024 to December 31, 2024 at 00:00 UTC. The final day of December was not included.&lt;/p&gt;

&lt;p&gt;Only the fee changed between scenarios. The 0.08% rate approximated the measured average for my account. I also tested 0.044% as a lower-cost scenario, not as a claim about the rate paid by everyone else. That is roughly what the same 31/69 split gives under Bybit's base futures table: 0.02% maker and 0.055% taker.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Fee per side&lt;/th&gt;
&lt;th&gt;Backtest return&lt;/th&gt;
&lt;th&gt;Difference from the baseline&lt;/th&gt;
&lt;th&gt;Closed trades&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0.044%&lt;/td&gt;
&lt;td&gt;+175.94%&lt;/td&gt;
&lt;td&gt;+60.82 USDT&lt;/td&gt;
&lt;td&gt;4,070&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.06%&lt;/td&gt;
&lt;td&gt;+173.51%&lt;/td&gt;
&lt;td&gt;Baseline&lt;/td&gt;
&lt;td&gt;3,936&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.08%&lt;/td&gt;
&lt;td&gt;+156.29%&lt;/td&gt;
&lt;td&gt;−430.34 USDT&lt;/td&gt;
&lt;td&gt;3,790&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Return here means the test's final profit divided by its starting balance. The USDT column is the difference between final backtest results, not simply the extra fees charged. These percentages describe the stated historical window; they are not a forecast.&lt;/p&gt;

&lt;p&gt;I also reran the original 0.06% case to check the baseline itself. All 3,936 trade records matched the old result exactly, including the nested order records.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvclxk3zgqw8n90tvey5v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvclxk3zgqw8n90tvey5v.png" alt="Returns and closed-trade counts for three backtests with different fee assumptions" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;All bars start at zero. The balance, data and settings were unchanged; only the flat fee changed. These are historical backtest returns, not live-account returns.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For completeness, the engine-reported drawdowns were 10.38%, 11.11% and 10.85%, respectively. That is its &lt;code&gt;max_drawdown_account&lt;/code&gt; metric, not a separately reconstructed mark-to-market drawdown including all open positions. I am not using those three figures as a measure of the strategy's full risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why subtracting extra fees was not enough
&lt;/h2&gt;

&lt;p&gt;On a fixed list of fills, changing the fee rate gives a straightforward cost recalculation. But that answers a narrow question: what would those same fills have cost at another rate?&lt;/p&gt;

&lt;p&gt;In our reruns, the trade set changed too: one scenario produced 3,790 closed trades and another 4,070.&lt;/p&gt;

&lt;p&gt;So, in this experiment, subtracting a different fee bill from the old result would not have reproduced the new run. I did not trace why each individual trade changed here. The summary figures therefore do not establish, for example, that trades all closed later.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check in your own test
&lt;/h2&gt;

&lt;p&gt;Start with the fee schedule for your account and instrument. Then check the fees actually charged on executions and compare them with the rate supplied to the backtest. Weight the average by executed notional; do not simply average the maker and taker rates.&lt;/p&gt;

&lt;p&gt;If the rates differ, keep two checks separate: repricing the old fill list and rerunning the strategy. They answer different questions.&lt;/p&gt;

&lt;p&gt;This experiment has limits. It covers one strategy and one historical window. Each run used a flat fee rather than a maker/taker classification for every simulated fill. The 0.08% scenario therefore does not recreate my account in every detail. It did not test slippage or order-book queue position. The strategy code is private, so readers cannot fully reproduce these particular runs without it.&lt;/p&gt;

&lt;p&gt;The practical conclusion is specific: &lt;strong&gt;a 0.06% assumption is not automatically wrong because my account pays more, and my account's rate is not universal. What matters is whether the test's assumptions match the conditions of the account.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>trading</category>
      <category>datascience</category>
      <category>finance</category>
      <category>python</category>
    </item>
    <item>
      <title>A Good Price Is Not Yet a Trade</title>
      <dc:creator>Sergei B</dc:creator>
      <pubDate>Fri, 23 Oct 2026 16:04:30 +0000</pubDate>
      <link>https://dev.to/sergei_b/a-good-price-is-not-yet-a-trade-1mab</link>
      <guid>https://dev.to/sergei_b/a-good-price-is-not-yet-a-trade-1mab</guid>
      <description>&lt;p&gt;When I look at the result of a trading bot, knowing how much it earned is not enough for me. I also want to understand a more down-to-earth thing: at what price did it actually buy and sell? The order asked for one price. Did the exchange give the same price, a better one, or a worse one?&lt;/p&gt;

&lt;p&gt;I checked this against backup copies of the databases of two of our live bots. I took the available history from 29 August to 22 October 2026. For this review I kept only limit orders — the ones that state a price boundary we agree to buy or sell at.&lt;/p&gt;

&lt;p&gt;The number that came out was reassuring: not a single fill was worse than the order's recorded price. But the check did not end there. In the same history I also found orders that were never filled at all. Price and the fact of a trade turned out to be two different questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, let's agree on what we're counting
&lt;/h2&gt;

&lt;p&gt;The sample has 2,242 limit orders in total. Of these, 2,219 received at least a partial fill, and 23 were cancelled without any fill. That is the first split:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2,242 = 2,219 filled + 23 unfilled.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now we look only at the first group. We compare the average fill price with each order's recorded price. Buying cheaper means better; selling higher also means better. The result:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1,759 orders filled exactly at the recorded price;&lt;/li&gt;
&lt;li&gt;460 got an average price better than the recorded one;&lt;/li&gt;
&lt;li&gt;0 got an average price worse than the recorded one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2,219 = 1,759 at the order price + 460 better + 0 worse.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The two splits are not there for the beauty of the arithmetic. If you place only "460 better" next to "23 not filled," you get a striking picture, but the meaning is lost: the first are counted among orders that were filled, the second are not part of that group at all.&lt;/p&gt;

&lt;p&gt;There is one more important detail. "Filled" does not mean "filled in full." Within our 2,219 there are 22 partially filled orders. They received part of the volume, and the rest was not filled. That is not the same case as a cancellation with no fill at all. When comparing prices, I used the average price of the part that was actually filled, rather than treating the whole order as completed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Entries and exits gave different numbers
&lt;/h2&gt;

&lt;p&gt;I looked separately at how the bots opened and increased positions, and how they exited them. First entries and follow-up add-on buys are combined into one group here. All the numbers below refer only to limit orders that were filled.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What the bot did&lt;/th&gt;
&lt;th&gt;Filled&lt;/th&gt;
&lt;th&gt;At recorded price&lt;/th&gt;
&lt;th&gt;Better&lt;/th&gt;
&lt;th&gt;Worse&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Entries and add-ons&lt;/td&gt;
&lt;td&gt;1,327&lt;/td&gt;
&lt;td&gt;1,101&lt;/td&gt;
&lt;td&gt;226&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exits&lt;/td&gt;
&lt;td&gt;892&lt;/td&gt;
&lt;td&gt;658&lt;/td&gt;
&lt;td&gt;234&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Together&lt;/td&gt;
&lt;td&gt;2,219&lt;/td&gt;
&lt;td&gt;1,759&lt;/td&gt;
&lt;td&gt;460&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On exits there were 234 better prices, on entries and add-ons 226, even though there are fewer exit orders. This is an observation, not an explanation. From this table I cannot say why it turned out this way: because of market movement, the chosen prices, or other fill conditions. Answering that would mean examining the specific orders and the situation around them.&lt;/p&gt;

&lt;p&gt;And 234 against 226 certainly does not mean exits earned more money thanks to their fills. What is counted here is cases, not profit. Orders can differ in volume and in the size of the price improvement.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F612j6hssng1zqzneubto.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F612j6hssng1zqzneubto.png" alt="Entries and add-ons versus exits: separate samples of filled limit orders" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why zero worse prices is no miracle
&lt;/h2&gt;

&lt;p&gt;A limit order is fairly literal. For a purchase it says: "no higher than the stated price." For a sale: "no lower." If you compare the fill price with that order's actual limit, excluding fees, a fill worse than the limit does not satisfy its condition.&lt;/p&gt;

&lt;p&gt;So our zero should not be presented as a special ability of the bot. It did not talk the exchange into waiving the rules of trading. We verified that the recorded fills in this sample were not worse than the orders' recorded prices.&lt;/p&gt;

&lt;p&gt;But a condition on price is not a promise to fill the whole volume. You can get a fill at the limit or better, you can get only part, or you can get nothing. The mere existence of an order does not mean a trade took place.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmsqkxbl6wrc0c6yvdisz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmsqkxbl6wrc0c6yvdisz.png" alt="A limit order caps the buy or sell price but does not guarantee a fill" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Our small rehearsal of a mistake
&lt;/h2&gt;

&lt;p&gt;While preparing a short post, I managed to mix two samples. The draft was about limit orders, but the count of better fills came in from a general tally: 516 instead of 460. The number was real, it just answered a different question. The general sample also included market orders; the check caught the mismatch before publication. In short, the post could be shortened — the check on it could not. In the final post the samples are already separated.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the 23 cancellations mean
&lt;/h2&gt;

&lt;p&gt;In the databases these 23 limit orders have a cancelled status and zero fills. That is all that can be said with confidence about their outcome within this count.&lt;/p&gt;

&lt;p&gt;Calling them "23 lost profitable trades" would be an invention. We did not calculate what would have happened under a different decision. A cancelled order is not a loss, but it cannot be counted as filled either. Besides, an order is not the same as a whole position: one position can contain several orders.&lt;/p&gt;

&lt;p&gt;I did not establish the cause of each cancellation here. Was there not enough counter-volume, did the price move, did another order appear afterwards, why was this particular one cancelled? The finished measurement has no verified answer for each case. I chose not to pick the most convenient explanation.&lt;/p&gt;

&lt;p&gt;For me these 23 matter above all as part of the whole picture. If you show only the prices of fills that happened, you can quietly strike out the orders that never got there. Then everything told would be true, but the telling would stay incomplete.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which price I compared against
&lt;/h2&gt;

&lt;p&gt;This is the main boundary of the measurement. The comparison price is taken from the order's record in the database. It is not a separate market quote saved at the moment of sending, and not a promise that at that exact price, at that moment, the whole needed volume could have been bought or sold.&lt;/p&gt;

&lt;p&gt;For limit orders, this comparison answers a clear question: how does the average fill price relate to the recorded price limit? But it does not measure all the possible costs of real trading.&lt;/p&gt;

&lt;p&gt;I did not include market orders in this table. For them, comparing the fill with a recorded reference price does not by itself prove a gain relative to the market available at the time. So you cannot take the resulting zero, stretch it over all order types, and declare: "we have no slippage."&lt;/p&gt;

&lt;p&gt;Fees also stayed outside the price comparison: the exact fee of each individual fill cannot be established from this data. A better price does not mean a free trade. And the money difference between two prices cannot simply be added to the bot's profit: that is not a calculation of how the whole trading would have gone under a different fill.&lt;/p&gt;

&lt;p&gt;Finally, this is about two databases and the stated period. From this observation no rule follows for all bots, all exchanges, and all future orders. A database stores history, but it does not by itself prove that the trading regime stayed unchanged throughout.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I took away from the check
&lt;/h2&gt;

&lt;p&gt;I did not get proof of perfect execution, but a more precise description of our sample. Among filled limit orders, no case worse than the recorded price was found. Some got a better price. Cancellations with no fill and partially filled orders remain a separate matter.&lt;/p&gt;

&lt;p&gt;Now, when I see a pretty number about fills, I want to ask three questions. Which price was the comparison against? Which orders went into the count? And where did the ones that were never filled go?&lt;/p&gt;

&lt;p&gt;The answers do not make the result worse. They let you understand what exactly it shows. A good price matters. It just does not yet mean the order turned into a trade.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This is a review of a specific measurement, not a recommendation to make trades and not a promise of future results. The text and illustrations were prepared with the help of AI and verified against the measurement tables.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>trading</category>
      <category>datascience</category>
      <category>finance</category>
      <category>python</category>
    </item>
  </channel>
</rss>
