As the Digital Marketing Specialist at OpenBB, I recently had the pleasure of sitting down with Jason Strimpel, the founder of PyQuant News and a seasoned data professional working at AWS, to discuss his first book.
The “Python for Algorithmic Trading Cookbook: Recipes for designing, building, and deploying algorithmic trading strategies with Python” is now available on Amazon.
In this interview, Jason shares insights into the power of Python in algorithmic trading, the inspiration behind his book, and the practical steps traders can take to harness this technology. Whether you’re a seasoned trader or just beginning your journey with Python, Jason’s expertise offers invaluable guidance.
You can also watch the video interview:
1. Hi Jason, thank you so much for taking the time to be with us today, and congratulations on your new book! Can you tell us about your journey into algorithmic trading and how Python became an essential tool in your career?
Yeah. Gosh, it starts a long time ago. You know, one of my first couple jobs was trading and I was doing trading for a long time, I was always pretty passionate about technology and did a master's in quant finance and kind of saw how the combination of markets and finance and technology, how powerful that was. And this was early 2010s. So like 2010, 2012. And, you know, it's obviously well known that computers were doing a lot of trading, but it was still not as accessible to everybody as it is today. We didn't have all the libraries and all the open source. And I think we're on like Python version 2.2 or something like that.
And when I did my master's degree, I learned MATLAB. It’s what they taught us. And when I got out, you know, I had to pay $2,000 for a MATLAB license and I didn't want to pay $2,000 for a MATLAB license.
So, I forgot how I came across Python, but I came across Python and I learned about Pandas pretty quickly, and I have been kind of hooked ever since. And as far as the algorithmic trading stuff goes, it's just kind of an expression of trading in technology. It's like the purest form of both. And, nowadays, things are so accessible that it's kind of a shame not to use it if you know how to code and if you are interested in the markets. So I've just kind of done it out of habit. And as a side, you know, like in my own time for the past ten years. And came across OpenBB maybe about 18 months ago or so and started using it, and here we are today.
2. What inspired you to write this "Python for Algorithmic Trading Cookbook," and who did you envision as its primary audience?
Yeah, the book. I think you asked me about the book, sorry I didn't really answer that question, but the book was kind of a culmination of all I've learned over the past couple of years running PyQuantNews and teaching the course. And writing 100+ newsletters… You get pretty in tune with what your audience wants to hear and what they want to see, where their problems are, and where they're getting stuck. So I put all that into the book and, you know, I don't know what the inspiration was per se, other than just more content and getting what's in my head out into the world.
The book is designed for financial professionals who probably have some experience with the markets, maybe have seen Python before, but are really kind of new to using Python for algorithmic trading. And, you know, the cookbook format is like a bunch of discrete recipes that you can pick and choose from or use. I kind of did it as a journey. But you don't have to go from start to finish. You can kind of pick it up at whatever pace.
It's like a bunch of very practical pieces of code that I've used professionally and personally over the past 15 years that help you bootstrap your way into this space. So instead of trying to figure out how to use Pandas from scratch, out of context, just read the five recipes. I talk about how to use Pandas to manipulate market data. Or, you know, trying to figure out how to get stock price data or futures data. Just go. You read the book and you learn how to use OpenBB in five seconds. It's really for that. It's also kind of angled towards maybe developers who have coding experience but are new to finance. It's definitely more tilted towards people who have never seen Python before. But I put a lot of practical explanation in and really try to bring the finance out and explain why things are being done and add a lot of practical nature to make it kind of all around for finance and for programming.
3. How does your book address the balance between simplicity and complexity in algorithmic trading strategies, especially for readers with varying levels of experience?
It's always a balance. I can say, I guess, two things. First is it kind of takes you from beginner-level stuff through to more advanced stuff. So I think you can grow with the book. You can learn with the book, or if you get stuck, you just kind of stop at where you're at. You go pick it up later.
The other thing too, I think there's kind of a common misconception that you have to have tons of very complicated strategies and use very sophisticated statistics and things. While, yes, that's true, but you can get pretty far with some pretty basic stuff like, you know, principal component analysis and linear regression and multivariate regression. Well, if you've never heard of these things before, they might sound scary, but they're pretty well understood. Pretty well-known techniques in statistics. And you can get pretty far with that kind of stuff.
And I try to keep things as simple as possible, but no simpler, which I think strikes a really good balance between the two. I don't go overboard. I don't try to stroke my ego and make myself sound smart by adding a lot of complexity in. I just try to keep it very practical. But that said, at some level, this stuff is hard at times. And you do have to kind of have the discipline and the willingness to spend some time learning the material.
4. What would you say to a nonprofessional who would come to find this book and had no idea what Python for algorithmic trading was? What would you say would be the key advantages of Python for this?
Great question. It's a very flexible, very beginner-focused language as far as programming languages go. You don't have to compile any code like you do with Java or C or C++. You don't need the whole toolkit. You can get by without even typing. It's so-called dynamically typed, which means it figures out what variables are kind of in real-time. You get immediate feedback so you can go into what's called a REPL, which is basically like an interface where you can type code and it gives you the answer right away, so you can just get up and running very, very quickly and make a lot of progress very, very quickly. It's great that way. The syntax is very accessible for beginners.
As far as the actual code itself, it's very English-like. Makes a lot of sense. Massive community, tons of resources, tons of learning material, tons of books. All of which makes it pretty accessible as far as programming languages go.
Now, as far as algorithmic trading goes and using Python for it, the benefit of using Python over a commercial language is that you can use Python for anything. If you go down the journey of learning Python and algorithmic trading doesn't work out for you, you can use Python for bio, engineering, astrophysics, AI, English, writing, or any number of different things. Whereas if you learn a proprietary language like Pine Script, all you can do with Pine Script is write scripts for trading. So, you get a much broader set of experience and a much broader toolkit, and you can apply things from other domains into algorithmic trading, along with other tools.
5. At what point would you say algorithmic traders should use faster languages like Rust or Go, instead of Python?
Yeah, I mean, I think you mentioned it, speed. Python is notoriously pretty slow relative to other programming languages, so you can't do any real high-frequency strategies, which, of course, retail nonprofessionals aren't usually doing anyway. But then, if you start to get into massive datasets, the main tools like Pandas actually start to get kind of slow. There are new variants out there like Polars, which make that faster. But a tool like Rust, which is basically like C++, is very fast, so it's really about the speed.
Also, if you're brand new to programming, while I think Python is probably the most accessible, it kind of depends on where you want to take your career. Like if you want to be a high-frequency trading programmer, you're not going to start with Python. You're going to start with C or C++ because that's what you use, Java as well. There are programming paradigms like type safety and thread safety, and a lot of things that other languages do better than Python in a kind of industrial production, mission-critical environment that you could use depending on your use case.
You didn't ask about commercial software, but if you're using a backtesting engine, for example, you've got backtesting engines in Python, but you also have commercial off-the-shelf tools that make it easier. The language is specifically designed for backtesting, it does a lot of things with very little code. There are even graphical builders and all these kinds of things as well. So it's ultimately a trade-off.
6. In your opinion, what are the essential Python libraries every algorithmic trader should be proficient in, and why?
Good question. I call it the Python quant stack. There's a group of libraries that kind of form a pyramid. You've got the foundational stuff, and then depending on whether you're doing portfolio optimization or derivatives pricing, you kind of angle different ways.
But I would say the most important is Pandas. What Pandas gives you is data manipulation and data acquisition. So you get these big data frames, they kind of look like Excel, and you can deal with all of this data in a very easy way in Python. Lots of libraries, including the OpenBB Platform, will give you data in a Pandas data frame. They're basically ubiquitous now, so absolutely get yourself up to speed with basic Python syntax, but shortly thereafter, it's really Pandas.
I think the OpenBB Platform is also becoming very important in the space just for the acquisition of market data from various sources in a very consistent way. It's a super powerful tool that sits right on top of Pandas. You start to get into more niche tools like NumPy and SciPy for numerical computing. You can largely avoid these because Pandas is built on them, but if you start to get into more specific use cases, NumPy, SciPy, things like Scikit-learn for machine learning, supervised and unsupervised learning, stats models for statistical testing—they're kind of that middle level.
Once you get above data, then you have the statistical and supervised learning libraries in the middle. And then you have tools like backtesting tools like Zipline and VectorBT. For backtesting, you have Riskfolio for portfolio optimization. You have QuantLib for derivatives pricing. So at that kind of tip of the pyramid, it's really then focused and dependent on your use case. But those middle two layers are pretty important to understand: Pandas for sure, NumPy, SciPy, and OpenBB as well.
7. What’s your perspective on the ethical considerations surrounding algorithmic trading, particularly concerning data privacy and market fairness?
That's a good question. We're on the wrong side of the ethical considerations, right? We're the victims. I think the best example of what you're talking about is order flow. There's a very niche, nuanced thing: you go into Robinhood, submit an order, and get charged no commission. You might be asking how Robinhood makes money. Well, Robinhood sells your order to high-frequency traders like Citadel, and many brokers do this. Schwab does this. You've got a company like Citadel that is sitting on the line of legality because they make a business by paying Robinhood to buy their order flow, and they are then expected not to trade in front of retail traders, although they can use all that data to understand and acknowledge what's going on.
So, is that legal? Yeah, probably. Is it ethical? Probably not, because you're operating at the detriment of retail traders. You put your market order in for Nvidia at 102.50, and you're like, "Oh, I put a market order in and didn't get filled till 102.55. I lost $0.05." Retail traders trading ten shares don't care because it's $0.50, but Citadel is doing that over and over on hundreds of millions of trades a day. And they're making $0.05 100 million times. That adds up. So is that ethical? I don't know, but I think we're on the wrong end of that. We as nonprofessional retail people don't have enough clout to really impact the market in that way.
8. How has the landscape of algorithmic trading evolved since you started, and what trends do you foresee shaping its future?
Yeah. I mean, when I started actually hooking up computers to trading platforms, you had very few offerings, right? Interactive brokers is the one I've been using for like 14 years. But back then you had a C API and you had really poor quality wrappers around the C API that you had to figure out. It was a nightmare. You just spent all your time trying to get the code to work rather than dealing with algorithmic strategies, pulling data down. You had to actually scrub the data because you couldn't trust the free data that you were getting, or you had to go buy very expensive data. I'm just talking about price data, which is free and ubiquitous now. I'm not even talking about anything more interesting than that.
The tools that you were using, you didn't have nearly as many manipulation libraries, open source libraries. You didn't have Pandas back then, so you had to deal with NumPy in array form. You didn't have any of the functionality that you need. How do you place an order? You didn't have any backtesting frameworks. None of that really existed. So what you ended up having to do is just spend a lot of time writing code that now you just pip install and you're done, or getting high-quality data that you could rely on. Maybe not for trading against, but at least for research. You don't have to write data cleansing pipelines. You don't have to do any of that. You can just pull down from the network.
That's the other thing. The internet was slow back then, right? So you were trying to pull down a 50-megabyte data file that might take you minutes. Now it's instantaneous, right? Because you're pulling down megabits per second, hundreds of megabits per second. So everything just became faster and more focused on what matters, which is actually building the strategies. The tools have become more potent. The access has become easier, the APIs are better. So everything is just better, cheaper, less expensive. Everything's just better. Unless you've grown up with that, you kind of have this expectation that it's all just plug and play. But it wasn't always like that.
Now, there are these fully integrated cloud platforms for algorithmic trading of things like Quant Connect, QuantRocket. You have all these open-source libraries for people to do it on their desktops. There's just this proliferation of software to try to make building strategies easier. But what I find is that most of them are kind of focused on this technical analysis stuff. In my experience, you can't consistently make money in technical analysis in a systematic way. So I see this proliferation of software that makes it much easier to start trading technical strategies that don't really consistently make money over a long period of time. That's what I'm seeing today.
In the future, I don't know where LLMs and GenAI will come in. I know that OpenBB Terminal Pro has the Copilot, which is exceptional for explaining what you're seeing on the screen and kind of summarizing what's happening today. LLMs are language models, right? They're not numerical. They're not numerically advanced. Now, that might change in five years. But I think what's going to happen with the AI stuff is that it will better put performance and risk into context. So if you're in a raging bull market and you have a particular set of metrics, is that good? Is that bad? Should I do something about this? Or if you're in a bear market, do you have enough risk control on? I think trading is hard, finding the edge is hard. I don't know how that's going to evolve, but I think putting this type of thing into context with the AI models and LLMs will be a big one.
I don't see a stop in the proliferation of the software. I think the backtesting models will become better, more multi-asset, for example. I think data will continuously be getting cheaper, and again, everything will just continuously get better.
9. Do you have any plans or future projects regarding algorithmic trading and Python that readers should look forward to?
I mean, I'm definitely constrained by time. I've got a full-time job, I work at AWS, so everything I do is mornings, nights, and weekends, that kind of thing. I'm teaching the course, and I just continuously try to pack as much value into that course as I can. The book is a nod to the course. The book kind of touches on what the course is all about, but I'm just really focused on getting as much value as I can into the course. I'm writing, obviously, I do the social media thing, I got the newsletter that comes out. That's kind of where my focus is.
I'm thinking about more of an entry-level course to teach people Python in the context of algorithmic trading. The course I have now kind of touches on Python, but assumes you have some expertise and it just ramps really fast from there. A lot of people come in without knowing a lot of Python. I think an inexpensive, short, self-paced course to get people up to speed on Python is probably going to be the next project I work on. But again, it's a nights and weekends thing, so it just takes a long time.
Also, with the book, I have a feeling there'll be updates to the code and errata and additions and things like that. That's a huge lift. It's tons of writing, tons of time. So we'll see where that leads to.
This conversation with Jason was a dive into the future of algorithmic trading, emphasizing how accessible and powerful Python has become for traders at all levels.
If you’re looking to refine your skills or break into the world of algorithmic trading, Python for Algorithmic Trading Cookbook is a must-read. Don’t miss the chance to get your hands on a copy. You can get it on Amazon.