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?

 

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.

 

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?

 

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.

 

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.

 

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

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.   

"Luck is what happens when preparation meets opportunity"
 

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

 

Harum vel minima vel cumque reprehenderit. Dolorem et dolores error ut porro asperiores sit ducimus. Aut vitae provident nihil quasi.

Qui voluptatem itaque mollitia ut. Nemo voluptatem libero accusamus. Facilis commodi corporis quia non. Est voluptates officiis autem ipsam. Mollitia commodi accusantium nihil itaque quo repellat voluptatem.

"Luck is what happens when preparation meets opportunity"

Career Advancement Opportunities

April 2024 Investment Banking

  • Jefferies & Company 02 99.4%
  • Goldman Sachs 19 98.8%
  • Harris Williams & Co. New 98.3%
  • Lazard Freres 02 97.7%
  • JPMorgan Chase 03 97.1%

Overall Employee Satisfaction

April 2024 Investment Banking

  • Harris Williams & Co. 18 99.4%
  • JPMorgan Chase 10 98.8%
  • Lazard Freres 05 98.3%
  • Morgan Stanley 07 97.7%
  • William Blair 03 97.1%

Professional Growth Opportunities

April 2024 Investment Banking

  • Lazard Freres 01 99.4%
  • Jefferies & Company 02 98.8%
  • Goldman Sachs 17 98.3%
  • Moelis & Company 07 97.7%
  • JPMorgan Chase 05 97.1%

Total Avg Compensation

April 2024 Investment Banking

  • Director/MD (5) $648
  • Vice President (19) $385
  • Associates (86) $261
  • 3rd+ Year Analyst (14) $181
  • Intern/Summer Associate (33) $170
  • 2nd Year Analyst (66) $168
  • 1st Year Analyst (205) $159
  • Intern/Summer Analyst (145) $101
notes
16 IB Interviews Notes

“... there’s no excuse to not take advantage of the resources out there available to you. Best value for your $ are the...”

Leaderboard

1
redever's picture
redever
99.2
2
Betsy Massar's picture
Betsy Massar
99.0
3
BankonBanking's picture
BankonBanking
99.0
4
Secyh62's picture
Secyh62
99.0
5
dosk17's picture
dosk17
98.9
6
GameTheory's picture
GameTheory
98.9
7
CompBanker's picture
CompBanker
98.9
8
kanon's picture
kanon
98.9
9
bolo up's picture
bolo up
98.8
10
Jamoldo's picture
Jamoldo
98.8
success
From 10 rejections to 1 dream investment banking internship

“... I believe it was the single biggest reason why I ended up with an offer...”