Matlab coding problem (Black-Scholes Option Pricing content)

In summary, the conversation discusses a code for pricing a European call and hedging, and the issue the person is facing when decreasing the time step. Suggestions are given to solve the problem, such as adjusting input parameters, using a different pricing model, implementing boundary conditions, or reconsidering the time step.
  • #1
spenghali
14
0
So I have made this code to price a european call, hedge, and record the hedging error at each time step. I then take the mean and variance of the hedging error which is suppose to go to zero as dt goes to zero. Here's what I have, my question will follow:

clear;

%Parameters

M = 200;
dt = 0.5;
T = repmat(365/4:-dt:0,M,1);
N = size(T,2);
K(1:M,1:N) = 50;
r(1:M,1:N) = 0.01;
sigma(1:M,1:N) = 0.25;

toss = randn(M,N-1);
S = cumsum([K(:,1), toss],2); %Stock Paths

V = blsprice(S, K, r, T, sigma); %BSM Price
delta = blsdelta(S, K, r, T, sigma); %BSM delta
X = V-(delta.*S); %Portfolio value

mean = mean(mean(X)) %Sample mean
var = var(var(X)) %Sample varianceSo my problem is that when I decrease dt to make the time steps smaller, some of the underlyings (stock prices, S) become negative and then the 'blsprice' function cannot compute the price of the option because it is expecting a non-negative entry. Any suggestions on how to solve this? The model works fine for dt = 0.5, I just cannot make it smaller. Thanks for any input.
 
Physics news on Phys.org
  • #2


Hello,

Thank you for sharing your code and explaining your problem. It seems like you have a good understanding of the concepts behind pricing a European call and hedging it. Based on the information provided, here are a few suggestions that may help you solve your problem:

1. Check your input parameters: It is important to make sure that the input parameters for your BSM functions (blsprice and blsdelta) are appropriate for the stock prices and time steps you are using. For example, if you are using a very small time step (dt), you may need to adjust your volatility (sigma) to compensate for the smaller time intervals.

2. Use a different pricing model: If your BSM model is not able to handle negative stock prices, you may want to consider using a different pricing model that can handle such scenarios. For example, you could try using the binomial or trinomial tree models, which can handle negative stock prices.

3. Implement boundary conditions: Another approach could be to implement boundary conditions to prevent your stock prices from becoming negative. This could involve setting a minimum stock price or using a reflective boundary condition, where negative stock prices are reflected back to positive values.

4. Consider using a different time step: If none of the above solutions work, you may need to reconsider using a smaller time step. Sometimes, a larger time step may be more appropriate for certain scenarios, and it may still provide accurate results.

I hope these suggestions are helpful and that you are able to find a solution to your problem. Keep in mind that there is no one-size-fits-all solution, and it may require some experimentation and fine-tuning to get the results you are looking for. Good luck!
 

FAQ: Matlab coding problem (Black-Scholes Option Pricing content)

What is the Black-Scholes Option Pricing Model?

The Black-Scholes Option Pricing Model is a mathematical formula used to determine the theoretical value of a European-style stock option. It takes into account factors such as the stock price, strike price, time to maturity, volatility, and risk-free interest rate to calculate the fair price of an option.

Why is the Black-Scholes Model important in finance?

The Black-Scholes Model is important in finance because it provides a standard way for investors to price options and make informed investment decisions. It has also led to the development of other option pricing models and has been widely used in the valuation of other financial instruments.

How is Matlab used in Black-Scholes Option Pricing?

Matlab is a popular programming language and software used in finance for quantitative analysis and modeling. It is often used in the implementation and evaluation of the Black-Scholes Model due to its powerful mathematical and computational capabilities.

What are the key inputs and outputs in the Black-Scholes Model?

The key inputs in the Black-Scholes Model are the stock price, strike price, time to maturity, volatility, and risk-free interest rate. The output is the theoretical value of the option, which represents the fair price that the option should be traded at in the market.

What are some limitations of the Black-Scholes Model?

Some limitations of the Black-Scholes Model include assumptions that may not always hold true in real-life situations, such as constant volatility and risk-free interest rates. It also does not account for dividends or early exercise of options, which can affect the value of an option. Additionally, it is designed for European-style options and may not accurately price American-style options.

Similar threads

Replies
2
Views
1K
Replies
3
Views
3K
Replies
2
Views
1K
Replies
1
Views
4K
Replies
8
Views
1K
Replies
9
Views
3K
Replies
4
Views
3K
Replies
3
Views
3K
Back
Top