Choosing R or C++ for Quantitative Trading Systems
Summary
The document distinguishes quantitative research from production execution when choosing programming languages. It presents R and Python as suitable environments for research and alpha-model development, while noting that a complete trading system must also connect to execution infrastructure and exchange APIs. In the response, the practical difficulty of using R for execution grows with trading frequency, partly because exchange connectivity may require additional wrappers.
For lower-frequency strategies, an online model updated in real time may be workable in R, though the added integration can increase system complexity. At higher frequencies, latency constraints make R unsuitable for the execution layer; the suggested architecture passes model coefficients from R into a C++ execution program. The central design idea is to use different languages for different components rather than require one language across the system. This is general guidance, not a benchmark: the document gives no performance measurements, and suitability depends on strategy frequency and implementation needs.
Key ideas
- R can support quantitative research and alpha-model development.
- Execution infrastructure and exchange connectivity are separate concerns from model research.
- Integration overhead can make R less practical for lower-frequency live execution.
- Higher-frequency strategies may pass model outputs from R into a C++ execution program.
- Language choice can vary across components of one trading system.
Tags
Full text
# Is R suited for a Quantitative Finance executable application # Is R suited for a Quantitative Finance executable application I wonder if a R-Shiny application works well for a production environment or the only option is C++. I make this question taking in account that R and C++ have a widely set of quant libraries that other languages like Java or Python doesn't have. ## Answer by Theodore (score 1, accepted) https://quant.stackexchange.com/a/43196 R makes a fine environment for quantitative research. Same case with Python. For further information on R versus Python for quant finance, see Is R being replaced by Python at quant desks? As far as entire production-level algorithmic trading systems go, no. For execution R is generally not used but rather the alpha model in R is integrated into an execution model. It depends on the frequency of the strategy, however. Online models are ones that are updated in real time, this is more common on lower frequency levels of trading (you cannot have an online model for HFT as it is too latency constrained). In this case, sure you could have an execution program in R however that only increases the complexity of the system because it will involve writing some wrapper in R to communicate with an exchange API since most exchanges (as far as I know) aren’t as R-friendly with respect to execution. The impracticality of using R (and Python) for everything increases as a function of trade frequency. For higher frequency algorithms developed in R, coefficients from the alpha model developed in R are injected and taken as arguments into an execution program in C++. There is no need to stick with one language for everything.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.