Skip to main content
Version: Upcoming

OptionCalculator

V8 Message Definiton

This table allows custom option pricing based on either user or SR supplied input values.

METADATA

AttributeValue
Topic5030-srse-calculators
MLink TokenInternal
ProductSRAnalytics
accessTypeSELECT,UPDATE,INSERT,DELETE

Table Definition

FieldTypeKeyDefault ValueComment
userNameVARCHAR(24)PRI''
okey_atenum - AssetTypePRI'None'
okey_tsenum - TickerSrcPRI'None'
okey_tkVARCHAR(12)PRI''
okey_yrSMALLINT UNSIGNEDPRI, SEC0
okey_mnTINYINT UNSIGNEDPRI, SEC0
okey_dyTINYINT UNSIGNEDPRI, SEC0
okey_xxDOUBLEPRI0
okey_cpenum - CallPutPRI'Call'
volDOUBLE0volatility
volSrcenum - FieldSrc'Default'
uPrcDOUBLE0underlying price
uPrcSrcenum - FieldSrc'Default'
yearsDOUBLE0yearstoexpiration default uses SR volatility time value
yearsSrcenum - FieldSrc'Default'
sdivDOUBLE0continuous stock dividend using for pricing
sdivSrcenum - FieldSrc'Default'
rateDOUBLE0discount rate used for pricing
rateSrcenum - FieldSrc'Default'
exTypeenum - ExerciseType'None'exercise type of the option American or European
exTypeSrcenum - FieldSrc'Default'
effStrikeDOUBLE0effective strike used for pricing default is okeyStrike
effStrikeSrcenum - FieldSrc'Default'
symRatioDOUBLE0underlying symbol ratio for nonstandard options discrete dividend will be scaled by this factor
symRatioSrcenum - FieldSrc'Default'
divStringTINYTEXT''discrete dividend string yearsToExpiry years1amt1 years2amt2 or 1 date1amt1 date2amt2
divSrcenum - FieldSrc'Default'
modelTypeenum - CalcModelType'None'
modelTypeSrcenum - FieldSrc'Default'
calcPrecisionenum - CalcPrecision'Low'numerical precision of steps if a numerical method is used more steps will be slower to calculate
incGreeksenum - YesNo'No'
priceDOUBLE0price premium
deltaFLOAT0delta
gammaFLOAT0gamma
thetaFLOAT0theta
vegaFLOAT0vega
volgaFLOAT0volga
vannaFLOAT0vanna
deDecayFLOAT0delta decay
rhoFLOAT0rho
phiFLOAT0phi
errorVARCHAR(32)''
pricerModelVARCHAR(8)''
timestampDATETIME(6)'2000-01-01'

PRIMARY KEY DEFINITION (Unique)

FieldSequence
userName1
okey_tk2
okey_yr3
okey_mn4
okey_dy5
okey_xx6
okey_cp7
okey_at8
okey_ts9

SECONDARY INDEX (ExpirationIndex) (Not Unique)

FieldSequence
okey_yr1
okey_mn2
okey_dy3

CREATE TABLE EXAMPLE QUERY

CREATE TABLE `SRAnalytics`.`MsgOptionCalculator` (
`userName` VARCHAR(24) NOT NULL DEFAULT '',
`okey_at` ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') NOT NULL DEFAULT 'None',
`okey_ts` ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','EUX','ANY','CXE','DXE','NXAM','NXBR','NXLS','NXML','NXOS','NXP','EUREX','CEDX','ICEFE') NOT NULL DEFAULT 'None',
`okey_tk` VARCHAR(12) NOT NULL DEFAULT '',
`okey_yr` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`okey_mn` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`okey_dy` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`okey_xx` DOUBLE NOT NULL DEFAULT 0,
`okey_cp` ENUM('Call','Put','Pair') NOT NULL DEFAULT 'Call',
`vol` DOUBLE NOT NULL DEFAULT 0 COMMENT 'volatility',
`volSrc` ENUM('Default','User') NOT NULL DEFAULT 'Default',
`uPrc` DOUBLE NOT NULL DEFAULT 0 COMMENT 'underlying price',
`uPrcSrc` ENUM('Default','User') NOT NULL DEFAULT 'Default',
`years` DOUBLE NOT NULL DEFAULT 0 COMMENT 'years-to-expiration (default uses SR volatility time value)',
`yearsSrc` ENUM('Default','User') NOT NULL DEFAULT 'Default',
`sdiv` DOUBLE NOT NULL DEFAULT 0 COMMENT 'continuous stock dividend using for pricing',
`sdivSrc` ENUM('Default','User') NOT NULL DEFAULT 'Default',
`rate` DOUBLE NOT NULL DEFAULT 0 COMMENT 'discount rate used for pricing',
`rateSrc` ENUM('Default','User') NOT NULL DEFAULT 'Default',
`exType` ENUM('None','American','European','Asian','Cliquet') NOT NULL DEFAULT 'None' COMMENT 'exercise type of the option (American or European)',
`exTypeSrc` ENUM('Default','User') NOT NULL DEFAULT 'Default',
`effStrike` DOUBLE NOT NULL DEFAULT 0 COMMENT 'effective strike used for pricing (default is okey.Strike)',
`effStrikeSrc` ENUM('Default','User') NOT NULL DEFAULT 'Default',
`symRatio` DOUBLE NOT NULL DEFAULT 0 COMMENT 'underlying symbol ratio (for non-standard options); discrete dividend will be scaled by this factor',
`symRatioSrc` ENUM('Default','User') NOT NULL DEFAULT 'Default',
`divString` TINYTEXT NOT NULL DEFAULT '' COMMENT 'discrete dividend string [ yearsToExpiry, years1:amt1, years2:amt2, ...] or [ -1, date1:amt1, date2:amt2, ... ]',
`divSrc` ENUM('Default','User') NOT NULL DEFAULT 'Default',
`modelType` ENUM('None','LogNormalExact','NormalExact','LogNormalApprox','NormalApprox') NOT NULL DEFAULT 'None',
`modelTypeSrc` ENUM('Default','User') NOT NULL DEFAULT 'Default',
`calcPrecision` ENUM('None','Low','Normal','High','Custom') NOT NULL DEFAULT 'Low' COMMENT 'numerical precision (# of steps) if a numerical method is used; [more steps will be slower to calculate]',
`incGreeks` ENUM('None','Yes','No') NOT NULL DEFAULT 'No',
`price` DOUBLE NOT NULL DEFAULT 0 COMMENT 'price (premium)',
`delta` FLOAT NOT NULL DEFAULT 0 COMMENT 'delta',
`gamma` FLOAT NOT NULL DEFAULT 0 COMMENT 'gamma',
`theta` FLOAT NOT NULL DEFAULT 0 COMMENT 'theta',
`vega` FLOAT NOT NULL DEFAULT 0 COMMENT 'vega',
`volga` FLOAT NOT NULL DEFAULT 0 COMMENT 'volga',
`vanna` FLOAT NOT NULL DEFAULT 0 COMMENT 'vanna',
`deDecay` FLOAT NOT NULL DEFAULT 0 COMMENT 'delta decay',
`rho` FLOAT NOT NULL DEFAULT 0 COMMENT 'rho',
`phi` FLOAT NOT NULL DEFAULT 0 COMMENT 'phi',
`error` VARCHAR(32) NOT NULL DEFAULT '',
`pricerModel` VARCHAR(8) NOT NULL DEFAULT '',
`timestamp` DATETIME(6) NOT NULL DEFAULT '2000-01-01',
PRIMARY KEY USING HASH (`userName`,`okey_tk`,`okey_yr`,`okey_mn`,`okey_dy`,`okey_xx`,`okey_cp`,`okey_at`,`okey_ts`),
KEY `ExpirationIndex` (`okey_yr`,`okey_mn`,`okey_dy`) USING HASH
) ENGINE=SRSE DEFAULT CHARSET=LATIN1 COMMENT='This table allows custom option pricing based on either user or SR supplied input values.';

SELECT TABLE EXAMPLE QUERY

SELECT
`userName`,
`okey_at`,
`okey_ts`,
`okey_tk`,
`okey_yr`,
`okey_mn`,
`okey_dy`,
`okey_xx`,
`okey_cp`,
`vol`,
`volSrc`,
`uPrc`,
`uPrcSrc`,
`years`,
`yearsSrc`,
`sdiv`,
`sdivSrc`,
`rate`,
`rateSrc`,
`exType`,
`exTypeSrc`,
`effStrike`,
`effStrikeSrc`,
`symRatio`,
`symRatioSrc`,
`divString`,
`divSrc`,
`modelType`,
`modelTypeSrc`,
`calcPrecision`,
`incGreeks`,
`price`,
`delta`,
`gamma`,
`theta`,
`vega`,
`volga`,
`vanna`,
`deDecay`,
`rho`,
`phi`,
`error`,
`pricerModel`,
`timestamp`
FROM `SRAnalytics`.`MsgOptionCalculator`
WHERE
/* Replace with a VARCHAR(24) */
`userName` = 'Example_userName'
AND
/* Replace with a ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') */
`okey_at` = 'None'
AND
/* Replace with a ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','EUX','ANY','CXE','DXE','NXAM','NXBR','NXLS','NXML','NXOS','NXP','EUREX','CEDX','ICEFE') */
`okey_ts` = 'None'
AND
/* Replace with a VARCHAR(12) */
`okey_tk` = 'Example_okey_tk'
AND
/* Replace with a SMALLINT UNSIGNED */
`okey_yr` = 123
AND
/* Replace with a TINYINT UNSIGNED */
`okey_mn` = 1
AND
/* Replace with a TINYINT UNSIGNED */
`okey_dy` = 1
AND
/* Replace with a DOUBLE */
`okey_xx` = 4.56
AND
/* Replace with a ENUM('Call','Put','Pair') */
`okey_cp` = 'Call';

UPDATE TABLE EXAMPLE QUERY

UPDATE `SRAnalytics`.`MsgOptionCalculator` 
SET
/* Replace with a DOUBLE */
`vol` = 4.56,
/* Replace with a ENUM('Default','User') */
`volSrc` = 'Default',
/* Replace with a DOUBLE */
`uPrc` = 4.56,
/* Replace with a ENUM('Default','User') */
`uPrcSrc` = 'Default',
/* Replace with a DOUBLE */
`years` = 4.56,
/* Replace with a ENUM('Default','User') */
`yearsSrc` = 'Default',
/* Replace with a DOUBLE */
`sdiv` = 4.56,
/* Replace with a ENUM('Default','User') */
`sdivSrc` = 'Default',
/* Replace with a DOUBLE */
`rate` = 4.56,
/* Replace with a ENUM('Default','User') */
`rateSrc` = 'Default',
/* Replace with a ENUM('None','American','European','Asian','Cliquet') */
`exType` = 'None',
/* Replace with a ENUM('Default','User') */
`exTypeSrc` = 'Default',
/* Replace with a DOUBLE */
`effStrike` = 4.56,
/* Replace with a ENUM('Default','User') */
`effStrikeSrc` = 'Default',
/* Replace with a DOUBLE */
`symRatio` = 4.56,
/* Replace with a ENUM('Default','User') */
`symRatioSrc` = 'Default',
/* Replace with a TINYTEXT */
`divString` = 'dummy tiny text',
/* Replace with a ENUM('Default','User') */
`divSrc` = 'Default',
/* Replace with a ENUM('None','LogNormalExact','NormalExact','LogNormalApprox','NormalApprox') */
`modelType` = 'None',
/* Replace with a ENUM('Default','User') */
`modelTypeSrc` = 'Default',
/* Replace with a ENUM('None','Low','Normal','High','Custom') */
`calcPrecision` = 'Low',
/* Replace with a ENUM('None','Yes','No') */
`incGreeks` = 'No',
/* Replace with a DOUBLE */
`price` = 4.56,
/* Replace with a FLOAT */
`delta` = 1.23,
/* Replace with a FLOAT */
`gamma` = 1.23,
/* Replace with a FLOAT */
`theta` = 1.23,
/* Replace with a FLOAT */
`vega` = 1.23,
/* Replace with a FLOAT */
`volga` = 1.23,
/* Replace with a FLOAT */
`vanna` = 1.23,
/* Replace with a FLOAT */
`deDecay` = 1.23,
/* Replace with a FLOAT */
`rho` = 1.23,
/* Replace with a FLOAT */
`phi` = 1.23,
/* Replace with a VARCHAR(32) */
`error` = 'Example_error',
/* Replace with a VARCHAR(8) */
`pricerModel` = 'Example_pricerModel',
/* Replace with a DATETIME(6) */
`timestamp` = '2022-01-01 12:34:56.000000'
WHERE
/* Replace with a VARCHAR(24) */
`userName` = 'Example_userName'
AND
/* Replace with a ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') */
`okey_at` = 'None'
AND
/* Replace with a ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','EUX','ANY','CXE','DXE','NXAM','NXBR','NXLS','NXML','NXOS','NXP','EUREX','CEDX','ICEFE') */
`okey_ts` = 'None'
AND
/* Replace with a VARCHAR(12) */
`okey_tk` = 'Example_okey_tk'
AND
/* Replace with a SMALLINT UNSIGNED */
`okey_yr` = 123
AND
/* Replace with a TINYINT UNSIGNED */
`okey_mn` = 1
AND
/* Replace with a TINYINT UNSIGNED */
`okey_dy` = 1
AND
/* Replace with a DOUBLE */
`okey_xx` = 4.56
AND
/* Replace with a ENUM('Call','Put','Pair') */
`okey_cp` = 'Call';

INSERT TABLE EXAMPLE QUERY

INSERT INTO `SRAnalytics`.`MsgOptionCalculator`(
/* Replace with a VARCHAR(24) */
`userName`,
/* Replace with a ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') */
`okey_at`,
/* Replace with a ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','EUX','ANY','CXE','DXE','NXAM','NXBR','NXLS','NXML','NXOS','NXP','EUREX','CEDX','ICEFE') */
`okey_ts`,
/* Replace with a VARCHAR(12) */
`okey_tk`,
/* Replace with a SMALLINT UNSIGNED */
`okey_yr`,
/* Replace with a TINYINT UNSIGNED */
`okey_mn`,
/* Replace with a TINYINT UNSIGNED */
`okey_dy`,
/* Replace with a DOUBLE */
`okey_xx`,
/* Replace with a ENUM('Call','Put','Pair') */
`okey_cp`,
/* Replace with a DOUBLE */
`vol`,
/* Replace with a ENUM('Default','User') */
`volSrc`,
/* Replace with a DOUBLE */
`uPrc`,
/* Replace with a ENUM('Default','User') */
`uPrcSrc`,
/* Replace with a DOUBLE */
`years`,
/* Replace with a ENUM('Default','User') */
`yearsSrc`,
/* Replace with a DOUBLE */
`sdiv`,
/* Replace with a ENUM('Default','User') */
`sdivSrc`,
/* Replace with a DOUBLE */
`rate`,
/* Replace with a ENUM('Default','User') */
`rateSrc`,
/* Replace with a ENUM('None','American','European','Asian','Cliquet') */
`exType`,
/* Replace with a ENUM('Default','User') */
`exTypeSrc`,
/* Replace with a DOUBLE */
`effStrike`,
/* Replace with a ENUM('Default','User') */
`effStrikeSrc`,
/* Replace with a DOUBLE */
`symRatio`,
/* Replace with a ENUM('Default','User') */
`symRatioSrc`,
/* Replace with a TINYTEXT */
`divString`,
/* Replace with a ENUM('Default','User') */
`divSrc`,
/* Replace with a ENUM('None','LogNormalExact','NormalExact','LogNormalApprox','NormalApprox') */
`modelType`,
/* Replace with a ENUM('Default','User') */
`modelTypeSrc`,
/* Replace with a ENUM('None','Low','Normal','High','Custom') */
`calcPrecision`,
/* Replace with a ENUM('None','Yes','No') */
`incGreeks`,
/* Replace with a DOUBLE */
`price`,
/* Replace with a FLOAT */
`delta`,
/* Replace with a FLOAT */
`gamma`,
/* Replace with a FLOAT */
`theta`,
/* Replace with a FLOAT */
`vega`,
/* Replace with a FLOAT */
`volga`,
/* Replace with a FLOAT */
`vanna`,
/* Replace with a FLOAT */
`deDecay`,
/* Replace with a FLOAT */
`rho`,
/* Replace with a FLOAT */
`phi`,
/* Replace with a VARCHAR(32) */
`error`,
/* Replace with a VARCHAR(8) */
`pricerModel`,
/* Replace with a DATETIME(6) */
`timestamp`
)
VALUES(
'Example_userName',
'None',
'None',
'Example_okey_tk',
123,
1,
1,
4.56,
'Call',
4.56,
'Default',
4.56,
'Default',
4.56,
'Default',
4.56,
'Default',
4.56,
'Default',
'None',
'Default',
4.56,
'Default',
4.56,
'Default',
'dummy tiny text',
'Default',
'None',
'Default',
'Low',
'No',
4.56,
1.23,
1.23,
1.23,
1.23,
1.23,
1.23,
1.23,
1.23,
1.23,
'Example_error',
'Example_pricerModel',
'2022-01-01 12:34:56.000000'
);

DELETE TABLE EXAMPLE QUERY

DELETE FROM `SRAnalytics`.`MsgOptionCalculator` 
WHERE
/* Replace with a VARCHAR(24) */
`userName` = 'Example_userName'
AND
/* Replace with a ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') */
`okey_at` = 'None'
AND
/* Replace with a ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','EUX','ANY','CXE','DXE','NXAM','NXBR','NXLS','NXML','NXOS','NXP','EUREX','CEDX','ICEFE') */
`okey_ts` = 'None'
AND
/* Replace with a VARCHAR(12) */
`okey_tk` = 'Example_okey_tk'
AND
/* Replace with a SMALLINT UNSIGNED */
`okey_yr` = 123
AND
/* Replace with a TINYINT UNSIGNED */
`okey_mn` = 1
AND
/* Replace with a TINYINT UNSIGNED */
`okey_dy` = 1
AND
/* Replace with a DOUBLE */
`okey_xx` = 4.56
AND
/* Replace with a ENUM('Call','Put','Pair') */
`okey_cp` = 'Call';

Doc Columns Query

SELECT * FROM SRAnalytics.doccolumns WHERE TABLE_NAME='OptionCalculator' ORDER BY ordinal_position ASC;