MATLAB 2011A SECRETS by Bryan Downing Powerpoint Templates Page 1 First Page : 1. Online business which focuses on building trading models for the finance industry. Revenue model is subscription based with additional potential auxiliary revenue. 2. Financial models are used to generate dozens of daily reports of high performing equities and other market securities to help traders, researchers, and analysts to optimize their trading decisions. Powerpoint Templates QUANTLABS.NET Page 2 Chosen Technologies: MATLAB 1. MATLAB is the investment community’s #1 commerical statistical tool for financial research, prototyping, etc.. 2. Has excellent resources including online demos, documentation, and community support. 3. Enables you to quickly get experienced as compared to R or other similar tools. 4. Free MATLAB open source clones include Octave or SciLab but not extensible. Powerpoint Templates QUANTLABS.NET Page 3 Chosen Technologies: C++ 1. C++ is the primary development programming language used for implementing re-coded models and strategies. It is commonly used to develop trading platforms as well. 2. C++ is fastest possible programming language as it gets applications closest to the target operating system. For example, there is no garbage collector as in Java. 3. C++ is very portable. Powerpoint Templates QUANTLABS.NET Page 4 Highlights : Disclaimer: Not teaching Matlab, C++, or C#. 1. MATLAB Coder Toolbox demo of HelloWorld.m script to C++ 2. Import MATLAB HelloWorld Converted project into Visual Studio C++ Express and use it in a C# client application. Quick high light of use in Visual C++. 3. Discussion of a popular Open Source Trading platform in C# 4. List components of a C++ primitive trading platform. 5. MATLAB import of Yahoo Finance data 6. Export MATLAB data into MYSQL database. Powerpoint Templates QUANTLABS.NET Page 5 Helpful URLS : 1. YouTube Channel Video tutorials at www.Youtube.com/quantlabs 2. Online code samples and 600+ research white papers: www.quantlabs.net/labs 3. Daily blog updates: www.quantlabs.net/blog 4. PRIVATE Email 1000+ opt-in list. Register at www.quantlabs.net 5. Tech quant LinkedIn group: http://www.linkedin.com/groups/Quant-Matlab-C-C-Java3427378?goback=%2Egna_3427378 6. Toronto based Meetup www.Meetup.com/quant-finance Powerpoint Templates QUANTLABS.NET group: Page 6 MATLAB Coder Toolbox : 1. Could use MATLAB Builder JA toolbox for a Java or .NET assembler bridge. This does does not generate native code (e.g. Java) but enables you to access through a compiled MEX file. 2. MATLAB Coder Toolbox works as of MATLAB 2011A. Most expensive toolbox available at $6K. 3. Coder converts Matlab M File scripts (e.g.Model or Algorithm) into native C or C++. 4. Removes need of extra coding to manually convert MATLAB M file to C/C++. Saves times in optimizing C or C++ source files. Powerpoint Templates QUANTLABS.NET Page 7 DLL Creation and Use : DEMO Demo Matlab Coder Toolbox to generate C++ from HelloWorld.m Coder GUI to open C:\matlab_m_scripts\coder_test Untitled1.prj Build conversion results in C:\matlab_m_scripts\coder_test\codegen\lib\hell o_world Powerpoint Templates QUANTLABS.NET Page 8 DLL Creation and Use : 1. Create Visual Studio 2010 C++ DLL solution. 2. Copy converted C++ code into project. 3. Manipulate source code for compatibility with Visual C++. 4. Build DLL or Static Library (LIB) for reuse 5. Create C# client application to access DLL. 6. There is a 3 part video series at QuantLabs Youtube channel. Powerpoint Templates QUANTLABS.NET Page 9 DLL Creation and Use : DEMO C:\Users\ratman\Documents\Visual Studio 2010\Projects HelloWorldMatlab C++ sln HelloWorldMgdDLLC++ sln HelloWorldClientCS C# sln Powerpoint Templates QUANTLABS.NET Page 10 DLL Resuse in Visual C++: 1. Following instructions at: Walkthrough: Creating and Using a Dynamic Link Library (C++) at http://msdn.microsoft.com/enus/library/ms235636.aspx 2. static __declspec(dllexport) modifier exports in DLL to be used by other C++ client applications. 3. Integrate converted code into above example Visual Studio solution. Powerpoint Templates QUANTLABS.NET Page 11 DLL Creation and Use : DEMO Matlab converted code from: C:\Users\ratman\Documents\Visual Studio 2010\Projects\ShrinkageDynamicLibrary\Shri nkage - c++ C:\Users\ratman\Documents\Visual Studio 2010\Projects\ShrinkageDynamicLibrary ShrinkageDynamic Library C++ sln Powerpoint Templates QUANTLABS.NET Page 12 Potential Trading Broker: 1. LMAX is established in 2010 out of London UK. 2. Legitimate with British Financial Services Authority regulation and Goldman Sachs ownership of 12.5% 3. Supports API trading through FIX with .NET, and Java support. 4. No minumum deposit or access fees to market multi second tick data. 5. Trade CFD and Forex. 6. Canadians can use LMAX. Powerpoint Templates QUANTLABS.NET Page 13 Trading Platforms: 1. Suggested Open source trading platform is TRADELINK. http://code.google.com/p/tradelink/ 2. Developed in C# and completely free with source code. Used by established hedge funds and prop shops. Over 18000 downloads. 3. Connects to multiple brokers but does include Interactive Brokers. 4. Has decent documentation and community support. There are frequent updates after bugs are reported. 5. Various components for tick capture, easily converted DLL implementation, & other supporting various applications. 6. Various affordable support at http://www.pracplay.com/buy Powerpoint Templates QUANTLABS.NET Page 14 Proposed C++ PRIMITIVE Trading Platform Components: 1. Will be built in C++ for speed, portability, and potential HFT scaling capabilities. 2. Capable to plug in to LMAX as trading broker for CFDs and Forex API execuction. 3. Multiple listeners to LMAX tick data of chosen currency pairs. 4. Use OTL 4 library to connect to MYSQL table for historical tick data. 5. Use TA-Lib library for forex strategy development 6. Use QuantLib library for mature quant finance modelling needs 7. Import custom Matlab Coder DLLs as shown. Powerpoint Templates QUANTLABS.NET Page 15 Proposed C++ PRIMITIVE Trading Platform Components: OTL 4 DEMO Need to Install MYSQL Connector DSN! http://www.geeksengine.com/article/mysql-odbc.html otl4 C++ sln Powerpoint Templates QUANTLABS.NET Page 16 MATLAB Yahoo Finance Data Capture with MYSQL: 1. Need Data Capture Toolbox for example MATLAB interaction: y = yahoo; FastFood = fetch(y, {'ko', 'pep', 'mcd'},'Last') FastFood = Last: [3x1 double] FastFood.Last ans = 42.96 45.71 23.70 2. Alternative for Yahoo data capture at http://luminouslogic.com/how-to-downloadhistorical-stock-data-into-matlab.htm 3. Get detailed Yahoo download data info http://www.gummy-stuff.org/Yahoo-data.htm 4. Demo with MYSQL at: http://www.youtube.com/watch?v=5QNyOe79l-s Powerpoint Templates QUANTLABS.NET Page 17 MATLAB Yahoo Finance Data Capture: DEMO C:\matlab_m_scripts\db\mysqltest.m Powerpoint Templates QUANTLABS.NET Page 18