ebook img

Pricing di Derivati del Credito e Credit Valuation Adjustment su multi-GPU PDF

218 Pages·2015·5.43 MB·Italian
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Pricing di Derivati del Credito e Credit Valuation Adjustment su multi-GPU

POLITECNICO DI MILANO Corso di Laurea Magistrale di Ingegneria Matematica Facolt`a di Ingegneria dei Sistemi Pricing di Derivati del Credito e Credit Valuation Adjustment su multi-GPU Relatore: Professor Daniele Marazzina Tesi di Laurea di: Giorgio G. Re matr. 799260 Anno Accademico 2013-2014 Failure is not an option. Abstract The aim of this work is to show a financial application of calculus on GPUs, i.e. graphic processing units. Using CUDA, a parallel pro- gramming model created by nVIDIA for general purpose computing, we face the pricing problem of some credit derivatives, such as Nth- to-DefaultSwapsandSyntheticCollateralizedDebtObligations,and the calculation of Expected Exposure and Credit Valuation Adjust- ment of an Interest Rate Swap, that is the credit exposure plus a price correction in order to take into account the counterparty credit risk. Forthispurpose,weexploitMonteCarloandQuasiMonteCar- lomethodsforsimulations. Moreoverwemodeljointdefaulttimesof the underlying reference portfolio of Nth-to-Default Swaps and Col- lateralized Debt Obligations, considering Gaussian and Student’s t copulas, and we deal with Vasicek, Hull-White and Cox-Ingersol- Ross interest rate models to evaluate Expected Exposure and Credit Valuation Adjustment. Therefore we created a C++/CUDA library1 which implements and solves the problems introduced. This dissertation is arranged in th- ree parts: at the beginning we formally describe the structure of the derivatives and the models and methods used, then we analyze our source codes and finally we show the obtained results. Keyword: CUDA, multi-GPU, Student’s t Copula, Monte Carlo, Quasi Monte Carlo (QMC), Pricing Credit Derivatives, Counterpar- ty Credit Risk, Expected Exposure, Credit Valuation Adjustment (CVA). 1Thelibraryisfreelyavailabletodownloadfromhttps://github.com/giogio12345/Credit/releases/ latest. 5 Sommario Lo scopo di questo elaborato `e mostrare un’applicazione in ambito finanziario del calcolo su GPU, cio`e sulle unit`a di elaborazione grafi- ca. Utilizzando CUDA, un paradigma di programmazione parallela offerto da nVIDIA che permette appunto di sfruttare le schede gra- fiche, abbiamo affrontato il problema di pricing di alcuni derivati del credito, ovvero Nth-to-Default Swap e Collateralized Debt Obli- gation sintetici, e il calcolo di Expected Exposure e Credit Valuation Adjustment di un Interest Rate Swap, ovvero l’esposizione creditizia e la correzione al prezzo del derivato in modo da tenere conto del rischio di controparte. Per risolvere questi problemi abbiamo esegui- to simulazioni con metodi di Monte Carlo e Quasi Monte Carlo, e abbiamo utilizzato copule gaussiane e t-Student per modellizzare le probabilit`a di default dei titoli sottostanti agli Nth-to-Default Swap e ai Collateralized Debt Obligation, e modelli di Vasicek, Hull-White e Cox-Ingersol-Ross per la simulazione dei tassi di interesse utilizzati per valutare Expected Exposure e Credit Valuation Adjustment. Questo lavoro `e composto da una libreria1 scritta in C++/CUDA che implementa e risolve questi problemi e da questa tesi, che descri- ve prima in maniera formale i titoli finanziari succitati e i modelli e i metodi utilizzati, poi analizza il codice implementato e infine espone i risultati ottenuti. Keyword: CUDA, multi-GPU, Copula t-Student, Monte Carlo, Quasi Monte Carlo (QMC), Pricing di Derivati del Credito, Ri- schio di Controparte, Expected Exposure, Credit Valuation Adjust- ment (CVA). 1La libreria `e scaricabile gratuitamente da https://github.com/giogio12345/Credit/releases/ latest. 7 Indice Introduzione 19 I Cenni Teorici e Strumenti Utilizzati 23 1 Derivati del Credito 25 1.1 Rischio di Credito e Mercati OTC . . . . . . . . . . . . . . . . . . . . . . . 25 1.2 Credit Default Swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 1.3 Interest Rate Swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 1.4 Basket Default Swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 1.5 Collateralized Debt Obligation . . . . . . . . . . . . . . . . . . . . . . . . . . 33 1.5.1 Synthetic CDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2 Rischio di Controparte e Credit Valuation Adjustment 37 2.1 Rischio di Controparte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 2.2 Unilateral Credit Valuation Adjustment . . . . . . . . . . . . . . . . . . . . 41 2.3 Bilateral Credit Valuation Adjustment . . . . . . . . . . . . . . . . . . . . . 42 3 Copule e Tempi di Default 45 3.1 Copule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.1.1 Copula Gaussiana . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.1.2 Copula t-Student . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 3.1.3 Confronto fra Copula Gaussiana e t-Student . . . . . . . . . . . . . . 54 3.2 Modelli per Tempi di Default . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4 Modelli di Tasso 61 4.1 Zero Coupon Bond, Tassi forward e short . . . . . . . . . . . . . . . . . . . 61 4.2 Modello di Vasicek . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 4.3 Modello di Hull-White . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 4.4 Modello di Cox-Ingersoll-Ross . . . . . . . . . . . . . . . . . . . . . . . . . . 66 5 Metodi Monte Carlo e Quasi Monte Carlo 69 5.1 Principi dei Metodi Monte Carlo . . . . . . . . . . . . . . . . . . . . . . . . 69 5.2 Numeri Pseudo Casuali . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 5.3 Metodi Quasi Monte Carlo . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.4 Sequenza di Sobol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 9 Indice 5.5 Inversione e Acceptance-Rejection . . . . . . . . . . . . . . . . . . . . . . . . 77 5.5.1 Inversione . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 5.5.2 Acceptance-Rejection . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 6 CUDA: Compute Unified Device Architecture 79 6.1 Architettura della GPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 6.2 Modello CUDA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 6.3 Gestione della memoria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 6.4 Librerie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 6.4.1 Thrust . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 6.4.2 cuBLAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 6.4.3 cuRAND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 6.5 Compilazione del Codice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 6.6 Librerie Esterne e Strumenti Utilizzati . . . . . . . . . . . . . . . . . . . . . 90 6.6.1 Eigen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 6.6.2 OpenMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 6.6.3 GitHub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 6.6.4 Profilers e Memory Checkers . . . . . . . . . . . . . . . . . . . . . . 91 II Algoritmi e Implementazione 93 7 Struttura del Codice e Propriet`a del C++ 95 7.1 Struttura del Codice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 7.2 Ereditariet`a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 7.3 Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 7.4 CUDA e C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 8 Default Time Generator 99 8.1 Struttura delle Classi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 8.2 Classe DefTimesGen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 8.3 Classe DefTimesGen GaussianCopula. . . . . . . . . . . . . . . . . . . . . . . 102 8.4 Classe DefTimesGen tCopula . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 9 Credit Derivative 111 9.1 Il costruttore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 10 Nth-to-Default Swap 117 10.1 La funzione run cpu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 10.2 La funzione run gpu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 11 Collateralized Debt Obligation 125 11.1 La funzione run cpu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 11.2 La funzione run gpu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 10

Description:
15.13Valore del CVA all'aumentare della Maturity dello swap 208 originario e coordinatore del kernel Linux, e il servizio di web hosting GitHub per lo svilup- [BM06] Damiano Brigo and Fabio Mercurio. Interest
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.