开发者

How to calculate value of short options call with Black-Scholes formula?

I am trying to calculate the profit/loss of a short call at various times in the future, but it isn't coming out correct. Compared to the time of expiration, the ones with time left have less profit above the strike price, but at some point below the strike they don't lose value as fast as the t=0 line. Below is the formula in pseudocode, what am I doing wrong?

profit(stockprice) = -1 * (black_scholes_price_of_call(stockPrice,optionStrike,daysTillExpiration) - premium);

Real matlab code:

function [ x ] = sell_call( current,strike,price,days)  
    if (days > 0)  
        Sigma = .25;  
        Rates = 0.05;  
        Settle = today;  
        Maturity = today + days;  
        
        RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, 'EndDates',...
            Maturity, 'Rates', Rates, 'Compounding', -1);
        
        StockSpec = stockspec(Sigma, current);
        
        x = -1 * (optstockbybls(RateSpec, StockSpec, Settle, Maturity, 'call', strike) - price);
    else
        x = min(price,strike-current-price);
    e开发者_运维技巧nd
end


Your formula ain't right. I don't know why you need that leading -1 as a multiplier for, because when I distribute it out the "formula" is a simple one:

profit(stockprice) = premium - black_scholes_price_of_call(stockPrice,optionStrike,daysTillExpiration);

Pretty simple. So that means the problem is buried in that function for the price of the call, right?

When I compare your formula to what I see as the definition on Wikipedia, I don't see a correspondence at all. Your MATLAB code doesn't help, either. Dig into the functions and see where you went wrong.

Did you write those? How did you test them before you assembled them into this larger function. Test the smaller blocks before you assemble them into the bigger thing.

What baseline are you testing against? What known situation are you comparing your calculation to? There are lots of B-S calculators available. Maybe you can use one of those.

I'd assume that it's an error in your code rather than MATLAB. Or you've misunderstood the meaning of the parameters you're passing. Look at your stuff more carefully, re-read the documentation for that function, and get a good set of baseline cases.


I found the problem, it had to do with the RateSpec argument. When you pass in a interest rate, it affects the option pricing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜