price: snapshot

This commit is contained in:
nym21
2026-01-16 00:41:25 +01:00
parent 967d2c7f35
commit f39681bb2b
5 changed files with 3471 additions and 5654 deletions

View File

@@ -32,6 +32,16 @@
//! - **Top-N tie-breaking with prev_price** - caused drift
//! - **50% margin threshold for round bin avoidance** - still had issues
//! - **Transaction-level min sats filter** - Python filters per-output, not per-tx
//! - **Heel-based weighted peak** - noise also has spread, not just isolated spikes
//! - **Top-3 with non-round preference (50% threshold)** - inconsistent results
//! - **Neighbor-weighted scoring** - inconsistent, round BTC has correlated neighbors
//!
//! ## Not Yet Tried
//!
//! - **Tighter witness filter** - Python uses 500 bytes per input max, we use 2500 total
//! - **Multi-block smoothing** - aggregate histograms across N blocks
//! - **Minimum histogram count threshold** - fall back to anchor if total_count < N
//! - **Blend with UTXOracle port** - we compute both, could validate/combine
//!
//! ## Known Limitations
//!
@@ -618,8 +628,8 @@ impl Vecs {
/// Convert a bin to price using anchor for decade selection
fn bin_to_price(bin: usize, anchor_price: f64) -> f64 {
let peak = (bin as f64 + 0.5) / PHASE_BINS as f64;
let raw_price = 10.0_f64.powf(EXPONENT - peak);
let phase = (bin as f64 + 0.5) / PHASE_BINS as f64;
let raw_price = 10.0_f64.powf(EXPONENT - phase);
let decade_ratio = (anchor_price / raw_price).log10().round();
raw_price * 10.0_f64.powf(decade_ratio)
}

View File

@@ -24,8 +24,8 @@ impl Vecs {
let phase_histogram = BytesVec::forced_import(db, "phase_histogram", version)?;
// Layer 5: Phase Oracle prices
// v20: Skip only bin 0 (reverted round bin skip)
let phase_version = version + Version::new(13);
// v32: Revert to simple anchor-based decade selection (no prev_price tracking)
let phase_version = version + Version::new(25);
let phase_price_cents = PcoVec::forced_import(db, "phase_price_cents", phase_version)?;
let phase_daily_cents = Distribution::forced_import(db, "phase_daily", phase_version)?;
let phase_daily_dollars = LazyTransformDistribution::from_distribution::<CentsToDollars>(