GS Quantify 2017
GS Quantify 2017
Volatility
For use by intended recipient only and not for further distribution
Financial derivatives [1] are defined as contracts/obligations which 'derive' their value from the prices of underlying
assets e.g. A contract to deliver 10 shares of a certain listed company XYZ Inc. at a future time and at a pre-specified
fixed price. Such derivatives are used by financial market participants to speculate on future market levels or to insure
against potential losses.
Introduction to Options
'Options'[2] are derivative contracts which offer to the holder the right, but not the obligation, to buy/sell an 'asset' at a
future date (called 'Maturity Date') and at a pre-agreed price (called 'Strike'). An option which offers the holder the rights
to 'buy' ('sell') the asset are called as 'Call' ('Put') options. These options are also commonly referred to as 'vanilla
options' in practice.
To give an example, if the price of the underlying asset were on the expiration date then, a call option with
Strike will allow the buyer to buy the asset at the Strike price . Thus, if then the buyer will exercise the
call option and receive one unit of the asset at price instead of thereby making profit of . However,
if the option is not exercised and expires worthless. Similar reasoning holds for the Put options with the
inequalities and the signs reversed. The possibility of making the profit comes at a cost which needs to be paid upfront
while entering the option contract. This cost is called as 'Premium' of simply 'Price' of the option. The price of entering a
call option can be represented mathematically as,
where,
This implies that the buyer of the call option benefits if the price of the asset at time is above the strike price but
his/her losses are limited since the option would not be exercised if . In the latter case the option is said to
have matured/expired worthless.
Options contracts are one of the simplest ways in which one can speculate on the values of asset prices for profit-
seeking or risk management purposes. However, market participants often at times find it more suitable to enter into
contracts with more complex characteristics owing to reasons like affordability of entering such specific contracts. The
affordability comes at the cost of increased complexity of the payoff structure of the derivative and thereby making it
harder to find ways of pricing such derivatives accurately. In the remainder of this challenge you would explore some of
these 'more complex' contracts also commonly known as 'exotics'.
Since future prices of financial assets are statistically random in nature, they are often mathematically represented using
'stochastic processes'[3]. If represents the value of the asset at time , then we assume that its evolution is
determined by the stochastic differential equation[4],
where, is the Weiner process. The quantity is called volatility of the asset price. The 'relative returns' at
time is a random variable and hence so is - the value of the asset price at future time . Higher value of
means that the variation of the asset price will be higher in magnitude, hence the term 'volatility' fits aptly.
The distribution of is known as the lognormal distribution. Note that isn't simply as would
have been expected from standard integration. The details of this are in [5] but not strictly necessary for this exercise.
Throughout this challenge, you are to assume that the asset price follows aforementioned process, unless explicitly
stated otherwise.
In this question, you will be provided with prices of vanilla call options which are priced using the
expression for described above. Using the price for the option , distribution of the asset prices , Strike Price
, Maturity time , Initial Asset Price and the formula for call option pricing, derive a method to estimate the volatility
(denote by ) of the asset price process.
Exotic Options
In the last section, the concept of Vanilla options was introduced. Now we look at a more complex type of option we call
as the 'Exotic option'. These options derive their name from the existence of a 'Barrier Level' which if crossed by the
future asset price, renders the option worthlesss. An exotic option rendered worthless due to such 'barrier crossing' is
commonly referred to as a 'knocked-out option'.
Exotic options like Vanilla options do possess a Strike price . The price of the exotic option is non-zero only when the
future asset prices are between the strike price and the barrier level for future times . The number of
future times can vary with each exotic option and can be as small as i.e. barrier crossing will be checked only
once in option's lifetime. These times are also known as 'Barrier observation dates'.
The above payoff, in English, means that an investor in possession of an exotic 'call' option on asset with Strike price
, Maturity and Barrier level has the right but not the obligation to buy the asset at price on time so long as
the price is in between and for all barrier observation times .
In this question you are required to design a method for pricing exotic call options. You can assume that the exotic
options in the context of this problem only have one barrier observation date. Sticking to our notation above, this means
that . Assume further that this single barrier observation date coincides with the maturity of the option .
In this setting, you are asked to compute where you will be provided with initial asset price ,
Barrier level for the option , Strike price of option and Maturity of the option . For you can use methods derived
in Question 1 for vanilla call options.
Instantaneous Volatility
The point to be noted from previous section is that volatility of asset price can depend on future time . Also the estimate
of (obtained from call option price) does not represent the 'instantaneous' volatility at time of the asset price.
Lets take an example to clarify this:
Assume we have 2 call options on having prices and and with maturity dates and respectively such that
and some strike price . Say we computed the volatilies and using the given data on
options and the methods we derived so far. Here, represents the volatility of asset price between and
. However, the volatility of asset price between and is NOT since such volatility values will
not lead to the correct call option price (which we started with).
This means, there must exist an 'instantaneous' volatility (say such that, taking these volatilities if
we had prepared estimates for they still produce the same prices that we started with.
This example with 2 call options can be extended to any number of call options in practice.
In this question you will be provided with vanilla call option prices for options along with their Strike Prices ,
corresponding maturity dates and the initial asset price . Using these data you are
required to build a program to calculate the instantaneous volatilities . The
definition of instantaneous volatility to be used is as per the section above.
So far, we have explored how vanilla call options with different maturities may imply a time-variant volatility structure. In
this final part of the challenge, we add some more complexity to the exotic option pricing problem by introducing multiple
barrier observation times. In 'Question 2', the exotic option you priced was bound to knock-out iff the barrier was
observed to be breached at the option maturity date . In practice, the traded exotic options have many such 'barrier
observation times'. Thus pricing such options demands verifying whether the future asset price as of all such future
observation dates does not lead to knock-out of the option. Mathematically, it means that the option can get knocked out
if where are the barrier observation dates.
In this question you will be provided with Initial asset price , set of barrier observation dates , set of vanilla
call option prices , Option strikes , Maturities . Using this data and the method you
derived to compute instantaneous volatilities in Question 3, you are required to find prices for following payoff,
To evaluate the price please take exotic option maturity date and strike to be and respectively.
References
Input Format
There are multiple test cases designed to test your submitted code. Each test case will have multiple lines with comma
separated numbers. The first number in each line in the input denotes the question number to which the test case
corresponds to e.g. '1' for question 1 and so on. The test cases could have any mixtures of inputs for questions 1,2,3 or
4. You must design your code to appropriately execute necessary steps.
Following the question number, the next set of comma separated numbers in each line denote the values of parameters
for the particular questions. The order of parameters for each of the questions is as given below (in same notation as
used in the sections above):
2. Question 2: (intial asset price), (strike), (Maturity), (Barrier level), (option price)
3. Question 3: (Initial asset price), (no. time steps), (vanilla Option prices),
(strike prices), (maturities)
4. Question 4: (Initial asset price), (barrier level), (no. barrier observation dates), (vanilla
Option prices), (strike prices), (barrier observation times)
Note
You have been provided with 'Sample Input 0' and 'Sample Output 0' to help you in validating your solution. 'Sample Input
0' contains sample inputs to your code as per the format described in this section. The expected outputs for each sample
input are given in same order as in 'Sample Output 0'.
Constraints
1. The code submitted must be written in Python 2.x/Python 3.x and must be well commented.
2. The documentation of work produced must be in electronically legible format. Scanned copies of handwritten
documents will not be considered for evaluation and will lead to invalidation of entire submission. There is a
separate question in the contest for submission of the documentation.
3. The methodology mentioned in the documentation must be consisted with the code submitted.
Deviations/falsifications will directly lead to invalidation of submission.
Output Format
Your code to solve the questions must produce output in format described below.
Note We expect an answer for each test case provided, else your submission will be considered invalid. Ensure that
number of test cases provided in input datasets is equal to number of answers in output file produced by your code.
There shouldn't be any blank lines in the output produced by the code
3. Question 3:
You do not need to add the question number while producing output. Just stick to above convention.
Note
The sample test inputs, outputs given to you cover a spectrum of inputs for all the questions. You are free to build the
code on your local machine and optimize it based on the sample input and sample outut data provided to you.
Once you have submitted solution code for evaluation on the platform, it will be run against a large set of test cases for
evaluation. This execution may take up to 12 minutes (depending on how optimized your code is), please be patient. In
this period you are encouraged not to re-submit any new code. If no response is obtained within 12 minutes of
submission, kindly reach out to us on the discussion board.
Please note that at the end of the contest, while computing final scores for leaderboard, your final submission will be re-
run against all test cases.
Sample Input 0
1,105,100,5,5
1,100,102,5,3.573
1,100,102,5,3.573
1,100,102,5,3.573
2,105,100,5,110,5
2,100,102,5,110,3.573
2,100,102,5,1100,3.573
2,100,102,5,100000000,3.573
3,75,3,5,10,15,100,100,100,1,3,5
3,75,3,5,10,15,100,100,100,1,1.5,2
3,75,3,5,5,5,100,100,100,1,3,5
4,75,350,3,5,10,15,100,100,100,1,3,5
4,75,350,3,5,10,15,100,100,100,1,1.5,2
4,75,350,3,5,5,5,100,100,100,1,3,5
Sample Output 0
8.881784197e-16
0.05
0.05
0.05
5.0
0.83405000731
3.55542067502
3.56730254256
0.41, 0.298914703553, 0.34
0.41, 0.595818764391, 0.673572564762
0.41, 0.0, 0.0522015325446
12.6897970638
13.0241936515
5.1419171701