Child pages
  • Option Pricing Models Interfaces and Methods
Skip to end of metadata
Go to start of metadata

ISpanOptionPricingModel: IDispatch interface methods:

 

PutExerciseStyle(short)

                  Sets Option ExerciseStile

Parameter value:

0 for American (Default value)

1 for European.

            Returns 0 (success) or non-zero (failure).

 

PutOptionTypeIsCall(BOOL);

Sets option type. 

Returns 0 (success) or non-zero (failure).

 

PutUndPrice(double);

Sets price of the underlying instrument. 

Returns 0 (success) or E_UNDERPICE (failure).

 

PutStrikePrice(double);

Sets option strike price. 

Returns 0 (success) or E_STRIKEPRICE (failure).

 

PutVolatility(double);

Sets volatility of the underlying instrument. 

Returns 0 (success) or E_VOLATILITY (failure).

 

PutRiskFreeRate(double);

Sets risk free interest rate. 

Returns 0 (success) or E_RISKFREERATE (failure).

 

PutDivYield(double);

Sets underlying instrument dividend yield. 

Returns 0 (success) or E_DIVYIELD (failure).

 

PutExpirTime(double);

Sets option expiration time. 

Returns 0 (success) or E_TIMETOEXPIR (failure).

 

PutUnderlyingAssetType(short);

Sets Underlying Asset Type for “Greeks” Calculations.

Parameter value:

0 for Futures (Default)

1 for Physicals.

Returns 0 (success) or non-zero (failure).

 

PutAllGreeksFlag (bool);

Sets flag for all Greeks Calculation.

Returns 0 (success) or non-zero (failure).

 

PutDeltaFlag (bool);

Sets flag for Delta Calculation.

Returns 0 (success) or non-zero (failure).

 

PutVegaFlag (bool);

Sets flag for Vega Calculation.

Returns 0 (success) or non-zero (failure).

 

PutGammaFlag(bool);

Sets flag for Gamma Calculation.

Returns 0 (success) or non-zero (failure).

 

PutThetaFlag (bool);

Sets flag for Theta Calculation.

Returns 0 (success) or non-zero (failure).

 

PutRhoFlag (bool);

Sets flag for Rho Calculation.

Parameter value:

Defaults for all “Greek” Flags set to true for Merton model, but false for Whaley and Cox-Ross-Rubinstein models because they are computationally expensive.

Returns 0 (success) or non-zero (failure).

 

PutUndPriceChange(double);

Sets price of the underlying instrument. 

Returns 0 (success) or E_UNDERPICE (failure) if Zero change.

 

PutVolatilityChange (double);

Sets volatility of the underlying instrument. 

Returns 0 (success) or E_VOLATILITY (failure) ) if Zero change.

 

PutExpirTimeChange (double);

Sets option expiration time. 

Returns 0 (success) or E_TIMETOEXPIR (failure) ) if Zero change.

 

PutRiskFreeRateChange (double);

Sets risk free interest rate. 

Returns 0 (success) or E_RISKFREERATE (failure) ) if Zero change.

 

PutDivYieldChange (double);

Sets underlying instrument dividend yield. 

Parameter value:

Defaults for Changes set to 0.01% for all Change methods.

Returns 0 (success) or E_DIVYIELD (failure) ) if Zero change.

 

Calculate();

Calculates theoretical prices for an opiton. 

Returns 0 (success) or non-zero failure codes: E_FAIL , S_NOTCONVERGE, E_OUTOFMEMORY

 

GetPrice(double*);

Gets option theoretical price. 

Returns 0 (success) or non-zero (failure).

 

GetDelta(double*);

Gets option delta. 

Returns 0 (success) or non-zero (failure).

 

GetVega(double*);

Gets option vega. 

Returns 0 (success) or E_NOTIMPL (failure).

 

GetTheta(double*);

Gets option theta. 

Returns 0 (success) or E_NOTIMPL (failure).

 

GetGamma(double*);

Gets option gamma of the underlying instrument. 

Returns 0 (success) or E_NOTIMPL (failure).

 

GetRho(double*);

Gets option rho. 

Returns 0 (success) or E_NOTIMPL (failure).

 

GetIntinsicValue(double*);

Gets Intrinsic Value. 

Returns 0 (success) or non-zero (failure).

 

GetCostOfCarry(double*);

Gets CostOfCarry. 

Returns 0 (success) or non-zero (failure).

 

GetExpirTime(double*);

Gets option expiration time. 

Returns 0 (success) or non-zero (failure).

 

ISpanMertonPricingModel: ISpanOptionPricingModel interface has following methods used for analytical calculations of European Options prices on  Equities or Futures:

 

GetSpanNormalProbability(IspanNormalProbability*);

Gets a pointer to the ISpanNormalProbability interface.

Returns 0 (success) or non-zero (failure).

 

ISpanWhaleyPricingModel: ISpanOptionPricingModel interface has following methods for numerical calculation of American Options on Futures:

 

PutMaxIterations(long);

Sets max number of iterations. 

Returns 0 (success) or non-zero (failure).

 

PutConvergeTreshhold (double);

Sets Convergence Treshhold. 

Returns 0 (success) or non-zero (failure).

 

GetCriticalPrice();

Gets critical price. 

Returns 0 (success) or non-zero (failure).

 

GetModelIterations(long);

Gets number of iterations. 

Returns 0 (success) or non-zero (failure).

 

ISpanCoxRossRubPricingModel: ISpanOptionPricingModel interface has following methods for numerical calculation of American Options on Futures and Equities

 

PutTreeDimension(long);

Returns 0 (success) or E_TREEDIM (failure). 

 

ISpanOptionVolatilityModel: IDispatch interface has following methods used for numerical calculations of Implied volatilities running backward SpanOptionPricingModel:

 

PutSpanOptionPricingModel(ISpanOptionModel*);

Sets a pointer to the ISpanOptionPricingModel interface.

Returns 0 (success) or non-zero (failure).

 

PutPrice(double*);

Gets option theoretical price. 

Returns 0 (success) or E_OPTIONPRICE (failure)

 

PutMaxIterations(long);

Sets max number of iterations. 

Returns 0 (success) or non-zero (failure).

 

PutConvergeTreshhold(double);

Sets Convergence Treshhold. 

Returns 0 (success) or non-zero (failure).

 

PutLoVolatility(double);

Sets low level for volatility range. 

Returns 0 (success) or non-zero (failure).

 

PutHiVolatility(double);

Sets high level for volatility range. 

Returns 0 (success) or non-zero (failure).

 

PutHiVolLimit(double);

Sets high limit for volatility. 

Returns 0 (success) or non-zero (failure).

 

Calculte();

Calculates option volatility. 

Returns 0 (success) or non-zero failure codes: E_LOVOLATILITY, E_HIVOLATILITY, or E_INTRINSICVAL.(failure)

 

GetVolatility(double);

Gets Implied volatility for the option. 

Returns 0 (success) or non-zero (failure).

 

GetModelIterations(long);

Gets number of iterations. 

Returns 0 (success) or non-zero (failure).

 

ISpanNormalProbability: IDispatch interface has following methods 

 

PutProbabilityEventValue(double);

Sets probability event Value. 

Returns 0 (success) or non-zero (failure).

 

Calculate();

Calculates normal cumulative probability and probability density. 

Returns 0 (success) or non-zero (failure).

 

GetProbabilityDensity(double*);

Gets normal probability density. 

Returns 0 (success) or non-zero (failure).

 

GetCumulativeProbability(double*);

Gets normal cumulative probability.  

Returns 0 (success) or non-zero (failure).


Calculation Status is represented by an HRESULT generic return code

 Code Name                               Code Value                   Description       

S_OK                                       0x00000000                   Operation succesfull

S_NOTCONVERGE                   0x0000020B                  Operation succesfull  but did not converge because Max Iterations or Conversion treshhold is too low

 E_NOTIMPL                              0x80004001                   Not Imlemented

 E_INVALIDARG                         0x80070257                   One or more arguments are invalid          

 E_FAIL                                     0x80040005                   Unspecified failure

 E_OUTOFMEMORY                  0x8007000E                  Failed to allocate necessary memory

 E_UNDERPICE                         0x80040201                   Underlying Price < 0 or (Underlying Price = 0 and Time to Expiration = 0)

E_STRIKEPRICE                       0x80040202                   Strike Price < 0 or (Strike Price = 0 and Time to Expiration = 0)

 E_TIMETOEXPIR                       0x80040203                   Time to Expiration < 0

 E_RISKFREERATE                   0x80040204                   Risk free Rate < 0

 E_DIVYIELD                              0x80040205                   Dividend Yield < 0

 E_VOLATILITY                          0x80040206                   Volatility < 0

 E_TREEDIM                              0x8004020C                  number of time intervals on the binomial tree is <= 0.

 E_OPTIONPRICE                      0x80040207                   Option Price <= 0

 E_INTRINSICVAL                       0x80040208                   Opiton Price not worth Intrinsic value

 E_LOVOLATILITY                      0x80040209                   “Low Volatility Guess” value is not sufficient to produce initial trial price lower than the actual price. 

 E_HIVOLATILITYLIM                  0x8004020A                  Upper Limit Value that triggers stop in searching for the sufficient “High Volatility Guess” is not sufficient. Value should be increased.

 E_MAXITERATIONS                   0x8004020FL                 Upper bound value of iterations that triggers stop in iterations when exceeded is <=0.

 E_LOVOLATILITYVAL                0x80040210L                 Low volatility guess value sufficient to produce initial trial price lower than the actual price is <0.

 E_HIVOLATILITYVAL                 0x80040211L                 High volatility guess value sufficient to produce initial trial price higher than the actual price is <=0.

 E_HIVOLATILITYLIMVAL            0x80040212L                 Upper Limit Value that triggers stop in searching for the sufficient “High Volatility Guess” is <= 0.

 E_CONVERGETRESHHOLD      0x80040213L                 Conversion treshhold value that triggers stop in iterations when absolute difference between the trial price and the target price is less than treshhold is <= 0.

  • No labels