Tag Archives: quant LIVE

Challenges of HFT with open source R with C or C++ vs Matlab for quant LIVE trading in production. No Visual Debugger in Rstudio?

Challenges of HFT with open source R with C or C++ vs Matlab for quant LIVE trading in production. No Visual Debugger in Rstudio?

Like this? Learn more through my FREE newsletter

I got this email asking for some points of view on R, Matlab, etc. This is in response to:


My responses followed by:


Hi Bryan,


This is great. I really want to use R to develop strategies. I don’t really want to use Matlab for the two reasons:

1) I live in Hong Kong and despite me sending a bunch of emails about getting set up they won’t get back to me. Their automated response when I fill out an online request is that a sales person in my region will contact me soon. I’m guessing they don’t have a sales person in Asia.


–> They should respond!

2) The cost of Matlab is significant relative to R. If you set up successful strategies then Matlab pays for itself but until you have built, tested, and implemented these strategies it puts a dent in your trading capital.

–> I agree but Matlab is more for 7 digit capital operations. My latest quote for my goodies exceeded $125K so I know the pain. I can tell you though you will easily make it back if you are hiring coders to hand code your trading ideas. Also, Matlab does not call in sick, steal your algos, or just quit mid way. Matlab is pretty easy work with. It just depends how serious you are as well as how much starting capital you have. If you are limited, yes R is the best way. Maybe even Python?

I just completed the free quants and econometrics course in R from University Washington on Coursera.org. It shows you how to code a trend forecasting AR model in R. You might want to put it down as a suggested intro to your courseware too. link here https://www.coursera.org/course/compfinance

–> I have heard about these but you can also learn through Apple Itunes U. It is all the open source courses through Ivey universities. Some killer stuff.

UW also run a course in R walking you through:

Rcpp interface from R to C++

Rinside interface from C++ to R



–> Yes I have tried this but it slows down when connecting the R seesion in your C/C++ environment. To connect an R session may take more nano/milliseconds than you want. This is why I went back to Matlab to look for the best code generation process to embed natively into your trading system. This is why I have looked at Simulink which is very cool with the rapid model development environment. I will be providing further online courses will be provided in this area as well.  You can code generate with C/C++ or even for FPGA deployment from the same Simulink visual model. Imagine that?  You will see a HUGE difference in productivity.

But the UW AMATH-557 is not online. There is bunch of stuff online when you google it so can figure things out for yourself, like this one http://dirk.eddelbuettel.com/code/rcpp.html . You might want to add something like this to your courseware.

–> Again, I like RCPP but see my point above. Those milliseconds delay could be an issue when you try to bridge R and C/C++ into the same session. I even looked at R with Java and .NET C#. I personally don’t think you would use this for a LIVE production environment but I may be wrong. As said, I am more comfortable doing it through a code generation process from Matlab. As for RCPP, I would encourage anyone to comment to set the record straight. I would love to investigate RCPP if there has been an significant engineering update from 2012. I am also still waiting for my visual debugger in Rstudio which would make my life much easier. My life would be pretty we ll a party if that happened.

I’ve spoken to a bunch of HFT desks and they always come back with the two questions:

1) Do you have a HFT strategy that’s got a good track record for over 3 months and is scalable?


–> This is a very standard response

2) What qualifications in programming automated strategies have you got?

–> Haha. Read the Max Dama online book on this. He basically says, real programmers/quants don’t care about the programming language.


ALso, it seems all institutions use Matlab more than R but again, it depends on your goals.


If your answer to the first question is yes then they don’t need to ask the second question. Your proposed training course should help people be able to answer that question with a yes which is the main goal.

If we are not there yet then being able to answer the second question strongly would be a secondary goal. The success of Coursera is it gives you certificates of completion. Being able to produce certificates of completed training for your courses would be very useful for those quant researcher roles.

–> Hey I could issue certificates to with quizzes at the end. I don’t think mine would be recognized by industry. But I thought about that with CQF as well. While I was in NYC, it appears I was dead wrong so maybe Courera may help.

I think what you are doing is great. Keep up the good work.

–> Thanks

P.S. I missed your Feb 27 at 7PM Instructions on how to set up this trading platform. Did you record it?

–> Send out the exact link or topic as I will be able to give you an answer. It could be on my Youtube channel (youtube.com/quantlabs) or only for my Premium Members.

Like this? Learn more through my FREE newsletter



NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!