Presentation on theme: "R/quantstrat For Fun & Profit"— Presentation transcript:
1R/quantstrat For Fun & Profit MotivationWhy R/quantstrat?Overview: The ToolsetData Warehousing with XTSModelingBacktestingE. AllenNov. 4th 2013Pittsburgh R Users Group Lightning Talk
2References Jan Humme, Brian Peterson @ R/Finance 2013: Guy Yollin, quantstrat/blotter lecture notes:Blair R/Finance 2012:My Blog:This presentation focuses on brevity and perceived gaps in more comprehensive resources. Slides will be available.
3R/quantstrat For Fun & Profit: Motivation Quantitative Trading MotivationProfit!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.
4R/quantstrat For Fun & Profit: Why R/quantstrat? Features – Leveraging framework with much of what commercial packages offer.Flexibility – Ability to change for own use.CostUsed in professional trading firms.From Blair Hull: xts, xtime, indexing, sde, monomvn, lars, fUnitRoots, fGarch, manovaProprietary trading firm contributions, even those with large operations.
5R/quantstrat For Fun & Profit: The Toolset The Toolset (from Humme/Peterson)
6R/quantstrat For Fun & Profit: The Toolset: quantstrat Part of the TradeAnalytics packagehttps://r-forge.r-project.org/projects/blotter/Not yet available on CRAN (under heavy development)Installing quantstrat:(Linux/from source)or, you can try:install.packages("quantstrat", repos="http://R-Forge.R-project.org")
7R/quantstrat For Fun & Profit: The Toolset: quantstrat Recommended Reading: Trading Systems: A New Approach to System Development and Portfolio Optimisation by Tomasini and JaekleThis text follows the development and testing of a simple system, Luxorwhich is featured in several quantstratdemos.
8R/quantstrat For Fun & Profit: The Toolset: quantstrat Professional+Commercial Tools will provide:Data WarehouseSystem DevelopmentProduction Strategy DeploymentR/quantstrat can be used for 1 and 2 – maybe 3.
9R/quantstrat For Fun & Profit: The Toolset: quantstrat Toolset: quantstrat (from Humme/Peterson)
10R/quantstrat For Fun & Profit: The Toolset: quantstrat Functional Programming WorkflowIndicators and Signals add columns to mkdata xts object.Applying a Strategy results in a blotter object that contains trade information, ready for analysis.More advanced features include optimization methods and parallelization.
11R/quantstrat For Fun & Profit: Data Warehousing Acquire DataRecord from feed (IQFeed, Interactive Brokers)Purchase (tickdata.com, IQFeed 6-mo backfill)Code for the following forthcoming atImport DataUse read.csv, convert to xts, name columns for BBO or OHLC dataUse FinancialInstrument SaveSymbols()/getSymbols.FI tosave xts data into daily .rda data filesload/merge subsets of daily data into xts objects
12R/quantstrat For Fun & Profit: Modeling R offers many useful packages. Some examples:urca: Unit root and cointegration tests for time series datafGarch: Rmetrics - Autoregressive ConditionalHeteroskedastic Modelling
13R/quantstrat For Fun & Profit: Backtesting Backtesting (from Humme/Peterson)
14R/quantstrat For Fun & Profit: Backtesting Backtesting (from Humme/Peterson)
15R/quantstrat For Fun & Profit: Optimization Optimization/Parallelization (from Guy Yollin)