SERVING THE QUANTITATIVE FINANCE COMMUNITY

• 1
• 2

mal
Topic Author
Posts: 5
Joined: June 22nd, 2019, 1:32 am

### R in market making/quant finance?

Firstly hello everyone, it's my first post and it's nice to come upon a site that is super relevant to me at the moment!

I'm coming up to my last semester of a statistics/math degree where I'll be taking stochastic modelling (introductory/intermediate) and generalized linear models - and I'm tossing up between taking possibly if i'm allowed a masters subject (like bayesian models or a math oriented machine learning course) - this is all in R.  If I don't take one of these subjects, my last one would be a numerical computing subject which focuses stochastic simulation, direct methods for linear systems, fitting linear and nonlinear models, and time stepping methods - all done in matlab.  I don't really know which subject to take and how they translate into quant finance area.  Would it be best to go more broad with my education (numerical solutions) or deeper (bayesian or math ML)?

I would like to possibly do a honours year next year in stats - where I'd focus on a trading based project, and it'd help give me time so I can work on my maths work for answering some of these market making interview questions etc.  A concern of mine is that I'm not really developing my python skills.  I have done a few subjects in C, a broad ML subject in python, and have been doing my stats subjects in R.  I definitely prefer python over R, as R's syntax is pretty gross imo; also python feels like a real language (I like loops).  Is R used much in quant finance/market making? Or is it generally exclusively python and C++?  It seems like a lot of the market making firms are orientated this way.  I do know R now has packages that include all the ML methods, and can interface with C++/C; much like how python can.  I'm not sure if I should even be worrying about this as I should be able to pick up more advanced python now that I've had an introduction.

I suppose I'd just like opinions on my subject choices, and also the use of R in quant finance?  I don't think my thoughts are super well thought out atm, and I guess that just comes from a lack of clarity as to what is actually used in industry.  I'm based in Australia btw if that is a factor.

Thanks for your opinions,
Mal

Cuchulainn
Posts: 62125
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: R in market making/quant finance?

Python and C++ are popular. R is useful as well.

FaridMoussaoui
Posts: 507
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

### Re: R in market making/quant finance?

I use R in my daily quant work (I moved to R from matlab in 2007). It is used everywhere in quant finance. R (after S+) is THE statistics language.

When you say Python, you have to be specfic. 2 or 3? (in python2, 1/2 is 0 while it is 0.5 in python3)

mal
Topic Author
Posts: 5
Joined: June 22nd, 2019, 1:32 am

### Re: R in market making/quant finance?

Python and C++ are popular. R is useful as well.
Thanks for your input.

I use R in my daily quant work (I moved to R from matlab in 2007). It is used everywhere in quant finance. R (after S+) is THE statistics language.

When you say Python, you have to be specfic. 2 or 3? (in python2, 1/2 is 0 while it is 0.5 in python3)

Thanks for your input.  I would be referring to python 3.  I have heard it's quite popular in market making/proprietary trading firms.  I am fine with going deep into R if I have too, I've just heard that some firms do programming tests (in python or C++) but I haven't seen that they give you the option to do it in R.  If you don't mind, would you say in what type of area you work in?  I understand if you don't want too though.

Cuchulainn
Posts: 62125
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: R in market making/quant finance?

I see Python as a procedural front-end to C++/Fortran library. It has its strengths and quite a few shortcomings as a language. e.g. large code base, no static typing, OOP in Python I find very scary. In fairness, it probably wasn't built for that purpose.

When you say Python, you have to be specfic. 2 or 3? (in python2, 1/2 is 0 while it is 0.5 in python3)
Python 2 is old? so upgrade to 3. Like in the past, has to be done sometime.
BTW Farid, which units are you using, 1/2 of what?

Cuchulainn
Posts: 62125
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: R in market making/quant finance?

Stupid question

Installing rpy2==3.0.4 from VisialStudio give the error

ERROR: C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\setuptools\pep425tags.py:89: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect

warn=(impl == 'cp')):
etc.

Any ideas, Farid?

tagoma
Posts: 18354
Joined: February 21st, 2010, 12:58 pm

### Re: R in market making/quant finance?

Stupid question

Installing rpy2==3.0.4 from VisialStudio give the error

ERROR: C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\setuptools\pep425tags.py:89: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect

warn=(impl == 'cp')):
etc.

Any ideas, Farid?
It sounds like you're using Windows 7 and you selected pip to install your package. Some sort of compatibility issue. You may be willing to upgrade to Windows 8 or 10 (I still love my own jokes). Importantly, your package might well be working as expected. Does it make sense?
Last edited by tagoma on June 22nd, 2019, 10:45 pm, edited 1 time in total.

ISayMoo
Posts: 2294
Joined: September 30th, 2015, 8:30 pm

### Re: R in market making/quant finance?

Move to Python 3.

bearish
Posts: 5535
Joined: February 3rd, 2011, 2:19 pm

### Re: R in market making/quant finance?

Sounds about right. As somebody who occasionally hire quants, I'd say that what you propose to do with these tools is more important than your tool of choice. That being said, the Python infrastructure (not the least including Two Sigma, Google and Facebook contributions) is pretty impressive, and your ability to integrate your efforts with others is most likely maximized in Python. If you were to travel back in time to the glory days of derivatives modeling, or somewhat more recently, HFT, by all means sharpen your C++ skills.

mal
Topic Author
Posts: 5
Joined: June 22nd, 2019, 1:32 am

### Re: R in market making/quant finance?

Sounds about right. As somebody who occasionally hire quants, I'd say that what you propose to do with these tools is more important than your tool of choice. That being said, the Python infrastructure (not the least including Two Sigma, Google and Facebook contributions) is pretty impressive, and your ability to integrate your efforts with others is most likely maximized in Python. If you were to travel back in time to the glory days of derivatives modeling, or somewhat more recently, HFT, by all means sharpen your C++ skills.
Hi everyone, thanks for your responses.  It seems like quite a few people are voting for Python 3 - with a strong case for R not being made yet.  I think bearish is right in that it's more important what you do with these tools then the tools themselves.  I suppose it's just frustrating for me that I can't kill two birds with one stone; i.e. my maths department doesn't use python.  On the topic of what I know, does anyone have an opinion on my subject choices?  Going broader with my education (numerical solutions/efficiency/simulation subject) vs deeper (more advanced ML/bayesian stats)?

Thanks again

FaridMoussaoui
Posts: 507
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

### Re: R in market making/quant finance?

I am not working on windows OS, Daniel. Try to install it from the command line outside VS.

I use "a lot" of C++ in R with the package Rcpp allowing a seamless integration. But I am quite language agnostic.

FaridMoussaoui
Posts: 507
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

### Re: R in market making/quant finance?

The install of rpy2 on Linux went smoothly:
matterhorn:/usr/bin # pip3 install rpy2
Collecting rpy2
Using cached https://files.pythonhosted.org/packages/8d/7c/826eb74dee57e54608346966ed931674b521cf098759647ed1a103ccfa79/rpy2-3.0.4.tar.gz
......
Installing collected packages: zipp, importlib-metadata, pluggy, more-itertools, attrs, atomicwrites, wcwidth, py, pytest, MarkupSafe, jinja2, simplegeneric, rpy2, pycparser
Running setup.py install for simplegeneric ... done
Running setup.py install for rpy2 ... done
Running setup.py install for pycparser ... done
Successfully installed MarkupSafe-1.1.1 atomicwrites-1.3.0 attrs-19.1.0 importlib-metadata-0.18 jinja2-2.10.1 more-itertools-7.0.0 pluggy-0.12.0 py-1.8.0 pycparser-2.19 pytest-4.6.3 rpy2-3.0.4 simplegeneric-0.8.1 wcwidth-0.1.7 zipp-0.5.1



FaridMoussaoui
Posts: 507
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

### Re: R in market making/quant finance?

As usual, installing a package from source on windows is a mess.

Cuchulainn
Posts: 62125
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: R in market making/quant finance?

As usual, installing a package from source on windows is a mess.
Indeed, Farid. I even stooped so low as to define computer ENV variables ... last time I did that was on minis.
Am looking into Miicrosoft R Open as plan B. Still doesn't work with rpy2 _inside_ VS, though..
BTW all the packages in your list are installed except rpy2.

FaridMoussaoui
Posts: 507
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

### Re: R in market making/quant finance?

Please use R community version
A workaround is to install rpy2 from the whl binaries (on windows OS):
launch "cmd"
2) pip install rpy2‑2.9.5‑cp37‑cp37m‑win_amd64.whl
The best practice for R development is to NOT install R in a path with ~ (e.g Prog~).
I install it in C:\R
To your knowledge, R is compiled with the gcc compiler (specifically mingw) and you should install Rtools to use C/C++ in R. (installed in C:\R)

C:\Users\farid\Downloads>set R_USER=%USERNAME%
Collecting six (from rpy2==2.9.5)
98238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting jinja2 (from rpy2==2.9.5)
3deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl (124
kB)
100% |████████████████████████████████| 133kB 1.6MB/s
Collecting MarkupSafe>=0.23 (from jinja2->rpy2==2.9.5)
8aebff1725558cddfd6e43d7a5184a675f4711f5/MarkupSafe-1.1.1-cp37-cp37m-win_amd64.w
hl
Installing collected packages: six, MarkupSafe, jinja2, rpy2
Successfully installed MarkupSafe-1.1.1 jinja2-2.10.1 rpy2-2.9.5 six-1.12.0