Hi all.

I want to build a class that calculates the Black Scholes Implied Volatility on Share Market Options data.

I have the Data in a DataSet and have built the interface to work with, but need the formula to achieve the result.

I know how to build the class, know how to pass the data to the class, don't know how to compute the result.

This has been done before as seen below (I think this is C code, you tell me);

// file black_scholes_imp_vol_bise

ct.cc

// author: Bernt A Oedegaard

// calculate implied volatility of Black Scholes formula

#include "fin_algoritms.h"

#include <cmath>

double option_price_implied_volatility_call_black_scholes_bisections(

double S, double X, double r, double time, double option_price)

{ // check for arbitrage violations:

// if price at almost zero volatility greater than price, return 0

double sigma_low=0.0001;

double price = option_price_call_black_scholes(S,X,r,sigma_low,time);

if (price>option_price) return 0.0;

// simple binomial search for the implied volatility.

// relies on the value of the option increasing in volatility

const double ACCURACY = 1.0e-5; // make this smaller for higher accuracy

const int MAX_ITERATIONS = 100;

const double HIGH_VALUE = 1e10;

const double ERROR = -1e40;

// want to bracket sigma. first find a maximum sigma by finding a sigma

// with a estimated price higher than the actual price.

double sigma_high=0.3;

price = option_price_call_black_scholes(S,X,r,sigma_high,time);

while (price < option_price) {

sigma_high = 2.0 * sigma_high; // keep doubling.

price = option_price_call_black_scholes(S,X,r,sigma_high,time);

if (sigma_high>HIGH_VALUE) return ERROR; // panic, something wrong.

};

for (int i=0;i<MAX_ITERATIONS;i++){

double sigma = (sigma_low+sigma_high)*0.5;

price = option_price_call_black_scholes(S,X,r,sigma,time);

double test = (price-option_price);

if (fabs(test)<ACCURACY) { return sigma; };

if (test < 0.0) { sigma_low = sigma; }

else { sigma_high = sigma; }

};

return ERROR;

};

This code came from the following site;

http://finance.bi.no/~bernt/gcc_prog/algoritms_v1/algoritms/node8.html#SECTION00423000000000000000

My Question: Can someone convert this code into VB.NET for me?

Any comments or resources you have come across for this type of project would also be of interest.

Regards,

Grant.