Tag Archives: RCPP

How to install R with RCpp RInside for C++ HFT with multithreading capabilities for parallelizing with Open MPI in Ubuntu Linux

How to install R with RCpp RInside for  C++ HFT with multithreading capabilities for parallelizing with Open MPI in Ubuntu Linux

To get RCpp and RInside running in your Ubuntu Linux environment

Install RStudio to manage the installation of your R packages which is the lazy person’s way of doing it.  Also, ensure you have the latest R version by doing:


In RStudio, install RCpp and RInside. Download the latest version of RInside for C++ from (under Download section)


Once the tarball is expanded in your Linux environment, navigate to the examples standard to make all the examples. Again, you will need the RCpp and RInside R packages available for the build process. Other R packages may be needed as your run the many examples.

To run the RInside examples with the OPen MPI for parallelizing examples, install Open MPI following apt-get instructions at:


The navigate to the RInside example mpi and do a make. Run the samples and watch your jaw drop on the potential of R and C++ for HFT in a multithreaded environment.




Best high frequency trading HFT performance: Linux open source with C++ v Java with R, RJava,RCaller, RCPP,RInside

Best high frequency trading HFT performance: Linux open source  with C++ v Java with R, RJava,RCaller, RCPP,RInside

This has been a struggle for me for a while. It seems that I always struggle between Java and C++ regarding HFT. As I want to implement R into it vs my usual struggle between R and Matlab, this is easily the best development stack to go with. Watch this video at


I also did some metric research of calling R from both Java and C++. It seems without a doubt, calling R from C++ is definitely the way as it is half the time vs Java.I need to thank any person developing these highly important R packages. They know who they are.



Please do not engage me on this debate but I don’t have the time for it. I also will be moving on with a very primitive C++ open source trading platform for Linux. It is a rather complicated library stack but when you research the above links, it should be no reason not to. I don’t want to face a rewrite down the line. Also, I can confirm that is the best way forward on development on some kind of trading platform using R with RCPP. You can only do this in Linux as RCPP only support GCC. There is no option in using Visual C++ with Visual Studio so sorry there.

I will present my next set of steps on how I proceed with this. I do think this will be the most time consuming step I have been involved especially the amount of debugging time on this platform. Let me be as straight as possible, I will not be releasing the code to no one on my hacked version of this platform. You will need to note that this stage is becoming a very proprietary stage of QuantLabs.net development. As a result, only my Premium member will get this access through my unrecorded live webinar and  live demos. There be no track record of these steps as I am not redistributing this code to no one other than demoing it to certain people. This platform will be worth a lot of money to people so  this will really only include those who can afford it, Institutional or high  net worth. Problem with it? Move on to Google for a new search.

My time is getting highly crunched and I do not have the time to hand hold people any more. This will only be given to those who pay for my time. That is all.

I will continue to provide pointers for you but don’t expect this operation to give you an out of box overnight kit to being a millionaire by following green arrows. It does not work like that. Use the scammers known as Vector Vest for that.

QuantLabs.net now is following the footsteps of the most secretive institutional trading operations in the world. This is an expensive endeavour and I would expect only those that can afford to enter it, otherwise go to a casino to spend your money. You have better chances that way or continue losing money with your favourite corrupt trading broker. Have fun.

Get access to this membership now before these rate skyrocket. 

Warning! Certain R packages may run not on Windows with as RCPP may be dependency. Would like a complete list?

Warning! Certain R packages may run not on Windows with as RCPP may be dependency. Would like a complete list?

As I am new to R using a mixed environment of Windows and Linux like Ubuntu or CentOS, I am finding certain R packages will not install properly on Windows. As I I really like RStudio because of its simplicity to install R packages, I get some strange messages of certain packages that do not load properly due to the so-called current version of R cannot be installed. I am using 2.1.5 but may have found a solution.

What is the solution?

That same R package that gives you install problems on Windows may actually work within an Linux environment. As a result, it could be the R package maybe the result of using RCpp as a dependency. I have even seen certain R packages get built or compiled during the install process. It seems RCpp is used which needs a local version of GCC to build. GCC is a GNU C/C++ compiler for Linux or Unix.  As a result, if you are using Windows, you will most likely not have GCC installed on your Windows desktop.

What to do?
You really have two choices:

  1. Build a Linux virtual machine on a virtualization environment appliance like VMWare or free Oracle Sun Virtual Box. If you go for Virtual Box, everything is free. Nice! There is lots of opening YouTube videos on how to do this so I won’t go there. Also, don’t forget to install your GCC with an ‘appt-get install gcc’ or ‘yum install gcc’ depending your Linux flavor. Again, you can easily find loads of YouTube videos on how to do this.
  2. Your other choice is something I am not a fan of but nevertheless you should know about. If you are not a fan of Linux, you can always load MINGW onto Windows and then separately install GCC. Again, I have verified there are so many YouTube videos showing how to do this.


I know this could be a pain for some but this is why I really like RStudio which makes my R experience so much better.


I am also looking for anyone who has experienced any R packages that need to be locally compiled with GCC, can you please leave a comment on your experience and which R package? It makes everyone’s life so much easier if can be compiled into one area.

Thanks for that!

P.S. You may want to know about our upcoming presentations in R topics at my R/Matlab Meetup for Financial specialists!


Video of R, RCPP, RInside makes use of C++ so much easier than Matlab Builder NE for high frequency trading aka HFT potential

Video of R, RCPP, RInside makes use of C++ so much easier than Matlab Builder NE for high frequency trading aka HFT potential

So I am going from trying out an open source C# application trading platform to an open source C++ ‘platform’ using Interactive Brokers. I also switched from Matlab to R. Lastly; I am looking at more open source projects including Linux where Ubuntu is becoming my preferred distribution. As you can tell, I am straying away from expensive options like Matlab. Being a developer, I can quickly debug most applications if need be.

The benefit I am finding switching to R as compared to using Matlab with something like Matlab’s Builder JA (for Java) or Builder NE (for .NET languages like C#) toolboxes. When I tried out the combination of R packages RCpp and RInside, I was pleasantly surprised for a number of things. Installing any R package is quite easy. Building or ‘making’ the provided C++ examples for RInside was flawless and easy to execute. The most impressive were samples of parallelization of C++ which was jaw dropping.

Now I am hoping I can see my newer open source C++ trading solution Trading Shim (http://www.tradingshim.org/) will work at some point as well.   Hey…it is C++ so leave it alone. But the speed and scalability of it should be impressive. I just wish there was a complete open source trading platform in Java that could connect to my chosen broker Interactive Brokers.

Anyhow, back to the R packages of RCpp and Rinside. I need to give a shout out to the contributors for making these packages happen in a quick and easy way. The provided C++ examples really do make a difference to showcase how a C++ application can call the R shell processor and execute individual R functions directly. You could not do that with the Matlab NE Builder as you could only call M scripts with their archaic programming structure. The C++ code within RInside as compared to Matlab NE is much simpler, tighter, and smaller. The Matlab NE Builder is really meant for C# so trying it in Visual C++ would have been ‘interesting.’ I am just glad I found this deadly combination of R, RCpp/Rinside, with C++. It may work well for my hopeful high frequency trading platform with R for prototyping and analytics.

[youtube_sc url=”http://www.youtube.com/watch?v=wIzrJFy-VCA” playlist=”Calling R from a C application for HFT development with MPI parallelzation ” title=”Calling%20R%20from%20a%20C%20application%20for%20HFT%20development%20with%20MPI%20parallelzation%20″]