test: require pool and typed M3a integration

This commit is contained in:
2026-10-19 18:10:46 -07:00
parent 5830036f9b
commit f6c5246715
@@ -36,4 +36,33 @@ test m3a-insufficient-history-1.0 {M3a refuses calibration from a too-short M2 p
list $code $msg list $code $msg
} -result {1 insufficient_price_history} } -result {1 insufficient_price_history}
test m2-pool-to-m3a-1.0 {DEX pool state participates in M3a calibration} -body {
set s [::stomach::Economy new -history_cap 256]
$s register_trader trader-a statistical
for {set i 0} {$i < 120} {incr i} {
set price [expr {100.0 * exp(0.0003*$i + 0.006*sin($i/9.0))}]
$s feed_publish price_tick synthetic $i [dict create token_ticker TEST price $price] 9.0
}
foreach {ts price liq} {100 103.1 1000000 101 103.3 1500000 102 103.2 2000000} {
$s feed_publish dex_pool_state dex $ts [dict create token_ticker TEST price $price liquidity $liq] 8.5
}
set p [$s statistical_from_feed_type TEST volatility_surface daily 700 91]
set out [list [dict get $p prediction_type] [dict get $p calibration_sources]]
$s destroy
set out
} -result {volatility_surface price_tick,dex_pool_state}
test m3a-regime-query-1.0 {categorical regime is carried as label on a bounded numeric posterior} -body {
set s [::stomach::Economy new -history_cap 256]
$s register_trader trader-a statistical
for {set i 0} {$i < 120} {incr i} {
set price [expr {100.0 * exp(-0.0008*$i + 0.003*sin($i/5.0))}]
$s feed_publish price_tick synthetic $i [dict create token_ticker TEST price $price] 9.0
}
set p [$s statistical_from_feed_type TEST regime_state current 700 92]
set out [list [dict get $p prediction_type] [expr {[lsearch -exact {bear neutral bull} [dict get $p label]] >= 0}] [expr {[dict get $p lower_bound] <= [dict get $p value] && [dict get $p value] <= [dict get $p upper_bound]}]]
$s destroy
set out
} -result {regime_state 1 1}
cleanupTests cleanupTests