%pip install -q validmind
Quickstart for knockout option pricing model documentation
Welcome! Let’s get you started with the basic process of documenting models with ValidMind.
A knockout option is a barrier option that ceases to exist if the underlying asset hits a predetermined price, known as the “barrier.” This barrier level, set above or below the current market price, determines whether the option will “knock out” before its expiration date. There are two types: “up-and-out” and “down-and-out.” In an up-and-out knockout option, the option expires if the asset price rises above the barrier, while in a down-and-out, it expires if the asset price falls below. Knockout options generally offer a lower premium than standard options since there is a chance they will expire worthless if the barrier is reached.
Pricing knockout options involves accounting for the proximity of the asset’s price to the barrier, as well as market volatility and the option’s time to expiration. High volatility and longer expiry increase the likelihood of the barrier being triggered, which reduces the option’s value. Models like modified Black-Scholes are used for simpler cases, while Monte Carlo simulations or binomial trees handle complex scenarios. Knockout options are useful for hedging or cost-effective investment strategies, allowing investors to save on premiums but with the risk of losing the option entirely if the barrier is hit.
You will learn how to initialize the ValidMind Library, develop a option pricing model, and then write custom tests that can be used for sensitivity and stress testing to quickly generate documentation about model.
Contents
About ValidMind
ValidMind is a suite of tools for managing model risk, including risk associated with AI and statistical models.
You use the ValidMind Library to automate documentation and validation tests, and then use the ValidMind Platform to collaborate on model documentation. Together, these products simplify model risk management, facilitate compliance with regulations and institutional standards, and enhance collaboration between yourself and model validators.
Before you begin
This notebook assumes you have basic familiarity with Python, including an understanding of how functions work. If you are new to Python, you can still run the notebook but we recommend further familiarizing yourself with the language.
If you encounter errors due to missing modules in your Python environment, install the modules with pip install
, and then re-run the notebook. For more help, refer to Installing Python Modules.
New to ValidMind?
If you haven’t already seen our Get started with the ValidMind Library, we recommend you explore the available resources for developers at some point. There, you can learn more about documenting models, find code samples, or read our developer reference.
Signing up is FREE — Register with ValidMind
Key concepts
Model documentation: A structured and detailed record pertaining to a model, encompassing key components such as its underlying assumptions, methodologies, data sources, inputs, performance metrics, evaluations, limitations, and intended uses. It serves to ensure transparency, adherence to regulatory requirements, and a clear understanding of potential risks associated with the model’s application.
Documentation template: Functions as a test suite and lays out the structure of model documentation, segmented into various sections and sub-sections. Documentation templates define the structure of your model documentation, specifying the tests that should be run, and how the results should be displayed.
Tests: A function contained in the ValidMind Library, designed to run a specific quantitative test on the dataset or model. Tests are the building blocks of ValidMind, used to evaluate and document models and datasets, and can be run individually or as part of a suite defined by your model documentation template.
Custom tests: Custom tests are functions that you define to evaluate your model or dataset. These functions can be registered via the ValidMind Library to be used with the ValidMind Platform.
Inputs: Objects to be evaluated and documented in the ValidMind Library. They can be any of the following:
- model: A single model that has been initialized in ValidMind with
vm.init_model()
. - dataset: Single dataset that has been initialized in ValidMind with
vm.init_dataset()
. - models: A list of ValidMind models - usually this is used when you want to compare multiple models in your custom test.
- datasets: A list of ValidMind datasets - usually this is used when you want to compare multiple datasets in your custom test. See this example for more information.
Parameters: Additional arguments that can be passed when running a ValidMind test, used to pass additional information to a test, customize its behavior, or provide additional context.
Outputs: Custom tests can return elements like tables or plots. Tables may be a list of dictionaries (each representing a row) or a pandas DataFrame. Plots may be matplotlib or plotly figures.
Test suites: Collections of tests designed to run together to automate and generate model documentation end-to-end for specific use-cases.
Example: the classifier_full_suite
test suite runs tests from the tabular_dataset
and classifier
test suites to fully document the data and model sections for binary classification model use-cases.
Install the ValidMind Library
To install the library:
Initialize the ValidMind Library
ValidMind generates a unique code snippet for each registered model to connect with your developer environment. You initialize the ValidMind Library with this code snippet, which ensures that your documentation and tests are uploaded to the correct model when you run the notebook.
Get your code snippet
In a browser, log in to ValidMind.
In the left sidebar, navigate to Model Inventory and click + Register Model.
Enter the model details and click Continue. (Need more help?)
For example, to register a model for use with this notebook, select:
- Documentation template:
Capital markets
You can fill in other options according to your preference.
- Documentation template:
Go to Getting Started and click Copy snippet to clipboard.
Next, load your model identifier credentials from an .env
file or replace the placeholder with your own code snippet:
# Load your model identifier credentials from an `.env` file
%load_ext dotenv
%dotenv .env
# Or replace with your code snippet
import validmind as vm
vm.init(# api_host="...",
# api_key="...",
# api_secret="...",
# model="...",
)
Initialize the Python environment
Next, let’s import the necessary libraries and set up your Python environment for data analysis:
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
from validmind.tests import run_test
Preview the documentation template
A template predefines sections for your model documentation and provides a general outline to follow, making the documentation process much easier.
You will upload documentation and test results into this template later on. For now, take a look at the structure that the template provides with the vm.preview_template()
function from the ValidMind library and note the empty sections:
vm.preview_template()
class OptionPricing:
def __init__(self, S0, K, T, r):
self.S0 = S0
self.K = K
self.T = T
self.r = r
def monte_carlo_simulation(self, N, M):
raise NotImplementedError("Must be implemented by subclasses")
def price_option(self, N, M):
raise NotImplementedError("Must be implemented by subclasses")
class BlackScholesModel(OptionPricing):
def __init__(self, S0, K, T, r, sigma):
super().__init__(S0, K, T, r)
self.sigma = sigma
def monte_carlo_simulation(self, N, M):
= self.T / M
dt = np.zeros((N, M + 1))
price_paths 0] = self.S0
price_paths[:, for t in range(1, M + 1):
= np.random.standard_normal(N)
Z = price_paths[:, t - 1] * np.exp((self.r - 0.5 * self.sigma**2) * dt + self.sigma * np.sqrt(dt) * Z)
price_paths[:, t] return price_paths
def price_option(self, N, M):
= self.monte_carlo_simulation(N, M)
price_paths = np.maximum(price_paths[:, -1] - self.K, 0)
payoffs return np.exp(-self.r * self.T) * np.mean(payoffs)
def calibrate(self, market_prices, strikes, maturities):
def objective_function(params):
self.sigma = params[0]
for K, T in zip(strikes, maturities):
self.K = K
self.T = T
self.price_option(10000, 100))
model_prices.append(return np.sum((np.array(market_prices) - np.array(model_prices))**2)
= minimize(objective_function, [self.sigma], bounds=[(0.01, 1.0)])
result self.sigma = result.x[0]
class StochasticVolatilityModel(OptionPricing):
def __init__(self, S0, K, T, r, v0, kappa, theta, xi, rho):
super().__init__(S0, K, T, r)
self.v0 = v0
self.kappa = kappa
self.theta = theta
self.xi = xi
self.rho = rho
def monte_carlo_simulation(self, N, M):
= self.T / M
dt = np.zeros((N, M + 1))
price_paths = np.zeros((N, M + 1))
vol_paths 0] = self.S0
price_paths[:, 0] = self.v0
vol_paths[:, for t in range(1, M + 1):
= np.random.standard_normal(N)
Z1 = np.random.standard_normal(N)
Z2 = Z1
W1 = self.rho * Z1 + np.sqrt(1 - self.rho**2) * Z2
W2 = np.abs(vol_paths[:, t - 1] + self.kappa * (self.theta - vol_paths[:, t - 1]) * dt + self.xi * np.sqrt(vol_paths[:, t - 1] * dt) * W1)
vol_paths[:, t] = price_paths[:, t - 1] * np.exp((self.r - 0.5 * vol_paths[:, t - 1]) * dt + np.sqrt(vol_paths[:, t - 1] * dt) * W2)
price_paths[:, t] return price_paths
def price_option(self, N, M):
= self.monte_carlo_simulation(N, M)
price_paths = np.maximum(price_paths[:, -1] - self.K, 0)
payoffs return np.exp(-self.r * self.T) * np.mean(payoffs)
def calibrate(self, market_prices, strikes, maturities):
def objective_function(params):
self.v0, self.kappa, self.theta, self.xi, self.rho = params
= []
model_prices for K, T in zip(strikes, maturities):
self.K = K
self.T = T
self.price_option(10000, 100))
model_prices.append(
return np.sum((np.array(market_prices) - np.array(model_prices))**2)
= [self.v0, self.kappa, self.theta, self.xi, self.rho]
initial_guess = [(0.01, 1.0), (0.01, 5.0), (0.01, 1.0), (0.01, 1.0), (-1.0, 1.0)]
bounds = minimize(objective_function, initial_guess, bounds=bounds)
result self.v0, self.kappa, self.theta, self.xi, self.rho = result.x
class KnockoutOption:
def __init__(self, model, S0, K, T, r, barrier):
self.model = model
self.S0 = S0
self.K = K
self.T = T
self.r = r
self.barrier = barrier
def price_knockout_option(self, N, M):
= self.T / M
dt = np.zeros((N, M + 1))
price_paths = np.zeros((N, M + 1)) if isinstance(self.model, StochasticVolatilityModel) else None
vol_paths 0] = self.S0
price_paths[:, if vol_paths is not None:
0] = self.model.v0
vol_paths[:,
for t in range(1, M + 1):
= np.random.standard_normal(N)
Z1 if vol_paths is None:
# Black-Scholes Model
= price_paths[:, t - 1] * np.exp(
price_paths[:, t] self.r - 0.5 * self.model.sigma**2) * dt + self.model.sigma * np.sqrt(dt) * Z1
(
)else:
# Stochastic Volatility Model
= np.random.standard_normal(N)
Z2 = Z1
W1 = self.model.rho * Z1 + np.sqrt(1 - self.model.rho**2) * Z2
W2 = np.abs(vol_paths[:, t - 1] + self.model.kappa * (self.model.theta - vol_paths[:, t - 1]) * dt + self.model.xi * np.sqrt(vol_paths[:, t - 1] * dt) * W1)
vol_paths[:, t] = price_paths[:, t - 1] * np.exp(
price_paths[:, t] self.r - 0.5 * vol_paths[:, t - 1]) * dt + np.sqrt(vol_paths[:, t - 1] * dt) * W2
(
)
# Knockout condition
>= self.barrier] = 0
price_paths[:, t][price_paths[:, t] = np.maximum(price_paths[:, -1] - self.K, 0)
payoffs return np.exp(-self.r * self.T) * np.mean(payoffs)
def generate_synthetic_market_data(model, strikes, maturities):
= []
market_prices for K, T in zip(strikes, maturities):
= K
model.K = T
model.T 10000, 100))
market_prices.append(model.price_option(return market_prices
# Parameters for synthetic data
= 100
S0 = 100
K = 1
T = 0.05
r # BlackSholes
= 0.2
true_sigma
# Stochastic Volatility
= 0.2
true_v0 = 2.0
true_kappa = 0.2
true_theta = 0.1
true_xi = -0.5
true_rho
# Synthetic data generation parameters
= [90, 95, 100, 105, 110]
strikes = [0.5, 1.0, 1.5, 2.0, 2.5]
maturities
# Generate synthetic market data using the true parameters
= BlackScholesModel(S0, K, T, r, true_sigma)
bs_model = generate_synthetic_market_data(bs_model, strikes, maturities)
bs_market_prices
= StochasticVolatilityModel(S0, K, T, r, true_v0, true_kappa, true_theta, true_xi, true_rho)
sv_model = generate_synthetic_market_data(sv_model, strikes, maturities) sv_market_prices
### Model Calibration * Clearly state the purpose of the calibration process. For example, in the context of an option pricing model, calibration aims to adjust model parameters to fit market data (e.g., market option prices, volatility surfaces). * Specify whether the calibration is to historical data, current market data, or a blend of both.
import pandas as pd
@vm.test("my_custom_tests.SyntheticDataCalibrationTest")
def generate_synthetic_data_summary(option_pricing_model, strikes, maturities, synthetic_prices):
"""
This function will use synthetic prices to calibrate each model
and then generate derived prices based on the calibrated parameters.
It will output a DataFrame summarizing the strikes, maturities,
synthetic and derived prices, and the model parameters.
"""
= []
derived_prices for K, T in zip(strikes, maturities):
= K
option_pricing_model.K = T
option_pricing_model.T 10000, 100))
derived_prices.append(option_pricing_model.price_option(
= type(option_pricing_model).__name__
model_type = {
data "Strike": strikes,
"Maturity": maturities,
"Synthetic_Price": synthetic_prices,
"Derived_Price": derived_prices,
"Model_Type": model_type,
"S0": [option_pricing_model.S0] * len(strikes),
"K": [option_pricing_model.K] * len(strikes),
"T": [option_pricing_model.T] * len(strikes),
"r": [option_pricing_model.r] * len(strikes)
}
if model_type == "BlackScholesModel":
"sigma"] = [option_pricing_model.sigma] * len(strikes)
data[elif model_type == "StochasticVolatilityModel":
"v0"] = [option_pricing_model.v0] * len(strikes)
data["kappa"] = [option_pricing_model.kappa] * len(strikes)
data["theta"] = [option_pricing_model.theta] * len(strikes)
data["xi"] = [option_pricing_model.xi] * len(strikes)
data["rho"] = [option_pricing_model.rho] * len(strikes)
data[
= pd.DataFrame(data)
df return df
Synthetic Data Calibration Test
Let’s evaluates the accuracy of a stochastic volatility model by comparing synthetic prices with derived prices after model calibration.
= run_test(
result "my_custom_tests.SyntheticDataCalibrationTest",
={
params"option_pricing_model": sv_model,
"strikes": strikes,
"maturities": maturities,
"synthetic_prices": sv_market_prices
},
) result.log()
#### Benchmark Testing * Compare the model’s performance with alternative models or industry-standard models to assess its relative effectiveness. * Ensure that the model is competitive in pricing, accuracy, and computational efficiency.
@vm.test("my_custom_tests.BenchmarkTest")
def benchmark_test(bs_model, sv_model, strikes, maturities):
"""
Comparison between Black Scholes and stochastic volatility model
"""
= type(bs_model).__name__
bs_model_type = type(sv_model).__name__
sv_model_type
= []
bs_derived_prices = []
sv_derived_prices for K in strikes:
= K
bs_model.K 10000, 100))
bs_derived_prices.append(bs_model.price_option(= K
sv_model.K 10000, 100))
sv_derived_prices.append(sv_model.price_option(
= {
data "Strike": strikes,
"Maturities": [sv_model.T] * len(strikes),
"bs_model_price": bs_derived_prices,
"sv_model_price": sv_derived_prices,
}= pd.DataFrame(data)
df1
= []
bs_derived_prices = []
sv_derived_prices for T in maturities:
= T
bs_model.T 10000, 100))
bs_derived_prices.append(bs_model.price_option(= T
sv_model.T 10000, 100))
sv_derived_prices.append(sv_model.price_option(
= {
data "Strike": [sv_model.K] * len(maturities),
"Maturities": maturities,
"bs_model_price": bs_derived_prices,
"sv_model_price": sv_derived_prices,
}
= pd.DataFrame(data)
df2
return {"strikes variation benchmarking": df1}, {"maturities variation benchmarking": df2}
= run_test(
result "my_custom_tests.BenchmarkTest",
={
params"sv_model": sv_model,
"bs_model": bs_model,
"strikes": strikes,
"maturities": maturities,
},
) result.log()
@vm.test("my_custom_tests.Sensitivity")
def sensitivity_test(model_type, S0, T, r, N, M, strike=None, barrier=None, sigma=None, v0=None, kappa=None,theta=None, xi=None, rho=None):
"""
This is sensitivity test
"""
if model_type == 'BS':
= BlackScholesModel(S0, strike, T, r, sigma)
model else:
= StochasticVolatilityModel(S0, strike, T, r, v0, kappa, theta, xi, rho)
model
= KnockoutOption(model, S0, strike, T, r, barrier)
knockout_option = knockout_option.price_knockout_option(N, M)
price
return pd.DataFrame({"Option price": [price]})
Initialise parameters
= 100
S0 = 1
T = 0.05
r = 100000
N = 100
M = (90, 110)
strike_range = (100, 120) barrier_range
Common plot function
def plot_results(df, params: dict = None):
= plt.figure(figsize=(10, 6))
fig2 "x"]], df[params["y"]], label=params["label"])
plt.plot(df[params["xlabel"])
plt.xlabel(params["ylabel"])
plt.ylabel(params["title"])
plt.title(params[
plt.legend()True)
plt.grid( plt.show()
Strike sensitivity Test
Let’s evaluates the sensitivity of a model’s output value to changes in the strike price, while keeping other parameters constant. This test is crucial for understanding how variations in strike prices affect the valuation of financial derivatives, particularly options.
= run_test(
result "my_custom_tests.Sensitivity:ToStrike",
={
param_grid"model_type": ['SV'],
"N": [N],
"M": [M],
"strike": list(np.linspace(strike_range[0], strike_range[1], 20)),
"barrier": [barrier_range[0]],
"S0": [S0],
"T": [T],
"r": [r],
"v0": [0.2],
"kappa": [2],
"theta": [0.2],
"xi": [0.1],
"rho": [-0.5],
},
)
result.log()
plot_results(0].data),
pd.DataFrame(result.tables[={
params"x": "strike",
"y":"Option price",
"label":"Option price",
"xlabel":"strike",
"ylabel":"option price",
"title":"Knockout Option Price - Strike Level sensitivity",
} )
Barrier Sensitivity Test
Let’s evaluates the sensitivity of a model’s output to changes in the barrier level of a financial derivative, specifically a barrier option. This test is crucial for understanding how small changes in the barrier can impact the option’s valuation, which is essential for risk management and pricing strategies.
= run_test(
result "my_custom_tests.Sensitivity:ToBarrier",
={
param_grid"model_type": ['SV'],
"N": [N],
"M": [M],
"strike": [strike_range[0]],
"barrier": list(np.linspace(barrier_range[0], barrier_range[1], 20)),
"S0": [S0],
"T": [T],
"r": [r],
"v0": [0.2],
"kappa": [2],
"theta": [0.2],
"xi": [0.1],
"rho": [-0.5],
},
)
result.log()
plot_results(0].data),
pd.DataFrame(result.tables[={
params"x": "barrier",
"y":"Option price",
"label":"Option price",
"xlabel":"barrier",
"ylabel":"option price",
"title":"Knockout Option Price - Barrier Level Sensitivity",
} )
@vm.test("my_custom_tests.Stressing")
def sensitivity_test(model_type, S0, T, r, N, M, strike=None, barrier=None, sigma=None, v0=None, kappa=None,theta=None, xi=None, rho=None):
"""
This is stress test
"""
if model_type == 'BS':
= BlackScholesModel(S0, strike, T, r, sigma)
model else:
= StochasticVolatilityModel(S0, strike, T, r, v0, kappa, theta, xi, rho)
model
= KnockoutOption(model, S0, strike, T, r, barrier)
knockout_option = knockout_option.price_knockout_option(N, M)
price
return pd.DataFrame({"Option price": [price]})
Rho (correlation) and Theta (long term vol) stress test
Let’s evaluates the sensitivity of a model’s output to changes in the correlation parameter (rho) and the long-term variance parameter (theta) within a stochastic volatility framework.
This test is useful for understanding how variations in these parameters affect the model’s valuation, which is crucial for risk management and model validation.
= run_test(
result "my_custom_tests.Stressing:TheRhoAndThetaParameters",
={
param_grid"model_type": ['SV'],
"N": [N],
"M": [M],
"strike": [strike_range[0]],
"barrier": [barrier_range[0]],
"S0": [S0],
"T": [T],
"r": [r],
"v0": [0.2],
"kappa": [2],
"theta": [0, 0.2, 0.4],
"xi": [0.1],
"rho": [-1, -0.5, 0, 0.5, 1],
},
) result.log()
Rho (correlation) and Xi (vol of vol) stress test
= run_test(
result "my_custom_tests.Stressing:TheRhoAndXiParameters",
={
param_grid"model_type": ['SV'],
"N": [N],
"M": [M],
"strike": [strike_range[0]],
"barrier": [barrier_range[0]],
"S0": [S0],
"T": [T],
"r": [r],
"v0": [0.2],
"kappa": [2],
"theta": [0.2],
"xi": [0, 0.2, 0.4],
"rho": [-1, -0.5, 0, 0.5, 1],
},
) result.log()
Sigma stress test
evaluates the sensitivity of a model’s output to changes in the volatility parameter, sigma. This test is crucial for understanding how variations in market volatility impact the model’s valuation of financial instruments, particularly options.
This test is useful for risk management and model validation, as it helps identify the robustness of the model under different market conditions. By analyzing the changes in the model’s output as sigma varies, stakeholders can assess the model’s stability and reliability.
= run_test(
result "my_custom_tests.Stressing:TheSigmaParameter",
={
param_grid"model_type": ['BS'],
"N": [N],
"M": [M],
"strike": [strike_range[0]],
"barrier": [barrier_range[0]],
"S0": [S0],
"T": [T],
"r": [r],
"sigma": list(np.linspace(0.1, 0.8, 10)),
},
)
result.log()
plot_results(0].data),
pd.DataFrame(result.metric.summary.results[={
params"x": "sigma",
"y":"Option price",
"label":"Option price",
"xlabel":"Sigma",
"ylabel":"Option price",
"title":"Knockout Option Price - Stress sigma",
} )
Stress kappa
Let’s evaluates the sensitivity of a model’s output to changes in the kappa parameter, which is a mean reversion rate in stochastic volatility models.
= run_test(
result "my_custom_tests.Stressing:TheKappaParameter",
={
param_grid"model_type": ['SV'],
"N": [N],
"M": [M],
"strike": [strike_range[0]],
"barrier": [barrier_range[0]],
"S0": [S0],
"T": [T],
"r": [r],
"v0": [0.2],
"kappa": list(np.linspace(0, 8, 10)),
"theta": [0.2],
"xi": [0.1],
"rho": [-0.5],
},
)
result.log()
plot_results(0].data),
pd.DataFrame(result.tables[={
params"x": "kappa",
"y":"Option price",
"label":"Option price",
"xlabel":"kappa",
"ylabel":"option price",
"title":"Knockout Option Price - stress kappa",
} )
Stress theta
Stress Theta evaluates the sensitivity of a model’s output to changes in the parameter theta, which represents the long-term variance in a stochastic volatility model
= run_test(
result "my_custom_tests.Stressing:TheThetaParameter",
={
param_grid"model_type": ['SV'],
"N": [N],
"M": [M],
"strike": [strike_range[0]],
"barrier": [barrier_range[0]],
"S0": [S0],
"T": [T],
"r": [r],
"v0": [0.2],
"kappa": [2],
"theta": list(np.linspace(0, 0.8, 10)),
"xi": [0.1],
"rho": [-0.5],
},
)
result.log()
plot_results(0].data),
pd.DataFrame(result.tables[={
params"x": "theta",
"y":"Option price",
"label":"Option price",
"xlabel":"theta",
"ylabel":"option price",
"title":"Knockout Option Price - stress theta",
} )
Stress xi
Stress Xi evaluates the sensitivity of a model’s output to changes in the parameter xi, which represents the volatility of volatility in a stochastic volatility model. This test is crucial for understanding how variations in xi impact the model’s valuation, particularly in financial derivatives pricing.
= run_test(
result "my_custom_tests.Stressing:TheXiParameter",
={
param_grid"model_type": ['SV'],
"N": [N],
"M": [M],
"strike": [strike_range[0]],
"barrier": [barrier_range[0]],
"S0": [S0],
"T": [T],
"r": [r],
"v0": [0.2],
"kappa": [2],
"theta": [0.2],
"xi": list(np.linspace(0.05, 0.95, 10)),
"rho": [-0.5],
},
)
result.log()
plot_results(0].data),
pd.DataFrame(result.tables[={
params"x": "xi",
"y":"Option price",
"label":"Option price",
"xlabel":"xi",
"ylabel":"option price",
"title":"Knockout Option Price - stress xi",
} )
Stress rho
Stress rho test evaluates the sensitivity of a model’s output to changes in the correlation parameter, rho, within a stochastic volatility (SV) model framework. This test is crucial for understanding how variations in rho, which represents the correlation between the asset price and its volatility, impact the model’s valuation output.
= run_test(
result "my_custom_tests.Stressing:TheRhoParameter",
={
param_grid"model_type": ['SV'],
"N": [N],
"M": [M],
"strike": [strike_range[0]],
"barrier": [barrier_range[0]],
"S0": [S0],
"T": [T],
"r": [r],
"v0": [0.2],
"kappa": [2],
"theta": [0.2],
"xi": [0.1],
"rho": list(np.linspace(-1.0, 1.0, 20)),
},
)
result.log()
plot_results(0].data),
pd.DataFrame(result.tables[={
params"x": "rho",
"y":"Option price",
"label":"Option price",
"xlabel":"rho",
"ylabel":"option price",
"title":"Knockout Option Price - stress rho",
} )
Next steps
You can look at the results of this test suite right in the notebook where you ran the code, as you would expect. But there is a better way — use the ValidMind Platform to work with your model documentation.
Work with your model documentation
From the Model Inventory in the ValidMind Platform, go to the model you registered earlier. (Need more help?)
Click and expand the Model Development section.
What you see is the full draft of your model documentation in a more easily consumable version. From here, you can make qualitative edits to model documentation, view guidelines, collaborate with validators, and submit your model documentation for approval when it’s ready. Learn more …
Discover more learning resources
We offer many interactive notebooks to help you document models:
Or, visit our documentation to learn more about ValidMind.