Python/R in Trading

For those of you who are traders, how frequently do you use python/r in your job? I know that this question varies for someone who works at a market maker vs. someone who works at a trade house, but for those of you who do program can you give me a sense of how you use it on a day to day basis?

WSO Elite Modeling Package

  • 6 courses to mastery: Excel, Financial Statement, LBO, M&A, Valuation and DCF
  • Elite instructors from top BB investment banks and private equity megafunds
  • Includes Company DB + Video Library Access (1 year)

Comments (22)

  • Works at Citadel Investment Group
Feb 10, 2021 - 11:27am

A lot! Although I don't use R much. I would say 75% Python 25% VBA (I hate VBA, but a lot of the tools that my PM (as well as many others that have been in the industry for a couple decades) uses are built in Excel...). For what it's worth I'm on the HF side, but I did work at a market maker for a couple of years ~4 years ago and mostly used Python there as well.

Feb 10, 2021 - 12:59pm

Don't mean to hijack the thread, but what coding language would you say has the best payoff? That is, if you had to give a ratio of how hard one is to learn vs. how applicable it is to trading. Like I'm sure there are easy ones to learn that are damn near useless and ones that make your life a lot easier but are extremely difficult. Have you found any that are a happy medium?

  • Works at Citadel Investment Group
Feb 10, 2021 - 1:38pm

It depends on the fund, role, and PM you work for, but in general for a trading role I would say VBA and Python is a good toolbox. C++ isn't really necessary unless you're working on pretty low latency strategies, and some people use R - you could argue R is easier to learn than Python, but I'm not really sure if that's true. Anyway, the industry is generally moving away from R towards Python.

For some roles you'll only use VBA, for some you'll only use Python, and for some you won't use either. Honestly I never really 'learned' VBA - I learned Python (and a couple of other basic languages, but Python is by far the most useful), and initially when I had to work on something in VBA, I struggled through but made it work just using Google and my experience with Python. At this point I feel pretty comfortable in VBA. I guess what I'm trying to say is that VBA is pretty easy to learn, but if you learn Python then VBA won't be that tough to figure out if/when you need to, but the other way around isn't necessarily true.

Learn More

300+ video lessons across 6 modeling courses taught by elite practitioners at the top investment banks and private equity funds -- Excel Modeling -- Financial Statement Modeling -- M&A Modeling -- LBO Modeling -- DCF and Valuation Modeling -- ALL INCLUDED + 2 Huge Bonuses.

Learn more
Feb 26, 2021 - 6:42pm

Python is the easiest popular language to learn, and it allows you to use industry standard statistical, data science, and deep/machine learning packages. I would do a comparison in how easy and robust analysis is in pandas/matplotlib vs excel once you pick that up to a reasonable amount of proficiency.

Feb 22, 2021 - 3:13pm

Using a lot of R, Python and 10% VBA (mostly legacy stuff). R is great for statistical models, but Python improved a lot during the past few years and is much easier to integrate with any tech stack. If you start from zero, nowadays I would go with Python.

The most important thing is don't get lost in stupid X is better than Y stuff, be language agnostic and select the best tool for each task. If everybody in your team is using R, use R. If your manager wants some fancy excel models use VBA. It makes no sense writing code in a specific language if it takes you 5x as long and your code quality sucks.

Most Helpful
Feb 28, 2021 - 9:28am

Oversimplified breakdown:

Python: Multi-purpose use/versatility. I might be interested in creating a very simple simulation of a broad trading strategy I have in mind. I also might be interested scraping data directly from certain websites using packages like BeautifulSoup, Selenium, etc and using Pandas to do some preliminary data analysis. Standard data science libraries. Maybe I want to build a simple alert bot for when certain thresholds pass or there's live news events I want to trade off of. 

R: Very useful if you want to get heavy with statistical analysis. Your bread and butter for running ML/AI analyses on datasets. You certainly can do plenty of quantitative deep downs with Python, but R will have the overall "edge" if you want to go all out. Goes without saying it offers great data visualization options, though I wouldn't discount Python either

VBA: Usually for lesser intensive automation processes. Lot of firms still rely on Excel so VBA is a great bridge. Working with spreadsheets, it's extremely useful for the operations side such as EOD P&L recap as well as position reconciliations. When you start out in a trading role, you typically need to oversee and master the operations aspects of the desk. You certainly CAN use Python but it could also be overkill in a lot of scenarios.   

Feb 28, 2021 - 11:07am

Hey ActuarialQuant,

I don't really use python on a regular basis in my daily work, but it's something I am interested in learning. Specifically the data-analysis and website sentiment scraping. As someone looking to self teach do you have any recommendations as to the best place to start?

I recently spent an entire weekend downloading python, sublime, and a few libraries and going through sentdex's "introduction to python" course where he builds a tic tac toe game. It was interesting but I felt I didn't really "learn" too much, just picked up on a few things. I went to try his "Finance" tutorial next but it seemed the videos were pretty old and he was relying on APIs that are no longer functional so I gave up.

I then learned about anaconda and that a lot of data-scientists prefer to use this vs traditional python and adding all the libraries they need as it comes "pre-loaded" out of the box with most everything you would want to use. Jupyter notebook also seems like the preferred way to teach/learn or am I off on this?

Do you know of any good resources for learning financial concepts/data-analytics through the anaconda framework, preferably free and as up to date as possible?

Thanks

Feb 28, 2021 - 8:40pm

Unde animi similique sed ut. Molestias fuga reiciendis totam quidem non. Qui error porro voluptatem possimus delectus rerum.

Start Discussion

Popular Content See all

Investment Banking is Paradise
+276IBby Partner in PE - LBOs
Public banging
+183OFFby Intern in PE - LBOs
Oncycle is a fucking joke
+167PEby Analyst 2 in IB - Cov
MD’s Daughter/Son has student loans?
+115REby Analyst 1 in RE - Comm
How often do you get "matches" on apps?
+113OFFby Associate 1 in AM - Other
Dating smart girls
+99OFFby Analyst 2 in Consulting
Who manages your money?
+96INVby TechnoPanther

Total Avg Compensation

September 2021 Investment Banking

  • Director/MD (10) $853
  • Vice President (38) $367
  • Associates (218) $232
  • 2nd Year Analyst (131) $152
  • 3rd+ Year Analyst (30) $147
  • Intern/Summer Associate (102) $144
  • 1st Year Analyst (483) $135
  • Intern/Summer Analyst (375) $82