Top Banner
© 2009 The MathWorks, Inc. Jörg-M. Sautter Application Engineer The MathWorks Introduction to MATLAB for Finance Bratislava June 4, 2009
34

Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

Aug 29, 2018

Download

Documents

dinhliem
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

©20

09 T

he M

athW

orks

, Inc

.

Jörg-M. SautterApplication Engineer

The MathWorks

Introduction to MATLAB for Finance

BratislavaJune 4, 2009

Page 2: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

2

MATLAB BenefitsMATLAB Benefits

Solutions to access, explore, and share– A seamless solution

Make your programs run faster– The de facto industry-standard, high-level

programming language or algorithm development

Reduce development time and cost– Earlier project finish or product time to market

Page 3: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

3

Introduction to MATLABOption PricingReportingMATLAB and ExcelGraphical User InterfacesDeploymentSummary

Agenda

Page 4: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

4

The Power of MATLABThe Power of MATLABMATLAB is both

A Computational EnvironmentFinancial professional develop complex financial models using MATLAB and its family of toolboxes

and

An Application Development EnvironmentModels developed in MATLAB are translated into components using the MATLAB Compiler and distributed as stand-alone applications

Page 5: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

5

ShareData Analysis Tasks

Access Explore

Page 6: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

6

ShareMATLAB for Data Analysis

Access Explore

Page 7: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

7

MATLAB Key Features

High-level technical computing language

Interactive analysis tools Development environment Feature areas

– Mathematics– Graphics and GUI Design– File I/O– Call C/C++, Fortran, Java,

COM

Page 8: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

8

The MathWorks Family of Products

Page 9: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

9

Database ToolboxDatabase Toolbox

ODBC or JDBC databases Preserve data types

Visual Query Builder Data access without knowing SQL Build-In visualization

IBM DB2 Universal

Page 10: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

10

Connecting to Data ProvidersConnecting to Data Providers

Datafeed Toolbox supports:

– Bloomberg– FactSet– Haver Analytics– Hyperfeed– Kx Systems– Reuters– Thomson– Yahoo

GUI: DFTOOL

Page 11: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

11

Example:Bootstrapping

Page 12: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

12

Example: Portfolio Optimization

Page 13: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

13

Introduction to MATLABOption PricingReportingMATLAB and ExcelGraphical User InterfacesDeploymentSummary

Agenda

Page 14: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

14

Example: Pricing an Asian Option

The process followed by an asset price path S in a risk-neutral world is:

r = Return, = Volatility, dW = Brownian motion

To simulate the paths of future asset prices S,divide the life of the derivative [0; T] into N equal intervals of length t and approximate the equation as:

tdtdtretSdttS

2

21

)()(

Normally distributed random variable

SdWrSdtdS

Page 15: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

15

SDE engine simulates generalized multivariate stochastic processes

Special cases: popular models are

Brownian motion Geometric Brownian motion Constant elasticity of variance Cox-Ingersoll-Ross Hull-White/Vasicek

Stochastic Differential Equations

drift rate diffusion rate

���� � ����

��� � ����

���

Page 16: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

16

Example:A Multidimensional Equity Market Model

���� �

��� � ��

����

Page 17: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

17

Introduction to MATLABOption PricingReportingMATLAB and ExcelGraphical User InterfacesDeploymentSummary

Agenda

Page 18: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

18

Example: Publishing

Page 19: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

19

Output Format

Report Generator What is it?

– Automatic documentation for MATLAB, Simulink and Stateflow Who can use it?

– Any MATLAB, Simulink and Stateflow users who need to document their work

MATLAB SimulinkStateflow® Report Generator

Page 20: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

20

Introduction to MATLABOption PricingReportingMATLAB and ExcelGraphical User InterfacesDeploymentSummary

Agenda

Page 21: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

21

Spreadsheet Link: Interface to ExcelSpreadsheet Link: Interface to Excel

Data I/O Import Excel-data to MATLAB

Export MATLAB-data to Excel

Execute MATLAB commands from Excel

MATLAB Spreadsheet Link

Page 22: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

22

Introduction to MATLABOption PricingReportingMATLAB and ExcelGraphical User InterfacesDeploymentSummary

Agenda

Page 23: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

23

Introduction to MATLABOption PricingReportingMATLAB and ExcelGraphical User InterfacesDeploymentSummary

Agenda

Page 24: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

24

Introduction to MATLAB Deployment Products

COMExcelAdd-in

Java www

MATLABBuilder NE

MATLABBuilder EX

MATLABBuilder JA

.NET.EXE .DLL.LIB

MATLAB Compiler

Page 25: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

25

Introduction to MATLAB Compiler Automatically converts your MATLAB®

programs into stand-alone applications and software components

Supports full MATLAB language and most toolboxes

Royalty-free deployment

Shared infrastructure with MATLAB:– Immediate support of MATLAB features– Speed of compiled application equivalent

to speed in MATLAB

Page 26: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

26

MATLABMATLABDesktopDesktop

EndEnd--UserUserMachineMachine

Working with MATLAB Compiler

11

22

33

Page 27: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

27

Working with MATLAB Builders

Builders exist for Java, .NET/COM, and Excel

Allow you to combine MATLAB based algorithms with applications in other languages or technologies

Same interface and workflow as MATLAB Compiler

Automatic wrapping of code for integration in target environment

Royalty-free deployment

Page 28: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

28

Automatically converts MATLAB algorithms into independent Excel add-ins

Run up to 20 times faster than Visual Basic add-ins

Royalty-free deployment model

MATLAB Builder EX

Page 29: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

29

MATLABMATLABDesktopDesktop

EndEnd--UserUserMachineMachine

Spreadsheet with Excel Add-In

ExcelAdd-in

DLL

Page 30: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

30

Summary: MathWorks Deployment Products

Convert MATLAB applications into self-contained applications and software components

Share them with end-users who do not have MATLAB

Deploy MATLAB algorithms and applications royalty-free

www

ExcelAdd-in

COM

.NET

C/C++

.exe

Java

Page 31: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

31

Using MATLAB® with Excel®Summary MATLAB® drives Excel

– MATLAB

Excel drives MATLAB– MATLAB– Spreadsheet Link

MATLAB deployed in Excel– MATLAB– MATLAB® Compiler– MATLAB® Builder EX

Page 32: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

32

Introduction to MATLABOption PricingReportingMATLAB and ExcelGraphical User InterfacesDeploymentSummary

Agenda

Page 33: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

33

Optimization ToolboxStatistics Toolbox

EconometricsFinancial Derivatives

Fixed Income

Financial Toolbox

MATLAB Compiler

MATLAB Builder NE

MATLAB Builder EX

MATLAB Builder JA

MATLAB Compiler

Dat

abas

e T

oolb

ox

Dat

afee

d T

oolb

ox

Spre

adsh

eet L

ink

MATLAB.exe .dll/.so COMExcel

Add-in www

Key Components of Process Flow

PCT

Page 34: Introduction to MATLAB for Finance - humusoft.cz · Introduction to MATLAB for Finance Bratislava June 4, 2009. 2 MATLAB Benefits Solutions to access, explore, and share – A seamless

34

MATLAB BenefitsMATLAB Benefits

Solutions to access, explore, and share– A seamless solution

Make your programs run faster– The de facto industry-standard, high-level

programming language or algorithm development

Reduce development time and cost– Earlier project finish or product time to market