GUIDELINES
Columbia University
MATH GR5260 Spring 2021 Programming for Quant and Computational Finance Ng
April 23rd 2021 (Fri) 8:10pm – 10:10pm
Copyright By PowCoder代写 加微信 powcoder
This is an open book exam. You may use any notes, reference materials, internet, Jupyter Notebook or any Python IDEs during the exam period. However, you only have limited time to complete the exam, so you must use your time wisely.
All answers must be written legibly.
In the Python code you write, add comments to your code where you think will help grader understand your logic.
If you suspect of any typos or some questions are wrong, please email the instructor during the exam.
Exam paper will be uploaded onto Courseworks as ‘Exam 2’ under the Assignment section.
Once you see the exam paper in ‘Exam 2’ section, you may download the exam paper and
work on your solution
You should finish completing the exam and prepare to upload your solution files onto Courseworks, in the same way you uploaded your homework previously. You have 10 mins to prepare the solution files for upload.
a proper timestamp of submission.
If you have technical issues in submitting your
solution (eg. courseworks is crashed), please email your solution directly to both TA and
Prof Ng to get
The exam will be closed. Anything submitted or emailed after this time will not be accepted as your exam solution.
Solution submission
• You may name these files whichever way you like.
• Make sure that in each of these files, you have your name and UNI on it.
Submit your python code (and output results) as a Jupyter notebook or HTML or pdf file.
Your solution to the theory questions can be included in your Jupyter notebook or submitted separately as
image files (eg. jpg, png, pdf) which can be viewed by standard tools.
During the exam, if you have questions, post your questions onto the Zoom chat.
HONOR CODE AFFIRMATION
I affirm that I will not plagiarize, use unauthorized materials, or give or receive illegitimate help on assignments, papers, or examinations. I will also uphold equity and honesty in the evaluation of my work and the work of others. I do so to sustain a community built around this Code of Honor. (https://www.college.columbia.edu/honorcode#:~:text=)
First name Last name UNI Signature
Please include the above statement, your name and signature in one of your solution files.
QUESTION 1 (35 POINTS)
This question is to investigate and compare the 10-day VaR calculations using a 10-day window and a 1-day window. We will use the Dow Jones Index closing prices from Yahoo Finance as the data source.
Hypothetically, suppose we have held a portfolio of 1 share of DJI for the past 2 years.
The current date is April 16th 2021.
a) Compute the 95% 1-day historical VaR of the portfolio for the past 100 days. Each historical VaR value (say, on date T) shall be computed using 250 days of daily log price returns (ie. returns on T-249, …, T-1, T). Display the result for the current date.
b) Estimate 95% 10-day VaR for the past 100 days from the results in (a). (Use: N-day VaR = 1-day VaR x √𝑁) Display the result for the current date.
c) Compute the 95% 10-day historical VaR of the portfolio for the past 100 days. Each historical VaR value shall be computed using 250 days of 10-day log price returns. Display the result for the current date.
d) Plot the results of part (b) and (c) in the same figure with proper labels.
e) Comment on the shape of the plots in (d). Could you give an explanation for the shape of the plots?
QUESTION 2 (45 POINTS)
This question is about comparing different machine learning models in the prediction of option prices.
The attached file, option_data.csv, includes simulated prices of a European call option with different spot prices, strikes, time to expiry (in years) and volatilities.
a) Use option_data.csv as the training set to train the following models to predict option prices. Use grid search with 5-fold cross validation to find the optimal hyperparameters when requested below.
i. SVM regression model: use RBF kernel with 𝐶 = 100, 𝛾 = 0.5.
ii. Random forest: use 3 features to determine the optimal split in each node of the trees. Find the
optimal number of decision trees between 30 and 50.
iii. Neural network with one hidden layer: use ReLU as activation function. Choose the best number 𝑛 of hidden neurons from 𝑛 = 8, 16, 32, 64, 128. For other parameters, feel free to pick your preferred ones.
b) Find the 5-fold cross validation mean score for each of the trained models in (a).
We would like to know how these models predict the payoff when time to expiry is zero.
c) Create a test dataset with 251 examples where the spot price ranges from 50,51,52,… 300 and all have the same strike = 180, time to expiry = 0 and option volatility = 0%. Predict the option prices for the test dataset using the 3 trained models.
d) Plot the predicted price results in (c) against the spot prices. Which trained model is the poorest in predicting the payoff at expiry? Can you give a possible explanation for that?
QUESTION 3 (20 POINTS)
This question is about training a SVM binary classifier without using scikit-learn.
In class, we discussed the mathematical formulation of the SVM binary classification model which is equivalent
to solving for the 𝛼!′𝑠 in the following optimization problem.
min𝐽(𝜶)subjectto ∑𝒎 𝛼𝑦(!) =0and0≤𝛼 ≤𝐶fori=1,…,m
> 𝛼 𝛼 𝒙(+)B − > 𝛼 2!+!
Suppose we have a training set of 3 examples with 2 features. The examples are: (−1,1), (0,1), (1,1) and their corresponding labels are 𝑦(-) = 1, 𝑦(.) = −1, 𝑦(/) = 1. (eg. we can visualize them as 3 points in a 2D plane, two in red color and one in green color)
Let’s say, we use 𝐶 = 100 in the SVM binary classifier with a polynomial kernel of degree 2 defined as 𝐾(𝒖,𝒗)=(𝒖∙𝒗). forany𝒖,𝒗∈R𝟐
and 𝒖 ∙ 𝒗 is the dot product of 𝒖, 𝒗.
a) Write down, explicitly, the function 𝐽(𝜶) = 𝐽(𝛼-, 𝛼., 𝛼/) and the constraints for this training problem.
b) Use (a) to find 𝛼!′𝑠 that minimize the value of 𝐽(𝜶). (Hint: write 𝛼. in terms of 𝛼-, 𝛼/)
c) In this particular case, the decision function can be written as 𝑓(𝑥-, 𝑥.) = 𝑎𝑥-. + 𝑏. What are the values of 𝑎 and𝑏?
–end of exam–
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com