Skip to main content

NormalOptimizationInput

Struct NormalOptimizationInput 

pub struct NormalOptimizationInput {
    pub budget: f64,
    pub belief_mean: f64,
    pub belief_sigma: f64,
    pub market_mean: f64,
    pub market_sigma: f64,
    pub effective_k: f64,
    pub payout_amplifier: f64,
    pub constraints: OptimizerConstraints,
}
Expand description

Fields§

§budget: f64

Trader’s budget in collateral tokens.

§belief_mean: f64

Trader’s belief mean.

§belief_sigma: f64

Trader’s belief σ (from the UI’s confidence selector).

§market_mean: f64

Current market mean.

§market_sigma: f64

Current market σ.

§effective_k: f64

AMM effective_k (post LP scaling).

§payout_amplifier: f64

Payout amplifier (default 1.0).

§constraints: OptimizerConstraints

Policy bounds.

Implementations§

§

impl NormalOptimizationInput

pub fn new( budget: f64, belief_mean: f64, belief_sigma: f64, market_mean: f64, market_sigma: f64, effective_k: f64, ) -> Self

Convenience constructor with sane defaults (amplifier=1, default constraints).

Examples found in repository?
examples/sigma_arb_probe.rs (lines 31-33)
11fn main() {
12    let cases: &[(&str, f64, f64, f64, f64, f64, f64)] = &[
13        // (label, mu_b, sigma_b, mu_m, sigma_m, k_eff, budget)
14        ("live-CPI-2026-05-14",        4.3274, 0.2143, 4.2900, 0.3500, 75.07, 50.0),
15        ("μ-only arb HUGE budget",     4.5000, 0.3500, 4.2900, 0.3500, 75.07, 1e9),
16        ("σ-only HUGE budget",         4.2900, 0.2143, 4.2900, 0.3500, 75.07, 1e9),
17        ("classic README scenario",    2.4700, 0.1581, 2.1000, 0.2000, 50.00, 50.0),
18        ("scenario w/ low k",          4.5000, 0.3500, 4.2900, 0.3500,  1.00, 50.0),
19        ("CPI shape unequal-σ",        4.3274, 0.2143, 2.1000, 0.3500, 75.07, 50.0),
20        ("CPI σ + low-μ market",       4.3274, 0.2143, 0.1000, 0.3500, 75.07, 50.0),
21        ("README+CPI-μ μ-only",        2.4700, 0.2000, 2.1000, 0.2000, 50.00, 50.0),
22    ];
23
24    println!(
25        "{:<26} {:>9} {:>9} {:>9} {:>9} {:>11} {:>10} {:>9} {:>9} {:>9} {:>9}",
26        "case", "μ_b", "σ_b", "μ_m", "σ_m", "k_eff", "budget", "μ_g*", "σ_g*", "coll", "EV"
27    );
28    println!("{}", "─".repeat(132));
29
30    for (label, mu_b, sigma_b, mu_m, sigma_m, k, budget) in cases.iter().copied() {
31        let r = optimize_normal_trade(NormalOptimizationInput::new(
32            budget, mu_b, sigma_b, mu_m, sigma_m, k,
33        ));
34        println!(
35            "{label:<26} {mu_b:>9.4} {sigma_b:>9.4} {mu_m:>9.4} {sigma_m:>9.4} {k:>11.4} \
36             {budget:>10.2} {:>9.4} {:>9.4} {:>9.4} {:>9.4}",
37            r.optimized_mean,
38            r.optimized_sigma,
39            r.collateral_required,
40            r.expected_value,
41        );
42    }
43}

Trait Implementations§

§

impl Clone for NormalOptimizationInput

§

fn clone(&self) -> NormalOptimizationInput

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for NormalOptimizationInput

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl PartialEq for NormalOptimizationInput

§

fn eq(&self, other: &NormalOptimizationInput) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Copy for NormalOptimizationInput

§

impl StructuralPartialEq for NormalOptimizationInput

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.