Skip to content

Conversation

@joaquinbejar
Copy link
Owner

Summary

This PR implements pricing support for Power options as described in issue #248. Power options have payoffs that are a power function of the underlying asset price, providing leveraged exposure.

What was implemented

Pricing Implementation

Created src/pricing/power.rs with the adjusted Black-Scholes formula for power options:

Pricing Formula

For a power option, S^n is log-normal with adjusted parameters:

  • Expected value: E[S^n] = S^n × e^(n×(r-q)×T + n×(n-1)×σ²×T/2)
  • Adjusted volatility: σ_adj = n × σ
  • Forward price: F = S^n × e^(drift_adjustment × T)
  • d1 = (ln(F/K) + σ_adj²×T/2) / (σ_adj×√T)
  • d2 = d1 - σ_adj×√T

Payoff Structure

  • Standard Power Call: max(S^n - K, 0)
  • Standard Power Put: max(K - S^n, 0)

Why This Implementation?

Power options require special handling because:

  1. Non-linear payoffs: S^n is not normally distributed, but log-normal with adjusted parameters
  2. Drift adjustment: The expected value of S^n includes an additional term n×(n-1)×σ²×T/2
  3. Volatility scaling: The effective volatility scales linearly with the exponent

Technical Decisions

  • Uses f64 arithmetic for power calculations to avoid Decimal overflow issues with large exponents
  • Validates exponent > 0 (negative or zero exponents are rejected)
  • Supports fractional exponents (e.g., n=0.5 for square root options)
  • For n=1, the formula reduces to standard Black-Scholes

Common Applications

  • Leveraged exposure: Higher exponents amplify both gains and losses
  • Structured products: Non-linear payoff profiles
  • Speculative trading: Betting on large price movements

Tests

12 comprehensive unit tests covering:

  • Power call pricing (n=2, squared)
  • Power put pricing (n=2, squared)
  • Different exponents (n=1, n=2, n=3)
  • Fractional exponents (n=0.5)
  • Invalid exponent handling (n ≤ 0)
  • Short position pricing
  • Deep ITM/OTM scenarios
  • Higher exponent gives higher value verification

Files Changed

  • src/pricing/power.rs: NEW - Power option pricing implementation
  • src/pricing/mod.rs: Added power module export
  • src/pricing/black_scholes_model.rs: Routed Power to new module

Closes #248

- Implement adjusted Black-Scholes formula for power options
- Support various power exponents (n=1, 2, 3, fractional)
- Handle non-linear payoffs with adjusted drift and volatility
- Add comprehensive unit tests (12 tests covering all scenarios)
- Route Power options in black_scholes_model.rs to new module
@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 82.60870% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pricing/power.rs 83.82% 11 Missing ⚠️
src/pricing/black_scholes_model.rs 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/pricing/black_scholes_model.rs 66.07% <0.00%> (+2.27%) ⬆️
src/pricing/power.rs 83.82% <83.82%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joaquinbejar joaquinbejar merged commit 410505d into main Jan 13, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Implement Power option pricing model

2 participants