Title: Introduction to MATLAB for Finance Model Analysis
1Introduction to MATLAB for Finance Model Analysis
-????MATLAB????-
???? TeraSoft
- ???? TeraSoft,Inc.
- Irene Chen
- 2003 / 4 / 17
2- Agenda
- MATLAB Financial Product Family
- Financial related solution
- Financial Time series Toolbox
- Financial toolbox
- Financial derivative toolbox
- Integration MATLAB with Excel
- Excel Link
- MATLAB Excel Builder
3Using MATLAB to Develop and Deploy Financial
ModelsFinancial Products Group
4The MathWorks Product Family
5The MathWorks Products
- MATLAB
- Numerical computation and visualization
- MATLAB Toolboxes .. sit on top of MATLAB and
extend its functionality - Over 60 toolboxes in the MATLAB family
- Toolboxes can be functional ... Financial Toolbox
- Toolboxes can be task-oriented .. Optimization
Toolbox - 15 Toolboxes applicable to finance
- SIMULINK
- Interactive simulation of dynamic systems
- Block diagram models
- Differential equation models
- Linear and non-linear models
- Continuous-time, discrete and hybrid systems
6The FMA Product Family
Financial Blockset
Fixed Income
Analysis Modeling Algorithm Design
Financial
Simulink
Optimization
Compiler Web Server Runtime
MATLAB Math, Programming Language, Visualization,
GUI-Builder
7Off-The-Shelf Products for Financial Modelling
Data I/O
Data I/O
Data Analysis, Modeling Visualization
Data Analysis, Modeling Visualization
Data Analysis, Modeling Visualization
Data Analysis, Modeling Visualization
Reporting
Reporting
Algorithm Development Simulation
Algorithm Development Simulation
Algorithm Development Simulation
Algorithm Development Simulation
Idea Sharing
Idea Sharing
Mathematical Modeling
Mathematical Modeling
Application Development
Application Development
Financial Modelling Products
- General Modelling
- Statistics
- Optimization
- Neural Network
- Symbolic Math
- Spline
- PDE
- Curve Fitting
- System Identification
- Control System
- Fuzzy Logic
- MATLAB Compiler
- C/C Math Library
- C/C Graphics Library
- Web Server
- MATLAB Report Generator
- Excel Link
- MATLAB Excel Builder
- MATLAB COM Builder
- Financial Engineering
- Financial
- Financial Time-Series
- Financial Derivatives
- GARCH
- Simulink
8Why MATLAB?
- Handle Large Data Sets
- Powerful indexing
-
- Analyzing Data
- 1000s Math Graphics
- Quick Prototyping
- Less programming
- Work with existing data / programs
- C/C, Excel, VB
9Custom Tool Development
- Application Areas
- Portfolio management
- Derivative modeling
- Risk management
- Data mining
- Econometrics
- Applications
- Data import (e.g. from databases, VB, XML,)
- Monte-Carlo simulation
- Trading strategy analysis
- Graphical User Interface design
- Reporting
- Deployment (standalone, runtime, add-ins,)
10Representative Customers
- Federal Reserve Bank
- Goldman Sachs
- J.P. Morgan Chase
- Morgan Stanley
- Salomon Smith Barney
- American RE
- Merrill Lynch
- Ernst Young
- Deloitte Touche
- Putnam Investments
- Price Waterhouse Coopers
- Prudential Securities
- Bank of America
- John Hancock
- Freddie Mac
- Fannie Mae
- Moodys Investors
- Scudder Investment
- Fidelity Investments
- FleetBoston
11- Agenda
- MATLAB Financial Product Family
- Financial related solution
- Financial Time-series Toolbox
- Financial toolbox
- Financial derivative toolbox
- Integration MATLAB with Excel
- Excel Link
- MATLAB Excel Builder
12Financial Time-Series Toolbox
13Financial Time Series Toolbox
- Introduction
- Key Features
- System and Product Requirements
- Example and Demo
14Introduction to FTS Toolbox
- Providing a date-aware time series object which
manages the relationship between data and dates
on a financial calendar - Provides access to data transformation, charting,
and technical analysis - Prepares data for further analysis using other
tools in the MATLAB product family
gtgt newfts fints(myfts1.dates,
fts2mtx(myfts1)/100,... 'Open','High','Low',
'Close', 1, 'New FTS') newfts desc New
FTS freq Daily (1) 'dates (20)' 'Open
(20)' 'High (20)' 'Low (20)'
'Close(20)' '04-Mar-1994' 38.31
38.68 38.01 38.32 '07-Mar-1994'
38.52 38.82 38.25
38.56 '08-Mar-1994' 38.58 38.82
38.22 38.52...
15Key Features
- Data transformation and analysis
- Technical analysis
- Charting and graphics
16Data Transformation and Analysis
- Leading and lagging data
- Frequency transformation
- Filtering and differencing
- Box-Cox transformation
- Moving average and smoothing
17Technical Analysis
- Oscillators
- Moving Average Convergence Divergence (MACD)
- Accumulation / Distribution
- Stochastic
- Chaikins Volatility and Williams R
- Indexes
- Relative Strength Index (RSI)
- Indicators
- On Balance Volume (OBV) and Bollinger Bands
18Charting and Graphics
- Displays time series data in graphic form
- Plotting functions include high-low, candle, and
annotated plots - An interactive charting tool displays the
relationship among several series
gtgt load disney.mat gtgt chartfts(dis)
19Financial Toolbox
20Financial Toolbox
- Handling and Converting Date
- Formatting Currency
- Charting Financial Data
- Analyzing and Computing Cash Flows
- Pricing and Analyzing Equity Derivatives
- Portfolio Analysis
21Financial Toolbox
- Handling and Converting Date
- Date Formats
- Date conversions
- Current Date and Time
- Determining Date
22Financial Toolbox
- Analyzing and Computing Cash Flows
- Annuities
- Amortization Depreciation
- Present / Future Value
- Payments Calculations
- Interest Rate / Rate of Return
- Cash Flow Sensitivities
gtgt test
23Financial Toolbox
- Pricing and Analyzing Equity Derivatives
- Sensitivity Measures
- Delta, Gamma, Lambda, Rho, Theta, Vega, Implied
Volatility - Analysis Pricing Models
- Black-Scholes Models
- Binomial Models
gtgt Application3\blsapp3.m
24Financial Toolbox
- Portfolio Analysis
- Mean, Var, Cov, Corrcoef
- Mean-variance model
- Capital Allocation Line
- Bond
- Sensitivity analysis
- Price calculation
gtgt Portfolio\portmodule.m
25Financial Toolbox demos
Application3
26Financial Toolbox demos
2. Portfolio Management demo
Portfolio
27Financial Derivative Toolbox
28- This toolbox builds on the MATLAB Financial
Toolbox in the areas of fixed income derivatives
and securities contingent on interest rates.
- Financial Instrument
- Bonds
- Bonds Options
- Fixed Rate Notes
- Floating Rate Notes
29Functions
- Creating and managing instrument portfolios
30Functions.Cont.
- Calculating prices and sensitivity indicators
- Interest Rate Term Structure
- Support instrument Bonds, Fixed Rate Notes,
Floating Rate Notes, - Swaps
- Sensitivity Delta and Gamma
31Functions.Cont.
- Hedging Portfolios
- Minimize cost and sensitivities
- Give target sensitivities ---- gt Minimizing the
cost of hedging a -
portfolio - Give max target cost ---- gt Minimizing Portfolio
Sensitivities - Specifying constraints with ConSet
- Specify a set of linear inequality constraints
for instruments in your portfolio (
) - Hedging with constrained portfolios
32- Agenda
- MATLAB Financial Product Family
- Financial related solution
- Financial Time-Series toolbox
- Financial toolbox,
- Financial derivative toolbox
- Integration MATLAB with Excel
- Excel Link
- MATLAB Excel Builder
33MATLAB link up Excel
- Integrates MATLAB math and graphics into a
Microsoft Excel spreadsheet.
34Start Using Excel Link--Add-in Program
35Adding Excel Link to Excel
36Functions
37Benefits
- Transfer data between MATLAB and Excel in both
- direction
- Direct access to all MATLAB functions from Excel
- Spreadsheets
- Analysis of Excel data in MATLAB and of MATLAB
- data in Excel
- Deliver high quality graphics.
38Excel-Link Demo
- How to price an instrument portfolio using
- Heath-Jarrow-Morton interest rate model
- BDT interest rate model
Excellink_ex
39MATLAB Excel Builder
40MATLAB Excel Builder
- Introduction
- Requirements
- Features
- Demo
41MATLAB Excel Builder
- MATLAB Excel Builder works with the Compiler
Suite to automatically generate stand-alone Excel
add-ins from MATLAB algorithms.
VBA wrapper .dll file
42Requirements
- Product Requirements
- MATLAB
- MATLAB Compiler
- System Requirements for
- Microsoft Windows 95/98/2K/NT
- UNIX / Linux
- Macintosh
- Compiler Requirements
- Borland C Builder 4, 5, 6
- Microsoft Visual Studio 5.0 , 6.0, NET
43Features
- Graphical User Interface(GUI)
mxltool
44Features-cont.
- Automatically creates a .dll and a Visual Basic
Application files that can be imported into Excel
45- Creates add-in functions that can run up to 95
faster than those created with VBA - Readable code
46Advantages
- Unlimited capability to generate functions
- No Cost Factor
- Free Deployment
47Summary- Excel Link vs. MATLAB Excel Builder
- Excel Link
- MATLAB centric
- MATLAB and Excel Link is required on every
end-users desktop - Algorithms can be quickly changed using Excel
link
- MATLAB Excel Builder
- Excel centric
- Add-ins created with Excel Builder are
independent of MATLAB - No Cost factor
- free distribution
- Add-ins created with Excel Builder cant be
changed within the Excel environment
48Excel Builder Demo
- Using multiple files and variable arguments
- butterflyval
- butterflysurf
49Q A?
Irene_at_terasoft.com.tw