Why traders need to start learning Python, and what they will do with it

eFC logo
Python for data science

It’s nearly forty years since the launch of the first spreadsheet, VisiCalc, which was written for Apple II (June 4 1979 to be precise). Today, whilst VisiCalc has long since disappeared, spreadsheets are still here. Excel is now one of the most important tools used by traders and is pretty much indispensable for most.

These days, however, spreadsheets can sometimes seem a bit outdated. Sure, Excel can help you to number crunch your way to a solution quickly, but it can struggle to handle the types of datasets associated with today’s markets. You can extend Excel’s functionality using its VBA programming language, but even this might not be enough.

Excel is fine if you’re dealing with daily price data, but try using tick data and those rows will quickly fill up. If pressing F9 means waiting 5 minutes for a result, maybe it’s time to try something else?

So, what’s the solution for traders who are finding Excel a bit limiting? One solution is to learn some Python. You can work with absolutely massive datasets with Python, using libraries like Dask. This is very relevant given that traders might want to analyse big datasets to gain market insights and improve their returns. For example, showing best execution, requires using tick data. Python can also help you deal with more unusual types of data, such as text, which a trader might wish to analyse. At the same time, despite its power, the learning curve if you're trying to pick up Python isn’t as steep as languages like C++.

Python isn’t all about heavy duty computation. Trading is fun, but like any job it also involves tasks which are repetitive. For example, you might want to send regular e-mails linked to spreadsheets. Python’s smtplib library does exactly this, saving traders time, copying and pasting. Or perhaps you want to regularly grab a value from a web page in order to help make a price? The BeautifulSoup library in Python can help there.

One of the most important features of Excel is the ability to visualise data quickly (after all, no one likes looking at massive tables of numbers). Python can do all the visualisations you can do in Excel, and much more. With Python libraries like Plotly, you can create interactive charts and even animated charts, where you can easily zoom in and share with your colleagues.

Learning Python is a good skill to have beyond trading, because it’s very transferable skill and used in many fields. Python opens up the route to other careers in the future, such as data science either in finance or across other industries. It’s mind boggling to see how many corporate sectors now employ data science.

From reading this, you might think I don’t use Excel at all. I admit I still use Excel a lot, because it’s easy and intuitive to use for some things, even if it isn’t really built for the data science age. However, the best thing is that you don’t need to throw away Excel if you want to use Python. With a tool like xlwings, you can do your number crunching in Python, but handle all the charts and inputs with Excel, keeping your spreadsheets compact and making them easier to maintain. You can write Excel functions that call Python. You can even attach Python code to Excel buttons!

Saeed Amen is a systematic FX trader, running a proprietary trading book trading liquid G10 FX, since 2013. He developed systematic trading strategies at major investment banks including Lehman Brothers and Nomura, and runs Cuemacro, a consulting and research firm focused on systematic trading.

Have a confidential story, tip, or comment you’d like to share? Contact: sbutcher@efinancialcareers.com in the first instance. Whatsapp/Signal/Telegram also available.

Bear with us if you leave a comment at the bottom of this article: all our comments are moderated by human beings. Sometimes these humans might be asleep, or away from their desks, so it may take a while for your comment to appear. Eventually it will – unless it’s offensive or libelous (in which case it won’t.)

Related articles

Close