tag:www.mathworks.com,2005:/matlabcentral/fileexchange/feedMATLAB Central File Exchangeicon.pnglogo.pngMATLAB Central - File Exchange - product:"Financial Derivatives Toolbox"User-contributed code library2015-01-26T01:59:34-05:00141100tag:www.mathworks.com,2005:FileInfo/468142014-06-01T14:21:22Z2014-06-17T21:17:15ZLi's Copula model for CDS and CDO default intensities and loss function Copula functions for credit loss distribution and default intensities of CDS<p>The file Assignment.m contains
<br />- in the first part the Matlab code for deriving the default intensities embedded in the market spread of the CDS of three companies according to piecewise and constant hazard rate models. I also plotted the sensitivity of the hazard rates to the maturity and the recovery rate.
<br />- in the second part the loss ditribution function under Li's copula model of a seller of a second to default basket CDS.
<br />
<br />Course: Advanced Tools for Risk Management and Asset Pricing(20263), Prof. M.Bedendo, Bocconi University</p>Francesco Da Vincihttp://www.mathworks.com/matlabcentral/profile/authors/5254901-francesco-da-vinciMATLAB 8.2 (R2013b)Econometrics ToolboxFinancial Derivatives ToolboxFinancial ToolboxFixed-Income ToolboxFinancial Instruments Toolboxfalsetag:www.mathworks.com,2005:FileInfo/415682013-05-01T19:57:57Z2013-05-01T19:57:57ZTrinomial tree seaption pricingSwaption pricing function under the Hull-White lattice model. It allows finer grid.<p>% This function generates the Swaption price, from a portfolio
<br />% of underlying swaps' cash-flow. The Bermudian type swaptions
<br />% can be exercised at the underlying cash-flow dates. The cash-flow
<br />% structure allows varying notionals, but only the first and last coupon
<br />% might be irregular. </p>
<p>% This function allows for a finer time-grid.</p>
<p>% Reminder: this swap pricing function includes the fraction
<br />% of the current coupon if the settlement is the start date
<br />% the floating leg is determined by the current fwd rate.
<br />% The function cannot determine fwd rates back in the past
<br />% (i.e. before the settlement). If the running coupon
<br />% is to be excluded, just set the start date fwd. The cash-flow
<br />% stream is basically determined by the Maturity time.</p>
<p>% The option exposure is assumed to be long (option buyer) with the convention that
<br />% a negative fixed leg cash-flow (fix payer) entails call option exposure.
<br />% On the other side, a positive fixed leg cash-flow (fix reciever) is associated
<br />% to a long put swaption exposure.
<br />%
<br />% input
<br />% U : code, date, principal, coupon, basis, period.
<br />% Curve : interest rate curve object
<br />% opt_type :
<br />% 'vanilla'
<br />% 'bermudan'
<br />% 'american'
<br />% 'swap' (no option)
<br />% model :
<br />% 'EV' (extended Vasicek)
<br />% 'BK' (Black-Karasinski)
<br />% a : parameter vector (3 dim vector)
<br />% d_aug : number of time-points between cash-flow dates
</p>Francesco Paolo Espositohttp://www.mathworks.com/matlabcentral/profile/authors/729768-francesco-paolo-espositoMATLAB 7.14 (R2012a)Financial Derivatives ToolboxFinancial ToolboxFixed-Income ToolboxMATLABFinancial Instruments Toolboxfalsetag:www.mathworks.com,2005:FileInfo/415632013-05-01T19:21:39Z2013-05-01T19:21:39ZBlack1976 swaption pricing for a bespoke dealThis function prices a swaption portfolio with any cash-low structure<p>% This function prices swaptions in the Black1976 model for any given cash-flow
<br />% structure. It assumes (without checking) that the matrix U is an n by 5 (at least)
<br />% matrix containing, respectively by column, the cash-flow code, the payment date
<br />% (matlab format), the cash-flow (negative for fixed payer and positive otherwise),
<br />% the coupon rate and finally the day-count basis. The earliest cash-flow is assumed to be
<br />% a no coupon payment used to determine the settlement date of the swap. The coupon
<br />% rate is expected to be constant and the strike is determined by the last coupon rate
<br />% in line. The current date is the settlement date of the curve object, while the
<br />% volatility matrix is assumed to be 10y by 10y (Exp-by-Mat) volatility surface.
<br />%
<br />% The option exposure is assumed to be long (option buyer) with the convention that
<br />% a negative fixed leg cash-flow (fix payer) entails call option exposure.
<br />% On the other side, a positive fixed leg cash-flow (fix reciever) is associated
<br />% to a long put swaption exposure.
<br />%
<br />% input
<br />% U : code, date, principal, coupon, basis
<br />% V : volatility matrix
<br />% Curve : interest rate curve object
</p>Francesco Paolo Espositohttp://www.mathworks.com/matlabcentral/profile/authors/729768-francesco-paolo-espositoMATLAB 7.14 (R2012a)Financial Derivatives ToolboxFinancial ToolboxFixed-Income ToolboxFinancial Instruments Toolboxfalsetag:www.mathworks.com,2005:FileInfo/415642013-05-01T19:21:02Z2013-05-01T19:21:02Ztrinomial tree plotThis function plots the Hull-White tree structure<p>This function plots the Hull-White tree structure. The function accept any type of tree generated by the HW Matlab utilities.</p>Francesco Paolo Espositohttp://www.mathworks.com/matlabcentral/profile/authors/729768-francesco-paolo-espositoMATLAB 7.14 (R2012a)Financial Derivatives ToolboxFinancial ToolboxFixed-Income ToolboxMATLABFinancial Instruments Toolboxfalsetag:www.mathworks.com,2005:FileInfo/415652013-05-01T19:01:29Z2013-05-01T19:01:29ZTrinomial tree calibrationThis function calibrates the Hull-White trinomial tree.<p>This function calibrates the Hull-White trinomial tree. to the swaption premiums implied by the swaption market (Black's) market volatility matrix.</p>
<p>% This function produces the calibrated parameters for the HW model in the extended Vasicek specification.
<br />% The reference basket is assumed to be the ATM swaption volatility matrix (Black76 model).
<br />% The Volatility surface matrix V is assumed to be 10y X 10y of Expiry X Maturity.
<br />% The model parameter vector a contains the levels of a straight line volatility function
<br />% ranging from 0 to 20y. The mean reversion parameters is held constant across the time domain.
<br />%
<br />% input
<br />% Curve : interest rate curve object
<br />% V : volatility matrix
<br />% Period : frequency of payments of the underlying swaps
<br />% coin : initial condition for the model parameters
</p>Francesco Paolo Espositohttp://www.mathworks.com/matlabcentral/profile/authors/729768-francesco-paolo-espositoMATLAB 7.14 (R2012a)Financial Derivatives ToolboxFinancial ToolboxFixed-Income ToolboxOptimization ToolboxMATLABFinancial Instruments Toolboxfalsetag:www.mathworks.com,2005:FileInfo/415662013-05-01T19:00:56Z2013-05-01T19:00:56Zvolatility to premium for swaptions (Black76 model)This function convert ATM volatility surface into swaption premiums and par rates.<p>% This function determines the matrix of swaption premiums
<br />% and the corresponding ATM par rates. The structure of the output
<br />% is identical to the Volatility surface matrix V, which is assumed
<br />% to be 10y X 10y of Expiry X Maturity.
<br />% It is assumed single curve discounting and 1,000 notional.
<br />%
<br />% input
<br />% Curve : interest rate curve object
<br />% V : volatility matrix
<br />% Period : frequency of payments of the underlying swaps
</p>Francesco Paolo Espositohttp://www.mathworks.com/matlabcentral/profile/authors/729768-francesco-paolo-espositoMATLAB 7.14 (R2012a)Financial Derivatives ToolboxFinancial ToolboxFixed-Income ToolboxMATLABFinancial Instruments Toolboxfalsetag:www.mathworks.com,2005:FileInfo/415672013-05-01T19:00:22Z2013-05-01T19:00:22ZTrinomial tree swaption pricingThis function generates swaption prices under the Hull-White trinomial tree model.<p>% This function generates the Swaption price, from a portfolio
<br />% of underlying swaps' cash-flow. The Bermudian type swaptions are
<br />% can be exercised at the underlying cash-flow dates. The cash-flow
<br />% structure allows varying notionals, but only the first and last coupon
<br />% might be irregular. </p>
<p>% Reminder: this swap pricing function includes the fraction
<br />% of the current coupon if the settlement is the start date
<br />% the floating leg is determined by the current fwd rate.
<br />% The function cannot determine fwd rates back in the past
<br />% (i.e. before the settlement). If the running coupon
<br />% is to be excluded, just set the start date fwd. The cash-flow
<br />% stream is basically determined by the Maturity time.</p>
<p>% The option exposure is assumed to be long (option buyer) with the convention that
<br />% a negative fixed leg cash-flow (fix payer) entails call option exposure.
<br />% On the other side, a positive fixed leg cash-flow (fix reciever) is associated
<br />% to a long put swaption exposure.
<br />%
<br />% input
<br />% U : code, date, principal, coupon, basis, period.
<br />% Curve : interest rate curve object
<br />% opt_type :
<br />% 'vanilla'
<br />% 'bermudan'
<br />% 'swap' (no option)
<br />% model :
<br />% 'EV' (extended Vasicek)
<br />% 'BK' (Black-Karasinski)
<br />% a : parameter vector (3 dim vector)
</p>Francesco Paolo Espositohttp://www.mathworks.com/matlabcentral/profile/authors/729768-francesco-paolo-espositoMATLAB 7.14 (R2012a)Financial Derivatives ToolboxFinancial ToolboxFixed-Income ToolboxMATLABFinancial Instruments Toolboxfalsetag:www.mathworks.com,2005:FileInfo/377802012-08-09T19:56:56Z2012-08-09T19:56:56ZSCOPE: interactively tabulate SEER excel variablesThis takes SEER excel column data interactively, tabulate them, write back in table format.<p>This program asks the user for the SEER variable stored in excel, it tabultes the eleemtns, then write it back to the excel. This facilates creation of excel tables for reporting and publication purposes. Otherwise, manually copying the tabulated results will be very tedious.
</p>Rex Cheunghttp://www.mathworks.com/matlabcentral/profile/authors/650874-rex-cheungMATLAB 7.14 (R2012a)Aerospace BlocksetAerospace ToolboxBioinformatics ToolboxCommunications BlocksetCommunications System ToolboxControl System ToolboxCurve Fitting ToolboxData Acquisition ToolboxDatabase ToolboxDatafeed ToolboxEconometrics ToolboxExtended Symbolic Math ToolboxFilter Design HDL CoderFilter Design ToolboxFinancial Derivatives ToolboxFinancial ToolboxFixed-Income ToolboxFixed-Point DesignerFuzzy Logic ToolboxGARCH ToolboxGauges BlocksetGlobal Optimization ToolboxImage Acquisition ToolboxImage Processing ToolboxInstrument Control ToolboxMapping ToolboxMATLAB Builder EXMATLAB Builder JAMATLAB Builder NEMATLAB CompilerMATLAB Report GeneratorModel Predictive Control ToolboxModel-Based Calibration ToolboxNeural Network ToolboxOPC ToolboxOptimization ToolboxParallel Computing ToolboxPartial Differential Equation ToolboxPolyspace Client for AdaPolyspace Client for C/C++Polyspace Model Link SLPolyspace Model Link TLPolyspace Server for AdaPolyspace Code ProverPolyspace UML Link RHReal-Time Windows TargetSimulink CoderEmbedded CoderSimRFRF ToolboxRobust Control ToolboxDSP System ToolboxSignal Processing ToolboxSimBiologySimDrivelineSimElectronicsSimEventsSimHydraulicsSimMechanicsSimPowerSystemsSimscapeSimulinkSimulink Control DesignSimulink Design VerifierSimulink Fixed PointHDL CoderSimulink Parameter EstimationSimulink Report GeneratorSimulink Response OptimizationSimulink Verification and ValidationSpline ToolboxSpreadsheet Link EXStateflowStateflow CoderStatistics ToolboxComputer Vision System ToolboxSimulink 3D AnimationSimulink Design OptimizationEmbedded IDE LinkHDL VerifierMATLAB CoderMATLABExcelfalsetag:www.mathworks.com,2005:FileInfo/330572011-09-28T16:57:19Z2011-10-14T16:37:41ZApproaches to implementing Monte Carlo methods in MATLABCode for the article in the September 2011 article
http://www.wilmott.com/magazine.cfm<p>Monte Carlo methods have long been used in computational finance to solve problems where analytical solutions are not feasible or are difficult to formulate. However, these methods are computationally intensive making it challenging to implement and adopt. In the last decade, advances in hardware, increasing processor speeds and decreasing costs have made it easier to adopt Monte Carlo methods to solve numerically intensive problems. With growing access to data and demand for quicker results, researchers are constantly looking for better ways to implement algorithms using Monte Carlo methods.</p>
<p>In the Wilmott Magazine September 2011 article(<a href="http://www.wilmott.com/magazine.cfm">http://www.wilmott.com/magazine.cfm</a>), we will share some of our observations and demonstrate various ways MATLAB could be used to implement Monte Carlo methods. We take a case study of pricing Asian options and show various approaches to implementing them in MATLAB.</p>
<p>A draft version of the article is included in this submission.</p>srihttp://www.mathworks.com/matlabcentral/profile/authors/4365968-sriMATLAB 7.12 (R2011a)Econometrics ToolboxFinancial Derivatives ToolboxFinancial ToolboxParallel Computing ToolboxStatistics Toolboxfalsetag:www.mathworks.com,2005:FileInfo/45642004-03-02T17:37:02Z2010-11-12T11:47:29ZFinancial Seminar DemosDemos commonly used at The MathWorks financial modeling seminars.<p>Ten demos, most of which are shown at The MathWork's financial modeling seminars. All of the demos are in their own folders, which contain the code, and a ReadMe file that explains what the demos do and gives directions on how to run it. The ReadMe also mentions which Toolboxes are needed for each demo. To run all of the demos, you'll need the Toolboxes listed in the required list. However, not all of the demos require all of the Toolboxes.</p>
<p>MLTutorial:
<br />Creates an array in MATLAB and shows indexing ability and examples of matrix math</p>
<p>DFDBportOpt:
<br />GUI that inputs data from database or Yahoo(Datafeed) and finds the efficient frontier</p>
<p>BLSVIS:
<br />Plots a 3d visualization of option sensitivities ? Delta and Gamma</p>
<p>GarchFXdemo:
<br />GARCH demo showing time-series, simulation, optimization, and graphics abilities of MATLAB.</p>
<p>OpriceAnimation:
<br />Animates option prices, gamma, and volatility in 3D as time to maturity changes</p>
<p>Xlderiv:
<br />Illustrates how to price an fixed-income instrument portfolio using the Heath-Jarrow-Morton and Black-Derman-Toy interest rate models</p>
<p>SpotCurveFit:
<br />Computes and compares spot and forward curves calculated from bootstrapping and spline fitting methods</p>
<p>OptVar:
<br />Calculates the Value at Risk (VaR) of a portfolio of equity options using the delta-gamma</p>
<p>method.PortVaRmc:
<br />Calculates the Value at Risk (VaR) of a portfolio of equities using Monte Carlo simulation</p>
<p>PortVaRreturns:
<br />Calculates the Value at Risk (VaR) of a portfolio of equities using historical return data</p>Ameya Deorashttp://www.mathworks.com/matlabcentral/profile/authors/1269486-ameya-deorasMATLAB 6.5 (R13)Database ToolboxDatafeed ToolboxFinancial Derivatives ToolboxFinancial ToolboxFixed-Income ToolboxGARCH ToolboxMATLAB CompilerOptimization ToolboxSpreadsheet Link EXStatistics Toolboxfalse