Example 1

This example performs the optimization described in the paper to obtain the physical distribution P and the martingale distributions Q, where:

  • n is the number of states considered

  • alpha is a parameter limiting the second moment of the pricing kernel

  • lambda is a parameter for the Tikhonov-type regularization

  • omega_l includes the disjunct state space partitions of interest

  • sp represents the spot prices in 4 different states of the world

  • strike represents the strike prices of different options

  • bid represents the bid prices of different options

  • ask represents the ask prices of different options

  • pflag indicates whether an option si a call or a put option

  • result includes two elements: the P distribution and the Q distribution

import dbbpy
import numpy as np 

n = 4 
alpha = 1.3
lambda_ = 1.1
omega_l = np.array([0, 3])
sp = np.array([1200, 1250, 1300, 1350])
strike = np.array([1290, 1295, 1295, 1300])
bid = np.array([27.7, 27.4, 29.4, 25.0])
ask = np.array([29.3, 29.7, 31.4, 26.9])
pFlag = np.array([1,0,1,0])

result = dbbpy.performOptimization(n, alpha, lambda_, omega_l, sp, strike, bid, ask, pFlag)
p = result[0]
q = result[1]

print(p)
print(q)

Last updated