Skip to main content

AmericanPut

Struct AmericanPut 

Source
pub struct AmericanPut {
    pub risk_free_rate: f64,
    pub volatility: f64,
    pub strike: f64,
    pub dx: f64,
}
Expand description

American Put Option

Models the optimal exercise strategy for an American Put option. This is formulated as an optimal stopping problem, but can be solved via HJB by treating the exercise decision as a control.

Dynamics follow Geometric Brownian Motion for the underlying asset.

Fields§

§risk_free_rate: f64

Risk-free interest rate (r).

§volatility: f64

Volatility of the underlying asset ($\sigma$).

§strike: f64

Strike price (K).

§dx: f64

Spatial discretization step size (dx) used for finite difference coefficients.

Implementations§

Source§

impl AmericanPut

Source

pub fn new(risk_free_rate: f64, volatility: f64, strike: f64, dx: f64) -> Self

Creates an American put model.

§Examples
use solver::models::american_put::AmericanPut;
let put = AmericanPut::new(0.05, 0.2, 100.0, 1.0);
assert_eq!(put.strike, 100.0);
Source

pub fn set_dx(&mut self, dx: f64)

Updates the spatial step size used by the finite-difference transport coefficients.

§Examples
use solver::models::american_put::AmericanPut;
let mut put = AmericanPut::new(0.05, 0.2, 100.0, 1.0);
put.set_dx(0.5);
assert_eq!(put.dx, 0.5);

Trait Implementations§

Source§

impl ControlProblem<1> for AmericanPut

Source§

type Control = ()

The action type. For Merton this is a scalar portfolio fraction; for market making it is a pair of bid/ask intensities.
Source§

fn optimize(&self, _t: f64, _state: &[f64; 1], _derivs: &StateDerivatives<1>)

Returns the control that maximizes the driver at (t, state).
Source§

fn running_reward(&self, _t: f64, _state: &[f64; 1], _control: &()) -> f64

Returns the running reward f(t,x,u).
Source§

fn generator( &self, _t: f64, state: &[f64; 1], _control: &(), derivs: &StateDerivatives<1>, ) -> f64

Returns the infinitesimal generator L^u V for the given control and derivative bundle.
Source§

fn terminal(&self, state: &[f64; 1]) -> f64

Terminal value g(x) at the horizon.
Source§

fn discount_rate(&self, _state: &[f64; 1]) -> f64

Discount rate r(t,x). Defaults to zero.
Source§

fn constant_discount_rate(&self) -> Option<f64>

Constant discount rate hint. Defaults to None (state dependent).
Source§

fn apply_constraint(&self, state: &[f64; 1], value: f64) -> f64

Optional pointwise constraint on the value, e.g. the early-exercise obstacle V >= payoff for an American option. Read more
Source§

fn next_step( &self, _t: f64, state: &[f64; 1], dt: f64, noise: &[f64; 1], ) -> [f64; 1]

Advances the state one step under the optimal control at forward time t.
Source§

fn is_diffusion_dimension(&self, _dim: usize) -> bool

Whether a dimension is driven by Brownian diffusion.
Source§

fn driver( &self, t: f64, state: &[f64; N], control: &Self::Control, derivs: &StateDerivatives<N>, ) -> f64

Returns the full HJB driver f(t,x,u) + L^u V. Read more
Source§

fn bsde_driver( &self, t: f64, state: &[f64; N], control: &Self::Control, _derivs: &StateDerivatives<N>, _dt: f64, ) -> f64

Returns the backward driver consumed by the BSDE regression solver. Read more
Source§

fn next_step_controlled( &self, t: f64, state: &[f64; N], _control: &Self::Control, dt: f64, noise: &[f64; N], ) -> [f64; N]

Advances the state one step under an explicitly supplied control. Read more
Source§

fn is_reduced_value(&self) -> bool

Whether the value this problem solves is a reduced value. Read more
Source§

fn gradient_step(&self, _dim: usize) -> f64

Physical finite-difference step for a dimension, used by mesh-free gradient stencils.
Source§

impl PdeProblem<1> for AmericanPut

Source§

fn dimension_kind(&self, _dim: usize) -> DimensionKind

Discretization kind for dim. Read more
Source§

fn transport( &self, _t: f64, state: &[f64; 1], _control: &(), _derivs: &StateDerivatives<1>, ) -> Transport<1>

Transport and local source for the given control and derivatives. Read more
Source§

fn jump_kernel( &self, _t: f64, _state: &[f64; N], _control: &Self::Control, _derivs: &StateDerivatives<N>, transport: &Transport<N>, ) -> JumpKernel<N>

Jump kernel for arbitrary-amplitude jump dimensions. Read more

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

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

§

fn vzip(self) -> V