fix: resolve mbp10_data_dir relative to workspace root + smoketest with MBP-10
Relative TOML paths now resolved via CARGO_MANIFEST_DIR → workspace root, matching test_data_dir() behavior. MBP-10 smoke test passes: 654 imbalance bars from Q1+Q2 2024, threshold=25.0. Smoketest config switched to data_source="mbp10" for MBP-10 validation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,10 +21,10 @@ hidden_dim_base = 64
|
||||
max_steps_per_epoch = 200
|
||||
reward_scale = 1.0
|
||||
huber_delta = 1.0
|
||||
# Data source: "ohlcv" for smoke tests (no MBP-10 data required)
|
||||
data_source = "ohlcv"
|
||||
# OFI feature enrichment from MBP-10 order book data (8 features: OFI L1/L5, depth imbalance, VPIN, Kyle's lambda, bid/ask slope, trade imbalance)
|
||||
# mbp10_data_dir = "test_data/futures-baseline-mbp10"
|
||||
data_source = "mbp10"
|
||||
mbp10_data_dir = "test_data/futures-baseline-mbp10"
|
||||
imbalance_bar_threshold = 25.0
|
||||
imbalance_bar_ewma_alpha = 0.1
|
||||
|
||||
[distributional]
|
||||
num_atoms = 51
|
||||
|
||||
@@ -636,6 +636,21 @@ impl DQNTrainer {
|
||||
.ok_or_else(|| anyhow::anyhow!(
|
||||
"data_source='mbp10' requires mbp10_data_dir to be set in [training] config"
|
||||
))?;
|
||||
// Resolve relative paths against workspace root (same as test_data_dir)
|
||||
let mbp10_path = {
|
||||
let raw = Path::new(mbp10_dir_str);
|
||||
if raw.is_absolute() || raw.exists() {
|
||||
raw.to_path_buf()
|
||||
} else {
|
||||
// Try resolving from workspace root via CARGO_MANIFEST_DIR
|
||||
let manifest = std::env::var("CARGO_MANIFEST_DIR").unwrap_or_default();
|
||||
let workspace = Path::new(&manifest)
|
||||
.parent().and_then(|p| p.parent())
|
||||
.unwrap_or(Path::new(""));
|
||||
let resolved = workspace.join(raw);
|
||||
if resolved.exists() { resolved } else { raw.to_path_buf() }
|
||||
}
|
||||
};
|
||||
// Extract symbol from dbn_data_dir (last path component, e.g. "ES.FUT")
|
||||
let symbol = Path::new(dbn_data_dir)
|
||||
.file_name()
|
||||
@@ -643,12 +658,12 @@ impl DQNTrainer {
|
||||
.unwrap_or("ES.FUT");
|
||||
info!(
|
||||
"Loading MBP-10 imbalance bars: dir={}, symbol={}, threshold={}, alpha={}",
|
||||
mbp10_dir_str, symbol,
|
||||
mbp10_path.display(), symbol,
|
||||
self.hyperparams.imbalance_bar_threshold,
|
||||
self.hyperparams.imbalance_bar_ewma_alpha,
|
||||
);
|
||||
let bars = crate::features::mbp10_loader::mbp10_to_imbalance_bars(
|
||||
Path::new(mbp10_dir_str),
|
||||
&mbp10_path,
|
||||
symbol,
|
||||
self.hyperparams.imbalance_bar_threshold,
|
||||
self.hyperparams.imbalance_bar_ewma_alpha,
|
||||
|
||||
Reference in New Issue
Block a user