How I made an Open-Source AI Hedge Fund

Ryan Kemmer
12 min readAug 1, 2023
Image by the Author

In this post I explain how I created an artificial intelligence that makes automated trades for me daily.

With modern advancements in machine learning and easy access to data online, it’s never been easier to get involved in quantitative trading. To make things even better, cloud tools like AWS make it a breeze to turn trading ideas into real, functional trading bots. For the past couple of years I’ve been messing around with financial data and recently decided to take the plunge to make a fully automated strategy.

The Strategy

Since this was my first automated strategy, I decided to make it fairly simple. I would swing trade SPY (S&P 500 index) using informed decisions from an ML model. I decided to use SPY as my asset of choice since it has relatively low risk incase something went wrong with my strategy.

Goal: Swing trade SPY using informed buy/sell points determined by a machine learning model.

The Data

To make informed decisions of when to trade SPY, I trained an ML model that would predict trades based on daily historical data from various financial sectors and US treasuries. I pulled around 20 years of daily data from these assets using the open source YFinance API.

import yfinance as yf
import pandas as…

--

--