### 10.6.1
A digital call option with maturity T and strike K. This has a payoff equal to 1 if the stock price at maturity is greater than K and 0 other wise. “Binary option” or even “Boolean option” would perhaps be more logical names, but digital is the standard term. You can get European,American, etc., versions of digital options. A digital put option has payoff equal to 1 if the stock price at maturity is less than K and 0 otherwise.
Write classes DigitalCallOption and DigitalPutOption. Price them using the MonteCarloPricer. See Appendix A if you do not recall what a digital option is.
Write a class NormalPDF and compute its integral from −1.96 to 1.96.
Write a function integralToInfinity that uses integration by substitution to transform an infinite integral to one the function integral can compute.
Test the normcdf function against numerical integration of the pdf of the normal distribution.
Write a function differentiateNumerically that can differentiate any RealFunction.
Any encryption algorithm should have methods encrypt and decrypt. This can be represented as an interface called Cipher. It is then possible to provide different implementations of the encryption algorithm that work in different ways. For example, you might write a CaeserCipher that replaces a with d, b with e, c with f, etc., or you might write a ReverseCipher that replaces a with z and b with y, etc. You could then write software that sends encrypted messages and that is capable of working with any Cipher.
Write an interface Cipher and provide at least two implementations of your choice. Write a single function void testCipher(Cipher& toTest) that can test any Cipher works correctly.
Write a class RectangleRulePricer which can price a PathDependentOption using the numerical integration routines written in the earlier exercises. Use Equation (A.3) to compute the probability density function for the log of the stock price. Check your solution works with a CallOption. This gives a numerical test of the derivation of Equation (A.6)
Design an interface called ContinuousTimeOption. It should have a function payoff which takes a vector of stock prices and a vector of times at which the price occurred. This should return the payoff that would have occurred if the stock price had varied linearly between the time points. (Obviously we can’t actually supply the stock price at an infinite number of points). The ContinuousTimeOption should also have a function called getMaturity(). Write an implementation of ContinuousTimeOption called KnockOutCallOption. Add a function to MonteCarloPricer which can approximate the price of any ContinuousTimeOption given a finite number of time steps.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。