You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(verify): consolidate TradingView trade-list fragments before pairing (#54)
TradingView's "List of Trades" (and the engine mirroring it) splits one entry
FILL into multiple "Trade #" rows: a tiny qty_step rounding remainder sharing
the SAME entry time+price, or FIFO partial-close lots of a grid bot. The greedy
entry-time matcher in verify_corpus then cross-pairs same-entry lots, producing
spurious count + exit-price-p90 deltas (the ~90% qty-p90 is the fingerprint)
even though the engine's fills are trade-for-trade price-exact.
Add consolidate_fragments(): group rows by an EXACT (entry_time, entry_price,
direction) key and merge each group into one logical trade (sum qty/pnl, keep
the shared entry, represent the exit by the shared price or qty-weighted final
close). Applied symmetrically to the TV and engine lists before alignment
(mirrored in regen_validation_report.py). Because the key is compared exactly,
two rows merge only when they are the same fill event — a distinct trade lands
on a different bar or price level and keeps its own key, so real divergences are
never masked.
Corpus byte-identical: verify_corpus.py --all stays excellent=251 / anomaly=1 /
fail=0 with ZERO tier changes (4 corpus strategies that legitimately fragment
consolidate symmetrically and stay excellent — the key is correct, not inert).
Scraped targets: tomukasss weak->excellent (count 31%->0%, qty-p90 51%->0.2%);
xlm/xau grids' fragment artifact cleared (qty-p90 ~90%->~0.5%, count->~0) while
their REAL residual exit-p90 ~6% (TV holds lots days longer) correctly remains.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments