Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Avhz RustQuant Power Backend

From Leeroopedia


Knowledge Sources
Domains Option_Pricing, Quantitative_Finance
Last Updated 2026-02-07 19:00 GMT

Overview

Concrete tool for pricing power contracts (options with a power payoff structure) analytically provided by the RustQuant library.

Description

This module implements the PowerOption struct for pricing power contracts. A power contract has the payoff (S/K)^i where i is the fixed power of the contract. The price() method computes the closed-form value:

(S/K)^i * exp(((b - 0.5*v^2)*i - r + 0.5*(i*v)^2) * T)

where S is the initial price, K is the strike, i is the power exponent, b is the cost of carry, v is the volatility, r is the risk-free rate, and T is the time to maturity. Date handling uses the time crate with a default day count convention.

Usage

Use when pricing power contracts or exotic derivatives with payoffs that depend on a power of the ratio of the underlying price to the strike.

Code Reference

Source Location

Signature

#[derive(Debug, Clone, Copy)]
pub struct PowerOption {
    pub initial_price: f64,
    pub strike_price: f64,
    pub power: f64,
    pub risk_free_rate: f64,
    pub cost_of_carry: f64,
    pub volatility: f64,
    pub evaluation_date: Option<Date>,
    pub expiration_date: Date,
}

impl PowerOption {
    pub fn new(
        initial_price: f64,
        strike_price: f64,
        power: f64,
        risk_free_rate: f64,
        cost_of_carry: f64,
        volatility: f64,
        evaluation_date: Option<Date>,
        expiration_date: Date,
    ) -> Self

    #[must_use]
    pub fn price(&self) -> f64
}

Import

use RustQuant::instruments::PowerOption;

I/O Contract

Inputs

Name Type Required Description
initial_price f64 Yes Initial underlying price (S)
strike_price f64 Yes Strike price (K)
power f64 Yes Power exponent of the contract (i)
risk_free_rate f64 Yes Risk-free interest rate (r)
cost_of_carry f64 Yes Cost of carry (b)
volatility f64 Yes Volatility parameter (v)
evaluation_date Option<Date> No Valuation date; defaults to today
expiration_date Date Yes Contract expiration date

Outputs

Name Type Description
price f64 The power contract price

Usage Examples

use RustQuant::instruments::PowerOption;
use RustQuant::time::today;
use time::Duration;

let power_option = PowerOption {
    initial_price: 400.0,
    strike_price: 450.0,
    power: 2.0,
    risk_free_rate: 0.08,
    cost_of_carry: 0.06,
    volatility: 0.25,
    evaluation_date: None,
    expiration_date: today() + Duration::days(182),
};

let price = power_option.price();

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment