1 Star 0 Fork 0

云金杞/learn_cpp_series

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

### 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.

10.6.2

Write a class NormalPDF and compute its integral from −1.96 to 1.96.

10.6.3

Write a function integralToInfinity that uses integration by substitution to transform an infinite integral to one the function integral can compute.

10.6.4

Test the normcdf function against numerical integration of the pdf of the normal distribution.

10.6.5

Write a function differentiateNumerically that can differentiate any RealFunction.

10.6.6

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.

10.6.8

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)

10.6.9

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.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/yunjinqi/learn_cpp_series.git
git@gitee.com:yunjinqi/learn_cpp_series.git
yunjinqi
learn_cpp_series
learn_cpp_series
master

搜索帮助