fix(data): skip non-OHLCV record types in DBN loader instead of hard error

MBP-10 .dbn files mixed into test_data/ caused OHLCV loader to crash
on unknown RType 0x42. Now silently skips non-OHLCV records.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-03-17 08:38:38 +01:00
parent ad28482a93
commit 492fdc025e

View File

@@ -903,10 +903,13 @@ impl DQNTrainer {
Ok(Some(record)) => {
idx += 1;
// Convert RecordRef to RecordRefEnum for pattern matching
let record_enum = record
.as_enum()
.map_err(|e| anyhow::anyhow!("Failed to convert record to enum: {}", e))?;
// Convert RecordRef to RecordRefEnum for pattern matching.
// Skip records with unknown RType (e.g. MBP-10 files mixed
// into an OHLCV directory) instead of hard-erroring.
let record_enum = match record.as_enum() {
Ok(e) => e,
Err(_) => continue, // non-OHLCV record type — skip
};
match record_enum {
dbn::RecordRefEnum::Ohlcv(ohlcv) => {