9 min read

Automating an Intraday Trading Strategy with the Interactive Brokers API

Automating an Intraday Trading Strategy with the Interactive Brokers API

I've been paper trading an automated intraday trading strategy on my Interactive Brokers account for a couple of weeks now. In this tutorial, I'm going to talk about this system, the dashboard I'm using to monitor it, and the server infrastructure behind it. This is the start of a series where I will discuss how to automate a trading strategy of your own and run it continuously on your own server. There's no claim that this will be profitable, but it will hopefully be both interesting and intellectually stimulating. And after we build this version of the strategy, I'll discuss into various ways you can modify the strategy to make it your own.

💡
Support My Content: If you want to check out Interactive Brokers, and want to support my content, I have a link to learn more here. I am using an Interactive Brokers Pro account to build the automated trading strategy discussed in this series.

This is a Live Trading Tutorial

Most tutorials about trading strategies primarily focus on backtests. I've done plenty of them myself. A while back I made a video on how to backtest a day trading strategy using a Python library called backtesting.py. The strategy was based on a paper that you can find on sites like Quantified Strategies and involved trading an opening range breakout on the symbol QQQ.

The problem with a strategy built around a single symbol like QQQ is that we already know how QQQ performed, so it's easy to pick a symbol that happened to do well. The other problem is that the backtest was most likely overoptimistic about the fills you'd get in a live market. In the real world you would miss many of these entries and exits by a few cents here and there. That might sound small, but small differences like that, added up across many trades and many days, make the results look very different.

Most tutorials end with a backtest in a notebook, where the past is already known. This series starts with deploying into the unknown, and all of the messy details involved in having code run a trading strategy in a live market. As of now, I don't know what the results will be. We're going to build the system piece by piece and deal with issues as they arise.

This post is for subscribers only