Machine Learning Based Intraday Calibration of End of Day Implied Volatility Surfaces
Total Page:16
File Type:pdf, Size:1020Kb
DEGREE PROJECT IN MATHEMATICS, SECOND CYCLE, 30 CREDITS STOCKHOLM, SWEDEN 2020 Machine Learning Based Intraday Calibration of End of Day Implied Volatility Surfaces CHRISTOPHER HERRON ANDRÉ ZACHRISSON KTH ROYAL INSTITUTE OF TECHNOLOGY SCHOOL OF ENGINEERING SCIENCES Machine Learning Based Intraday Calibration of End of Day Implied Volatility Surfaces CHRISTOPHER HERRON ANDRÉ ZACHRISSON Degree Projects in Mathematical Statistics (30 ECTS credits) Master's Programme in Applied and Computational Mathematics (120 credits) KTH Royal Institute of Technology year 2020 Supervisor at Nasdaq Technology AB: Sebastian Lindberg Supervisor at KTH: Fredrik Viklund Examiner at KTH: Fredrik Viklund TRITA-SCI-GRU 2020:081 MAT-E 2020:044 Royal Institute of Technology School of Engineering Sciences KTH SCI SE-100 44 Stockholm, Sweden URL: www.kth.se/sci Abstract The implied volatility surface plays an important role for Front office and Risk Manage- ment functions at Nasdaq and other financial institutions which require mark-to-market of derivative books intraday in order to properly value their instruments and measure risk in trading activities. Based on the aforementioned business needs, being able to calibrate an end of day implied volatility surface based on new market information is a sought after trait. In this thesis a statistical learning approach is used to calibrate the implied volatility surface intraday. This is done by using OMXS30-2019 implied volatil- ity surface data in combination with market information from close to at the money options and feeding it into 3 Machine Learning models. The models, including Feed For- ward Neural Network, Recurrent Neural Network and Gaussian Process, were compared based on optimal input and data preprocessing steps. When comparing the best Ma- chine Learning model to the benchmark the performance was similar, indicating that the calibration approach did not offer much improvement. However the calibrated models had a slightly lower spread and average error compared to the benchmark indicating that there is potential of using Machine Learning to calibrate the implied volatility surface. Sammanfattning Implicita volatilitetsytor ¨arett viktigt vektyg f¨orfront office- och riskhanteringsfunk- tioner hos Nasdaq och andra finansiella institut som beh¨over omv¨arderaderas portf¨oljer best˚aendeav derivat under dagen men ocks˚af¨oratt m¨atarisk i handeln. Baserat p˚a ovann¨amndaaff¨arsbehov ¨ardet eftertraktat att kunna kalibrera de implicita volatilitets ytorna som skapas i slutet av dagen n¨astkommande dag baserat p˚any marknadsin- formation. I denna uppsats anv¨andsstatistisk inl¨arningf¨oratt kalibrera dessa ytor. Detta g¨orsgenom att uttnytja historiska ytor fr˚anoptioner i OMXS30 under 2019 i kombination med optioner n¨ara at the money f¨oratt tr¨ana3 Maskininl¨arningsmod- eller. Modellerna inkluderar Feed Forward Neural Network, Recurrent Neural Network och Gaussian Process som vidare j¨amf¨ordesbaserat p˚adata som var bearbetat p˚aolika s¨att. Den b¨astaMaskinl¨arnings modellen j¨amf¨ordesmed ett basv¨ardesom bestod av att anv¨andaf¨oreg˚aendedags yta d¨arresultatet inte innebar n˚agonst¨orref¨orb¨attring. Samtidigt hade modellen en l¨agrespridning samt genomsnittligt fel i j¨amf¨orelsemed basv¨ardetsom indikerar att det finns potential att anv¨anda Maskininl¨arningf¨oratt kalibrera dessa ytor. Acknowledgements We would like to express our gratitude towards our examiner Fredrik Viklund at the De- partment of Mathematics at the Royal Institute of Technology for his feedback regarding our thesis. We would also like to thank our supervisor at Nasdaq, Sebastian Lindberg, for his support, feedback and genuine interest in our project. Also a big thanks to our manager Henrik Hedlund who made sure that we had the data required for this project and David White who introduced us to the subject. Contents List of Figuresi List of Tables iii Acronyms iv 1 Introduction1 1.1 Problem Setting................................2 1.2 Previous Work.................................3 1.3 Thesis Outline.................................3 2 Financial Background4 2.1 Options.....................................4 2.1.1 Put and Call Options.........................4 2.1.2 Option Spreads and Arbitrage....................5 2.1.3 Black Scholes Options Pricing.....................8 2.1.4 Option Risks.............................. 11 2.2 Volatility.................................... 12 2.2.1 Implied Volatility............................ 12 2.2.2 Constructing a Implied Volatility Surface.............. 13 3 Mathematical Background 15 3.1 Statistical Learning Theory.......................... 15 3.1.1 The Loss Function........................... 16 3.1.2 Model Selection: The Bias Variance Dilemma............ 18 3.1.3 Regularisation............................. 19 3.1.4 Dimension Reduction......................... 20 3.2 Artificial Neural Networks........................... 22 3.2.1 Feed Forward Neural Network..................... 22 3.2.2 Recurrent Neural Networks...................... 23 3.2.3 Training a Neural Network...................... 25 3.2.4 Choosing a Network Architecture................... 29 3.2.5 Neural Network Drawbacks...................... 30 3.3 The Gaussian Process............................. 31 3.3.1 Gaussian Process Regression..................... 31 3.3.2 Gaussian Process Model Selection.................. 34 4 Methods 36 4.1 Statistical Learning Approach......................... 36 4.2 The Data.................................... 36 4.2.1 Implied Volatility Data........................ 36 4.2.2 Intraday Data.............................. 38 4.2.3 Feature Engineering.......................... 38 4.2.4 The Final Data Set........................... 39 4.3 Hyperparameter Optimization......................... 39 4.3.1 Optimized Model Parameters..................... 40 4.4 Algorithm Selection.............................. 41 5 Results and Analysis 43 5.1 Data Comparison................................ 43 5.1.1 Feature Engineering.......................... 43 5.1.2 ATM Options.............................. 45 5.2 Model Comparison............................... 46 5.3 Benchmark Comparison............................ 47 6 Discussion and Conclusion 51 6.1 Results Evaluation............................... 51 6.1.1 Data Comparison............................ 51 6.1.2 Model Comparison........................... 52 6.1.3 Benchmark Comparison........................ 52 6.2 Conclusion................................... 52 6.3 Future Work.................................. 53 References 55 Appendicesa A..........................................a A.1 List of OMXS30 listed companies 2019................a A.2 Feature Engineering..........................b List of Figures 2.1 Example of premiums for call and put options with 30 days until expiration.5 2.2 Profit based on stock price for a given vertical spread............6 2.3 Profit based on stock price for a given butterfly spread...........7 2.4 Profit based on stock price for a given calendar spread............8 2.5 Example of a Implied Volatility Surface.................... 13 3.1 Illustration of bias-variance trade-off...................... 19 3.2 Comparison of training and validation error.................. 20 3.3 Single hidden layer Feed Forward Neural Network architecture....... 22 3.4 Example of recurrence in a computational graph............... 24 3.5 Comparison of path of descent for Gradient (red) and Stochastic Gradient Descent (blue), where f(0; 0) minimises the function............. 27 3.6 Computational graph for a single hidden layer Feed Forward Neural Net- work........................................ 28 3.7 Gaussian Processes Regression of the function f(x) = x · sin(x)...... 33 4.1 Comparison of number of unique options observed per trading day using only traded or traded and order data..................... 37 5.1 Comparison of Root Mean Squared Error and Mean Absolute Error be- tween the three different approaches to preprocess the input data..... 44 5.2 Comparison between using three, six or nine closest at the money options in the intraday data per model in terms of Root Mean Squared Error and Mean Absolute Error using Principal Component Analysis data...... 45 5.3 Comparison of Root Mean Squared Error and Mean Absolute Error be- tween the different models for the selected optimal dataset......... 46 5.4 Comparison to see if either model is closer to the previous or future end of day implied volatility surface in terms of Root Mean Squared Error and Mean Absolute Error for optimal data set................... 47 5.5 Comparison of sample Root Mean Squared Error and Mean Absolute Er- ror between the Benchmark and Gaussian Process for the selected optimal dataset...................................... 48 i LIST OF FIGURES 5.6 Comparison of Absolute Error for the implied volatility surface based on time to maturity and log moneyness...................... 49 5.7 3D Comparison of the Root Mean Squared Error for the implied volatility surface based on time to maturity and log moneyness............ 49 5.8 3D Comparison of the Mean Absolute Error for the implied volatility surface based on time to maturity and log moneyness............ 50 A.1 Comparison of Root Mean Squared Error and Mean Absolute Error be- tween the three different approaches to preprocess the input data.....b A.2 Comparison of Root Mean Squared Error and Mean Absolute Error be- tween the three different approaches to preprocess the input data.....b ii List of Tables 4.1 Vol1-Vol5 is the implied volatility at 5 different