首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
C++程序讲解、辅导c++程序、辅导program编程语言 讲解R语言编程|辅导Database
项目预算:
开发周期:
发布时间:
要求地区:
Project 2 (50% of the final mark)
Path dependent options pricing
using object-oriented programming
C++ Programming with Applications to Finance Spring 2021
The aim of this project is to create a program in C++ that can be used to study the prices of Path
Dependent on an underlying asset driven by a binomial model in discrete time. Your program
should be accompanied by end-user and developer documentation. The project is aimed at testing
your knowledge from the Term 2 of the course and must be implemented in the object-oriented
programming paradigm. You must use object-oriented approach when creating this project.
A path dependent option is an exotic option that's value depends not only on the price of the
underlying asset but the path that asset took during all or part of the life of the option.
(source: Investopedia)
We assume that the price of the underlying is strictly positive at moment 0 (S0 = S(0) > 0) and at
each moment t in can either move up (1+u) times or down (1+d) times. As always in the binomial
model there is a risk-free security growing by a factor (1+r) during each time step. For more
details on binomial model please see Capinski & Zastawniak (2012) pp. 1-2.
Further we use S(t) for the price of the underlying asset at moment t, K for the strike, T for
maturity and A(0,T) for the average price for the period [0, T].
You should create a project that includes pricing of four types of path dependent options: a
lookback option, a fixed strike Asian call option (with arithmetic average), a Parisian option and
the one that we will refer to as Consecutive Growth option.
A lookback option is a path dependent option where the option owner has the right to buy the
underlying instrument at its lowest price over some preceding period:
( ( ) ( ))
0
min lookback t T
C S T S t
= −
. Pleases notice that the minimum is taken over all
t T 0, .
Fixed strike Asian call payoff is given by
C A T K Asian Call = − max 0, , 0 ( ( ) ) , where A(0,T) stands
for arithmetic mean
( ) ( )
1
1
0,
T
t
A T S t
T =
= .
The payoff of a standard Parisian option is dependent on the maximum amount of time the
underlying asset value has spent consecutively above or below a strike price
( ) ( ) ( )
( ) ( )
, 1 ,...,
max 1 , 0,
0,
S s K S s K S t K
Parisian
t s if t T such that S t K
C
otherwise
+
− +
=
. Notice that we
consider the maximal number of consecutive moments (not the periods between the moments)
when the price S(t) of the underlying is at or above some strike value K, and the payoff equals the
number of the moments in such streak. If at all moments from 0 to T the price S(t) is below K (i.e.,
S(t)
The payoff of the Consecutive Growth option is also defined in terms of the number of days:
( ) ( ) ( )
( ) ( ) ( )
1
max , 0, 1 1
0,
S s S s S t
Consecutive Growth
t s if t T such that S t S t
C
otherwise
+
− − +
=
. Notice that
we consider the maximal number of consecutive periods (not the moments, but the periods
between them) of growth when the price S(t) of the underlying is non-decreasing. If the price S(t)
always decreases, then the payoff is zero.
General hints and tips
• Read the submission instructions at the end of this document before starting work on the
project.
• Read through all the tasks before starting work on the project. Tasks do not have to be
completed in the order that they are listed here.
• You are free to recycle any code produced by yourself during the module. You are also free
to use any code provided in Moodle during the module, provided that such code is
acknowledged.
This project contributes 50% to the mark for this module. The deadline for submission is
23:59pm on Monday 17 May 2021 (Week 5 Summer Term). The marks for each of the tasks
below will be split into 60% for coding style, clarity, accuracy, and efficiency of computation, and
40% for documentation (including comments within the code) and ease of use.
Task.
You will do this project in the object-oriented paradigm. There are 10 header files and 2 cpp files
attached to the task. You project must include the following classes:
1) BinModel (h file and cpp files are attached to the task)
2) Pathinfo (h file is attached to the task)
3) AllPaths (h file is attached to the task)
4) PricePathGenerator (h file is attached to the task)
5) Option (h file is attached to the task)
6) EurOption (h file is attached, the class is intentionally left empty as it is not a matter of
interest in this project and you do NOT need to write any implementation in this class)
7) AmOption (h file is attached, the class is intentionally left empty as it is not a matter of
interest in this project, and you do NOT need to write any implementation in this class)
8) PathDependentOption (h file is attached to the task)
9) AsianCallOption
10) ParOption (h file is attached to the task)
11) LookbackOption
12) GrowOption (h file is attached to the task)
Two classes that do not have h files are AsianCallOption and LookbackOption. It means that they
must be created from scratch. If you want you can create additional classes or members in the
existing classes, but you must justify and describe them in the comments and in the
documentation.
BinModel.h and BinModel.cpp form the class for binomial model (they repeat BinModel02.h and
BinModel02.cpp from the project for the book Capinski & Zastawniak (2012)). This class is
already implemented.
Class Pathinfo contains information about a single path: its number, the path itself represented
as a vector of length N of numbers from {0,1} set (according to the bijection explained below, you
need to create and implement this bijection), the vector of prices along this path and the riskneutral
probability of this path. Please notice that the main goal this class to store the information
about the path and provide an access to this information via getters. Generation of the path (as a
vector of numbers from {0,1}), the prices along the path and the probability of the path are left in
a separate class PricePathGenerator. Finally, class AllPaths contains the vector of objects of
PathInfo and a method GetPathsNumber that returns the number of paths in the vector. Such
design provides greater flexibility as, for example, one may prefer to read the paths, from the file
instead of generating them in the program. Notice that three classes mentioned in this paragraph
are related to the price paths of the underlying assets only and do not require a presence of any
options. If the paths are needed for some reasons other than option pricing, then these classes
can be used there as well. You need to write implementation of all necessary functions in this
classes. You are allowed to add members to these classes, but you must justify and describe them
all in the comments and in the documentation.
There are several classes related to the options. First, there is a general class Option, that has
three children: class EurOption of European options, class AmOption of American options and
class PathDependentOption of path dependent options. Classes EurOption and AmOption are
intentionally left totally empty as they are not a matter of interest in this project, and you do NOT
need to write any implementation in these two classes. Class Option contains the information
about the binary model Model associated with this option and the number of steps to expiry N, it
also has a virtual function GetPrice that will be redefine in the subclasses and will return the price
of the option.
Class PathDependentOption is inherited from Option and should contain information about all
paths, a virtual function GetPayoffByPathInfo that will be redefined in the subclasses and return
a payoff on each path. It also has a sketch of a GetPrice function that prices a path dependent
option (the implementation of this function must be moved to a corresponding cpp file, you may
also want to modify it).
All four path dependent options that you need to price in this project: Lookback, Asian call,
Parisian, and Consecutive Growth options are particular cases of path dependent options. Their
classes then must be inherited from PathDependentOption. Class ParOption stands for Parisian
option, class GrowOption stands Consecutive Growth option. Notice that there is a considerable
difference between these two options as Parisian option has an extra parameter Strike price. You
need to create a class AsianCallOption for Asian call option and a class LookbackOption for
Lookback option from scratch. Perhaps, you will want to create some intermediary classes such
as AsianOption for Asian options. If you decide to create such class, then you must justify and
document it properly. When working on the project, please keep in mind the idea of the
reusability of your code and its possible extensions. These aspects must necessarily be
addressed in the documentation.
Your program should ask the user to enter the value of the parameters S0, U, D, R, Ka (a strike
price for the Asian Call option), Kp (a strike price for the Parisian option) and N (the number of
steps to expiry – the same as T in the description of the model).
Clearly, for the N-period model there are 2N different paths, and one can easily construct a
bijection between these paths and the set of arrays of length N consisting of zeros and ones. For
example, if N = 3 then then an array {0,0,1} may correspond to the underlying asset growing in
the first two periods and then falling in the period 3, i.e. getting S1=S0(1+U), S2=S0(1+U)2 and
S3=S0(1+U)2(1+D), if one codes an upward moving of the asset with 0 and a downward moving
with 1 (or falling in the first two periods and then growing in the period 3 if one codes a
downward moving of the asset with 0 and an upward moving with 1, or perhaps, even the
elements of the array may describe the changes in the underlying asset in the opposite order with
the last elements corresponding to the moves in the first periods – you can use any approach that
suits you, but you need to describe it carefully and be consistent). For this purpose, you should
use the function GenPathByNumber.
After successfully coding the path with number x as an array of zeros and ones you can generate
a vector of prices along this path with GenPricesByPath. The probability of moving along the path
should be calculated with GenProbabilityByPath. The probability of getting a path along which the
price moves up i times and down (N-i) times equals qi(1-q)
N-i
, where q is the risk-neutral
probability
R D
q
U D
−
=
−
.
For pricing the option, one needs to find the discounted value of the average payoff. The main
difficulty you may face is that the payoff is defined by all values of the underlying asset along the
path, so the payoffs must be computed along each path separately.
Your program should then calculate the prices of Lookback, Asian call, Parisian, and Consecutive
Growth options according to the formulas listed on pages 1 and 2.
Please notice that this project tests your understanding of object-oriented programming. Before
writing a code, you need to think on the design of your project. As mentioned above, reusability
of your code and its possible extensions also affect the mark for the assignment!
Submission instructions
Submit your work by uploading it in Moodle by 23:59pm on Monday 17 May 2021 (Week 5
Summer Term).
Format
Submit the code as a single compressed .zip file, including all Code::Blocks project (.cbp) files (if
you used Code::Blocks), source code and header (.cpp and .h) files, all residing in a single parent
directory. The .zip file should preserve the subdirectory structure of the parent directory (that is,
the subdirectory structure must be automatically recreated when unzipping the file).
The code should be accompanied by detailed documentation, split into two parts:
1. Code developer documentation containing information to help understand the code.
It should contain the following:
• Description of the file structure.
• Description of the available functions.
• Instructions on how to extend the code by adding new options or derivatives.
• Test runs, including tables. Graphs are optional but encouraged.
The developer documentation should not include extensive extracts from the code (brief
snippets are perfectly fine, if typeset correctly—no screenshots!), and there is no need to
describe the mathematical methods in any detail. It is expected that the developer
documentation will be less than 10 pages in length.
2. The end user instructions should contain instructions on how to use the compiled .exe
program, how to input data and how the results are presented, and a brief description of the
methods implemented. The contents of this document should be appropriate for a reader
who is not familiar with C++. It is expected that the end user instructions will be less than 5
pages in length.
The documentation files must be submitted in .pdf format (two separate .pdf files containing
developer documentation and user instructions) and uploaded in Moodle separately from the
code .zip file.
It is advisable to allow enough time (at least one hour) to upload your files to avoid possible
congestion in Moodle before the deadline. In the unlikely event of technical problems in Moodle
please email your .zip files to sergei.belkov@york.ac.uk before the deadline.
Code usage permissions and academic integrity
You may use and adapt any code submitted by yourself as part of this module, including your own
solutions to the exercises. You may use and adapt all C++ code provided in Moodle as part of this
module, including code from Capinski & Zastawniak (2012) and the solutions to exercises. Any
code not written by yourself must be acknowledged and referenced both in your source
files and developer documentation.
This is an individual project. You may not collaborate with anybody else or use code that has
not been provided in Moodle. You may not use code written by other students. Collusion and
plagiarism detection software will be used to detect academic misconduct, and suspected offences
will be investigated.
If things go wrong
Late submissions will incur penalties according to the standard University rules for assessed
work.
It may prove impossible to examine projects that cannot be unzipped and opened due to file
corruption, or projects that cannot be compiled and run due to coding errors. In such cases a
mark of 0 will be recorded. It is therefore essential that all project files and the directory
structure are tested thoroughly on your machine before being submitted in Moodle. It is advisable
to run all such tests starting from the .zip files about to be submitted and using a different
computer to that on which the files have been created.
All files must be submitted inside the zipped project directory, and all the files in the
project directory should be connected to the project. A common error is to place some files
on a network drive rather than in the submitted directory. Please bear in mind that testing on a
lab computer may not catch this error if the machine has access to the network drive. However,
the markers would have no access to the file (since they have no access to your part of the network
drive) and would be unable to compile the project.
References
Capinski, M. J. & Zastawniak, T. (2012), Numerical Methods in Finance with C++, Mastering
Mathematical Finance, Cambridge University Press.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做 program、代写 c++设计程...
2024-12-23
comp2012j 代写、代做 java 设...
2024-12-23
代做 data 编程、代写 python/...
2024-12-23
代做en.553.413-613 applied s...
2024-12-23
代做steady-state analvsis代做...
2024-12-23
代写photo essay of a deciduo...
2024-12-23
代写gpa analyzer调试c/c++语言
2024-12-23
代做comp 330 (fall 2024): as...
2024-12-23
代写pstat 160a fall 2024 - a...
2024-12-23
代做pstat 160a: stochastic p...
2024-12-23
代做7ssgn110 environmental d...
2024-12-23
代做compsci 4039 programming...
2024-12-23
代做lab exercise 8: dictiona...
2024-12-23
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!