Files
foxhunt/tests/standalone/test_dbn_decoder.rs
jgrusewski 8d89fe80ff chore: Second cleanup wave - organize root directory
- Archive: 85 agent .txt files → docs/archive/agents/legacy_txt/
- Scripts: Move 110 shell scripts → scripts/ (keep deploy.sh in root)
- Models: Move 18 .safetensors → ml/models/checkpoints/training_artifacts/
- Delete: 34 directories (~33GB freed) - target/, coverage_*, test artifacts
- Build: Clean 14 build artifacts (.rlib, .o, .pid, binaries)
- Tests: Move 14 .rs files → tests/standalone/
- SQL: Move 5 files → sql/ (keep init-db*.sql for Docker)
- Wave 153: Archive to docs/archive/historical/wave153/
- Docs: Archive 9 markdown files to wave_d/reports/ and historical/

Total impact: ~34GB freed (both waves), root directory cleaned from 583 to ~40 essential files
Directory count reduced from 65 to 31 (52% reduction)
All historical data preserved in organized archive structure
2025-10-30 01:26:02 +01:00

66 lines
1.9 KiB
Rust

//! Test official DBN crate decoder to understand API
//! Run with: cargo script test_dbn_decoder.rs
use anyhow::Result;
use std::fs::File;
use std::io::BufReader;
fn main() -> Result<()> {
// Use official dbn crate decoder
use dbn::decode::dbn::Decoder;
use dbn::RecordRef;
let file_path = "test_data/real/databento/ml_training_small/6E.FUT_ohlcv-1m_2024-01-02.dbn";
println!("Testing DBN decoder on: {}", file_path);
let file = File::open(file_path)?;
let reader = BufReader::new(file);
// Create decoder
let mut decoder = Decoder::new(reader)?;
// Read metadata
let metadata = decoder.metadata();
println!("\nMetadata:");
println!(" Version: {:?}", metadata.version);
println!(" Dataset: {:?}", metadata.dataset);
println!(" Schema: {:?}", metadata.schema);
println!(" Start: {:?}", metadata.start);
println!(" End: {:?}", metadata.end);
println!(" Symbols: {:?}", metadata.symbols);
// Count OHLCV records
let mut ohlcv_count = 0;
let mut other_count = 0;
let mut total_count = 0;
println!("\nDecoding records...");
for (idx, record) in decoder.enumerate() {
let record = record?;
total_count += 1;
match record {
RecordRef::Ohlcv(ohlcv) => {
ohlcv_count += 1;
if ohlcv_count <= 3 {
println!(" Record {}: OHLCV - open={}, high={}, low={}, close={}, volume={}",
idx, ohlcv.open, ohlcv.high, ohlcv.low, ohlcv.close, ohlcv.volume);
}
}
_ => {
other_count += 1;
if other_count <= 3 {
println!(" Record {}: {:?}", idx, record);
}
}
}
}
println!("\nSummary:");
println!(" Total records: {}", total_count);
println!(" OHLCV records: {}", ohlcv_count);
println!(" Other records: {}", other_count);
Ok(())
}