예제 #1
0
"""

import sys

sys.dont_write_bytecode = True

from entity.EuropeanOptions import *
from model.BlackScholesCalculator import *

bs = BlackScholesCalculator()

opt = EuropeanOptions("call", 100.0, 100.0, 0.35607, 1, 0.02)
value = bs.getValue(opt.type, opt.stockPrice, opt.strike, opt.volatility, opt.expiryYears, opt.riskfreeRate)
print "value of call:", value

delta = bs.getDelta(opt.type, opt.stockPrice, opt.strike, opt.volatility, opt.expiryYears, opt.riskfreeRate)
print "delta of call:", delta

theta = bs.getTheta(opt.type, opt.stockPrice, opt.strike, opt.volatility, opt.expiryYears, opt.riskfreeRate)
print "theta of call:", theta

rho = bs.getRho(opt.type, opt.stockPrice, opt.strike, opt.volatility, opt.expiryYears, opt.riskfreeRate)
print "rho of call:", rho

print

opt = EuropeanOptions("put", 100.0, 100.0, 0.35607, 1, 0.02)

value = bs.getValue(opt.type, opt.stockPrice, opt.strike, opt.volatility, opt.expiryYears, opt.riskfreeRate)
print "value of put:", value