Apama Capital Markets Foundation 10.15.0.0
QuantlibPlugin Class Reference

#include <QuantlibPlugin.hpp>

Inheritance diagram for QuantlibPlugin:

Public Member Functions

 QuantlibPlugin ()
 
custom_t< OptionResultsChunkmodelPrice (double _underlying, double _strike, const char *_currentBussinessDate, const char *_maturity, double _riskFreeRate, double _volatility, double _dividendYield, const char *_t, const char *_modelName)
 
custom_t< OptionResultsChunkmodelImplVol (double _price, double _underlying, double _strike, const char *_currentBussinessDate, const char *_maturityDate, double _riskFreeRate, double _dividendYield, const char *_t, const char *_modelName)
 
custom_t< OptionResultsChunkmodelGreeks (double _underlying, double _strike, const char *_currentBussinessDate, const char *_maturity, double _riskFreeRate, double _volatility, double _dividendYield, const char *_t, const char *_modelName)
 
custom_t< OptionResultsChunkbtcoxrossrubinsteinGreeks (double _underlying, double _strike, const char *_currentBussinessDate, const char *_maturity, double _riskFreeRate, double _volatility, double _dividendYield, int64_t _timeSteps, const char *_t)
 
custom_t< OptionResultsChunkbtcoxrossrubinsteinPrice (double _underlying, double _strike, const char *_currentBussinessDate, const char *_maturity, double _riskFreeRate, double _volatility, double _dividendYield, int64_t _timeSteps, const char *_t)
 
custom_t< OptionResultsChunkbtcoxrossrubinsteinImplVol (double _price, double _underlying, double _strike, const char *_currentBussinessDate, const char *_maturity, double _riskFreeRate, double _dividendYield, int64_t _timeSteps, const char *_t)
 
const char * error (const custom_t< OptionResultsChunk > &results)
 
double npv (const custom_t< OptionResultsChunk > &results)
 
double delta (const custom_t< OptionResultsChunk > &results)
 
double gamma (const custom_t< OptionResultsChunk > &results)
 
double theta (const custom_t< OptionResultsChunk > &results)
 
double vega (const custom_t< OptionResultsChunk > &results)
 
double rho (const custom_t< OptionResultsChunk > &results)
 
double implVol (const custom_t< OptionResultsChunk > &results)
 
double yield (const char *_symbol, double _price, const char *_issueDate, const char *_maturityDate, const char *_settlementDate, double _rate, int64_t _freq)
 
double dv01 (const char *_symbol, double _yield, const char *_issueDate, const char *_maturityDate, const char *_settlementDate, double _rate, int64_t _freq)
 
double price (const char *_symbol, double _yield, const char *_issueDate, const char *_maturityDate, const char *_settlementDate, double _rate, int64_t _freq)
 
int64_t createBond (const char *_symbol, const char *_issueDate, const char *_maturityDate, const char *_settlementDate, double _rate, int64_t _frequency, bool _updateFlag)
 
void addToDataset (double _value, double _weight)
 
void removeFromDataset (double _value, double _weight)
 
void resetDataset ()
 
double mean ()
 
double stddev ()
 
double weightSum ()
 
double variance ()
 
double kurtosis ()
 
double skew ()
 
double min ()
 
double max ()
 
int64_t numSamples ()
 

Static Public Member Functions

static void initialize (base_plugin_t::method_data_t &md)
 
static bond_ptr _getBond (const char *symbol, const char *issueDate, const char *maturityDate, const char *settlementDate, Rate rate, Frequency frequency, bool updateFlag, int &ouputValue, std::string &discrepancyMessage)
 
static Rate _yield (bond_ptr bond, const Real &price, const char *settlementDate)
 
static Real _dv01 (bond_ptr bond, const Rate &yield, const char *settlementDate)
 
static Real _price (bond_ptr bond, const Rate &yield, const char *settlementDate)
 
static std::string getDiscrepancyErrorMessage (int outputValue, BondKey cachedBondKey, BondKey inputBondKey)
 
static void dumpCaches ()
 

Static Public Attributes

static Logger * _logger
 

Detailed Description

Constructor & Destructor Documentation

◆ QuantlibPlugin()

QuantlibPlugin::QuantlibPlugin ( )
inline

QuantlibPlugin constructor

Member Function Documentation

◆ _dv01()

static Real QuantlibPlugin::_dv01 ( bond_ptr  bond,
const Rate &  yield,
const char *  settlementDate 
)
static

Helper method for QuantlibPlugin::dv01

◆ _getBond()

static bond_ptr QuantlibPlugin::_getBond ( const char *  symbol,
const char *  issueDate,
const char *  maturityDate,
const char *  settlementDate,
Rate  rate,
Frequency  frequency,
bool  updateFlag,
int &  ouputValue,
std::string &  discrepancyMessage 
)
static

getBond: return a bond matching the specs. updateFlag is a boolean to indicate whether the input specs should override the specs of any matching bond found in the cache (keyed by symbol). outputValue is actually a return value containing an indicator of the discrepancies between the specs of the input compared to the specs of the matching bond found in the cache. The values are OR'ed together (see QuantlibPlugin.hpp)

◆ _price()

static Real QuantlibPlugin::_price ( bond_ptr  bond,
const Rate &  yield,
const char *  settlementDate 
)
static

Helper method for QuantlibPlugin::price

◆ _yield()

static Rate QuantlibPlugin::_yield ( bond_ptr  bond,
const Real &  price,
const char *  settlementDate 
)
static

Helper method for QuantlibPlugin::yield()

◆ addToDataset()

void QuantlibPlugin::addToDataset ( double  _value,
double  _weight 
)

adds data to the GeneralStatistics instance for use in stats calculations.

Parameters
[in]_value
[in]_weight

◆ btcoxrossrubinsteinGreeks()

custom_t< OptionResultsChunk > QuantlibPlugin::btcoxrossrubinsteinGreeks ( double  _underlying,
double  _strike,
const char *  _currentBussinessDate,
const char *  _maturity,
double  _riskFreeRate,
double  _volatility,
double  _dividendYield,
int64_t  _timeSteps,
const char *  _t 
)

Calculates all the Greeks(delta,gamma,rho,theta,vega) values of QuantLib for europeanOption and americanOption by Cox-Ross-Rubinstein Option Pricing Model

Parameters
[in]_underlyingfloat value
[in]_strikefloat value
[in]_currentBussinessDateCurrent Business date in form of const char*
[in]_maturityMaturity date in form of const char*
[in]_riskFreeRateRisk free rate
[in]_volatilityvolatility value
[in]_dividendYielddividendYield value
[in]_timeStepstimeSteps value
[in]_tOption value
Returns
chunk object

◆ btcoxrossrubinsteinImplVol()

custom_t< OptionResultsChunk > QuantlibPlugin::btcoxrossrubinsteinImplVol ( double  _price,
double  _underlying,
double  _strike,
const char *  _currentBussinessDate,
const char *  _maturity,
double  _riskFreeRate,
double  _dividendYield,
int64_t  _timeSteps,
const char *  _t 
)

Calculates Implied volatility for europeanOption and americanOption by Cox-Ross-Rubinstein Option Pricing Model

Parameters
[in]_pricefloat value
[in]_underlyingfloat value
[in]_strikefloat value
[in]_currentBussinessDateCurrent Business date in form of const char*
[in]_maturityMaturity date in form of const char*
[in]_riskFreeRateRisk free rate
[in]_dividendYielddividendYield value
[in]_timeStepstimeSteps value
[in]_tOption value
Returns
chunk object

◆ btcoxrossrubinsteinPrice()

custom_t< OptionResultsChunk > QuantlibPlugin::btcoxrossrubinsteinPrice ( double  _underlying,
double  _strike,
const char *  _currentBussinessDate,
const char *  _maturity,
double  _riskFreeRate,
double  _volatility,
double  _dividendYield,
int64_t  _timeSteps,
const char *  _t 
)

Calculates Net present value of cash flows for europeanOption and americanOption by Cox-Ross-Rubinstein Option Pricing Model

Parameters
[in]_underlyingfloat value
[in]_strikefloat value
[in]_currentBussinessDateCurrent Business date in form of const char*
[in]_maturityMaturity date in form of const char*
[in]_riskFreeRateRisk free rate
[in]_volatilityvolatility value
[in]_dividendYielddividendYield value
[in]_timeStepstimeSteps value
[in]_tOption value
Returns
chunk object

◆ createBond()

int64_t QuantlibPlugin::createBond ( const char *  _symbol,
const char *  _issueDate,
const char *  _maturityDate,
const char *  _settlementDate,
double  _rate,
int64_t  _frequency,
bool  _updateFlag 
)

creates a bond with the supplied specs or validates an existing bond with the same symbol. the bond is checked against the internal cache (bondSpecCache) and if it is different an exception is thrown

Parameters
[in]_symbol
[in]_issueDate
[in]_maturityDate
[in]_settlementDate
[in]_rate
[in]_frequency
[in]_updateFlag
Returns
price

◆ delta()

double QuantlibPlugin::delta ( const custom_t< OptionResultsChunk > &  results)

returns delta value of OptionResultsChunk set by either modelGreeks or btcoxrossrubinsteinGreeks

Parameters
[in]resultsReference of Chunk object
Returns
const char* error

◆ dumpCaches()

static void QuantlibPlugin::dumpCaches ( )
static

Dumps all cache created by bond and instruments

◆ dv01()

double QuantlibPlugin::dv01 ( const char *  _symbol,
double  _yield,
const char *  _issueDate,
const char *  _maturityDate,
const char *  _settlementDate,
double  _rate,
int64_t  _freq 
)

returns dv01 which is calculated as the price from a given yield less one basis point minus the price based on the given yield

Parameters
[in]_symbol
[in]_yield
[in]_issueDate
[in]_maturityDate
[in]_settlementDate
[in]_rate
[in]_freq
Returns
dv01

◆ error()

const char * QuantlibPlugin::error ( const custom_t< OptionResultsChunk > &  results)

returns error value of OptionResultsChunk set by either modelGreeks or btcoxrossrubinsteinGreeks

Parameters
[in]resultsReference of Chunk object
Returns
const char* error

◆ gamma()

double QuantlibPlugin::gamma ( const custom_t< OptionResultsChunk > &  results)

returns gamma value of OptionResultsChunk set by either modelGreeks or btcoxrossrubinsteinGreeks

Parameters
[in]resultsReference of Chunk object
Returns
const char* error

◆ getDiscrepancyErrorMessage()

static std::string QuantlibPlugin::getDiscrepancyErrorMessage ( int  outputValue,
BondKey  cachedBondKey,
BondKey  inputBondKey 
)
static

Returns error while creating bond by _getBond method in string format

◆ implVol()

double QuantlibPlugin::implVol ( const custom_t< OptionResultsChunk > &  results)

returns Implied volatility value of OptionResultsChunk set by either modelImplVol or btcoxrossrubinsteinImplVol

Parameters
[in]resultsReference of Chunk object
Returns
const char* error

◆ initialize()

static void QuantlibPlugin::initialize ( base_plugin_t::method_data_t &  md)
static

Plugin intitialization

◆ kurtosis()

double QuantlibPlugin::kurtosis ( )

mean: see quantlib Incremental Stats in docs

◆ max()

double QuantlibPlugin::max ( )

mean: see quantlib Incremental Stats in docs

◆ mean()

double QuantlibPlugin::mean ( )

mean: see quantlib Incremental Stats in docs

◆ min()

double QuantlibPlugin::min ( )

mean: see quantlib Incremental Stats in docs

◆ modelGreeks()

custom_t< OptionResultsChunk > QuantlibPlugin::modelGreeks ( double  _underlying,
double  _strike,
const char *  _currentBussinessDate,
const char *  _maturity,
double  _riskFreeRate,
double  _volatility,
double  _dividendYield,
const char *  _t,
const char *  _modelName 
)

Calculates all the Greeks(delta,gamma,rho,theta,vega) values of QuantLib for europeanOption and americanOption

Parameters
[in]_underlyingfloat value
[in]_strikefloat value
[in]_currentBussinessDateCurrent Business date in form of const char*
[in]_maturityMaturity date in form of const char*
[in]_riskFreeRateRisk free rate
[in]_volatilityvolatility value
[in]_dividendYielddividendYield value
[in]_tOption value
[in]_modelNamemodelName value
Returns
chunk object

◆ modelImplVol()

custom_t< OptionResultsChunk > QuantlibPlugin::modelImplVol ( double  _price,
double  _underlying,
double  _strike,
const char *  _currentBussinessDate,
const char *  _maturityDate,
double  _riskFreeRate,
double  _dividendYield,
const char *  _t,
const char *  _modelName 
)

Calculates Implied volatility for europeanOption and americanOption

Parameters
[in]_priceprice value
[in]_underlyingfloat value
[in]_strikefloat value
[in]_currentBussinessDateCurrent Business date in form of const char*
[in]_maturityDateMaturity date in form of const char*
[in]_riskFreeRateRisk free rate
[in]_dividendYielddividendYield value
[in]_tOption value
[in]_modelNamemodelName value
Returns
chunk object

◆ modelPrice()

custom_t< OptionResultsChunk > QuantlibPlugin::modelPrice ( double  _underlying,
double  _strike,
const char *  _currentBussinessDate,
const char *  _maturity,
double  _riskFreeRate,
double  _volatility,
double  _dividendYield,
const char *  _t,
const char *  _modelName 
)

Calculates Net present value of cash flows for europeanOption and americanOption

Parameters
[in]_underlyingfloat value
[in]_strikefloat value
[in]_currentBussinessDateCurrent Business date in form of const char*
[in]_maturityMaturity date in form of const char*
[in]_riskFreeRateRisk free rate
[in]_volatilityvolatility value
[in]_dividendYielddividendYield value
[in]_tvalue Option value
[in]_modelNamemodelName value
Returns
chunk object

◆ npv()

double QuantlibPlugin::npv ( const custom_t< OptionResultsChunk > &  results)

returns npv value of OptionResultsChunk set by either modelGreeks or btcoxrossrubinsteinGreeks

Parameters
[in]resultsReference of Chunk object
Returns
const char* error

◆ numSamples()

int64_t QuantlibPlugin::numSamples ( )

mean: see quantlib Incremental Stats in docs

◆ price()

double QuantlibPlugin::price ( const char *  _symbol,
double  _yield,
const char *  _issueDate,
const char *  _maturityDate,
const char *  _settlementDate,
double  _rate,
int64_t  _freq 
)

returns Price calculated as the price from a given yield

Parameters
[in]_symbol
[in]_yield
[in]_issueDate
[in]_maturityDate
[in]_settlementDate
[in]_rate
[in]_freq
Returns
price

◆ removeFromDataset()

void QuantlibPlugin::removeFromDataset ( double  _value,
double  _weight 
)

Removes from dataset

Parameters
[in]_value
[in]_weight

◆ resetDataset()

void QuantlibPlugin::resetDataset ( )

Resets complete dataset created by addToDataset

◆ rho()

double QuantlibPlugin::rho ( const custom_t< OptionResultsChunk > &  results)

returns rho value of OptionResultsChunk set by either modelGreeks or btcoxrossrubinsteinGreeks

Parameters
[in]resultsReference of Chunk object
Returns
const char* error

◆ skew()

double QuantlibPlugin::skew ( )

mean: see quantlib Incremental Stats in docs

◆ stddev()

double QuantlibPlugin::stddev ( )

mean: see quantlib Incremental Stats in docs

◆ theta()

double QuantlibPlugin::theta ( const custom_t< OptionResultsChunk > &  results)

returns theta value of OptionResultsChunk set by either modelGreeks or btcoxrossrubinsteinGreeks

Parameters
[in]resultsReference of Chunk object
Returns
const char* error

◆ variance()

double QuantlibPlugin::variance ( )

mean: see quantlib Incremental Stats in docs

◆ vega()

double QuantlibPlugin::vega ( const custom_t< OptionResultsChunk > &  results)

returns vega value of OptionResultsChunk set by either modelGreeks or btcoxrossrubinsteinGreeks

Parameters
[in]resultsReference of Chunk object
Returns
const char* error

◆ weightSum()

double QuantlibPlugin::weightSum ( )

mean: see quantlib Incremental Stats in docs

◆ yield()

double QuantlibPlugin::yield ( const char *  _symbol,
double  _price,
const char *  _issueDate,
const char *  _maturityDate,
const char *  _settlementDate,
double  _rate,
int64_t  _freq 
)

returns bond yield value

Parameters
[in]_symbol
[in]_price
[in]_issueDate
[in]_maturityDate
[in]_settlementDate
[in]_rate
[in]_freq
Returns
yield

Member Data Documentation

◆ _logger

Logger* QuantlibPlugin::_logger
static

Logger object for not resgistered method in QuantlibPlugin class


The documentation for this class was generated from the following file: