Algorithmic Trading With MATLAB
Algorithmic Trading With MATLAB
Increasing complexity
More data More complicated models
Clients
Financial Services
Banks (Commercial,Retail,Investment)
Central Banks
Share
Reporting
Databases
Applications
Datafeeds
Strategy Development
Production
Automate
5
Share
Reporting Applications Production
Report Generator
Spreadsheet Link EX
Database Datafeed
Econometrics
Builder EX Builder NE
Optimization
Agenda
Break Implementing MATLAB into your production trading environment Wrap up and Q&A
Management requirements:
Tested on historical data Uses sophisticated analytics to identify optimal trading rule combination Integrates with existing data and execution APIs
Strategy Modeling
Research / Algorithms Model Development Calibration
Back Testing
Profit / Loss Risk Exposure
Implementation
Live Data
Real-Time Feeds Event-Based
Decision Engine
Models Trading Rules
Execution
Broker API Order Routing
Sophisticated analytics
Custom rules & indicators Non-traditional techniques
Scalable speed
Higher frequency data More trading rules
10
Strategy Modeling
Research / Algorithms Model Development Calibration
Back Testing
Profit / Loss Risk Exposure
Implementation
Live Data
Real-Time Feeds Event-Based
Decision Engine
Models Trading Rules
Execution
Broker API Order Routing
11
Key tasks
Key tasks Import data from files Create a preliminary rule Test the rules performance Solutions MATLAB data tools High-level programming and pre-built functions Powerful graphics environment
Max Sharpe Ratio 0.758 for Lead 17 and Lag 120 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8 0 20 40 60 80 100 120 0 20 40 60 80 100 120 -0.6 -0.4 -0.2 0 0.2 0.4 0.6
12
Strategy Modeling
Research / Algorithms Model Development Calibration
Back Testing
Profit / Loss Risk Exposure
Implementation
Live Data
Real-Time Feeds Event-Based
Decision Engine
Models Trading Rules
Execution
Broker API Order Routing
14
Key tasks
Key tasks Importing data from databases Increase computational speed Solutions MATLAB data tools: Database Toolbox High-performance computing: Parallel Computing Toolbox, MATLAB Distributed Computing Server
15
Strategy Modeling
Research / Algorithms Model Development Calibration
Back Testing
Profit / Loss Risk Exposure
Implementation
Live Data
Real-Time Feeds Event-Based
Decision Engine
Models Trading Rules
Execution
Broker API Order Routing
17
Key tasks
Key tasks Increase number of rules Incorporate advanced analytics to select best combination
18
Should I trade?
Signal 1
AND OR
Signal 2
AND OR
Signal 3
Yes
Yes
No
Dempster et. al., Computational learning techniques for intraday fx trading using popular technical indicators, IEEE Transactions on Neural Networks (2001).
19
Signal 1
AND
Signal 2
OR
Signal 3
1
Signal 1
0
AND
1
Signal 2
0
OR
1
Signal 3
1
Signals Active?
20
Selection
Retain the best performing bit strings from one generation to the next. Favor these for reproduction
Crossover
parent1 = [ 1 0 1 0 0 1 1 0 0 0 ] parent2 = [ 1 0 0 1 0 0 1 0 1 0 ] child = [1 0 0 0 0 1 1 0 1 0]
Mutation
parent child = [1 0 1 0 0 1 1 0 0 0] = [0 1 0 1 0 1 0 0 0 1]
21
Key tasks
Key tasks Increase number of rules Incorporate advanced analytics to select best combination
Evolutionary Learning Results, Sharpe Ratio = 2.38 150
Price (USD)
Price (USD)
100
50
1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Final Return = 239 (249%)
200 150 100 50 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Serial time number Position Cumulative Return
22
Sophisticated analytics
Custom rules & indicators Non-traditional techniques
Scalable speed
Higher frequency data More trading rules
23
MATLABs solutions
Sophisticated analytics
Advanced graphics environment Toolboxes give access to hundreds of new techniques Flexible and customizable
Scalable speed
Parallel computing solution
24
Agenda
Break Implementing MATLAB into your production trading environment Wrap up and Q&A
25
Price (USD)
Cointegration: Two or more time series share long-term behavior Identify a pair that has spread apart Take opposing positions Profit occurs when prices revert
Nov/09
Dec
Jan/10 Date
Feb
Mar
26
Pairs indicator: rebalance every 60 minutes with previous 420 minutes' prices. 3 2 1 0 Indicator LCO: Over bought LCO: Over sold
Strategy Modeling
Research / Algorithms Model Development Calibration
Back Testing
Profit / Loss Risk Exposure
Implementation
Live Data
Real-Time Feeds Event-Based
Decision Engine
Models Trading Rules
Execution
Broker API Order Routing
28
Key Tasks
Key tasks Read live market data from data feed Connect to trading engine Solutions Datafeed Toolbox Many external APIs
.NET, Java, C/C++, etc. 3rd party APIs
29
MATLAB Builder EX
MATLAB Builder JA
MATLAB Builder NE
Excel
Java
Web
COM
.NET
30
MATLABs solutions
Sophisticated analytics
Advanced graphics environment Toolboxes give access to hundreds of new techniques
Scalable speed
Parallel computing solution
31
32
Consulting Services
Accelerating return on investment
A global team of experts supporting every stage of tool and process integration
Process and Technology Automation Process and Technology Standardization Full Application Deployment Component Deployment Advisory Services
Process Assessment
Research
Advanced Engineering
Supplier Involvement
33
Continuous Improvement
Training Services
Exploit the full potential of MathWorks products
34
MATLAB Central
Open exchange for the MATLAB and Simulink user community 662,000 visits per month File Exchange
Upload/download access to free files including MATLAB code, Simulink models, and documents Ability to rate files, comment, and ask questions More than 9,000 contributed files, 400 submissions per month, 25,500 downloads per day Web forum for technical discussions about MATLAB and Simulink 200 posts per day Frequent posts from key MathWorks developers who design and build the products Open conversation at blogs.mathworks.com
35
Newsgroup
Blogs
Connections Program
More than 300 add-on products and services that complement and extend MathWorks products:
Specialized third-party toolboxes for MATLAB Interfaces to third-party software and hardware products Specialized training courses and consulting services System integrators and suppliers that incorporate MathWorks products
36
Book Program
More than 1,000 books for educational and professional use, in 26 languages
37
Technical Support
Resources
Over 100 support engineers All with MS degrees (EE, ME, CS) Local support in North America, Europe, and Asia Comprehensive, product-specific Web support resources
95% of calls answered within three minutes 70% of issues resolved within 24 hours 80% of customers surveyed rate satisfaction at 80-100%
38