170 likes | 978 Views
Motivation Why R/ quantstrat ? Overview: The Toolset Data Warehousing with XTS Modeling Backtesting. R/ quantstrat For Fun & Profit. E. Allen ( e@biglucre.com ) Nov. 4 th 2013 Pittsburgh R Users Group Lightning Talk. Jan Humme , Brian Peterson @ R/Finance 2013:
E N D
Motivation • Why R/quantstrat? • Overview: The Toolset • Data Warehousing with XTS • Modeling • Backtesting R/quantstratFor Fun & Profit E. Allen (e@biglucre.com) Nov. 4th 2013 Pittsburgh R Users Group Lightning Talk
Jan Humme, Brian Peterson @ R/Finance 2013: • http://www.rinfinance.com/agenda/2013/workshop/Humme+Peterson.pdf • Guy Yollin, quantstrat/blotter lecture notes: • http://www.r-programming.org/papers • Blair Hull @ R/Finance 2012: • http://www.rinfinance.com/agenda/2012/talk/BlairHull.pdf • My Blog: http://ww.biglucre.com/ • This presentation focuses on brevity and perceived gaps in more comprehensive resources. Slides will be available. References
R/quantstratFor Fun & Profit: Motivation Quantitative Trading Motivation Profit! But, it’s risky – not good for regular income to pay the rent. Don’t quit your day job – unless you’re working for a group that really knows what they’re doing. But, it is also interesting! Not as expensive as you might think to trade –except for High Frequency.
R/quantstratFor Fun & Profit: Why R/quantstrat? Why R/quantstrat? Features – Leveraging framework with much of what commercial packages offer. Flexibility – Ability to change for own use. Cost Used in professional trading firms. From Blair Hull: xts, xtime, indexing, sde, monomvn, lars, fUnitRoots, fGarch, manova Proprietary trading firm contributions, even those with large operations.
R/quantstratFor Fun & Profit: The Toolset The Toolset (from Humme/Peterson)
R/quantstratFor Fun & Profit: The Toolset: quantstrat The Toolset: quantstrat Part of the TradeAnalytics package https://r-forge.r-project.org/projects/blotter/ Not yet available on CRAN (under heavy development) Installing quantstrat: http://biglucre.com/environment/ (Linux/from source) or, you can try: install.packages("quantstrat", repos="http://R-Forge.R-project.org")
R/quantstratFor Fun & Profit: The Toolset: quantstrat The Toolset: quantstrat Recommended Reading: Trading Systems: A New Approach to System Development and Portfolio Optimisationby Tomasini and Jaekle This text follows the development and testing of a simple system, Luxor which is featured in several quantstrat demos.
R/quantstratFor Fun & Profit: The Toolset: quantstrat Professional+CommercialTools will provide: Data Warehouse System Development Production Strategy Deployment R/quantstrat can be used for 1 and 2 – maybe 3.
R/quantstratFor Fun & Profit: The Toolset: quantstrat Toolset: quantstrat(from Humme/Peterson)
R/quantstratFor Fun & Profit: The Toolset: quantstrat Toolset: quantstrat Functional Programming Workflow Indicators and Signals add columns to mkdataxts object. Applying a Strategy results in a blotter object that contains trade information, ready for analysis. More advanced features include optimization methods and parallelization.
R/quantstratFor Fun & Profit: Data Warehousing Data Warehousing Acquire Data Record from feed (IQFeed, Interactive Brokers) Purchase (tickdata.com, IQFeed6-mo backfill) Code for the following forthcoming at www.biglucre.com Import Data Use read.csv, convert to xts, name columns for BBO or OHLC data Use FinancialInstrumentSaveSymbols()/getSymbols.FI to save xtsdata into daily .rda data files load/merge subsets of daily data into xts objects
R/quantstratFor Fun & Profit: Modeling Modeling R offers many useful packages. Some examples: urca: Unit root and cointegration tests for time series data http://cran.r-project.org/web/packages/urca/index.html fGarch: Rmetrics - Autoregressive Conditional HeteroskedasticModelling http://cran.r-project.org/web/packages/urca/index.html
R/quantstratFor Fun & Profit: Backtesting Backtesting(from Humme/Peterson)
R/quantstratFor Fun & Profit: Backtesting Backtesting(from Humme/Peterson)
R/quantstratFor Fun & Profit: Optimization Optimization/Parallelization (from Guy Yollin)
R/quantstratFor Fun & Profit: Questions? Questions?