Exploring the rsims package for fast backtesting in R

rsims is a new package for fast, realistic (quasi event-driven) backtesting of trading strategies in R. Really?? Does the world really need another backtesting platform…?? It’s hard to argue with that sentiment. Zipline, QuantConnect, Quantstrat, Backtrader, Zorro… there are certainly plenty of good options out there. But allow me to offer a justification for why …

Read more

How to Lose Money Trading (and how not to)

It’s easy to lose money trading if you do certain things: Trade too much (paying fees and market impact on each transaction) Size positions too big (high volatility hurts compounding ability, and in the extreme can cause you to blow up) Short positive drift/risk premia Perhaps surprisingly, it’s actually quite hard to lose money consistently …

Read more

Three types of systematic strategy that “work”

Broadly, there are three types of systematic trading strategy that can “work.” In order of increasing turnover they are: Risk premia harvesting Economically-sensible, statistically-quantifiable slow-converging inefficiencies Trading fast-converging supply/demand imbalances This post provides an overview of each. 1. Risk Premia Harvesting Risk Premia Harvesting is typically the domain of wealth management, but it’s important to …

Read more

Exporting Zorro Data to CSV

Earlier versions of Zorro used to ship with a script for converting market data in Zorro binary format to CSV. That script seems to have disappeared with the recent versions of Zorro, so I thought I’d post it here. When you run this script by selecting it and pressing [Test] on the Zorro interface, you …

Read more

Evolving Thoughts on Data Mining

Several years ago, I wrote about some experimentation I’d done with data mining for predictive features from financial data. The article has had several tens of thousands of views and nearly 100 comments. I think the popularity of the article lay in its demonstration of various tools and modeling frameworks for doing data mining in R …

Read more

Trading FX using Autoregressive Models

I’m a big fan of Ernie Chan’s quant trading books: Quantitative Trading, Algorithmic Trading, and Machine Trading. There are some great insights in there, but the thing I like most is the simple but thorough treatment of various edges and the quant tools you might use to research and trade them. Ernie explicitly states that …

Read more

How to Connect Google Colab to a Local Jupyter Runtime

Colaboratory, or Colab, is a hosted Jupyter notebook service requiring zero setup and providing free access to compute resources. It is a convenient and powerful way to share research, and we use it extensively in The Lab. What’s The Lab? The Lab is the RW Pro group’s portal for doing collaborative research together as a …

Read more

What Assumptions Are You Making About “Time” In Your Trading?

I recently listened to a podcast about one of the earliest human civilizations – the ancient Sumerians. Apparently, our system of minutes, hours, and days has been with us since the time of these ancient people, who developed it based on a simple base-12 counting system: There are three joints in each of the four …

Read more

My Thoughts on Quantopian’s Closing

I was very sad to learn that Quantopian is shutting down its community services. Quantopian’s efforts to bring quant finance outside of institutions was a genuine game-changer. The educational content was solid, the tech was excellent, and the QuantCon conferences were professional, well-run, and inclusive in a way that you never see at the “finance …

Read more

Working with Tidy Financial Data in tidyr

Holding data in a tidy format works wonders for one’s productivity. Here we will explore the tidyr package, which is all about creating tidy data. In particular, let’s develop an understanding of the tidyr::pivot_longer and tidyr::pivot_wider functions for switching between different formats of tidy data. In this video, you’ll learn: What tidy data looks like …

Read more