Skip to main content

BlackScholesProcess

Struct BlackScholesProcess 

Source
pub struct BlackScholesProcess<'a> { /* private fields */ }
Expand description

Risk-neutral lognormal dynamics dS = (r - q) S dt + sigma(S, t) S dW with constant or local volatility.

evolve is overridden so each step costs one volatility lookup shared by drift and diffusion (a local-vol lookup is several surface interpolations); the trait’s coefficient methods expose the same dynamics to generic consumers.

Implementations§

Source§

impl<'a> BlackScholesProcess<'a>

Source

pub fn new(drift_rate: f64, vol: VolDynamics<'a>) -> Self

Source

pub fn vol(&self, s: f64, t: f64) -> f64

The volatility used to diffuse at level s, time t.

Trait Implementations§

Source§

impl StochasticProcess1D for BlackScholesProcess<'_>

Source§

fn constrain(&self, x: f64) -> f64

A lognormal spot cannot go negative; approximate schemes can.

Source§

fn drift(&self, _t: f64, x: f64) -> f64

Drift coefficient a(t, x).
Source§

fn diffusion(&self, t: f64, x: f64) -> f64

Diffusion coefficient b(t, x).
Source§

fn diffusion_dx(&self, t: f64, x: f64) -> f64

∂b/∂x, the extra coefficient Milstein needs.
Source§

fn exact_step(&self, t: f64, x: f64, dt: f64, dw: f64) -> Option<f64>

One draw from the closed-form transition X_{t+dt} | X_t = x, when the process has one. None (the default) makes the Exact scheme fall back to Euler.
Source§

fn evolve( &self, scheme: DiscretizationScheme, t: f64, x: f64, dt: f64, dw: f64, ) -> f64

Advance the state by one step of scheme: the generic stepping, written against drift/diffusion alone. Override only to exploit model structure (e.g. one volatility lookup shared by the coefficients, or a scheme the enum cannot express).

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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V