More Intuitive Joins in dplyr 1.1.0 – how to do an asof join on trades and quotes data

dplyr 1.1.0 was a significant release that makes several common data operations more syntactically intuitive. The most significant changes relate to joins and grouping/aggregating operations. In this post we’ll look at the changes to joins. First, install and load the latest version of dplyr: install.packages(“dplyr”) library(dplyr) A new approach to joins The best way to …

Read more

Exploring the finnhub.io API

The changing face of market data providers Over the last few years, a number of new market data providers have come online. They tend to have modern websites, broad coverage, and well-documented RESTful APIs. Their services are often priced very competitively – especially for personal use – and usually have generous free tiers. One such …

Read more

How to get serious about making money trading

In Australia, if you’re serious about getting the job done effectively and efficiently, you might say: “I’m not here to f*** spiders.” Many traders act like they are, indeed, here to f*** spiders. If you’re making soup, you first need a good stock. Stock isn’t exciting. Everyone has stock. Garnish is exciting, but you can’t …

Read more

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