Fix category mapping and TotalTrades drift, plan traits/tiering (Teil D)

- MarketCategoryMapper: classify from question text (the Gamma /markets
  endpoint delivers neither category nor event tags, so on-demand markets
  had no signal at all), match short tokens on word boundaries ("eth" no
  longer hits inside "whether", "pop" not inside "popular"), widen the
  keyword lists across all categories.
- UpdateMarketFields: never overwrite a tag-derived category with an
  uninformative "Other" from the on-demand path.
- PositionPnLEngine: sync Trader.TotalTrades to the actual replayed row
  count — the worker-side increment counters drift (INSERT IGNORE,
  deletions, historic imports) and produced Trades30d > TotalTrades.
- Tests: 14 new (mapper classification + word-boundary regression,
  TotalTrades sync + Trades30d invariant, category update guard via
  SQLite) — suite now 32 green + 1 skip.
- FIXPLAN Teil D for the larger rebuilds (AggregatedCount column,
  TraderTraits heuristics, IngestMode tiering for ultra-HF traders).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-07-11 14:09:12 +02:00
co-authored by Claude Fable 5
parent 940a99fec2
commit d2f3ec2bd0
9 changed files with 391 additions and 195 deletions
@@ -192,8 +192,15 @@ public class MarketRepository : IMarketRepository
existing.PlatformMarketId = updated.PlatformMarketId;
existing.QuestionId = updated.QuestionId;
existing.Description = updated.Description;
existing.Category = updated.Category;
existing.Subcategory = updated.Subcategory;
// The /markets endpoint (on-demand path) carries no event tags, so its
// classification is often just "Other". Never let an uninformative update
// overwrite a category previously derived from the tag-bearing /events sync.
if (updated.Category != MarketCategory.Other || existing.Category == MarketCategory.Other)
{
existing.Category = updated.Category;
existing.Subcategory = updated.Subcategory;
}
existing.Volume = updated.Volume;
existing.Volume24h = updated.Volume24h;
existing.Liquidity = updated.Liquidity;