SERVING THE QUANTITATIVE FINANCE COMMUNITY

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

R in market making/quant finance?

June 22nd, 2019, 3:50 am

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
 
User avatar
Cuchulainn
Posts: 59421
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: R in market making/quant finance?

June 22nd, 2019, 9:16 am

Python and C++ are popular. R is useful as well.
 
User avatar
FaridMoussaoui
Posts: 401
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

Re: R in market making/quant finance?

June 22nd, 2019, 9:52 am

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?

June 22nd, 2019, 10:07 am

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.
 
User avatar
Cuchulainn
Posts: 59421
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: R in market making/quant finance?

June 22nd, 2019, 12:04 pm

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?
 
User avatar
Cuchulainn
Posts: 59421
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: R in market making/quant finance?

June 22nd, 2019, 2:26 pm

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?
 
User avatar
tagoma
Posts: 18254
Joined: February 21st, 2010, 12:58 pm

Re: R in market making/quant finance?

June 22nd, 2019, 4:43 pm

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.
 
User avatar
ISayMoo
Posts: 1896
Joined: September 30th, 2015, 8:30 pm

Re: R in market making/quant finance?

June 22nd, 2019, 10:41 pm

Move to Python 3.
 
User avatar
bearish
Posts: 4808
Joined: February 3rd, 2011, 2:19 pm

Re: R in market making/quant finance?

June 22nd, 2019, 11:07 pm

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?

June 23rd, 2019, 12:37 am

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
 
User avatar
FaridMoussaoui
Posts: 401
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

Re: R in market making/quant finance?

June 23rd, 2019, 9:00 am

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.
 
User avatar
FaridMoussaoui
Posts: 401
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

Re: R in market making/quant finance?

June 23rd, 2019, 9:33 am

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


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

Re: R in market making/quant finance?

June 23rd, 2019, 11:16 am

As usual, installing a package from source on windows is a mess.
 
User avatar
Cuchulainn
Posts: 59421
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: R in market making/quant finance?

June 23rd, 2019, 11:22 am

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.
 
User avatar
FaridMoussaoui
Posts: 401
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

Re: R in market making/quant finance?

June 23rd, 2019, 11:49 am

Please use R community version :)
A workaround is to install rpy2 from the whl binaries (on windows OS):
download the rpy2 binary from: https://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2
launch "cmd"
1) set R_USER=%USERNAME%
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%
C:\Users\farid\Downloads>pip install rpy2-2.9.5-cp37-cp37m-win_amd64.whl
Processing c:\users\farid\downloads\rpy2-2.9.5-cp37-cp37m-win_amd64.whl
Collecting six (from rpy2==2.9.5)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe8
98238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting jinja2 (from rpy2==2.9.5)
  Downloading https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a43
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)
  Downloading https://files.pythonhosted.org/packages/65/c6/2399700d236d1dd681af
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
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On