Explore the research behind our trading, plus some just-for-fun stuff....

Posted on May 28, 2020 by Kris Longmore
No Comments.

When data is too big to fit into memory, one approach is to break it into smaller pieces, operate on each piece, and then join the results back together. Here's how to do that to calculate rolling mean pairwise correlations of a large stock universe. Background We've been using the problem of calculating mean rolling correlations of ETF constituents as...

Posted on May 27, 2020 by Robot James
No Comments.

When you're working with large universes of stock data you'll come across a lot of challenges: Stocks pay dividends and other distributions that have to be accounted for. Stocks are subject to splits and other corporate actions which also have to be accounted for. New stocks are listed all the time - you won't have as much history for these...

Posted on May 26, 2020 by Robot James

One way we can quantify a stock's movement relative to the market index is by calculating its "beta" to the market. To calculate the beta of MSFT to SPY (for example) we: calculate daily MSFT returns and daily SPY returns align the returns with one another regress MSFT returns against SPY returns. This shows the procedure, graphically: library(tidyverse) library(ggpmisc) msftspyreturns...

Posted on May 25, 2020 by Ajet Luka

In today's article, we are going to take a look at rolling and expanding windows. By the end of the post,  you will be able to answer these questions: What is a rolling window? What is an expanding window? Why are they useful? What is a Rolling or Expanding window? Here is a normal window. We use normal windows because...

Posted on May 22, 2020 by Robot James
No Comments.

Here's a round-up of our new articles this week. They cover options trading, digital signal processing, data munging and Kris's luxurious moustache... Trading Insanity! Every new trader tries out a few insane trading ideas! In a new series on the blog, Kris explores three insane trading strategies that tempted him back when he didn't know any better. First, he looks at...

Posted on May 22, 2020 by Kris Longmore
No Comments.

Recently, we wrote about calculating mean rolling pairwise correlations between the constituent stocks of an ETF. The tidyverse tools dplyr and slider solve this somewhat painful data wrangling operation about as elegantly and intuitively as possible. Why did you want to do that? We're building a statistical arbitrage strategy that relies on indexation-driven trading in the constituents. We wrote about...

Posted on May 20, 2020 by Kris Longmore
1 Comment.

Working with modern APIs you will often have to wrangle with data in JSON format. This article presents some tools and recipes for working with JSON data with R in the tidyverse. We'll use purrr::map functions to extract and transform our JSON data. And we'll provide intuitive examples of the cross-overs and differences between purrr and dplyr. library(tidyverse) library(here) library(kableExtra)...

Posted on May 19, 2020 by Kris Longmore

In this post, we look at tools and functions from the field of digital signal processing. Can these tools be useful to us as quantitative traders? What's a Digital Signal? A digital signal is a representation of physical phenomena created by sampling that phenomena at discrete time intervals. If you think about the way we typically construct a price chart,...