The Algo Engineer

Blog Posts


Downloading S&P 500 tickers and data using Python

Finding and dowloading a list of current S&P 500 companies and their respective price data can be tedious at best. Luckily for you, today I’m going to share with you a Python script that I use to construct a database of daily bar data for the current S&P 500 companies. [read more]

Online Linear Regression using a Kalman Filter

Linear regression is useful for many financial applications such as finding the hedge ratio between two assests in a pair trade. In a perfect world, the realtionship between assests would remain constant along with the slope and intercet of a linear regression. Unfortutanely this is usually the exception rather than the rule. In this post, I’m going to show you how to use a Kalman filter for online linear regression that calculates the time-varying slope and intercept. [read more]

Headless execution of IB Gateway on Ubuntu Server

I have a headless machine running Ubuntu Server that is up 24/7 and would like to use it to run our algo trading system. If you’re reading this, then you’re probably aware that running the IB Gateway is not possible in Linux without an X server to handle the GUI. A possible workaround is to use X forwarding over SSH but if your network connection is interrupted it will kill IB Gateway and have to be restarted manually. So, what we need is a way to run IB Gateway without the GUI, the ability to start/stop it as a service and a method to monitor it’s status. [read more]