Skip to content

Round closed-trade statistics with SmartRounding instead of two decimals - #10204

Merged
quantconnect-kronos[bot] merged 5 commits into
masterfrom
kronos/bug-10137-trade-statistics-precision
Nov 18, 2026
Merged

quantconnect-kronos[bot] merged 5 commits into
masterfrom
kronos/bug-10137-trade-statistics-precision

Conversation

@quantconnect-kronos

@quantconnect-kronos quantconnect-kronos Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

TradeBuilder rounded each closed trade's ProfitLoss, MAE, MFE and EndTradeDrawdown to two decimal places, whatever the account currency. In an account denominated in a currency like BTC, ordinary amounts are far below 0.01. For example, a $10 profit at a USD→BTC rate of 0.000025 is 0.00025 BTC, and it was stored as 0.00. The trade was then also classified as a loss (IsWin = false), which skews the trade statistics built from these values.

This replaces the two-decimal Math.Round(x, 2) on those ten assignments, in all three fill-grouping methods (FillToFill, FlatToFlat, FlatToReduced), with SmartRounding(), as decided on #10137. It's the rounding ChartPoint and Candlestick already use: 4 decimal places above 1000, and 7 significant digits otherwise. Small account-currency amounts such as 0.00025 BTC are kept, and the decimal noise of averaged or inverse prices is dropped, so 1000 stays 1000, not 999.999999999999999999988.

SmartRounding() checks input > 1000 rather than the absolute value, so values at or below -1000 round to 7 significant digits. For example, an inverse future's MAE of -1222.2222… becomes -1222.222. Charts behave the same way, and this was left as is by decision.

FlatToFlat and FlatToReduced computed ProfitLoss from running averages of the fill values (avg += (v - avg) * q / total). Each step's division leaves residue, so a breakeven trade could come out as, say, -3.6e-27 instead of 0. The old two-decimal rounding hid that, but SmartRounding() keeps seven significant digits of it. The trade then counted as a win or a loss, and the following trade statistics could overflow, dividing by that residue in the profit-loss ratio. These two paths now sum quantity × value over the entry and exit fills. FlatToReduced takes the profit from those totals directly, with no division. FlatToFlat takes it as (exit total / exit quantity − entry total / entry quantity) × entry quantity, the same formula as before but with each average from a single division. When the closing fill also reverses the position, the two quantities differ, as before. A breakeven trade has equal averages, and the two divisions round to the same decimal, so its profit is exactly 0. The reported EntryPrice and ExitPrice averages are unchanged, and so is how a closing fill that also reverses the position is weighted (#9938 tracks that separately).

For inverse crypto futures, the per-fill values are -1/price, which decimal can't hold exactly. So even the summed totals of a true breakeven don't cancel. For example, buy 100 @ 40000, buy 100 @ 60000, sell 200 @ 48000 (the harmonic mean) came out as 8.8E-20. As decided on this pull request (option A), FlatToFlat and FlatToReduced treat a profit below 1e-20 × the trade's entry value as 0 before SmartRounding(). The bound is relative to the trade's size, not a fixed account-currency epsilon, so small real profits such as a BTC account's are kept.

Related Issue

Closes #10137

Motivation and Context

In non-USD-scale account currencies, profit, excursion and drawdown are zero, and profitable trades count as losses.

How Has This Been Tested?

  • New TradeBuilderTests.KeepsAccountCurrencyPrecision, one case per grouping method. It covers a USD-quoted trade in a BTC account and asserts ProfitLoss = 0.00025, IsWin = true, and, for FillToFill, MAE, MFE and EndTradeDrawdown exactly. It fails on master, where all three cases report 0.
  • Existing tests keep exact AreEqual assertions. The inverse crypto-future excursion test expects SmartRounding() of the exact fractions (11000m / 9 and so on) instead of Math.Round(…, 2). The inverse scale-in test sums trades that are each rounded on their own, so it compares the total 1900/3 within 0.001.
  • New TradeBuilderTests.BreakevenAveragedFillsHaveZeroProfit (FlatToFlat and FlatToReduced, FIFO and LIFO). It covers breakeven sequences such as buy 1 @ 3, 2 @ 11, 1 @ 1, sell 4 @ 6.5, and buy 9 @ 1, 4 @ 18, 5 @ 4, then sell 4 @ 18, 5 @ 4, 9 @ 1. In FlatToFlat it also covers breakeven reversals: buy 3 @ 50, sell 9 @ 50, buy 6 @ 50, and buy 1 @ 3, 2 @ 11, 1 @ 1, sell 6 @ 6.5, buy 2 @ 6.5. It also covers the inverse BTCUSD breakeven above, long and short, in FlatToFlat and FlatToReduced. Each sequence is run FIFO and LIFO and followed by a profitable trade. The test asserts every breakeven trade is exactly 0 and not a win, and that TradeStatistics builds. Without the relative bound, the inverse cases come out as ±8.8E-20 (FlatToFlat) and ±4.4E-20 (FlatToReduced). With running averages these trades came out as 8E-28 and -3.6E-27, and with the earlier quantity-ratio form the reversals came out as -2E-26 and 1E-27.
  • Built with dotnet build /p:Configuration=Release QuantConnect.Lean.sln. Full test suite with the CI filter (TestCategory!=TravisExclude&TestCategory!=ResearchRegressionTests): Passed! - Failed: 0, Passed: 39832, Skipped: 100, Total: 39932.
  • Tested end to end with a BTC-denominated algorithm that trades SPY. With this change, all 10 closed trades report nonzero BTC profit and excursions, rounded to 7 significant digits (for example pnl=-9.710185e-06, mfe=4.924451e-05), and the win/loss classification matches each trade's price move. The same algorithm without this change reports zero profit on those trades. A second end-to-end backtest uses a FlatToFlat trade builder through SetTradeBuilder and fills the breakeven sequence above, followed by a 10000 profit. The breakeven trade reports 0 and isn't a win, and all 27 summary statistics and the trade statistics are generated. The same holds for a breakeven reversal (buy 3 @ 50, sell 9 @ 50, buy 6 @ 50): both of its trades report 0. A third backtest trades coin-margined BTCUSD with a FlatToFlat trade builder. The inverse breakeven trade above reports 0 and isn't a win, and a following buy 1 @ 40000, sell 1 @ 44000 keeps its profit of 18.94815 USD and counts as a win.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves implementation)
  • Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-functional change (xml comments/documentation/etc)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

TradeBuilder rounded ProfitLoss, MAE, MFE and EndTradeDrawdown to two
decimal places, which zeroes ordinary amounts in accounts denominated in
currencies like BTC and misclassifies profitable trades as losses. Keep
the calculated values; formatting rounds them for display.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@quantconnect-kronos quantconnect-kronos Bot added kronos:develop:working develop: in progress kronos:review Request review labels Nov 18, 2026
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued kronos:review:working review: in progress and removed kronos:review Request review kronos:review:queued review: queued labels Nov 18, 2026
@quantconnect-kronos-reviewer
quantconnect-kronos-reviewer Bot marked this pull request as ready for review November 18, 2026 16:23

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. The change removes the two-decimal rounding of ProfitLoss, MAE, MFE and EndTradeDrawdown in all three grouping methods, which is exactly what #10137 asks for, and nothing else.

What I checked

  • CI: every run on e50c7ac passed (Build & Test, Regression, Research Regression, Report Generator, Syntax, Benchmarks, Python Virtual Environments). API Tests was skipped, as it is for pull requests.
  • KeepsAccountCurrencyPrecision fails on master in all three cases (Expected: 0.00025m But was: 0m) and passes with the change. All 483 QuantConnect.Tests.Common.Statistics tests pass locally.
  • End to end: I ran a backtest with a BTC account currency that trades SPY minute bars for a week. On master all 32 closed trades report ProfitLoss = MAE = MFE = EndTradeDrawdown = 0.00 and 0 wins, while 17 trades closed above entry. With this change no trade is zero, and the 17 wins are exactly the 17 trades that closed above entry (for example pnl=0.000493…, mfe=0.000576…).
  • Consumers: TradeStatistics and Extensions.IsWin only compare and sum these values, so full precision changes nothing except the intended win/loss classification. For option exercises, IsWin now compares an unrounded P&L with the unrounded ITM amount, which is more consistent than before. ReturnsPerTradeReportElement uses only entry and exit prices. No rounding is lost in serialization that wasn't already lost for EntryPrice.
  • Decimal noise near zero: the averaged values in FlatToFlat and FlatToReduced are computed as sum / quantity on both sides, so a trade with a true P&L of zero gives identical decimals and still comes out as 0, not a win from noise.

Note, not blocking: in USD accounts, closed-trade values in results now carry trailing digits such as 999.999999999999999999988 instead of 1000.00. The description says so, EntryPrice already does this for averaged entries, and keeping precision until formatting is what the issue proposes.

Other repositories: none need a change. There is no API or stub change.

Risk: risk:low. It's a 10-line bug fix that is easy to revert, with no API change and nothing new that can throw. It's backed by a test that fails without the fix, green CI including regression tests, and the end-to-end comparison above.

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added risk:low Low risk and removed kronos:review:working review: in progress labels Nov 18, 2026
@quantconnect-kronos quantconnect-kronos Bot added the kronos:review Request review label Nov 18, 2026
@Martin-Molinero

Copy link
Copy Markdown
Member

Keeping up to 28 significant digits on every closed trade is far more than we need, but rounding to 2 dp is what breaks BTC accounts. SmartRounding() handles both cases: it rounds to 4 dp above 1000 and to 7 significant digits below that.

Value Before (2 dp) This PR SmartRounding()
BTC profit 0.00 0.00025 0.00025
Inverse future profit 1000.00 999.999999999999999999988 1000
Inverse future MFE 1222.22 1222.2222… 1222.2222
  • Replace Math.Round(x, 2) with x.SmartRounding() on the 10 assignments. The tests can then go back to exact AreEqual on round values instead of Within(1e-18m).
  • ChartPoint.Y and Candlestick already round with it, so closed trades would match the equity chart, which goes through the same rounding.
  • One quirk: it checks input > 1000 rather than the absolute value, so values at or below -1000 round to 7 significant digits instead (-1,234,567.89 becomes -1,234,568). Charts already behave this way, so I wouldn't change it here.

Replace the full-precision values with SmartRounding, which keeps small
account-currency amounts such as BTC profits while dropping the decimal
noise of averaged and inverse prices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@quantconnect-kronos quantconnect-kronos Bot changed the title Keep account-currency precision in closed-trade statistics Round closed-trade statistics with SmartRounding instead of two decimals Nov 18, 2026
@quantconnect-kronos

Copy link
Copy Markdown
Contributor Author

Applied the SmartRounding() decision from #10137 in 3898122:

  • The 10 Math.Round(x, 2) assignments in TradeBuilder (ProfitLoss, MAE, MFE, EndTradeDrawdown, all three grouping methods) now use .SmartRounding() instead of keeping full precision.
  • I reverted the earlier Within(1e-18m) test changes, so the existing tests use exact AreEqual again. The scale-in, split and inverse profit cases pass unchanged, for example 1000 and 40. The inverse excursion test now expects SmartRounding() of the exact fractions, for example 1222.2222. As noted, negative values at or below -1000 round to 7 significant digits, for example -1222.222. The inverse scale-in test sums trades that are each rounded on their own, so it compares its total (1900/3) within 0.001.
  • KeepsAccountCurrencyPrecision (BTC account, 0.00025 profit and IsWin) still passes exactly and fails on master.
  • Full suite with the CI filter: 39823 passed, 0 failed. The end-to-end BTC-account check passes again: all 10 trades are nonzero, rounded to 7 significant digits, and every win/loss matches its price move.

The PR description is updated to match.

@quantconnect-kronos
quantconnect-kronos Bot marked this pull request as draft November 18, 2026 16:49
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued kronos:review:working review: in progress and removed kronos:review Request review kronos:review:queued review: queued labels Nov 18, 2026
@quantconnect-kronos quantconnect-kronos Bot added the kronos:review Request review label Nov 18, 2026
@quantconnect-kronos-reviewer
quantconnect-kronos-reviewer Bot marked this pull request as ready for review November 18, 2026 17:04

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving 3898122. It applies the SmartRounding() decision from the discussion above to the same ten assignments, and nothing else changed.

What changed since my last review

  • TradeBuilder now stores ProfitLoss, MAE, MFE and EndTradeDrawdown through SmartRounding() in all three grouping methods, instead of at full precision. That resolves the trailing-digit note from my earlier review: 1000 stays 1000.
  • Small account-currency amounts are kept. RoundToSignificantDigits returns 0 for zero and otherwise keeps 7 significant digits at any scale, so 0.00025 BTC is stored exactly, as KeepsAccountCurrencyPrecision asserts. Nothing here can newly throw: the scale it computes is a power of ten within decimal range for any trade value.
  • Tests: the excursion test now expects SmartRounding() of the exact fractions. Its long case covers the negative branch (-1222.2222… becomes -1222.222). The inverse scale-in total is now compared within 0.001 because each trade is rounded on its own. Both are the expected consequence of the decided rounding, not looser checks of the fix.
  • As the description says, losses at or below -1000 round to 7 significant digits instead of 4 decimals. That was decided above and matches charts, so it doesn't block.

CI: all runs on 38981222b passed: Build & Test, Regression, Research Regression, Report Generator, Syntax, Benchmarks and Python Virtual Environments. API Tests was skipped, as it is for pull requests.

Other repositories: none need a change. There's no API or stub change.

Risk: risk:low, unchanged. It's a ten-line bug fix that's easy to revert, with no API change. Evidence: a test that fails without the fix, green CI including regression tests, and the end-to-end BTC-account run in the description.

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued and removed kronos:review:working review: in progress kronos:review Request review labels Nov 18, 2026
@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot added kronos:review:working review: in progress risk:high High risk and removed kronos:review:queued review: queued labels Nov 18, 2026
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued kronos:review:working review: in progress and removed kronos:review Request review kronos:review:queued review: queued labels Nov 18, 2026

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes on 00e295e. The reversal fix works, but inverse crypto futures can still turn a breakeven trade into a tiny win. It has the same cause as the two earlier findings, so I'm asking for a decision on the approach (below) instead of suggesting another patch.

What changed since my last review

  • FlatToFlat now computes (exit total / exit quantity − entry total / entry quantity) × entry quantity. Equal averages divide to the same decimal, so a breakeven reversal is exactly 0. The new reversal cases in BreakevenAveragedFillsHaveZeroProfit cover it. Keeping master's reversal weighting out of this change, and leaving it to #9938, is the right scope. My reversal finding is resolved.

Still open: residue on inverse contracts (blocking). For inverse crypto futures, GetProfitPrice returns -1 / price. That value rarely fits in a decimal exactly, so the summed totals of a true breakeven don't cancel. SmartRounding() keeps the leftover as 7 significant digits. I reproduced this with a local test on this head, using BTCUSD on Binance with multiplier 100, rate 1 and zero fees, run FIFO and LIFO: buy 100 @ 40000, buy 100 @ 60000, sell 200 @ 48000. 48000 is the harmonic mean, so the trade's true profit is exactly 0.

  • FlatToFlat records ProfitLoss = 8.8E-20 with IsWin = true.
  • FlatToReduced records 4.4E-20 with IsWin = true.
  • On master both round to 0.00 and don't count as a win.

The short version of that trade comes out as a loss of the same size, which then inflates the profit-loss ratio. Other inverse sequences I tried, such as scaling in and out at the same prices in a different order, gave 0. FillToFill is unaffected.

Cause: this is the third time a decimal residue shows up. The first came from running averages, the second from the reversal ratio, and this one from reciprocal prices. SmartRounding() keeps 7 significant digits whatever the value's size, so any residue survives. Exact sums can't remove it for inverse contracts, because their per-fill values are already rounded.

@Martin-Molinero Decision needed: how should closed-trade P&L drop decimal residue on inverse contracts, now that SmartRounding() keeps tiny values?

This pull request replaces two-decimal rounding of closed-trade P&L with SmartRounding(), as you decided on #10137. That fixes BTC-denominated accounts, and the linear-instrument breakeven cases are now exact. For inverse crypto futures, a breakeven trade can still record a residue of about 1e-20 and count as a win or a loss. Removing that needs a tolerance, and choosing one is a policy call.

  • A. Drop residue relative to the trade's own size (recommended): treat a profit below about 1e-20 × the trade's entry value as 0 before SmartRounding(), in FlatToFlat and FlatToReduced. Real BTC-scale profits are many orders of magnitude above that, so the original fix is kept. It takes a few lines plus inverse breakeven tests. Why recommended: it keeps your rounding and has no fixed account-currency epsilon.
  • B. Accept it and merge as is: inverse-contract trades that close exactly at breakeven count as tiny wins or losses, tracked as a separate issue. No more work.
  • C. Round to a fixed number of decimals first (for example 10) and then apply SmartRounding(): simple, but it's an absolute epsilon that would zero real profits in currencies scaled below it.

Reply with the option you choose, or another way to go.

Other repositories: none need a change. There's no API or stub change.

Risk: risk:high stays. A valid fill sequence on an inverse contract still gets a different win/loss classification than on master. Once that's resolved, with its regression test, the rest of the evidence (green CI and the end-to-end runs) is in place.

Comment thread Common/Statistics/TradeBuilder.cs Resolved
Comment thread Common/Statistics/TradeBuilder.cs Resolved
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot removed the kronos:review:working review: in progress label Nov 18, 2026
@quantconnect-kronos

Copy link
Copy Markdown
Contributor Author

Confirmed on 00e295e: on inverse BTCUSD (Binance, multiplier 100, zero fees), buy 100 @ 40000, buy 100 @ 60000, sell 200 @ 48000 records ProfitLoss = 8.8E-20 in FlatToFlat and 4.4E-20 in FlatToReduced. Both count as wins, FIFO and LIFO. The cause is that the per-fill values -1/price already come rounded from decimal, so no rearrangement of the sums makes a true breakeven exactly 0. Removing it takes a tolerance. Linear instruments and FillToFill aren't affected.

I'm not changing the code until @Martin-Molinero picks an option (A, B, C or another) from the review above. Once he does, I'll implement it with an inverse breakeven regression test and record the decision in the description.

@Martin-Molinero

Copy link
Copy Markdown
Member

A. Treat a profit below 1e-20 × the trade's entry value as 0 before SmartRounding(), in FlatToFlat and FlatToReduced. Add the inverse breakeven case (100 @ 40000, 100 @ 60000, 200 @ 48000), long and short, FIFO and LIFO, to BreakevenAveragedFillsHaveZeroProfit.

An inverse contract's reciprocal prices aren't exact decimals, so a
breakeven FlatToFlat or FlatToReduced trade kept a residue that
SmartRounding preserves and counted as a win or loss. Treat a profit
below 1e-20 of the trade's entry value as zero, which keeps small real
profits such as those of a BTC account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@quantconnect-kronos

Copy link
Copy Markdown
Contributor Author

Implemented option A, as @Martin-Molinero decided, in 3400c9d:

  • Change: FlatToFlat and FlatToReduced now go through RoundAveragedProfitLoss. It treats a profit below 1e-20 × the trade's entry value (|Σ quantity × value|, compared before conversion to account currency, which scales both alike) as 0, and otherwise applies SmartRounding(). FillToFill is unchanged.
  • Tests: BreakevenAveragedFillsHaveZeroProfit gains the inverse BTCUSD breakeven (100 @ 40000, 100 @ 60000, 200 @ 48000), long and short, FIFO and LIFO, in both grouping methods. The four new cases fail on 00e295e with ±8.8E-20 and ±4.4E-20 and pass now. KeepsAccountCurrencyPrecision still keeps 0.00025 BTC. All 1632 statistics tests pass, and the full suite with the CI filter gives 39832 passed, 0 failed.
  • End to end: a backtest trading coin-margined BTCUSD with a FlatToFlat trade builder records the inverse breakeven trade as 0 and not a win. A following buy 1 @ 40000, sell 1 @ 44000 keeps its profit of 18.94815 USD as a win.

The decision and the new evidence are in the description.

@quantconnect-kronos quantconnect-kronos Bot added the kronos:review Request review label Nov 18, 2026
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued kronos:review:working review: in progress and removed kronos:review Request review kronos:review:queued review: queued labels Nov 18, 2026
@quantconnect-kronos-reviewer
quantconnect-kronos-reviewer Bot marked this pull request as ready for review November 18, 2026 21:08

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving 3400c9d. It implements option A as decided: in FlatToFlat and FlatToReduced, a profit below 1e-20 × the trade's entry value is 0 before SmartRounding(). That resolves the inverse breakeven finding.

What I checked

  • The four new inverse cases in BreakevenAveragedFillsHaveZeroProfit (BTCUSD, long and short, both grouping methods) fail locally with the previous commit's TradeBuilder (±8.8E-20, ±4.4E-20) and pass on this head. All 492 QuantConnect.Tests.Common.Statistics tests pass, KeepsAccountCurrencyPrecision included.
  • Headroom on both sides: profit and entry value are compared in the same units, before the account-currency rate and multiplier. In the test, the raw residue is about 2e-26 against a threshold of about 4e-23. A -1/price value is off by at most 5e-29, so the residue relative to entry value grows with price and nears 1e-20 only at prices around 1e8, far above any coin-margined contract. A real profit would have to be under 1e-20 of the position's value to be dropped, far below one price tick. Linear instruments were already exactly 0 at breakeven, so the check changes nothing for them, and FillToFill is unaffected.
  • CI: all runs on 3400c9d passed. API Tests was skipped, as it is for pull requests.

Other repositories: none need a change. There's no API or stub change.

Risk: I set risk:low. The breakeven cases that blocked earlier commits are now covered by tests that fail without the fix. The rounding and the tolerance are what was decided on #10137 and on this pull request. It's a small bug fix that's easy to revert, with no API change and nothing new that can throw, backed by green CI including regression tests and the end-to-end runs in the description.

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added risk:low Low risk and removed risk:high High risk kronos:review:working review: in progress labels Nov 18, 2026
@quantconnect-kronos quantconnect-kronos Bot added the kronos:review Request review label Nov 18, 2026
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued and removed kronos:review Request review labels Nov 18, 2026
@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot added kronos:review:working review: in progress and removed kronos:review:queued review: queued labels Nov 18, 2026

@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. The averaged-fill totals and agreed relative-residue threshold resolve my earlier breakeven/statistics-generation finding while retaining small account-currency profits.

  • Release build and all 492 statistics tests pass locally.
  • Tested end to end through algorithm orders in both FlatToFlat and FlatToReduced: averaged linear fills, same-price reversals, and the inverse BTCUSD harmonic-mean round trip remain exactly zero and are not wins. Genuine profits of 0.00025 BTC and 0.0002272727 BTC remain wins. The runs produce the expected 8 and 7 closed trades, respectively, and all 27 summary statistics.

Risk: risk:low. The previously failing paths now have regression coverage and end-to-end verification. This remains a small, reversible bug fix with no public API change; the existing reversal-weighting issue stays outside its scope.

@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot removed the kronos:review:working review: in progress label Nov 18, 2026
@quantconnect-kronos
quantconnect-kronos Bot merged commit 53236fa into master Nov 18, 2026
8 checks passed
@quantconnect-kronos
quantconnect-kronos Bot deleted the kronos/bug-10137-trade-statistics-precision branch November 18, 2026 21:36
@quantconnect-kronos quantconnect-kronos Bot removed the kronos:develop:working develop: in progress label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Low risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Closed-trade rounding discards profit in BTC-denominated accounts

1 participant