How to Get Started With Algorithmic Finance

Algorithmic finance has been around for decades as a money-making tool, and it's not magic. Learn about some practical strategies along with and introduction to code you can use to get started.



By Frederik Bussler, Founder of the Security Token Alliance.

Algorithmic finance, depending on whom you ask, is an under-tapped goldmine or an easy way to lose your money. The truth is, technology has been applied in finance for a long, long time.

In fact, computational finance has been around since the 1930s. Fast forward to 1998, and the US SEC (Securities and Exchange Commission) authorized electronic exchanges. In 2012, a company called Dataminr launched a service to turn social media streams, like hundreds of millions of tweets, into actionable trading signals.

Now, the seven leading US commercial banks are investing in AI. So, what methods are some of these players using?

Well, most of these companies like to keep their secret sauce behind closed doors. However, I’ve gleaned insights from research papers to GitHub repos to bring you a couple of methods for using AI and algorithms in finance. Let’s get started.

 

Dynamic Hedging

One investment fund that makes some of its strategies public is Invictus Capital’s CRYPTO10 Hedged fund, through their litepaper. In a one-line summary, the fund offers a “dynamic asset allocation strategy that dampens volatility and provides protection against losses.”

All algorithms are fueled by data, so where does their data come from?

According to the litepaper, the fund is an index of the “top 10 cryptoassets.” We can easily find publicly available data on cryptoassets from CoinMarketCap.

The paper delves into some mechanics on how their algorithms work, including weekly rebalancing and a dynamic asset allocation framework, which allocates between a “passive cryptoasset index base strategy and a cash position based on a variety of fixed parameters.”

While the paper is highly technical, their CEO Daniel Schwartzkopff offers a more digestible explanation:

“Transparency and the scientific method are core tenets of our philosophy at Invictus. We believe that all funds should be developed and justified with a data-backed approach. We do not rely on guesswork and intuition.”

The fund fundamentally rebalances 10 assets, which can be seen as 10 data sources, in a manner analogous to the FTSE Russell Capping Methodology, discussed in depth here, which looks like this:

Parameters of their base strategy include a rebalancing period and the number of constituent assets. So, we have insights into the data sources used, the algorithmic strategy, and the parameters. The paper even goes into the basics of the fitness function used:

In the above, ai represents a weight, and Xi represents a performance criterion. Maximizing the function yields a portfolio close to the “efficient frontier” - basically, the goal is to make the most money at the least risk.

Of course, lest an algorithmic finance strategy become a money blackhole, it needs to be backtested, as seen in this backtested performance graph:

Clearly, algorithmic finance can work, and dynamic hedging is just one of many strategies. So, let’s get on to number two.

 

Momentum Trading

For this strategy, we’ll look at an O’Reilly guide on algorithmic trading, which offers code on a basic momentum trading play. A time-series momentum strategy “assumes that a financial instrument that has performed well/badly will continue to do so.” The guide uses Oanda’s platform as well as data and the Python language.

The most relevant code pieces (for educational purposes) are on getting the data, formalizing the momentum strategy, and deriving its performance.

After importing needed dependencies, getting the data uses a simple function provided by Oanda, in this case:

Basically, you just have to decide what data source your project needs, and then it’s simply about looking at timeframes and granularity. Formalizing the momentum strategy comes down to taking the mean log return of a set of time “bars,” like 15, 30, 60, and 120 minutes, and if this value is positive, you assume it’ll stay positive, while if the value is negative, you assume it’ll stay negative.

Here’s the code:

Finally, the last part is to derive the absolute performance. This is done by multiplying the positions we just derived by the market returns. Here’s the last bit of code:

As you can see, you can get started in algorithmic finance without a lot of code or heavy machinery needed. A word of caution, though: “Getting started” is a far cry from making money consistently, so let this article be educational rather than financial advice.

Bio: Frederik Bussler is the Founder of the Security Token Alliance, the industry's largest think tank with over 100 partners. As a public speaker, he has presented for audiences including IBM, Nikkei, Slush Tokyo, and the Chinese government, and is featured in outlets including Forbes, Yahoo, Thrive Global, Hacker Noon, European Commission sites, and more.

Related: