How To Build A Trading Engine In A Microsoft Microsoft Matlab 2.5.2.2 (A Trading Engine)

Similar documents
Algorithmic Trading with MATLAB Martin Demel, Application Engineer

Machine Learning with MATLAB David Willingham Application Engineer

Credit Risk Modeling with MATLAB

Data Analysis with MATLAB The MathWorks, Inc. 1

Introduction to MATLAB for Data Analysis and Visualization

Deploying MATLAB -based Applications David Willingham Senior Application Engineer

Introduction to MATLAB Gergely Somlay Application Engineer

Turning Data into Actionable Insights: Predictive Analytics with MATLAB WHITE PAPER

MathWorks Products and Prices North America Academic March 2013

Origins, Evolution, and Future Directions of MATLAB Loren Shure

Converting Models from Floating Point to Fixed Point for Production Code Generation

Parallel Computing with MATLAB

Echtzeittesten mit MathWorks leicht gemacht Simulink Real-Time Tobias Kuschmider Applikationsingenieur

MATLAB for Use in Finance Portfolio Optimization (Mean Variance, CVaR & MAD) Market, Credit, Counterparty Risk Analysis and beyond

Fraud Detection with MATLAB Ian McKenna, Ph.D.

MATLAB as a Collaboration Platform Marta Wilczkowiak Senior Applications Engineer MathWorks

Speeding up MATLAB and Simulink Applications

What s New in MATLAB and Simulink

Find the Hidden Signal in Market Data Noise

The Future of Algorithmic Trading

PERFORMANCE STABILITY CONNECTIVITY TIME TO MARKET. A Bloomberg offering

Numerical Methods in MATLAB

From Raw Data to. Actionable Insights with. MATLAB Analytics. Learn more. Develop predictive models. 1Access and explore data

SOLUTION BRIEF. TIBCO StreamBase for Algorithmic Trading

Integrating MATLAB into your C/C++ Product Development Workflow Andy Thé Product Marketing Image Processing Applications

Annual Shareholder Meeting. June 2012

MATLAB in Production Systems, Database Integration, and Big Data Eugene McGoldrick

Bringing Big Data Modelling into the Hands of Domain Experts

APPROACHABLE ANALYTICS MAKING SENSE OF DATA

Welcome to the second half ofour orientation on Spotfire Administration.

Real-time trading in MATLAB

ON-LINE MATLAB-BASED EDUCATIONAL TOOLS FOR PROCESS CONTROL RELATED COURSES

MATLAB in Business Critical Applications Arvind Hosagrahara Principal Technical Consultant

ActBinary. 110 Wall Street, 7th Floor New York, NY

Power BI as a Self-Service BI Platform:

ni.com/vision NI Vision

How To Handle Big Data With A Data Scientist

Titolo del paragrafo. Titolo del documento - Sottotitolo documento The Benefits of Pushing Real-Time Market Data via a Web Infrastructure

How To Get A Computer Science Degree At Coastal Carolina University

Numerix CrossAsset XL and Windows HPC Server 2008 R2

IntercontinentalExchange. Credit Suisse Financial Services Forum February 7, 2008

OVERVIEW HIGHLIGHTS. Exsys Corvid Datasheet 1

Development Testing for Agile Environments

SOLUTION BRIEF. TIBCO StreamBase for Foreign Exchange

The Perks of Having a Dedicated Database.

Cisco TelePresence Management Suite Extension for Microsoft Exchange

Unified Trading Communications

Programming models for heterogeneous computing. Manuel Ujaldón Nvidia CUDA Fellow and A/Prof. Computer Architecture Department University of Malaga

Ebase Xi Agile Service Oriented Architecture

Development of AUTOSAR Software Components within Model-Based Design

Service Virtualization andRecycling

Abdullah Mohammed Abdullah Khamis

MARKETMAP Innovative, global, cost-effective market data

OPC COMMUNICATION IN REAL TIME

Plexus Planning. Plexus - Mastering Complex Aerospace and Defense Supply Chains

The SAMANTA platform. Emeritus Expert SNECMA. Department Prognostic Health Monitoring Systems SNECMA

How to build a Business Case for ERP. A step by step guide for plastic industry decision makers

IBM Software Portals and Mashups Engage and delight more customers with an exceptional web experience

Synergy Funds Management. Synergy Financial Markets. Create Your Financial Future by Investing with

Rocket AS v6.3. Benefits of upgrading

MATLAB as an Automated Execution System

Streaming Real-Time Data into Xcelsius Apps

IBM Software Enabling business agility through real-time process visibility

STATISTICA Solutions for Financial Risk Management Management and Validated Compliance Solutions for the Banking Industry (Basel II)

X_TRADER 7. The World's Most Powerful Trading Tool

Harnessing the power of advanced analytics with IBM Netezza

Increasing frequency of releases to every week down from quarterly major releases

Triton. All the trading power of ITG, now on your desktop. Client-Site Trading Products

Optimize workloads to achieve success with cloud and big data

Automating Code Reviews with Simulink Code Inspector

Worldwide Advanced and Predictive Analytics Software Market Shares, 2014: The Rise of the Long Tail

Big Data Executive Survey

WHITE PAPER. Harnessing the Power of Advanced Analytics How an appliance approach simplifies the use of advanced analytics

Predictive Modeling Techniques in Insurance

Actuate for: Financial Management Reporting Applications

White Paper Electronic Trading- Algorithmic & High Frequency Trading. PENINSULA STRATEGY, Namir Hamid

Executive Summary. The purpose of this document is to provide an overview of the Niagara AX product model.

Increased Agility with Integration Testing

Solve your toughest challenges with data mining

Annex: Concept Note. Big Data for Policy, Development and Official Statistics New York, 22 February 2013

Optimally Manage the Data Center Using Systems Management Tools from Cisco and Microsoft

DAQ in MATLAB HANS-PETTER HALVORSEN,

Social Media Implementations

Intraday FX Trading: An Evolutionary Reinforcement Learning Approach

How to use Matlab on the Virtual Labs

Cost effective methods of test environment management. Prabhu Meruga Director - Solution Engineering 16 th July SCQAA Irvine, CA

Requirements Specifications for: The Management Action Record System (MARS) for the African Development Bank

Overview. Integrated Front-mid-back office as well as standalone Front office or Back-office solution or Trading Channels

Keywords revenue management, yield management, genetic algorithm, airline reservation

Transcription:

Algorithmic Trading with MATLAB Martin Demel, Application Engineer 2011 The MathWorks, Inc. 1

Challenges when building trading strategies Increasing complexity More data More complicated models Increasing computational speed Push to higher frequency Long deployment cycle (Re)coding is costly and error-prone 2

Challenges through the organization Management Regulators Financial Engineer Traders Clients Quant Group Other groups Partners 3

Customers using MATLAB Asset Management Insurance Energy Trading Financial Services Banks (Commercial,Retail,Investment) Central Banks 4

Algorithmic trading workflow Access Files Research and Quantify Data Analysis & Visualization Share Reporting Databases Testing & Optimization Applications Datafeeds Strategy Development Production Automate 5

Algorithmic trading workflow Access Research and Quantify Share Files Data Analysis and Visualization Reporting Databases Testing and Optimization Applications Datafeeds Strategy Development Production Spreadsheet Link EX Database Datafeed Fixed Income Financial Derivatives Econometrics Financial Statistics Optimization Builder EX Builder NE Builder JA MATLAB Compiler Report Generator MATLAB Parallel Computing MATLAB Distributed Computing Server 6

Agenda Introduction: Algorithmic trading Developing an automated trading decision engine Identify a successful trading rule Extend trading rule set Automate trading rule selection Break Implementing MATLAB into your production trading environment Wrap up and Q&A 7

The problem at hand: Identifying profitable trading strategies Commodities analyst Developing a trading strategy Multiple trading rules High frequency Management requirements: Tested on historical data Uses sophisticated analytics to identify optimal trading rule combination Integrates with existing data and execution APIs 8

Trading decision engine Development and testing Historical Data End of Day / Intraday Files Databases 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 9

Requirements for the trading engine Sophisticated analytics Custom rules & indicators Non-traditional techniques Scalable speed Higher frequency data More trading rules Quick to develop and deploy Try different strategies Embed in trading engine 10

Task 1: Develop a back testing environment Goal: Build a back testing environment around historical data and a preliminary trading rule Development and testing Historical Data End of Day / Intraday Files Databases 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 0.8 Max Sharpe Ratio 0.758 for Lead 17 and Lag 120 Create a preliminary rule 0.6 0.4 0.6 Test the rule s performance 0.2 0 0.4-0.2 0.2-0.4 Solutions MATLAB data tools -0.6-0.8 0 20 40 60 0-0.2-0.4 High-level programming and pre-built functions 80 100 120 0 20 40 60 80 100 120-0.6 Powerful graphics environment 12

Task 2: Expand the scale of the engine Goal: Move to a higher frequency (minute-by-minute) and re-calibrate the model Development and testing Historical Data End of Day / Intraday Files Databases 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

Task 3: Rule selection engine Goal: Develop a rule selection system for instruments using evolutionary learning Development and testing Historical Data End of Day / Intraday Files Databases 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

Working with multiple strategies 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 Signal 2 Signal 3 Working with multiple strategies Represent different combinations as bit strings Signal 1 AND Signal 2 OR Signal 3 1 0 0 1 0 1 1 1 1 1 AND OR Signals Active? 20

Building Custom Evolution Algorithms 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 = [ 1 0 1 0 0 1 1 0 0 0 ] child = [ 0 1 0 1 0 1 0 0 0 1 ] 21

Price (USD) Price (USD) Key tasks Key tasks Increase number of rules Incorporate advanced analytics to select best combination Solutions High-level programming MATLAB Toolboxes: Global Optimization, 150 100 50 0 200 150 100 Evolutionary Learning Results, Sharpe Ratio = 2.38 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Final Return = 239 (249%) Position Cumulative Return 50 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Serial time number 22

Review: Requirements for the trading engine Sophisticated analytics Custom rules & indicators Non-traditional techniques Scalable speed Higher frequency data More trading rules Quick to develop and deploy Try different strategies Embed in trading engine 23

MATLAB s solutions Sophisticated analytics Advanced graphics environment Toolboxes give access to hundreds of new techniques Flexible and customizable Scalable speed Parallel computing solution Quick to develop and deploy High-level programming Automated deployment after the break 24

Agenda Introduction: Algorithmic trading Developing an automated trading decision engine Identify a successful trading rule Extend trading rule set Automate trading rule selection Break Implementing MATLAB into your production trading environment Wrap up and Q&A 25

Price (USD) Pairs Trading in Brief Cointegration: Two or more time series share long-term behavior Identify a pair that has spread apart Take opposing positions 84 82 80 78 76 74 Intraday prices for LCO and WTI LCO WTI Profit occurs when prices revert 72 70 Nov/09 Dec Jan/10 Feb Mar Date 26

Indicator Key tasks / challenges Key tasks Identify cointegrating relationships Test the strategy Pairs indicator: rebalance every 60 minutes with previous 420 minutes' prices. 3 2 1 Indicator LCO: Over bought LCO: Over sold Solution Econometrics Toolbox New in R2011a: Engle- Granger and Johansen frameworks Code reuse from previous tasks 0-1 -2-3 -4-5 -6 2450 2500 2550 2600 2650 2700 2750 2800 2850 27

Implementing the Decision Engine Goal: Evaluate and test the decision engine with real-time feeds and execution through a messaging bus Development and testing Historical Data End of Day / Intraday Files Databases 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. 3 rd party APIs 29

Deploying Applications with MATLAB Give MATLAB code to other users MATLAB Compiler Share applications with end users who do not need MATLAB Stand-alone executables Shared libraries.exe.dll MATLAB Builder EX Excel MATLAB Builder JA Java Web MATLAB Builder NE COM.NET Software components 30

MATLAB s solutions Sophisticated analytics Advanced graphics environment Toolboxes give access to hundreds of new techniques Scalable speed Parallel computing solution Quick to develop and deploy High-level programming Automated deployment 31

Support and Community 32

Continuous Improvement Consulting Services Accelerating return on investment A global team of experts supporting every stage of tool and process integration Process and Technology Standardization Process and Technology Automation Process Assessment Advisory Services Component Deployment Full Application Deployment Jumpstart Migration Planning Research Advanced Engineering Product Engineering Teams Supplier Involvement 33

Training Services Exploit the full potential of MathWorks products Flexible delivery options: Public training available worldwide Onsite training with standard or customized courses Web-based training with live, interactive instructor-led courses More than 30 course offerings: Introductory and intermediate training on MATLAB, Simulink, Stateflow, Real-Time Workshop, and PolySpace products Specialized courses in control design, signal processing, parallel computing, code generation, communications, financial analysis, and other areas 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 Newsgroup Web forum for technical discussions about MATLAB and Simulink 200 posts per day Blogs Frequent posts from key MathWorks developers who design and build the products Open conversation at blogs.mathworks.com Based on February 2009 data 35

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 Controls Signal Processing Image Processing Biosciences Communications Mechanical Engineering Mathematics Aerospace Engineering Environmental Sciences Chemistry Finance Electronics 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 High customer satisfaction 95% of calls answered within three minutes 70% of issues resolved within 24 hours 80% of customers surveyed rate satisfaction at 80-100% 38