+ All Categories
Home > Documents > Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting...

Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting...

Date post: 12-Aug-2020
Category:
Upload: others
View: 2 times
Download: 1 times
Share this document with a friend
83
Evolutionary algorithms for the discovery of trading rules in high-frequency betting markets A thesis submitted in partial fulfilment of the requirements for the degree Master of Social and Economic Data Analysis at the Department of Economics of the University of Konstanz. by Imant Daunhawer 1st assessor: Prof. Dr. Sven Kosub 2nd assessor: Prof. Dr. Christian Borgelt Konstanz, March 1, 2018
Transcript
Page 1: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Evolutionary algorithms for the discovery oftrading rules in high-frequency betting markets

A thesis submitted in partial fulfilment of the requirements forthe degree Master of Social and Economic Data Analysis atthe Department of Economics of the University of Konstanz.

by

Imant Daunhawer

1st assessor: Prof. Dr. Sven Kosub2nd assessor: Prof. Dr. Christian Borgelt

Konstanz, March 1, 2018

Page 2: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes
Page 3: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Acknowledgements

I would like to thank a handful of people whose advice and support was invaluablefor the completion of this thesis. First, I greatly appreciate the guidance of mysupervisors Prof. Dr. Kosub and Prof. Dr. Borgelt, who are a source of inspirationas researchers, teachers, and mentors alike. Further, I am grateful to Oliver Sampson,for our vivid discussions, as well as his technical advice and proficient corrections. Fortheir constant support, I am obliged to my parents as well as to Luisa Fleischhauer.Finally, I am thankful for the funding of the data through the Economics departmentof the University of Konstanz, as well as for the access to the High-PerformanceComputing Cluster BwForCluster BinAC of the state Baden-Württemberg.

i

Page 4: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes
Page 5: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Abstract

This work investigates how evolutionary algorithms (EA) can improve the searchfor information ine�ciencies in financial markets. It explains why EAs can be anadequate optimization method for the discovery of trading strategies, but also that itrequires a problem-specific design to exploit their full potential. We put forth a designbased on theoretical considerations and apply it to investigate the e�ciency of thein-play football betting market—a case study that aims to generalize to other typesof financial markets. We are able to demonstrate the functionality of the optimizationin a realistic setting and provide support for individual design choices. Although ouranalysis does not reject the information e�ciency of the market under investigation,the system appears to be e�ective in restricting the search space based on domainknowledge and subjective beliefs, and it copes with the problem of overfitting in thecourse of the optimization.

iii

Page 6: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes
Page 7: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Contents1 Introduction 1

1.1 Aim and Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Significance of the study . . . . . . . . . . . . . . . . . . . . . . . . . 31.3 Structure of the thesis . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Background 52.1 Definitions and Concepts . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 Evolutionary algorithms for rule discovery . . . . . . . . . . . . . . . 132.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3 Methods 193.1 Genetic Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.2 Problem-Specific Design . . . . . . . . . . . . . . . . . . . . . . . . . 213.3 Testing Market E�ciency . . . . . . . . . . . . . . . . . . . . . . . . 343.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

4 Data 414.1 Preprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434.2 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

5 Empirical Analysis 495.1 Verifying the Favorite-Longshot Bias . . . . . . . . . . . . . . . . . . 495.2 Rule Discovery with Financial Indicators . . . . . . . . . . . . . . . . 575.3 Summary and Discussion . . . . . . . . . . . . . . . . . . . . . . . . . 60

6 Conclusion 63

A Appendix 65A.1 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65A.2 Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

Bibliography 71

v

Page 8: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes
Page 9: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

1. Introduction

Financial markets revolve around the idea of information e�ciency (Fama, 1970;Roberts, 1959), a concept that raises the intriguing question whether markets exhibitopportunities that can be systematically exploited, or if they adapt to new informationfully and swiftly. Obviously, a large share of the financial industry is built around theassumption that ine�ciencies exist, for example hedge funds that strive for higherrates of return, or active investors who go to great lengths in trying to find and exploitedges in financial markets. Yet, in academic circles there is an ongoing debate aroundthis issue, because evidence against market e�ciency is often isolated and di�cultto reproduce as a consequence of the evolving nature of financial markets (Lim andBrooks, 2011; Lo, 2005).

With the advance of technology and methods of data analysis there have evolvedelaborate ideas and techniques in the pursuit of market ine�ciencies. These methodshave in common the attempt to make better use of information, either by tappinginto new sources of data or by the application of novel methods of analysis andevaluation. In return, the rapid growth of information and the advance of toolsand techniques for its analysis expands the number of approaches, variables, andinteractions that can be explored. This gives rise to a vast space of options, so thatthe task of finding ine�ciencies—if they even exist—becomes reminiscent of thesearch for a needle in a haystack. Consequently, it raises the question whether theresulting search space can be explored more intelligently.

A complex search space lends itself to the application of mathematical optimiza-tion procedures with the ability to search more e�ciently than an exhaustive search,and more e�ectively than a random search does. While many optimization techniquesinvolve strong assumptions about a problem or entail impracticable computationalcosts, metaheuristic algorithms may be particularly suited for applications in thefinancial domain, because they require fewer assumptions and were shown to bee�ective when a su�ciently good solution is required instead of a global optimum(Mitchell, 1998). In particular, evolutionary algorithms—a class of metaheuristicsthat is inspired by principles of biological evolution—constitute a natural choice for

1

Page 10: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

optimization problems in financial markets as previous studies have demonstrated(see review by Hu et al., 2015). Not only do they allow for an optimization overcontinuous, discrete, or mixed spaces, but they are also comparatively robust in thepresence of noise (Goldberg, 1989), a property that is inherently severe in financialmarkets (Black, 1986). Moreover, evolutionary algorithms o�er a flexible designthat allows domain knowledge and individual risk preferences to be incorporated.However, since it is such a general technique, there is no canonical way of translatinga problem into a form that an evolutionary algorithm can handle. But is it possibleto design an evolutionary algorithm in such a way that it becomes e�ective for thegeneral task of finding information ine�ciencies in financial markets? This leads usto the conceptual problem that lies at the heart of this thesis:

How can evolutionary algorithms improve the searchfor information ine�ciencies in financial markets?

Without a problem-specific design, one may not be able to take full advantage ofthe power of evolutionary algorithms, which may not only raise the probability offinding information ine�ciencies, but also help in the interpretation of the tradingstrategy and its individual components.

1.1 Aim and Scope

The aim of this study is to provide insight on how evolutionary algorithms can bedesigned to support the search for information ine�ciencies in financial markets.For this purpose, we conduct a field study which investigates the in-play footballbetting market with high-frequency data from a leading betting exchange. Bettingexchanges have the advantage that they exhibit favorable properties facilitating thestudy of market e�ciency; they o�er a defined termination point for an investment,while being similar to financial markets in that they follow the model of supply anddemand. Further, we limit the scope of our analysis to technical trading strategiesbased on price and volume information, because these are inherent to our data andhave been studied most thoroughly in the context of evolutionary algorithms for rulediscovery (Hu et al., 2015).

More concretely, based on theoretical considerations, we design an evolutionaryalgorithm for the discovery of trading strategies represented by combinations oftechnical rules, and use it to approach the research question in two steps: first, weverify the functionality in a simplified as well as in a realistic setting, and secondly, inthe empirical analysis we investigate the design choices that went into the evolutionary

2

Page 11: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

algorithm. Thereby, we intend to shed light on the use of evolutionary algorithmsfor the task of finding information ine�ciencies in financial markets and develop anoptimization framework that generalizes beyond this particular example.

1.2 Significance of the studyThe contribution of this study is twofold: on a theoretical level, we aim to contributeto the understanding of what factors are e�ective for the design of evolutionaryalgorithms with respect to the task of finding information ine�ciencies in financialmarkets. In this regard, we discuss theoretical considerations for the choices of anencoding, genetic operators, objective functions, and adequate validation strategies.Furthermore, in the course of the empirical analysis, we provide empirical support fora validation strategy that limits the risk of overfitting and increases the stability of theoptimization. On a practical level, we investigate the information e�ciency of a majorbetting exchange and draw a comparison to betting markets of traditional bookmakers,which previous studies have focused on. Moreover, we transfer ideas commonly foundin the technical analysis of financial markets to betting exchanges where thesetechniques have not received su�cient attention, despite the markets’ similarities.Finally, we provide an extensible framework for the evolutionary optimization oftrading strategies in financial markets, a tool that may be useful for further researchin the realm of market e�ciency.

1.3 Structure of the thesisThe thesis is structured into five additional chapters. Chapter 2 provides a review ofthe background and related literature, especially of the application of evolutionaryalgorithms in the financial domain and of their significance for the concept ofmarket e�ciency. Chapter 3 explains the applied methods and the reasoning behindthem, before it introduces the problem-specific encoding that is used in our analysis;therefore, it merges theoretical considerations with practical experience from previousresearch. In Chapter 4, we describe and explore the data, its preprocessing, andour simulation procedure for historical data. Chapter 5 then proceeds with theempirical analysis that verifies the functionality of the system and ultimately teststhe framework’s ability to search for information ine�ciencies in the in-play footballbetting market. Finally, Chapter 6 concludes with a summary of the main findings.

3

Page 12: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes
Page 13: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

2. Background

In this chapter we provide both a theoretical foundation and an overview on therelated literature, before delving into the methods, which Chapter 3 is dedicated to.

This chapter is divided into two parts. The first section provides backgroundinformation to familiarize the reader with the definitions and concepts from financialliterature that we draw upon, especially with the topic of market e�ciency and itsrole in the context of betting markets. The second section then reviews the literaturethat is concerned with the application of evolutionary algorithms for the discoveryof market ine�ciencies; it positions this study in the body of existing literature anddescribes its contribution.

2.1 Definitions and Concepts

This section provides the reader with the definitions and concepts from the fieldof finance that will be used throughout the thesis and are necessary to understandhow betting markets work, what distinguishes them from financial markets, andthe special role that betting exchanges came to play. Subsequently, it reviews theconcept of information e�ciency and its relevance in the context of betting markets.

2.1.1 Fundamentals of Betting Markets

While in financial markets the price of securities is usually governed by the processof supply and demand, betting markets originally had a di�erent pricing mechanism,influenced by bookmakers. Even though betting exchanges (or more generally,prediction markets) have adopted the model of supply and demand, we first startwith the concept of traditional bookmakers, because they have shaped many of theideas and terms that are associated with betting markets and their e�ciency.

Bookmakers determine the value of an event—such as the outcome of a footballmatch, or the winner of a horse race—from the probability they ascribe to it; adecision that is usually based on historical information (empirical data) as well as

5

Page 14: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

recent information such as news about injuries. From his subjective probability P (E)of an event E, a bookmaker b calculates the odds1 as

Êb(E) = 1P (E) ≠ ‘E (2.1)

where ‘E represents the overround that a bookmaker subtracts to adjust the odds inhis favor. The overround is usually positive, however, the exact pricing may dependon additional factors such as demand, competition, and the level of uncertainty. Sinceodds in prediction markets take the important place of prices in financial markets,we dedicate a thorough example to their use.

Odds, Probabilities, and Volumes

Let A, B and C be three mutually exclusive events,2 for which a bookmaker o�ersthe odds

Êb(A) = 1.5, Êb(B) = 10, Êb(C) = 3 .

In practical terms the odds express the amount of money a bettor would receive ifhe bet one monetary unit on an event that later happens. For example, if a personplaced 10 units (i.e., his investment or stake) on event A and happened to be rightin his prediction, he would receive 15 units in return, a profit of 15 - 10 = 5 units.

By rewriting Equation 2.1 in terms of the probability and ignoring the overround,we get the inverse of odds, a term that is often called the implied probability (Hauschet al., 2008) of an event

Pimpl(E) = 1Êb(E) .

Summing up the implied probabilities of all three events, we notice that the sum is1.1, which is not a valid probability, because it is larger than one. This indicatesthat the bookmaker in this example added an overround of ten percent across allevents. Even though the precise overround per event is usually not known, it becomesclear that a bookmaker is likely to profit from such a scheme in the long run, if hisforecasts are close to the true underlying probabilities.3

From the perspective of a bettor—an individual who wagers against a bookmaker—1 By “odds” we consistently refer to decimal odds. Even though there exist other forms, such as

fractional odds, we stick to a single definition, for the sake of simplicity.2 A real world example could be a football match where either one of the two teams wins, or

there is a draw.3 Even if we were to normalize the implied probabilities to one, it is possible that the overrounds

are not distributed proportionally. For example, the bookmaker might choose to o�er morefavorable odds on a specific outcome: a common technique used by many bookmakers as we shallsee Subsection 2.1.2.

6

Page 15: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

there is another important feature that we left out in the example, namely the taxesthat he has to pay on profits. Considering a tax rate of ⁄ œ [0, 1], we can computethe net profit of a bet on an event as

fiE =

Y_]

_[

(1 ≠ ⁄) (Êb(E) ≠ 1) sE, if E happens

≠sE, otherwise(2.2)

where sE is the size of the stake. Usually, tax rates range between 0–20 percent,depending on legislation (PwC, 2015).

Apart from traditional bookmakers, betting exchanges o�er the possibility towager on a wide variety of uncertain outcomes of events, including, but not limitedto, sports betting. Therefore, one may also find the more general term of predictionmarkets. The main di�erence to bookmakers is that the pricing mechanism ofprediction markets is governed by the model of supply and demand, as it is withmost financial markets. Market participants are given the possibility to order abet on or against any outcome of an event, and are free to choose the stake aswell as the odds (i.e., the probability they assign to an outcome). A bet, however,becomes active only if the order is matched with corresponding orders on the contraryoutcome. Therefore, market participants in a betting exchange can e�ectively takethe role of bookmakers, betting against each other. The resulting market movesaround the most recently matched odds and reflects the aggregate opinion of themarket participants about the probabilities of each outcome.

Rather than by means of an overround, betting exchanges generate their revenuethrough a commission that bettors pay on winnings. Commissions usually varybetween two and five percent (Croxson and Reade, 2014), and the net profit forthe bettor is computed similar to the profit for bets with traditional bookmakers(Equation 2.2) by substituting the tax rate with the commission rate.

Based on the previous example, we now illustrate how a betting exchange worksfrom the perspective of a bettor. Table 2.1 shows the order book with respect to eventA, for which the hypothetical bookmaker from the previous example o�ered oddsÊb(A) = 1.5. The order book displays how much money is currently available to betin favor or against A. Note that betting in favor of an elementary event such as thevictory of a team is often called backing, while betting against it would be describedas laying the event. What we can see from the order book is that, for example, it ispossible to back A instantly at odds of 1.45 (central column) with 100 units or less(left column), because there is enough volume available on the “back” side of the

7

Page 16: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

back odds lay- 1.65 150- 1.60 200- 1.55 100- 1.50 100

100 1.45 -400 1.40 -300 1.35 -

Table 2.1: Hypothetical order book representing the unmatched volumeat di�erent odds steps. The last traded (backing) odds are representedin bold. If there were volume on both sides of a row, the correspondingorders would be matched.

order book.4 If a stake of more than 100 units is requested, the bettor would eitherhave to accept lower odds, or his order would need to wait until the desired stake canbe matched. Analogously, one could instantly bet 400 units against A for backingodds of 1.6. Thus, if there is volume on both sides of a price, the corresponding betsare matched, leading to the observed spread which is similar to the spread betweenbuy and sell prices in a financial market. Generally, it is beneficial for an individualto back as high and to lay as low as possible, in terms of odds.

Note that, for the computation of layer’s odds, the backing odds that are shownin the central column need to be transformed. The odds for laying an event E canbe computed from the inverse of the complimentary probability as

Êlay(E) =A

1 ≠ 1Êback(E)

B≠1

(2.3)

where Êback(E) denotes the backer’s odds in favor of event E. In the following wewill refer to backer’s odds merely as odds and leave out the respective subscript, butwe will explicitly denote the usage of layer’s odds.

There are also important di�erences between betting exchanges and financialmarkets. One major di�erence is that betting exchanges often enforce additionalrestrictions and rules. For example, betting exchanges introduce an artificial delayon trades during in-play periods to ensure that market participants with fast accessto information (e.g., spectators of a match) do not have an unfair advantage. Also,betting exchanges interfere with the market by canceling all unmatched orders inresponse to substantial events such as goals, injuries, or player dismissals, in order

4 Put di�erently, other market participants have, in aggregate, bet 100 units against A happening.

8

Page 17: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

to protect casual bettors from large price shifts.5 Another less significant di�erenceto financial markets is that odds usually move in predetermined intervals. In theprevious example of an order book we saw the odds change in steps of 0.05 units,but the exact size may depend on the type of market as well as on the size of thecurrent odds.6 Finally, one should also point out that there is a di�erence betweenprediction and financial markets with regard to their incentives. Prediction marketscan be considered a zero-sum game, because one side of the bet always makes a loss,while one might argue financial markets to be a potential win-win, because investorsprovide capital in exchange for potential profits and/or voting rights; thereforeparticipants of a financial market might exhibit di�erent behaviors and risk attitudes(Tetlock, 2004). Being aware of the similarities and di�erences between bookmakers,betting exchanges, and financial markets, we now turn to the concept of informatione�ciency.

2.1.2 Information E�ciency

Starting from the definition of market e�ciency, this section sketches out the con-troversy around this topic. Specifically, it reviews the current literature about theinformation e�ciency of betting markets and betting exchanges.

The e�cient markets hypothesis (Fama, 1970; Roberts, 1959) states that afinancial market reflects all available information and adapts to new informationfully and swiftly. From this definition emerges the concept of information e�ciencyof financial markets and we will use these two terms interchangeably. A confirmationof the hypothesis would imply that the price of a security is a valid representation ofits value and that market participants should therefore not be able to gain abnormalreturns in the long run other than by mere chance. Moreover, in an e�cient marketall trading strategies should, in expectation and after transaction costs, yield thesame return on investment.

Even though the definition is usually associated with Fama’s pioneering ideas,the first observations of seemingly random price movements and attempts at mod-eling them originated much earlier, around the beginning of the twentieth century(Bachelier, 1900).7 What Fama did, however, is to group the concept of informatione�ciency into three classes:8 a weak, a semi-strong, and a strong form. Each of those

5 These factors, among others, need to be considered when designing a realistic model, but wereserve their discussion until Chapter 5.

6 For instance, odds in the interval [1.01, 2] may move in increments of 0.01, while odds in theinterval [100, 1000] may exhibit a step size of 100.

7 A review of the (early) developments can be found in Williams (2005).8 The origins of this grouping can be traced to ideas from Roberts (1959), though, Fama has

stated the distinction more explicitly and has popularized the idea.

9

Page 18: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

classes makes di�erent assumptions about the type of information that is considered.Weak form market e�ciency states that abnormal returns cannot be achieved basedon the analysis of historical information alone. This would imply that technicalanalysis, which relies on historical data such as prices, volumes, or volatility measures,cannot be used to predict future market movements. The semi-strong form of markete�ciency adds the assumption that abnormal returns are not achievable even if oneconsiders all publicly available information. Therefore, even fundamental9 analysisas well as trading strategies that respond to news or other anomalies, would notsu�ce to predict future price movements. Lastly, the strong form of market e�ciencyargues that systematic excess returns are not feasible even if one were to considerall available information, including privately available and monopolistic information.The hierarchical levels of strictness indicate that the assumptions for the weak formare a subset of those for the semi-strong form, which in turn are a subset of thestrong form. In other words, if the strong form of market e�ciency holds true, thendo also its semi-strong and weak form; whereas, if there exists evidence against theweak form of market e�ciency, then we also cannot accept its two stricter forms.

Not surprisingly, the e�cient market hypothesis has been contested fiercely. Amidheaps of conflicting evidence (Malkiel, 2003) and a potential publication bias workingboth in favor of studies with positive results as well as against potential breakthroughsthat have not been published due to financial incentives, there seem to be only ahandful of facts that academics in this field can agree on. In a nutshell, there isevidence for the existence of information ine�ciencies in the past (Malkiel, 2003)and reason to believe that markets have become increasingly e�cient in recent years(Park and Irwin, 2007). Further, behavioral finance suggests that market e�ciencycan be reconciled with the existence of individuals’ behavioral biases through theframework of the adaptive markets hypothesis (Lo, 2004; Lo, 2005)—a theoreticmodel that tries to explain the varying degree of market e�ciency in terms of adaptiveagents in an evolutionary setting. On the other hand, proponents of the e�cientmarkets hypothesis point at the failure of hedge funds to outperform the marketsystematically (Malkiel, 2005; Fama and French, 2010). Thus, the e�cient marketshypothesis, although simple to express, remains a controversial proposition that stirsan ongoing academic debate and has significant practical implications.

9 Fundamental analysis (Graham and Dodd, 1934) is usually based on information that reflectsthe intrinsic value of a security, for example through the assessment of financial statements, economicindicators, or industrial activity.

10

Page 19: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Information E�ciency in Betting Markets

The question on information e�ciency is central to many studies of betting markets,because it is, to some extent, easier to assess their level of e�ciency compared toconventional financial markets. Most importantly, bets have a defined terminationpoint at which their value becomes certain, which facilitates the application ofempirical techniques (Williams, 2005); whereas, the value of an asset in financialmarkets is subject to large price fluctuations and uncertainty around an appropriateselling point. Furthermore, the lifetime of most financial securities is significantlylonger than the opportunity to bet on a sports event, while at the same time theinformation for the latter is arguably more accessible. For example, the market forthe majority of sports events usually opens a few days or weeks in advance to theevent—a time during which the odds typically register only minor movements—anda short yet very volatile in-play period. Most of the time, relevant information isreadily available, such as large datasets of historical information (including odds andperformances), while relevant events are usually covered in public announcements.Furthermore, betting markets are similar to financial markets in terms of incentivesand liquidity. Betting markets attract a large number of investors and bettingexchanges even trump the trade frequency of leading stock exchanges.10 Thus,betting markets provide a potent environment for the study of information e�ciency.

First studies on weak-form market e�ciency have focused on the di�erences inprofitability that exist between various odds groupings. Williams (1999) traces thesestudies back to a series of laboratory experiments (Preston and Baratta, 1948; Yaari,1965; Rosett, 1971) that demonstrate the tendency of participants to overestimatethe occurrence of events that have a small probability (bets with large odds) and viceversa. This observation was independently confirmed in a practical setting (i.e., withempirical data from a racetrack) by Gri�th (1949) and was later coined the favorite-longshot bias, as it was shown to exist in many di�erent betting markets acrosscountries and forms of sport.11 The existence of the favorite-longshot bias contradictsweak-form market e�ciency with respect to the definition that any investment

10 In particular, the largest betting exchange Betfair™, who is also the source of our data,dominates the market with a weekly turnover of $50 million, accounting for more than 90 percentof the worldwide betting activity on exchanges (numbers as of 2005, according to Croxson andReade, 2014).

11 However, a reverse e�ect has been observed in a few markets, for example in baseball betting(Woodland and Woodland, 2003). There is a selection of conflicting theories for the existence ofthe favorite-longshot bias, but most of them can be grouped into two categories: demand-sideexplanations such as bettors’ di�ering utility curves, risk-loving behavior, and misperception ofprobabilities, or supply-side explanations such as profit maximization due to an unbalanced demand,and bookmakers guarding against adverse selection at large odds. A thorough review of thefavorite-longshot bias and its possible explanation can be found in Williams (2005).

11

Page 20: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

strategy should provide the same average return in the long run, however, it is notstrong enough for abnormal profits to be achieved. Still, the presence of potentialbiases in the odds pricing indicates that betting markets might exhibit furtherine�ciencies. Considering semi-strong form market e�ciency, there are individualstudies reporting the possibility for systematic excess returns (Dixon and Coles, 1997;Goddard and Asimakopoulos, 2004; Vlastakis et al., 2009; Constantinou et al., 2012),but the scarcity of these results points to them either not being reproducible, or tothe e�ects fading out in response to their publication.

Betting exchanges, compared to traditional bookmakers, are a relatively recentinvention which already seized a significant share of the online betting market.12

These markets o�er great potential for the study of market e�ciency, becausethey sit at the intersection between financial markets and traditional bookmakers.Especially, they o�er not only a direct interaction between investors, but also adefined termination point for each bet. Therefore, with su�cient liquidity one wouldexpect the odds of betting exchanges to be an even better estimate for the trueunderlying probabilities of events than the implied probabilities in bookmakers’ odds.Recent evidence supports this idea, showing that odds in betting exchanges providemore accurate forecasts (Franck et al., 2010) and exhibit a significantly weakerfavorite-longshot bias (Tetlock, 2004; Smith, Paton, et al., 2006; Smith and Williams,2008)—results that hint at a higher level of information e�ciency in exchanges.Nevertheless, there may be other biases, as shown for example by Choi and Hui(2014) who detect a significant overreaction of investors in response to goals scoredby underdogs and an underreaction to goals scored by favorites—an e�ect that theyfind to be both statistically significant as well as profitable in practice.

However, currently there appears to be a lack of research in the scope of bettingmarkets, especially with respect to automated approaches for the discovery of marketine�ciencies; for example, technical analysis, which is concerned with modelingmarket movements based on historical price and volume information, would allowresearchers to draw on extensive work from the field of finance, and it could openthe possibility to discover biases in a more systematic way. Hence, this work may beseen as an early endeavor to close the existing gap towards the automated search formarket ine�ciencies in betting markets.

Summarizing, the e�cient markets hypothesis has received considerable attentionboth in conventional financial markets as well as in betting markets, but it is stillheavily debated by researchers in this field. In our work, we choose to focus on

12 For the fiscal year 2016, the business merger Paddy Power Betfair plc reports a 22% marketshare of the combined UK and Ireland online betting market (Paddy Power Betfair plc, 2017).

12

Page 21: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

betting exchanges, because they provide favorable properties, especially a definedtermination point of each investment and a pricing model that is based on supplyand demand, circumventing traditional bookmakers who can manipulate prices totheir advantage. Due to their similarity to financial markets, betting exchanges o�era fertile ground for the application of technical trading strategies which have beenstudied extensively in financial markets, but received little attention of research inbetting markets. The next section extends the idea of the discovery of trading rulesthrough the framework of evolutionary algorithms, and provides the reader with areview of the related literature around this topic.

2.2 Evolutionary algorithms for rule discovery

This section reviews the related literature that we draw on to tackle the question ofhow evolutionary algorithms can improve the search for information ine�cienciesin betting markets. In particular, it navigates the reader through existing work oncomputational methods for the discovery of trading rules in financial and bettingmarkets. But prior to that, it fleshes out the motivation for choosing evolutionaryalgorithms for this task on a high level, providing a starting point from whereChapter 3 takes up the explanation of the method as well as its technical advantagesand drawbacks in more depth. Finally, this section aims to describe the position ofour study in relation to the existing literature and how it contributes to the currentstate of knowledge.

Asking the question why automated rule discovery is an interesting problem,one could think of an individual trader trying to manually find a profitable tradingstrategy. His ideas can possibly be grouped into two categories. First, he mightchoose to perform a technical analysis if he presumes patterns (e.g., seasonalitiesor trends) in past prices directly, or indirectly through related information suchas trading volumes or volatility measures. Here, finance literature already o�ers amyriad of technical indicators each of which has parameters that the trader needsto decide on. Alternatively, he might conjecture that prices change in response toexternal information such as the publication of news, financial reports, or otheranomalies. Again, the investor faces additional decisions, for example his timingto buy or sell. In any of those cases, trading strategies require the values of manydi�erent parameters to be selected, in particular when multiple trading rules arecombined. Thus, one could argue that the trader faces a complex optimizationproblem of finding not only a promising combination of rules, but also a good set ofparameters. In this regard, automated rule discovery has the potential to support a

13

Page 22: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

complex decision making process.For the discovery of trading rules in financial markets there is a wide choice of

computational methods available, so why are we particularly interested in evolutionaryalgorithms? The main advantages of evolutionary algorithms are their ability to findinterpretable solutions to complex optimization problems in a reasonable time, aswell as their flexible design that can be geared towards a specific task. Evolutionaryalgorithms employ a guided random search which allows them to be more e�cientthan exhaustive procedures and more e�ective than random search. In comparison tostate-of-the-art predictive models, such as recurrent neural networks, the advantageof evolutionary algorithms lies in their interpretability. Especially neural networksare considered black-boxes whose predictions cannot be easily interpreted; yet,interpretability is considered particularly important in the design of algorithmictrading systems, because it encourages the understanding, approval, justification,and control of such systems by experts (Hu et al., 2015). Further, the flexible designof evolutionary algorithms allows domain knowledge and subjective beliefs to beincorporated relatively directly as we shall see in Chapter 3. Finally, applications ofevolutionary algorithms have also demonstrated promising results in previous studies(e.g., Neely et al., 1997; Potvin et al., 2004; Ghandar et al., 2009).

2.2.1 Related Literature

In the following, we review a selection of studies that are closely related to ourapproach. Starting with related work in the context of betting markets, we thenproceed with studies in financial markets, including approaches that use slightlydi�erent methods but make important contributions which we can built upon. Notethat, for the remainder of this chapter we treat evolutionary algorithms as an abstractprocedure—a guided random search for interpretable trading rules—that is to bedescribed in detail in Chapter 3.

Related work in betting markets

Applications of evolutionary algorithms in betting markets can be traced to theend of the 1980s (Maza, 1989), however, studies in this context remain scarce.A first noteworthy example is a study by Tsang, Li, and Butler (1998) who useevolutionary computation with horse racing data to find profitable trading rulesbased on information about an event and about previous races. Concretely, they takeinformation about a race (e.g., the amount of price money) and about a runner’sprevious performance to predict the winner of an event. Therefore, trading rules

14

Page 23: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

are represented as betting decisions, such as: “price money in the last race < pricemoney in this race” (Tsang, Li, and Butler, 1998, p. 6).

They apply a genetic programming13 approach where rules are encoded as decisiontrees and are evaluated based on the predictive performance of a tree. Althoughtheir results tell a compelling story, their methodology contains a few weaknesseswhich question the validity of their findings. First and foremost, they use a verysmall sample (180 races) and in their data even a naive strategy of betting on thefavorite o�ers considerable returns—a result that would be highly unlikely in arepresentative sample. Moreover, their model selection after optimization is basedon the performance of a single decision tree, which entails a risk of overfitting. Insubsequent studies (Tsang, Li, Markose, et al., 2000; Tsang and Li, 2002; Tsang, Yung,et al., 2004; Kampouridis and Tsang, 2010) their system was developed into a financialforecasting tool named EDDIE14 that aims at “e�ectively searching for combinations(interactions) of financial indicators and discovering thresholds” (Tsang, Yung, et al.,2004, p. 560). Although their idea is similar to our proposition, their method issubstantively di�erent from ours: they focus on the combination of a large number ofrules through logical operators, whereas our focus lies on the parameter optimizationand incorporation of subjective information. Therefore, their system is more flexiblewith regard to finding structure, while our approach allows for more flexibility inthe restriction of the search space. Viewed di�erently, their approach assumes thatthere is a reasonably good set of indicators with relatively fixed parameters for whichone merely needs to find the right logical connectives and thresholds. In contrast,our procedure rather assumes that the strategy (i.e., the structured set of inputrules) is fixed and instead focuses on the optimization of the rules’ parameters viaan evolutionary process. The technical di�erences lie in the distinction between thegenetic programming approach (GP) they use and the comparatively simple geneticalgorithm (GA) that we apply; however, previous studies have demonstrated thatgenetic algorithms can outperform genetic programming, if the problem is su�cientlywell encoded in a GA, or if the search space of the GP approach becomes too largeto be explored e�ciently (Kampouridis and Tsang, 2010; Subramanian et al., 2006).We will delve into these technicalities more deeply in Chapter 3.

In the context of betting exchanges, we are aware of only a single study that isrelated to our work: the development of an algorithmic trading system for bettingexchanges by Tsirimpas (2014). Their system handles the specification, simulation,execution, optimization, and evaluation of trading strategies using both historical

13 Genetic programming is a special type of evolutionary algorithm; we discuss its advantagesand disadvantages in Chapter 3.

14 An acronym for “Evolutionary Dynamic Data Investment Evaluator”.

15

Page 24: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

and live data (Tsirimpas, 2014, p. 34). The optimization of a strategy’s parametersis performed using an evolutionary algorithm and the functionality is tested onhistorical data. In a related study, Tsirimpas and Knottenbelt (2013) use theirsystem to optimize the parameters of a trading strategy on odds from 990 horseraces. Using a walk-forward validation framework,15 they observe that the optimizedstrategy shows positive results in the course of the optimization, but they find it notto be robust enough to argue in favor of a viable trading strategy. Unfortunately, theyprovide little insight into the design choices underlying the optimization techniquethey employ, treating it rather as a black-box procedure. Furthermore, they do notexplore the evolution of new strategies in depth but suggest it as an opportunity forfurther research.

In contrast, our approach is geared more carefully to the problem, justifies thedesign of the evolutionary algorithm more thoroughly, and allows strategies andparameters to be defined more broadly—a step towards the evolution of strategiesthat generalize beyond the concrete specification a user provides. Moreover, we usehigh-frequency data from in-play events together with rules that are inspired bytechnical indicators from the field of finance, while they have limited their analysisto a single rule that becomes active only once in advance of an event. Nevertheless,their work is a valuable source for information about the design and implementationof algorithmic trading systems for betting exchanges, a topic that needs to be dealtwith when simulating historical data and processing market information.16

Related work in financial markets

In financial markets the discovery of trading rules by evolutionary computation hasreceived abundant attention: a recent survey by Hu et al. (2015) counts 650 articlesthat were published before 2013 in this field. In their review, they zoom in on aselection of 51 relevant articles and subdivide the evolutionary approaches into threecategories: genetic algorithms, genetic programming, and techniques that combinefuzzy logic systems (Zadeh, 1965; Mendel, 2001) with evolutionary approaches. Theydo not, however, find that any of those techniques strictly dominates the others, andin general no more than 14 percent of the papers they survey report profitable resultscompared to a buy-and-hold strategy after transaction costs—still a surprisingly

15 Walk-forward validation works by dividing the dataset into chunks which keep the temporalorder. Starting from the earliest data, the parameters of a strategy are optimized on this subsetand the optimized strategy is tested on a subsequent chunk of the data. This procedure is repeateduntil the last (i.e., most recent) chunk has been used as a test set. It provides the results of multipleoptimization runs and therefore allows for a sensible evaluation of the performance of a strategy aswell as the robustness of parameters.

16 We address these issues in Chapter 4.

16

Page 25: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

large number considering the prominence of the e�cient markets hypothesis. Further,their survey carves out the coherence between studies with promising results, findingsimilarities in the choices of performance metrics and observing that in a majority ofstudies, evolutionary algorithms seem to perform better in downwards trends thanin upwards markets.

With regard to the selection of a performance metric—which is also called thefitness function in the context of evolutionary algorithms—it appears that profitabilitymeasures (such as net profit or return on investment) are usually preferred overaccuracy metrics, which is sensible in a financial context. However, individualstudies (Subramanian et al., 2006; Ghandar et al., 2009) have reported a significantperformance improvement through the use of risk-adjusted returns, measures that wealso consider in our analysis.17 Thus, we build on the experience of previous researchin financial markets and extend the application of evolutionary algorithms for thediscovery of trading rules to betting exchanges—a case study which, to the best ofour knowledge, has not been realized so far.

Our contribution can be summarized in the following way. First, we design aproblem-specific evolutionary algorithm with a focus on the optimization of ruleparameters—a method that allows for an e�cient optimization of a combination ofrules with continuous and discrete parameters. Secondly, we transfer the idea of usingevolutionary algorithms for the discovery of trading strategies to betting exchangeswhere the method has not been su�ciently studied. Thereby, we aim to provide adeeper understanding on how evolutionary algorithms can improve the search forinformation ine�ciencies in betting exchanges and try to define an approach thatgeneralizes to other types of financial markets. Finally, our contribution yields anextensible implementation that allows further research to investigate the concept ofmarket e�ciency.

2.3 Summary

This chapter established the foundational knowledge that we build upon in subsequentchapters. Initially, it introduced relevant definitions and concepts from financialliterature and from the context of betting markets; specifically, we described howbetting markets operate, pointed out the similarities and di�erences between book-makers, betting exchanges, and financial markets, and illustrated in what form theavailable odds as well as the liquidity of the market are visible to traders on a bettingexchange. Further, we revised the concept of market e�ciency and highlighted the

17 Performance metrics are explained and discussed in Section 3.2.2.

17

Page 26: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

ongoing debate around the e�cient markets hypothesis; in particular, we addressedthe topic of information e�ciency in betting markets, pointing to the presence ofcontroversial biases and noting that recent findings suggest a higher level of e�ciencyin betting exchanges compared to traditional bookmakers.

In a second step, we discussed related literature around the application of evolu-tionary algorithms for the discovery of trading rules. We motivated for the use ofevolutionary algorithms by their ability of finding interpretable solutions to complexoptimization problems and by referring to promising results from previous studies inthe field of finance. In the context of betting markets, we found a lack of research inthe application of technical analysis in general, and of evolutionary algorithms forthe discovery of trading rules in particular. Finally, we condensed the contributionof this thesis into (1) the design of a problem-specific evolutionary algorithm, and(2) the transfer of evolutionary optimization methods for rule discovery to bettingexchanges.

Therefore, we have sketched out the significance and possible implications ofevolutionary approaches for automated rule discovery and proceed to focus on thetechnical side of the question how evolutionary algorithms can improve the searchfor information ine�ciencies in betting markets. In the next chapter, we tackle thetheoretical foundations of evolutionary algorithms and explain the problem-specificencoding we have developed, before we delve into the concrete data and its analysis.

18

Page 27: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

3. Methods

The previous chapter provided an overview of the literature that is concerned withevolutionary computation in the financial domain and with the topic of evolutionaryalgorithms for the discovery of technical trading rules in particular. It situated thisresearch in relation to the studies that are closest to it and touched upon the methodemployed in this study: a genetic algorithm that focuses on the optimization ofrule parameters and o�ers flexibility to incorporate domain knowledge or subjectivebeliefs.

This chapter further explains the employed method, its underlying motivations,assumptions, and limitations. Since we aim to design an evolutionary algorithmthat is geared towards the problem of finding information ine�ciencies in financialmarkets, we provide theoretical justifications and plausibility arguments for everycomponent we include in the optimization procedure, and thereby try to shed lighton how evolutionary algorithms can improve the search for market ine�ciencies.

First, a brief introduction to genetic optimization aims at familiarizing the readerwith the core ideas and terminology surrounding the employed method. Secondly,we go through the components of a genetic algorithm and explain how they areadjusted to the problem at hand. Finally, the third section explains how the methodis applied to search for market ine�ciencies in the in-play football betting market; inparticular, it explains the validation strategy as well as the types of technical rulesthat we use in the analysis.

3.1 Genetic Optimization

As its name suggests, genetic optimization is an optimization technique that isinspired by biological processes. It represents a subclass of evolutionary algorithms,which in turn can be attributed to the abstract concept of metaheuristics. Thelatter represent a class of procedures that try to find a reasonably good solution tooptimization problems for which usually no analytical solution exist and exhaustivemethods are too computationally expensive (Kruse et al., 2016). Evolutionary

19

Page 28: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

algorithms, a particular type of metaheuristic, incorporate ideas from biologicalevolution to guide the process of optimization; their key idea is to evolve populationsof solution candidates (individuals) such that better solutions become more prevalentand worse solutions die out over time. In turn, genetic algorithms drive the processof evolution by the application of biologically inspired genetic operators (mutation,recombination and selection) on the population of solution candidates. Ultimately,the goal is to find an adequate solution via the resulting guided random search, but,as for metaheuristics in general, there is no guarantee for the best solution to befound. That is why these procedures are popular for applications where a solutionof su�ciently high quality—or fitness, as it is called in the context of evolutionaryalgorithms—will su�ce, even if it is not a global optimum.

There are good reasons why genetic algorithms are suitable for the task of findingine�ciencies in financial markets. First and foremost, the main incentive in financialmarkets is to discover strategies that are “good enough”, not necessarily globaloptima. In a financial context this is usually understood as a strategy that generatessubstantial profits while having a limited risk of large losses.1 Furthermore, financialmarkets tend to be extremely noisy, due to their speculative nature and the varietyof market participants that engage in them (Black, 1986).2 Genetic algorithms,however, were found to be relatively robust in the presence of noise (Goldberg, 1989)and, in contrast to derivative methods such as gradient ascent, they can even beapplied when the objective function is not di�erentiable or continuous, thus allowingfor the optimization of trading rules with discrete parameter domains. Anotherreason is that we can consider the search space to be too large for an exhaustivesearch and too poorly understood for the application of domain-specific heuristics,which are usually preferred for problems that are well understood (Mitchell, 1998;Allen and Karjalainen, 1999).

However, this does not imply that genetic algorithms are guaranteed to finda good solution even if one exists, since GAs are restricted by their stochasticnature as well as their own assumptions and limitations. They assume that gradualimprovement is possible, meaning that solutions in a close neighborhood should havea comparable fitness. Furthermore, it is possible that there are no strategies thatcan be systematically exploited with an advantage, either because the analysis doesnot specify the right variables, or because the market is e�cient and adapts to newinformation fully and swiftly. Yet, most importantly, the success of GAs relies heavily

1The meanings of the words “substantial” and “limited” are subjective and depend on anindividual’s preference for risk and reward. This is discussed more thoroughly in Subsection 3.2.2.

2The same arguments apply to prediction and betting markets. Probably most strikingly duringin-play periods where the amount of information (or noise) is dense.

20

Page 29: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

on a good mapping from the problem to the encoding of solution candidates as wellas on the choice of suitable genetic operators, fitness functions, and optimizationparameters. Otherwise, there is not enough information to guide the optimizationsuch that it either becomes too similar to a random search, or tends to get stuck inlocal optima. In other words, the design of an evolutionary algorithm should finda good balance between the exploration of the search space and the exploitationof promising solution candidates. Therefore, we put much emphasis on the designof the genetic optimization for the problem of finding information ine�ciencies infinancial markets.

3.2 Problem-Specific Design

The design of a genetic algorithm encompasses multiple components: first andforemost, it requires one to define the representation of solution candidates. Secondly,one has to specify how to assess the quality of a solution candidate, and how,based on their fitness, solution candidates are selected from one generation to thenext. In the process of evolution, genetic operators are designed to determine hownew solutions can be created. Furthermore, some of these components introduceparameters—knobs that can be turned to influence the optimization procedure inspecific ways—which also need to be decided on. All of these parts o�er the potentialto improve the optimization with regard to the problem at hand, therefore we aimto base our decisions on theoretical considerations and experience from previousresearch, while we discuss every component of the genetic algorithm.

On a high level, the encoding, operators, and optimization parameters allow oneto control the exploration of the search space (i.e., the variety of candidates) andthe exploitation of promising individuals. Ideally, the genetic algorithm would favorexploration in the beginning of the optimization and put more weight on exploitationof good individuals in the course of time. We revisit these two concepts during thedescription of the design and in the course of the empirical analysis.

3.2.1 Solution Candidates

In the context of this study, investment decisions are represented by a functionS : RK æ {0, 1} mapping a K-dimensional input vector x œ RK to a binary decision(1: act, 0: do nothing). A strategy is defined as a conjunction of individual rules

S(x) = R1(x(1)) · R2(x(2)) · . . . · RL(x(L)) (3.1)

21

Page 30: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

where each rule is a function Ri : RKi æ {0, 1} representing a binary decision withKi Æ K arguments. The input variables of the strategy are divided among its rulessuch that qL

i=1 Ki = K. Note that we indicate the input vector of a strategy inboldface x, the input vector of a rule at position l in boldface with a superscript x(l),and the scalar values of a vector with xi or x

(l)i respectively.

For example, consider a strategy SMA to buy a security if its moving averagesMA(w1) and MA(w2) of two di�erent window sizes w1, w2 œ N intersect in a specificdirection:

SMA(w1, w2) =

Y_]

_[

1, if MAt(w1) > MAt(w2) and MAt≠1(w1) Æ MAt≠1(w2)

0, otherwise

where t and t ≠ 1 stand for the current and previous points in time respectively. Therule evaluates to one if, at time t, MA(w1) surpasses MA(w2) after being smaller attime t ≠ 1. For example, if 1 Æ w1 < w2 the strategy indicates the beginning of aperiod where the short-term moving average exceeds the longer term one.

There are multiple ways to encode SMA, each having its advantages and disadvan-tages. For instance, we could choose an encoding as a conjunction of two individualrules

R1(w1, w2) = MAt(w1) > MAt(w2)R2(w1, w2) = MAt≠1(w1) Æ MAt≠1(w2)

Alternatively, we might choose to encode the strategy as a single rule

R

Õ1(w1, w2) =

1MAt(w1) > MAt(w2)

1MAt≠1(w1) Æ MAt≠1(w2)

2

But does it make a di�erence with respect to the optimization? Indeed, an advantageof the first encoding is that it allows rules to stand on their own. For example, if wewere interested in a strategy that includes R1 but not R2, then the first encodingwould be more adequate.3 However, notice that in the first encoding both rulesshare the same input variables, which has the disadvantage that interdependenciesbetween rules must be built into the encoding of a solution candidate, otherwise theremight be problems when applying genetic operators, as we shall see in Subsection3.2.3. The second encoding is more specific and works only for the purpose of findingan MA-crossover; it is more restrictive, which reduces the search space, but also

3More concretely, in Subsection 3.2.3 we will introduce a mutation operator that allows individualrules to be ignored in the evaluation of the conjunction.

22

Page 31: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

more convenient as there are no input variable interdependencies between rules thatare encoded in this way. Our implementation is based on the second encoding tocircumvent parameter dependencies, therefore, when formulating a rule, one shouldconsider to split it into multiple components if a larger search space is desired anddependencies are not an issue.

Another important ingredient for the encoding is the range of values that theinput variables can take on. For the definition of strategies in equation 3.1 eachinput argument was defined to be a real-valued number, however, the actual rangeof the variable might be much smaller. For the MA-crossover the window sizes w1

and w2 must be positive integers, and probably one wants to reduce the range ofpossible values even further, depending on the dataset and problem. Such sensiblelimitations can be subjective to some extent, but they allow us to reduce the searchspace significantly and help in avoiding “forbidden regions”—areas of the space inwhich the fitness of solution candidates is not defined—for example, in the case whenan individual strategy happens to execute not a single trade.

We now address the concrete encoding, keeping in mind that there should be nodependencies between input variables of individual rules and that the value range ofinput variables can be limited. The position of a candidate in the solution space isdetermined solely by the input vector x, because the set of rules that makes up astrategy is fixed. Therefore, the candidate can be represented by a fixed-length array,which we will call a chromosome representation. The length of the array correspondsto the number of input variables that a strategy contains, and a value at positioni corresponds to the value of the input variable xi. Table 3.1 illustrates a possibleencoding of the MA-strategy.

In the example, a solution candidate (i.e., an individual in the population) is a pointin N2. Assume we extend the strategy by a conjunction with another hypothetical ruleR3(w3) that has w3 œ R as an input variable. The chromosome representation canbe extended to [w1, w2, w3], so each individual becomes a point in three dimensionalspace. Note that in this example we have a di�erent value range for w3 than we havefor w1 and w2; this has to be taken into account for the upcoming definition of geneticoperators, because ideally we want to replace a value of a solution candidate onlywith a valid value from its input range. Therefore, we associate an alphabet �i witheach position i of the solution candidate; for the above example, this corresponds to�1 = �2 = N and �3 = R. In addition, to each alphabet we add the symbol ú whichshall have the special function of ignoring a rule that receives inputs xi = ú in theevaluation of a strategy. For instance, in the above example the individual [2, 3, ú]would ignore the new rule R3, so the strategy can be reduced to the MA-crossover.

23

Page 32: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

mathematical formulation SMA(w1, w2) = R1(w1, w2)chromosome representation [w1, w2]population example [2, 3], [2, 1], [4, 2], . . .

Table 3.1: Possible encoding of the MA-crossover strategy with windowsizes w1, w2 œ N. The chromosome representation shows the solutioncandidate as an array of two elements. The population example illus-trates how a collection of possible solution candidates with concretevalues might look like.

This allows us to extend a strategy with disjunctions of its individual rules (requiringthat at least one rule is not ignored) and it has the advantage that, apart fromincreasing the space of possible solutions, particularly harmful rules can be avoided.4

Put di�erently, it allows the genetic algorithm to not only optimize for the parametersof the complete set of rules, but also to explore the structure as we decrease the sizeof the rule set.

Nevertheless, there are also drawbacks to the chosen encoding. Most prominently,we are restricted by the fixed maximum size of the rule set. Therefore, it is notpossible to dynamically extend the size of the chromosome, or to reuse rules multipletimes in a strategy. For such a method one would need to consider to use geneticprogramming (Koza, 1992) instead. Thereby, one could increase the search spacedramatically, because genetic programming can enable arbitrary combinations ofrules, represented as tree structures and combined via a set of logical operators.However, the considerable increase in the complexity of the search space can also bea challenge during optimization. For instance, Subramanian et al. (2006) employboth approaches for the task of rule discovery, finding that a well designed geneticalgorithm outperforms the genetic program in their case. Moreover, in their reviewof evolutionary computation methods for rule discovery in financial markets, Huet al. (2015) suggest that there is not enough evidence to conclude that geneticprogramming outperforms genetic algorithms, or vice versa. Therefore, we remainwith the comparably simple method of genetic algorithms and instead focus moreon the optimization of parameters than on the exploration of possible combinationsof rules. Another drawback lies in the implicit uniformity of rule weights. Noticethat by using a conjunction of rules we enforce that all rules need to be active fora strategy to become active—an unanimous majority vote. Instead, one could usea weighted decision and encode the weights as parameters (cf. Subramanian et al.,

4If, for example, a single rule within a strategy had an extremely bad fitness for any input, thenwe might only improve by ignoring this one rule.

24

Page 33: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

2006; Ghandar et al., 2009) which would introduce further degrees of freedom intothe optimization.5 Though, in a first step, we focus on the simple case of uniformweights.

In summary, we defined the encoding of solution candidates on both an abstractand concrete level. Abstractly, we are looking at a conjunction of active tradingrules, or a subset of them if we consider an extended alphabet of input values. Ona concrete level, the solution candidate is represented by a fixed-length array thatcontains the values of each input variable and represents the position of an individualin the solution space. Based on this encoding, we now describe how the search spaceis explored in the context of a genetic algorithm.

3.2.2 Fitness and Selection

The fitness of an individual characterizes the quality of the solution candidate thatit represents and influences its probability of being selected for the creation of thepopulation of the next generation. The analogy stems from an organism’s fitness as itspotential to reproduce. Mathematically, it is a function f : RK æ R that associateseach position in the solution space with a fitness value. For a two dimensional inputvector one can visualize the fitness function along a third dimension, as illustratedwith a hypothetical example in figure 3.1. The goal is to e�ciently explore the fitnesslandscape, whose properties one usually does not know, in search for a solutioncandidate with a reasonably good fitness. For this purpose, the fitness should, inprinciple, be an objective function that determines the quality of a solution candidatewithout doubt. However, in a practical economic context the choice depends onsubjective preferences, such as risk attitudes. Therefore, we first discuss severaloptions of suitable fitness functions, before explaining how individuals are selectedfor reproduction.

A simple criterion that comes to one’s mind is the net profit of a trading strategy.The net profit of a trading strategy is the sum over the net profits of individualtrades that are executed following the strategy:

fi =ÿ

i

fii

where fii is the net profit of an individual trade (equation 2.2). As noted earlier, inthe context of a betting market one would rather describe the net profit of a betas the (tax-adjusted) di�erence between the gross profit and the stake. Although

5 One might even consider using both positive and negative weights such that rules are able tovote in favor and against the activation of a strategy.

25

Page 34: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Figure 3.1: Hypothetical fitness landscape as a function of two inputvariables. In the context of a maximization problem one would like tofind a global maximum, i.e., a point x1, x2 for which f(x1, x2) is largest.

simple and intuitive, the net profit is an absolute measure that o�ers no informationabout the amount of money that was invested. For instance, if two strategies reportthe same profit, one would prefer the strategy that is based on a smaller investment,all other factors being equal.

A relative counterpart to the net profit is the average return per trade, whichmeasures the net profit relative to the invested money; it ranges from -1 (ruin) toinfinity and positive values represent a profitable strategy:

r̄ = 1n

nÿ

i=1

fii

si. (3.2)

Here, si denotes the size of the stake and n is the total number of trades that areexecuted by the strategy. The average return is better suited to compare the relativeperformance across strategies, however, it has the disadvantage that it does not takerisk into consideration. For example, take two series of bets; one that contains onehundred bets with odds of 1.1, the other containing the same amount of bets withodds of 10. Assume a strategy starts with a capital of 100 units and bets one uniton each bet of the first series, winning all of the bets. The resulting return would be100 · (1.1 ≠ 1) = 10. Further assume that a second strategy, with the same initialcapital, bets one unit on each of the bets from the second series and wins only one

26

Page 35: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

of the bets. The return would be identical and assuming the odds translate to fairprobabilities, both strategies would, in expectation, reap the same reward. Yet, in ashort series of bets, (e.g., a single bet) the first strategy o�ers a much smaller risk oflosing the stake. Therefore, the objective should express a tradeo� between expectedpayo� and risk.

A popular measure for risk-adjusted returns is the Sharpe ratio. It computes theratio of average excess return over a benchmark, divided by the standard deviationof returns.

Sharpe = r̄ ≠ r̄b

The numerator computes the di�erence between the return of a strategy and thereturn of a baseline b, for example a risk-free interest rate or a buy-and-hold strategy.However, for a betting market there is no such natural baseline and the time intervalunder consideration is so short that we assume the baseline return to be zero.6 Thedenominator estimates the risk of a strategy as the standard deviation of its returns‡. In general, one would like to find a strategy with a large, positive Sharpe ratio,that is a strategy with a large return and small risk. A problem with the Sharpe ratiois its property to penalize a large variation in returns irrespective of whether they arepositive (upside risk) or negative (downside risk). A related measure that provides aremedy is the Sortino ratio, which is equivalent to the Sharpe ratio, but penalizes onlythe downside deviation (i.e., the standard deviation of negative returns) which canbe considered more harmful (Estrada, 2006). Therefore, we choose the Sortino ratioover the Sharpe ratio as an estimate for the risk-adjusted return of an investmentstrategy.

Finance literature o�ers numerous alternatives for the computation of the activereturn (alpha) and volatility (beta) of an investment compared to a baseline. Itis criticized that the Sharpe and Sortino ratios are dimensionless and thereforedi�cult to interpret and compare. Nevertheless, scale and interpretability of thefitness function are not a priority during the genetic optimization, and for subsequenttesting it is not a problem to compare various metrics.7 Furthermore, a commoncritique for estimating the risk by the standard deviation of returns is the observationthat returns often do not follow a normal distribution, but exhibit abnormalities suchas skewness or high kurtosis (Lo, 2002). Unfortunately, the distribution of returnsis not known a priori and it can vary significantly between datasets (depending

6 The data covers an interval of only two months. With respect to a baseline, one may arguethat refraining from betting is a sensible comparison. Therefore we will, for the sake of simplicity,assume that the benchmark return is zero when dealing with the Sharpe ratio or any related metric.

7 One may even consider to use multi-objective optimization, a task for which genetic algorithmsare particularly well suited (Deb, 2001).

27

Page 36: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

on, for example, the strategy and time interval under consideration), however, weassume that it is still a reasonable starting point, and that further assumptions canbe examined post hoc. Therefore, we follow suit with previous studies (Subramanianet al., 2006; Ghandar et al., 2009) and adhere to the Sortino ratio.

Penalizing the fitness

Another possibility to adapt the fitness function is via the addition of a penalty termwhich o�ers flexibility in numerous ways. First of all, it allows one to fine-tune thefitness function to individual preferences. For instance, the Sortino ratio has theunfavorable property that it may disguise the total amount of drawdown;8 becauseof this, we add a penalty term that sets the fitness to an extremely low value, if themaximal drawdown surpasses a predefined threshold value. A second use case for apenalty handles invalid solution candidates (i.e., individuals with an invalid fitness),such as strategies that make no trades or that have a constant downside return (theyhave a downside deviation of zero and thus an infinite Sortino ratio).9 Again, wechoose to penalize invalid solution candidates by an extremely low fitness. Finally,we add a penalty to individuals who make too few trades, in order to favor rulesthat are frequently active; analogously to the above cases, we penalize strategies thattrade on fewer than a predefined fraction of events with an extreme low fitness value.Further use cases might, for example, be the penalization of complexity (for instance,very large rule sets) as well as an additional penalty for strategies that exhibit largelosses (cf. Ghandar et al., 2009).

Following the above argumentation, the fitness function of choice for this studyis a penalized Sortino ratio

f = Sortino + „inv + „dd(·dd) + „min(·min) (3.3)

which represents the fitness f of a trading strategy with penalty terms that areactive (set to minus infinity) if the strategy is invalid, surpasses a specified drawdown·dd, or if it falls short of a minimum number of trades ·min. More concretely, wecalculate the fitness of an individual by applying the represented trading strategyon historical data and compute the Sortino ratio over the resulting series of bets.Then we evaluate whether the solution candidate violates any of the above penalties,and if it does, the respective penalty term, and thus the fitness of the individual, is

8 (Maximal) drawdown refers to the maximal decline of an investment (or a bank) from aprevious peak. An investment can exhibit a significant drawdown, even if is profitable overall andhas a satisfying Sortino ratio.

9 One might also regard solution candidates that lie outside of the search space as invalid,however, we already prevent this issue by the use of an alphabet (Subsection 3.2.1).

28

Page 37: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

set to minus infinity. If the strategy is not penalized, the fitness of the individual isdetermined by the Sortino ratio over its series of bets. Since this procedure can beapplied for all solution candidates independently, the computation of fitness valueso�ers potential for parallelization: one could, for example, use one processor for thecomputation of the fitness of one individual respectively.10

Selection

As discussed previously, the fitness of an individual a�ects its probability of be-ing selected for reproduction, but it is the selection procedure that determineswhich individuals pass their genes—the partial information about the solution theyrepresent—on to the next generation. For example, roulette wheel selection wouldassign each individual a selection probability proportional to its relative fitness valuein the population. Even though it is a simple, intuitive procedure, the presence ofinfinite fitness values complicates the computation and it has the disadvantage thatit puts increasing selection pressure on dominant individuals which can underminethe population’s diversity and lead to premature convergence to a local optimum(Kruse et al., 2016). There are many variations of fitness proportionate selection, butmost of them rely on modifications of the fitness function or additional parameters.Instead, we choose to employ tournament selection, because it is a straightforwardprocedure with a constant selection pressure and only a single parameter: the numberof tournament participants k. Tournament selection starts by randomly samplingk individuals from a population of size n. The sampled individuals represent theparticipants of a tournament whose winner is the individual with the largest fitnessvalue. The winner is selected for reproduction and the process of sampling andcomparing individuals is repeated (on the original population) until n individualshave been selected. By varying the tournament size, the selection pressure can becontrolled. For instance, if k = n then the best individual (assuming all individualshave a unique fitness) repeatedly wins the tournament, so that the set of selectedindividuals consists of n copies of the best solution candidate—a case of maximalselection pressure. If on the other hand k = 1, then selection pressure is minimaland tournament selection becomes equivalent to uniform sampling. In other words,a small tournament size leads to a more diverse population and therefore favors theexploration of the search space, while a large tournament promotes the exploitationof good solution candidates.

10Unfortunately, in this problem it is the generation of the series of trades that is most expensive,because it requires one to iterate through the dataset for every individual. Nevertheless, the dataalso o�ers opportunities for parallelizing the generation of trades; we address these in Section 4.2.

29

Page 38: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

For the problem at hand it is sensible to exert little selection pressure, becausethe search space can be expected to be dominated by either solution candidatesthat represent mediocre, undesirable11 strategies, or by penalized individuals. Ifthe tournament size were chosen to be too large, the search would probably focustoo heavily on mediocre individuals and explore too little of the space around othercandidates. However, by choosing a small tournament size it becomes more likely thatgood solutions, which we want to keep track of, are discarded during the stochasticselection process. Therefore, we choose to supplement the tournament selection withelitism that ensures that the best Ÿ individuals are copied to the next population.12

In a nutshell, the objective function is designed to o�er a tradeo� between rewardand risk; in our case this is accomplished by using a measure for risk-adjusted returns,namely the Sortino ratio. For special cases, such as invalid solution candidates,strategies with a large drawdown or with too few trades, a penalty term is introducedthat sets the individual’s fitness to an extremely low value. Tournament selectionis used to select individuals for reproduction while the top Ÿ individuals are copieddirectly to the next population to ensure that the best solutions are not lost inintermediate populations. The next subsection explains how the individuals thatwere selected for reproduction are used to create new solution candidates.

3.2.3 Genetic Operators

The application of genetic operators revolves around the question of how the solutionspace is explored in search for a good solution. They give us the possibility to changesolution candidates and to recombine them into new, possibly better solutions. As thename implies, genetic operators are heavily inspired by biological evolution where, inthe process of sexual reproduction, genetic material from two parents is recombined(crossover), or during the replication of DNA copying errors (mutations) occur. Ingenetic algorithms we apply the same terminology, using mutation to describe unary-operators as they change only a single solution candidate, and crossover for binaryoperators that recombine two individuals. Subsection 3.2.1 defined the encodingof solution candidates as an array of values, each representing the value of a rule’sparameter. In the following we extend this definition to ensure that mutation andcrossover operators are used e�ectively to guide the search of the genetic algorithm.

11 Thereby we mean strategies that may be the fittest in the population, but are still unprofitable,and therefore undesirable.

12 To be concrete, we choose the elite to consists of unique individuals, in order to preventduplicates which could undermine the diversity. When determining unique individuals, we roundcontinuous parameters to the third decimal place.

30

Page 39: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Crossover

We illustrate the application of the crossover operator and its complications for therepresentation of trading rules with a concrete example: let s = [1, 3, 1, 1, 5] be asolution candidate that represents a trading strategy S consisting of three rulesS(x1, . . . , x5) = R1(x1) · R2(x2, x3) · R3(x4, x5). Further assume that we want tocross s with another solution candidate s

Õ = [2, 4, 6, 2, 6]. In order to form twonew solution candidates, a simple one-point crossover could be used, which cutsboth arrays at the same index and exchanges the subarray left and right of thecut point. Note that, however, such an operation might separate the parametersof a rule; for example, if we were to cut the chromosomes after index 2, we wouldseparate the parameters of rule R2. Instead, rules shall be treated as the elementaryunits of inheritance (genes) that are not separated during crossover. The reasoningis that, when re-combining partial solutions, we do not want to break up goodrules that have evolved during the optimization process. Therefore, the formerchromosome representation is extended to a nested structure: an array of arrays.13

As a consequence, the length of a chromosome is now determined by the number ofrules that it is composed of, so that the application of a one-point crossover on theouter array does not break up individual genes.

As a crossover operator, shu�e crossover is used, because it eliminates thepositional14 bias that is inherent in the one-point crossover, as well as a distributional15

bias that a uniform exchange of genes would introduce. Shu�e crossover works byfirst shu�ing both chromosomes with the same permutation, then applying one-pointcrossover, and finally reversing the permutation. The resulting two individuals takethe places of their parents in the new population. The crossover rate is controlled bya probability p1—a parameter of the optimization that determines the fraction ofindividuals that are subject to crossover. Table 3.2 illustrates the new encoding andthe application of shu�e crossover.

13The same structure is used in the implementation.14 Positional bias describes the property that genes lying close to each other on the chromosome

are less likely to be separated, than genes that are separated by many genes in between them.There is little reason why this property should be assumed for trading rules in general.

15 If each gene were chosen randomly as one of the parents’ genes at the respective position(uniform crossover of a single gene), the experiment would be equivalent to a Bernoulli trial. Thus, arepeated number of independent experiments (uniform crossover of each gene in a chromosome) wouldimply a Binomial distribution for the number of genes that are exchanged between chromosomes.Again, an assumption for which there is little justification in the problem at hand.

31

Page 40: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

parent chromosomes [[1] , [3, 1] , [1, 5]] [[2] , [4, 6] , [2, 6]]

permutation [[1, 5] , [1] , [3, 1]] [[2, 6] , [2] , [4, 6]]

one-point crossover [[1, 5] , [1] , [4, 6]] [[2, 6] , [2] , [3, 1]]

inverse permutation [[1] , [4, 6] , [1, 5]] [[2] , [3, 1] , [2, 6]]

Table 3.2: Example of a shu�e crossover on two solution candidatesof a strategy S(x1, . . . , x5) = R1(x1) · R2(x2, x3) · R3(x4, x5). Startingwith the parent chromosomes at the top, the individual steps of theshu�e crossover operator are performed. First, a random permutationthat is applied to both parents, followed by a one-point crossover (here,cutting after the second index), and lastly the inversion of the previouspermutation.

Mutation

This study employs three di�erent types of mutations, each of which changes a singlegene in a specific way. The first one will be called standard mutation, because it ismost similar to the original mutation operator which flips a single bit in a bitstring.Standard mutation passes over the set of all genes and randomly changes a genewith a small probability p2. A gene is changed by replacing its current parametervalues with new values that are sampled from its alphabet.

The second mutation operator will be called vicinity mutation, because it changesa parameter of a rule only slightly, such that it stays in the vicinity of the previousvalue.16 Genes to be mutated are selected in an analogous way to standard mutation,but with a larger probability p3. The reason behind its application is that in thepresence of many invalid individuals, as we encounter in our case, the population’sdiversity drastically diminishes. By making only small changes to a large proportion ofthe population we can increase the diversity without sacrificing too many individualsto standard mutations, which often happen to be harmful. In preliminary experimentsvicinity mutation turned out to be a very e�ective addition.

The last operator will be called flip mutation, because it determines whether arule is considered (flipped on) or ignored (flipped o�). It implements the functionalitythat was discussed in Subsection 3.2.1 about the extended alphabet. A gene that isignored represents a rule that is always active, or in the conjunction of equation 3.1

16To be concrete, during vicinity mutation we draw a number u from a uniform U(0, 0.05)distribution and change one parameter xi in the rule by ±u(b ≠ a), where [a, b] is the value rangefor this parameter, defined by its alphabet �i. If the alphabet is a discrete set, we sample half of itsvalues (without replacement and excluding xi) and replace the parameter’s current value xi withthe closest value in the sampled set.

32

Page 41: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

individual [[1] , [9, 7] , [1, 5]]

standard mutation [[1] , [3, 1] , [1, 5]]

vicinity mutation [[2] , [2, 1] , [1, 5]]

flip mutation [[1] , [2, 1] , [ú, ú]]

Table 3.3: Illustration of the three mutation operators, each of whichoperates isolated on the original individual shown in the first row.Standard mutation resamples the parameters in the second gene, vicinitymutation makes a slight change to a parameter of the first gene and flipmutation deactivates the third gene.

it can be seen as a rule that always evaluated to true. As described previously, thisallows individuals to represent subsets of rules in a strategy. Again, genes for flipmutation are selected randomly, this time with a small probability p4. Examples foreach of the three mutation operators presented above are shown in Table 3.3.

Summing up, this study makes use of four genetic operators: shu�e crossoverand three di�erent mutation operators. The crossover operator was selected toavoid a positional and distributional bias, because the encoding of the problem doesnot lend itself to these assumptions. The variety of mutation operators aims toimprove the diversity of the population and each of the operators is designed to takeadvantage of the genetic encoding by sampling from the alphabet of the respectiveparameter. Consequently, the calibration of genetic operators should be conductiveto the exploration of the search space for the problem at hand.

3.2.4 Initialization

Initialization refers to the creation of the first population and in the context ofthis study it turned out to be important, because in preliminary experiments anaive initialization produced a population with too many invalid individuals—a badstarting position for the upcoming selection. Therefore, we enforce that each rule isinitialized with a valid set of parameters.17

For purpose of illustration, take a rule R(x1, x2) with x1, x2 œ R+ that requiresx1 Æ x2, for example an indicator that is active if a stock’s price lies in the range[x1, x2]. Instead of demanding a strict dependency between parameters, which wouldcomplicate the design of genetic operators, we circumvent this problem by requiringmerely a valid initialization of each individual rule. Harmful mutations may still

17In the implementation, each rule is a new class which inherits from an abstract class thatrequires the new rule to implement a method, defining how valid instances of this rule are initialized.

33

Page 42: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

occur in subsequent generations, but the initial population, if large enough, shouldprovide enough diversity to build upon.

3.3 Testing Market E�ciencyThis section explains how the genetic encoding is used to test the informatione�ciency in financial markets. It aims to provide theoretical justification for thevalidation methods that are applied in the analysis and draws on practical experiencefrom previous studies. Moreover, it presents the technical indicators that we use asthe building blocks of the trading strategy we apply on the betting exchange data.

3.3.1 Validation

Most importantly, we use a validation framework that separates the data on whichthe strategies are optimized, from the data on which they are tested; after all, weare interested in profitable trading rules that generalize to unseen data. Using ahold-out validation set allows us to trace the performance of the genetic algorithmover the course of generations while limiting the risk of overfitting. For example, onthe training data we would definitely expect to see a performance improvement as weproceed from one generation to the next, since individuals are evaluated and selectedbased on the training data. But only if the performance on the test set improves,there is reason to believe that the solutions generalize to unseen data. Therefore, itis mainly the test performance that matters for the discovery of potential marketine�ciencies.

Furthermore, we do not use the complete training data for the evaluation andselection of rules in every generation, but only a sample of it, to ensure that individualrules do not overfit to the training data as well. Thereby, we intentionally increase thebias in the population as individuals are selected on the basis of less evidence; this,however, is expected to decrease the variance of the test performance in exchange.The idea is that there might be individuals who capture idiosyncrasies of the trainingdata and consequently have an overestimated selection probability. By samplingfrom the training data it becomes more likely that individuals who survive overthe course of generations have more capacity to generalize to new data—a built-inmeasure to cope with overfitting during training.

The following procedure is not strictly a validation technique, but it aims atdecreasing the high variance of returns that we observe in our data. A unique featureof betting markets is that investments are liquidated at the end of a match, whichis a relatively short life span for an asset. The liquidation of a single bet is total,

34

Page 43: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

meaning that either a profit is made, or the complete stake is lost. As a consequenceof these extreme market movements, it becomes increasingly hard to decide whethera trading strategy is successful on average. For example, a single bet on a longshotmay happen to outweigh a strategy with many small wins. In comparison, a lossin financial markets typically means that assets are sold at a lower price than theywere previously bought at—moves that are relatively small in comparison to thedynamics of betting odds. However, the special structure of a betting exchangeallows a bettor to wager against an outcome, which can be thought of as a way to sella bet before its liquidation at the end of a match. We take advantage of this propertyby placing counter trades at random points during the subsequent ten minutes of amatch, after the trade was entered. In other words, for each entry we use a randomexit strategy to reduce the variance in expected returns.18 The intuitive reasoningbehind random exits is that we assume the market to be e�cient most of the time,but try to find market ine�ciencies through entry strategies alone. Alternative exitstrategies can be, for example, “stop-losses” or “take-profit” rules that are designedto place a counter trade at a specific level relative to the odds that the trade wasentered at. As a consequence of the random exit strategy, it is possible that identicalsolution candidates, even though making the same trades, have a di�erent fitnessvalue; however, due to the approach of unique elitism (see Subsection 3.2.2), wemake sure that only one individual is placed in the elite, but we compute its fitnessas the average fitness of all of its instances.

Thus, the validation approach of this study contains three components. First, asplit into training and hold-out data favors an unbiased test performance. Secondly,sampling in each generation further protects against overfitting to the training dataduring optimization. Finally, a random exit strategy is employed to reduce thevariance of expected returns.

3.3.2 Technical Indicators

In this study, we use technical rules, inspired by popular indicators from the field offinance, as the building blocks of trading strategies. The choice of possible indicatorsis vast and therefore we choose a small set of popular rules that have been appliedin previous studies and that appear to be applicable to the case of betting markets.

Before the indicators are presented in turn, there are two small remarks to make.First, note that the indicators, in the way they are presented, only work for one side

18Another advantage of this scheme is that it allows us to actually compute the Sortino ratio. Ifwe waited until the end of the match, the negative return of a bet would always be -1 (the completestake) and thus the variance of negative returns would be zero, resulting in an infinite Sortino ratio.

35

Page 44: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

of a bet, namely for betting on the victory of a team (backing). For laying a team, itrequires that instead of the backing odds Ê, the inverse odds 1

1≠ 1Ê

are used, and thatthe variables we denote by “back” and “lay” are swapped. Secondly, in the followingwe introduce subjective choices for the range of parameters; these choices mostly relyon plausibility arguments and were selected in advance to the analysis.

Exponentially Weighted Moving Average (EMA) Crossover

The EMA crossover for irregular time series (Eckner, 2012; Müller, 1991) comparestwo EMAs with di�erent exponential decay factors for past observations. The rulebecomes active if one EMA exceeds the other by more than a relative threshold, andtherefore this indicator aims to capture dynamics in the movement of odds averagedover two di�erent weighted irregular intervals

REMA(–1, –2, —) =A

EMA (–1)EMA (–2)

≠ 1 > —

B

, –1, –2 œ [10, 1000], — œ (0, 3] .

The EMA at time t on observations y = {y1, y2, . . . , yN} is computed as

EMAt(y, –) =

Y_]

_[

y1, t = 111 ≠ e

≠ �t–

2yt≠1 + e

≠ �t– EMAt≠1(y, –), t œ {2, . . . , N}

where – controls the exponential decay and �t denotes the time di�erence fromyt≠1 to yt in an irregular time series. The rule REMA is parametrized by two decayfactors –1, –2 and one threshold —. We limit the possible range of values for thedecay factors to positive values of up to 1000.19 The threshold — denotes the relativedi�erence by which one moving average must exceed the other for the rule to becomeactive and we restrict it to the interval (0, 3]. During initialization and standardmutation, the parameters are sampled uniformly from the respective interval.

“-Filter

The second indicator stems from the class of filter rules (Alexander, 1961) thatbecome active if, in a time interval of m observations, the decimal odds decrease bymore than a given percentage from a previous high:

RFLT(“, m) =Q

amax

i=0,...,m(Êt≠i)

Êt≠ 1 > “

R

b, m œ {1, 2, . . . , 1000}, “ œ (0, 0.2]

19 The e�ect of varying decay factors is di�cult to explain on an intuitive level, because itsimpact on the EMA is influenced by the values in the time series as well as by the time di�erence inbetween them. Figure A.1 (included in the appendix) provides a feeling for varying decay factors.

36

Page 45: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

where Êt denotes the current odds (i.e., the last traded odds) and Êt≠i the oddsi seconds ago. Again, for initialization and mutation the parameters are drawnuniformly from the respective alphabet.

Weight of Money (WOM)

The WOM is based on the volume balance of the order book for which it comparesthe currently unmatched volume that is placed on a team to win (Vback), with theunmatched volume that is placed against it (Vlay). The rule becomes active, if theratio exceeds a given threshold ”

RWOM(”) =A

Vback

Vlay≠ 1 > ”

B

, ” œ (0, 10] .

The reasoning is that, all other things being equal, the market would be expected tomove in the direction of larger demand. For example, if there is three times moreunmatched volume in favor of a team than against it, the above reasoning wouldexpect the backing odds to drop, because more people are ready to back the team atsmaller odds, than to lay the same team at larger odds. The volume is computedonly for orders that fall into a limited odds range around the current market odds,since otherwise the weight could be very sensitive to large orders that are placedat unrealistic odds. A peculiarity of our data is that odds move in discrete stepsthat are predefined and depend on the current odds. Consequently, we compute thevolume on a specific side as the sum of volumes over the three closest odds steps.

Table 3.4 illustrates how the weight of money is computed. In this example, thevolume is computed as Vback = 100+400+300 = 800 and Vlay = 100+100+200 = 400respectively, and the weight of money WOM = 800

400 = 2 would estimate the demandto back the team to be twice as large as the demand of betting against it. Theparameter ” is drawn from a truncated exponential distribution20 with support (0, 10],to ensure that most individuals are initialized with a volume balance that is relativelyclose to zero.

Pre-match Favorite/Longshot

This rule is inspired by the previously discussed favorite-longshot bias (Subsec-tion 2.1.2), which according to recent studies appears to be less pronounced inbetting exchanges (Smith, Paton, et al., 2006; Franck et al., 2010; Smith andWilliams, 2010); but it is interesting nevertheless, because it may have an influence

20 An example for the distribution is shown in Figure A.2 in the appendix.

37

Page 46: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

back odds lay- 5.7 150- 5.6 200- 5.5 100- 5.4 100

100 5.3 -400 5.2 -300 5.1 -

Table 3.4: Hypothetical order book representing the unmatched volumeat di�erent odds steps. The last traded (backing) odds are representedin bold. If there were volume on both sides of a row, the correspondingorders would be matched.

on the betting behavior in the course of a match.21

RFavLong(x1, x2) = (x1 < Êpre < x2) , x1, x2 œ [1, 10] (3.4)

The indicator becomes active if the pre-match odds Êpre (measured right beforekicko�) fall into the interval [x1, x2]. Again, the parameters of this rule are drawnfrom a uniform distribution sampling from [1, 10]. For example, clear favorites areexpected to have small odds, approximately in the range [1, 1.5].

In a nutshell, the used indicators represent di�erent techniques to capture marketdynamics during the in-play period, or the static role of a team as in the favorite-longshot rule. We intentionally keep the rules and their parameters relatively openfor the optimization to find its own way. Yet, we want to point out that the encodingallows domain knowledge and subjective beliefs to be easily incorporated into theoptimization by the choice of rules and parameters. Furthermore, although all ofthe presented indicators are based solely on historical information about odds andvolumes, our optimization framework is easily extended to incorporate other sourcesof information such as in-play events.22

3.4 SummaryThis chapter explained our choice for an evolutionary algorithm as well as its designthat, based on theoretical considerations, shall support the search for potential

21For instance, Choi and Hui (2014) report an overreaction of the market to goals scored byunderdogs and an underreaction to goals scored by favorites.

22 For instance, events can be represented as indicator rules that evaluate to one if the event hashappened (or is active) and to zero otherwise.

38

Page 47: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

information ine�ciencies in financial markets. Primarily, we defined a rule-basedgenetic encoding that selects rules (together with their parameters) as the fundamentalunits of inheritance in a genetic algorithm. Individuals are evaluated based on theSortino ratio—a metric that estimates the risk-adjusted return—and selected forreproduction via tournament selection. Shu�e crossover recombines partial solutionswithout introducing biases, while a choice of three mutation operators aims tosupport the exploration of the search space. Elitism, on the other hand, targets theexploitation of good solution candidates. Further, for testing market e�ciency, wedefined a validation strategy that employs a hold-out set and introduces samplingduring training to cope with the problem of overfitting. Finally, we described thefinancial and domain-specific indicators that constitute the elementary buildingblocks of the trading strategy which we put to the test during the main analysis.

On the other hand, for the chosen encoding we exposed two deficiencies whichlimit the expressiveness of trading strategies. The fixed chromosome size restrictsthe set of possible rules to those provided by the user. Further, the assumption ofuniform weights implies that all rules have the same voting power.

Being aware of the advantages and limitations of the employed method, we arenow armed with a better understanding of evolutionary algorithms in general andwith regard to the problem at hand, and therefore proceed with the description ofthe data and the empirical analysis.

39

Page 48: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes
Page 49: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

4. Data

The previous chapter explained the workings of evolutionary computation in generaland how we adapted an evolutionary algorithm for the problem at hand, that is,the search for information ine�ciencies in betting markets. This chapter provides abrief description of the data; in particular, it explains how the data was preprocessedand how it is used in the simulation of trading strategies. Moreover, the goal of thischapter is to find, understand, and address the peculiarities of the data, to ensure asu�cient quality of information for the upcoming empirical analysis (Chapter 5).

In the course of the analysis, we will make use of two di�erent datasets, thefirst of which is the main dataset containing the market information from a bettingexchange, whereas the second represents an auxiliary dataset that we only use in afirst step to verify the functionality of the optimization.

Betting exchange data

The main dataset was acquired from the betting exchange Betfair™ and it containsdetailed market information about the development of odds and trading volumes inthe context of football matches.1 In total, there are 9230 football matches available inthe data, covering the months of September and October 2017. Although the datasetcontains all types of bets that were available for these matches, we limit ourselves tothe “match odds” which simply express the odds on the victory (if backing) or loss(if laying) of a team; we restrict the focus to these types of bets because they aremost popular and therefore usually exhibit the highest market liquidity compared toother types of bets.

The available data captures the market information at a high frequency of 50milliseconds, making it particularly interesting for the analysis of in-play periodswhen there is substantial trading activity. More concretely, the data for every matchconsists of a stream of messages with information about the current state of themarket as well as about changes in the order book. The market state contains staticinformation such as the starting time of the match and information surrounding the

1 Datasets are available at http://historicdata.betfair.com.

41

Page 50: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Key Description

pt Published time, i.e., the time when the message was published.openDate The scheduled start date and time of the event.status The status of the market (e.g., ’open’, ’suspended’, ’closed’).inPlay Whether the match is currently in play.betDelay Number of seconds an order is held before it is submitted into

the market.marketBaseRate The (maximal) commission rate for this market.runners Information about the teams, including their name country,

and status (active, winner, loser).ltp Last traded price of a team, i.e., the most current price at

which opposing orders were matched.tv Traded volume, i.e., the total amount of money that has been

matched on a team.trd A list of tuples (odds, vol), representing the volume that was

recently traded at given odds.atb, atl Available to back/lay; a list of tuples (odds, vol) that represent

the changes of available volume at given odds.

Table 4.1: Description of relevant fields in market messagesof the betting exchange data. A complete specification ofvariables can be found on https://historicdata.betfair.com/Betfair-Historical-Data-Feed-Specification.pdf.

teams, but also dynamic information about the bet delay, whether the market iscurrently open for betting, and whether the match is in play. With respect to theorder book, messages inform about the last traded price (i.e., the most recent priceat which opposing orders were matched), the total volume that has been tradedon a team, as well as the change of available volume at any odds. Therefore, thereis su�cient information to reconstruct the order book in the course of time at agranular level. A more detailed description of relevant fields in the data is presentedin table 4.1.

Figure 4.1 illustrates the market movement based on a match between Chelsea F.C.and Leicester City F.C. played on September 9. 2017. The lines show the progressionof implied probabilities, while the traded volume across all outcomes is representedby bars below. Clearly visible are the shifts of the implied probabilities in responseto the three goals in this match, which Chelsea won 2:1. Further, it can be observedthat the traded volume varies significantly, with the peaks indicating a matchedvolume of 42000 Euro in a single market message. In total, the traded volume ofthis market exceeded 2.6 million Euro.

42

Page 51: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Figure 4.1: Progression of implied probabilities and delta of tradedvolume across all outcomes during a match between Chelsea F.C. and Le-icester City F.C., which was won 2:1 by Chelsea. The peaks of tradedvolume represent an amount of approximately 42000 Euro.

Bookmaker data

The auxiliary dataset contains a time-series of pre-match odds across 16 di�erentbookmakers; it was collected over a period of five months, ranging from February toJune 2017. We do not, however, use the information of individual bookmakers, butlimit our analysis to an aggregated sample that contains only the best closing oddsacross bookmakers. In other words, for every outcome in every match, we choosethe bookmaker that o�ers the highest odds right before kicko�. Even though it isunlikely that the best odds are always available, it gives us an optimistic baseline tocompare against the odds on betting exchanges.2

4.1 PreprocessingThe data across bookmakers requires no further preprocessing, thus, in the following,we refer only to the preprocessing of the betting exchange data. The goal of thepreprocessing is to keep only those matches with su�cient liquidity, a defined endresult, and a complete in-play period. As a consequence, this forces us to delete alarge share of the data, such that we are left with 4403 of the original 9230 matches.

Most importantly, we constrain our analysis to in-play data, because this iswhere the market is most dynamic and is supposed to attract most traders. Weconjecture that the in-play period possesses the highest potential for informationine�ciencies to occur, as there is a rapid flow of new information to process bothwith respect to the activity on the field as well as in the market. In total, there are1779 matches that appear no to be finished and 873 matches where there is missing

2 For example Kaunitz et al. (2017) describe how individual bookmakers attract new bettorswith enticing odds, but thwart the possibility to trade su�cient amounts on these opportunities.

43

Page 52: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

information about the in-play period, all of which are filtered out. Furthermore, thereare 1523 matches with ambiguous information (mostly duplicates that fall underdi�erent regulators than internationally traded markets) that we also exclude fromthe analysis. Finally, there are 652 matches for which there is no trading activity onat least one outcome before the in-play period, indicating that there is insu�cientliquidity in these markets; therefore, we choose to exclude these matches as well.

Figure 4.2 explores the liquidity, approximated by the sum of traded volumeon all outcomes of a match, across all remaining matches. It is important to pointout that the visualization uses a logarithmic scale because of the highly skeweddistribution of trading volume. In total, 50% of all matches exhibit a trading volumeof less than 17100 Euro, while for the top 10% there is more than 203400 Eurotraded. Moreover, it stands out that a large share of matches exhibit little liquidityas there is less than 1695 Euro traded volume for matches in the 10% quantile; yet,we choose not to exclude these matches since we are checking for su�cient liquidityduring the simulation of trading strategies anyway. On average, 78.3% of the overallvolume is traded during the in-play period, supporting our previous assumption ofincreasing trading activity after kicko�.

Apart from the elimination of matches that do not fulfill the above criteria, wechoose not to transform the data in any other way; in particular, we do not resamplethe data at a regular frequency, but keep the data as a stream of messages aboutmarket changes occurring at unevenly spaced intervals. As a consequence, we canavert potential biases that the resampling of unevenly spaced financial data canintroduce (Gençay et al., 2001). Although this also implies that we have to dispensewith many of the classical methods from time-series analysis, the trading rules thatwe chose to include do not depend on equally spaced observations (Subsection 3.3.2).

4.2 Simulation

We simulate the historical data in order to validate whether, in response to a buysignal, there is su�cient volume available to execute a trade. In the following, wedescribe the simulation in the case of a single match.

Starting from the first in-play message, we stream the market change messages,while keeping track of the current state of the market and updating the orderbook with the new information. After every message, the updated information iscommunicated to each strategy (i.e., every individual in the current population),which in turn may respond with a buy signal. In case of a buy signal, if the market is

44

Page 53: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Figure 4.2: Distribution of the logarithm of traded volume acrossmatches. Note that the vertical axis does not correspond to relativefrequencies of the bins, but to the kernel-smoothing densities for whichthe values integrate to one.

open3, a pending trade is initialized, waiting until the bet delay has passed.4 Then, ifthe market is still open and the requested volume is available at the current marketprice (i.e., the last traded price), the trade is finally executed. If the volume is notavailable, we keep the order in the market for a short period of two seconds, afterwhich the order is canceled, if it could not be matched completely. In other words,we place a limit order with a timeout—a type of bet that is also available throughBetfair’s API.5

Finally, it is possible to exit a trade by betting on the opposite outcome asdescribed in section 3.3.1. Since a random exit strategy is used, we do not checkthe availability of the exit, but merely execute it at the respective last traded price.After a trade is executed in response to the buy signal of a trading strategy, there isa cool-down period of 60 seconds during which this strategy cannot send anotherbuy signal, in order to prevent the excessive application of a single rule in a shortperiod of time.

The requested volume is based on a proportional staking strategy (Hausch et al.,2008), such that a relatively small stake is placed on events with large odds, and vice

3 Alternatively, a market can be suspended or closed. It is usually suspended for a short period ofup to two minutes after the occurrence of substantial events such as goals, penalties, and red-cards.Markets turn closed after a match has finished.

4The bet delay is enforced by Betfair during in-play periods, to prevent an unfair advantage forlive spectators of a match. Usually it lies between 5 and 12 seconds, depending on the country.

5Note that a limit order should buy at the specified price or better; however, even if a betterprice is available, we execute the trade at the specified price, to have a pessimistic benchmark.

45

Page 54: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

versa. We fix the maximal stake at 10 Euro for an event with odds of 1—i.e., anevent that is certain to happen, in terms of the implied probability. Proportional tothat baseline, we compute the stake (as well as the counter stake) as

s = 10Ê

.

Thereby, we restrict the maximal stake size and limit the risk of a long series of losseson improbable events. Consequently, in combination with the cool-down period, astrategy cannot risk more than 10 Euro per minute on a single event.

It is important to point out that our simulation by no means represents a complete,optimized trading system. For example, it has the disadvantage that trading rulescan only react upon market changes, but even though the system does not tradein between messages, the updates are so frequent that this probably does not havea practical significance. Further, we do not account for the latency that may beintroduced during the communication and computation processes. Finally, in thisstudy we merely optimize the entry, which constitutes only one part of a completetrading strategy; for other parts, such as the pricing, position sizing, exit strategy,and control mechanism of algorithmic trading systems, our testing mostly relies onplausible heuristics. To be explicit, we use a random exits, limit orders with a twosecond timeout, a cool-down period of 60 seconds, pricing based on the last tradedprice, and a proportional position sizing. In any case, a backtest on historical datadoes not replace live testing, but merely provides a first step in the assessment of atrading strategy.

Parallelization

The described procedure generalizes to the case of multiple matches, which can beprocessed in parallel, since matches can usually be considered independent of eachother.6

In general, evolutionary algorithms allow for the parallelization of many of itssub procedures, but it depends on the problem which parts of the optimization aremost time-consuming and therefore most worthwhile to parallelize. In our case, thecomputation of fitness values is most expensive, because each strategy needs to beapplied on a relatively large number of historical matches. Unfortunately, as the sameinformation is repeatedly read, the backtesting is largely bound by input/output

6 This may not be true in the case of decisive matches that are played simultaneously, suchas qualification rounds in a tournament where the performance of one team may influence theperformance of another. However, most of the matches in our data are league matches for whichthese cases are rare.

46

Page 55: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

operations which therefore constitute the main bottleneck. Therefore, we process amatch only once per generation and concurrently apply all strategies, while collectingthe resulting trades in a centralized queue. Hence, this allows us to parallelize theevaluation of k matches across k processors.

4.3 SummaryThis chapter described the two datasets that we use in the analysis and pointed outtheir peculiarities. The auxiliary dataset contains the best pre-kicko� odds across16 bookmakers and it represents an optimistic benchmark for the odds o�ered intraditional betting markets. Secondly, the betting exchange data provides insightsinto the in-play football betting market at a high frequency. Through the simulationof the exchange data we intend to validate that there is su�cient volume availableto execute a trade in response to a buy signal. Moreover, the simulation mimics analgorithmic trading system that relies on various settings and heuristics that are notinfluenced in the optimization, but determined in advance.

The next chapter proceeds with the analysis of the datasets, based on thepreprocessing and simulation steps that were discussed in this chapter.

47

Page 56: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes
Page 57: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

5. Empirical Analysis

Now that we have explained our approach and introduced the data, we turn to theanalysis, which aims to test the functionality of the optimization and whether thevalidation strategy is supported by empirical evidence. Furthermore, we investigate ifthe optimization can discover viable trading strategies in the in-play football bettingmarket based on the technical indicators we have introduced in Subsection 3.3.2.

The empirical analysis is divided into three parts. First, we validate the function-ality of the optimization on a dataset with known properties; in particular, we testwhether the system is able to identify the favorite-longshot bias in the kicko� oddsof traditional bookmakers. Secondly, we proceed with the main analysis, examininghow the optimization performs using financial indicators for the rule discovery withhigh-frequency data from a betting exchange. Finally, we summarize the results anddiscuss the observations in a more general context.

5.1 Verifying the Favorite-Longshot Bias

This section aims to test the basic functionality of the optimization framework for thesimple task of identifying the favorite-longshot bias in the odds across bookmakers.First, we verify the existence of the favorite-longshot bias through an explorativeanalysis, and secondly apply the optimization on the bookmaker data for which weexpect to see a significant favorite-longshot bias. But the question is, whether theoptimization can detect the bias on its own—a sanity check of its performance.

Note that we discard all draws for the analyses of this section, because the focuslies on the identification of the favorite-longshot bias, which might be obfuscated ifwe were to include draws. Additionally, in all of the following examples we considera deduction of 5% from profits for both datasets, representing a realistic tax-rate orcommission respectively.

49

Page 58: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Explorative Analysis

The left table in Table 5.1 illustrates the presence of the favorite-longshot bias inthe data across bookmakers. The table divides the odds of all events proportionallyinto ten di�erent odds intervals, such that every bin contains approximately tenpercent of all events (equal-depth binning), and it shows that the average returnon bets with smaller odds is significantly higher than for those with larger odds.The favorite-longshot bias does not manifest itself for every pair of bins, but it isclearly visible if we compare the average return of bets on extreme longshots (eventswith odds larger than 6.75) with the average return that we observe for smaller oddsgroupings. Moreover, we notice that a bettor, who wagers the same amount on everymatch, is expected to lose 5.7% of his stake with every bet on average.

The right table applies the same procedure to the betting exchange data, forwhich the favorite-longshot bias appears to be less pronounced. One can observethat the overall average return of -6.1% is somewhat smaller than for the bookmakerdata, but the di�erence seems relatively small considering that we are comparing itwith the best odds across bookmakers. Further, it appears that the average profitis more comparable across bins than in the left table, even in the case of extremelongshots. This indicates that the favorite-longshot bias is less pronounced in bettingexchanges than in the odds o�ered by traditional bookmakers.

It is important to note that we do not use the last traded odds as a proxy forthe odds before kicko�, but compute the odds at which a minimum volume (i.e., aminimum stake size) smin is available for backing. This approach is more precise,because it is based on the information that is contained in the order book; the lasttraded odds would overestimate the available odds, since the former state a price thathas already been matched, and therefore is not available anymore. smin is chosensuch that a winning bet at any odds would result in approximately the same profitof 1 Euro

smin = 10.95 (Ê ≠ 1)

which we get by rewriting Equation 2.2 in terms of the stake. For example, onewould have to stake approximately 105.26 Euro at odds of 1.01, or 0.12 Euro at oddsof 10, to receive a potential profit of 1 Euro respectively.1 However, for the bettingexchange data the results are variable with respect to the stake size smin, because inorder to stake a larger quantity, one often has to accept less favorable odds. Using

1Although this becomes practically infeasible for odds larger than 100, since one cannot stakeless than one cent, we use the simplifying assumption that it would be possible as this does nothave a substantial e�ect on the results. The reasoning is that there are only few events priced thathigh before kicko�: in our data, these account for less than 0.3 percent of all matches.

50

Page 59: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

count mean std

[1.01, 1.55] 4895 -0.011 0.590(1.55, 1.83] 4768 -0.049 0.824(1.83, 2.13] 4809 -0.020 0.969(2.13, 2.4] 4730 -0.021 1.097(2.4, 2.75] 5000 -0.036 1.216(2.75, 3.18] 4596 -0.031 1.355(3.18, 3.75] 4824 -0.100 1.477(3.75, 4.75] 4983 -0.070 1.707(4.75, 6.75] 4619 -0.030 2.072(6.75, 81] 4758 -0.205 2.852

overall 47982 -0.057 1.546

count mean std

[1.01, 1.53] 906 -0.060 0.579(1.53, 1.84] 878 -0.063 0.823(1.84, 2.11] 896 -0.069 0.967(2.11, 2.39] 865 -0.024 1.091(2.39, 2.71] 878 -0.048 1.206(2.71, 3.14] 920 -0.103 1.318(3.14, 3.69] 850 -0.082 1.475(3.69, 4.58] 911 -0.037 1.702(4.58, 6.59] 841 -0.037 2.049(6.59, 390] 859 -0.086 3.365

overall 8804 -0.061 1.629

Table 5.1: Odds groupings and their statistics for both datasets, thebookmaker data (left table) and the exchange data (right table). Theintervals were created with equal-depth binning, such that every bincontains approximately ten percent of all events (excluding draws). Forthe exchange data we removed two events that did not have enoughavailable volume to match the desired profit smin = 1.

smin = 10 we get an overall average return of -6.7%, and using smin = 100 furtherreduces the return to -10.8%.2

Verifying the basic functionality

Next, our goal is to let the system itself search for the bias given minimal informationabout its existence. For this task we use a trading strategy that consists of a singlerule RFavLong (Equation 3.4). The rule becomes active if the kicko� odds of an eventfall into the range [x1, x2] for which we sample the bounds x1 and x2 uniformly fromthe interval [1, 10] to incorporate as little information as possible.3 If the parametersof a solution candidate encompass large odds, for example if its left bound x1 > 5 (animplied winning probability of less than 20%), then the individual represents a rulethat bets on longshots. With respect to the favorite-longshot bias, we would expectthat the optimization gradually moves into a lower odds range, where the averageperformance is assumed to be better. As a fitness function we use the average returnas described in Equation 3.2, because it allows us to draw a relation to the size ofthe bias that we observed in the explorative analysis. Furthermore, we penalizeindividuals that bet on fewer than one percent of all events, to guard against rules

2 The respective tables are shown in Table A.1 in the appendix.3 We exclude events with odds larger than 10, since there are relatively few (4.2% of all events)

and the explorative analysis showed that the average return in this interval is comparably low.

51

Page 60: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Parameter Value

number of generations 30population size 100elite size 10sampling fraction 30%tournament size 3crossover rate —mutation rate 5%vicinity mutation rate 20%flip mutation rate —fitness metric average return per trade

Table 5.2: Parameter settings for the optimization exploring the favorite-longshot bias.

that specialize on a narrow odds range for which there are too few trades to deducegeneralizable conclusions.4 The optimization parameters are listed in Table 5.2;notably, crossover and flip-mutation are not active, because we use only a single rulein this strategy.

Figure 5.1 presents the results of the optimization using the bookmakers’ odds.The upper plot tracks the average fitness at the end of each generation for thecomplete population (blue line) as well as for the elite (green line).5 Additionally, thered line tracks the average fitness of the elite on a hold-out set which does not influencethe evolution of individuals, but helps us in assessing the generalizability of the elite.As we would expect, the fitness of the overall population increases initially, indicatingthat in the course of the optimization better individuals become more prevalent,while worse individuals tend to die out. The elite training performance is consistentlybetter than the population’s overall fitness, because the elite represents the subset ofbest performing individuals in the current generation. The test performance seemsto oscillate around an average return of 0% from the eighth generation, suggestingthat the optimization converged around that time. Since the test performance iscomparable to the training performance, the results appear to be generalizable. Bycloser inspection we observe that exceedingly optimistic results, as for example thetraining performance in generation 12, are often followed by negative swings—aconsequence of the sampling procedure, as we shall later see. Overall, the performanceseems realistic compared to the results from the previous table, considering that weallow for a smaller interval in this case; yet, we have to keep in mind that we are

4 The penalty corresponds to the term „min in Equation 3.3.5 More concretely, we use the average fitness over the valid population, leaving out penalized

individuals from the computation, because their fitness was set to minus infinity. However, thenumber of invalid individuals rarely exceeds 30% of the population and therefore we assume thatthe average fitness is a reasonable measure for the overall performance.

52

Page 61: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Figure 5.1: Development of the optimization over the course of 30 gener-ations using the bookmaker dataset. The training and test performancesare visualized in the upper chart, while the development of parametersis shown in the lower chart.

looking at an optimistic set of best odds across bookmakers.With regard to the favorite-longshot bias we turn to the bottom plot, showing

the development of the populations’ average left and right bounds over time. Wesee that the bounds quickly converge to a relatively low odds range, approximately[1.1, 1.5], indicating that the optimization is successful in finding low odds rangesto be more profitable than large odds, consistent with our expectation about thefavorite-longshot bias. One should note that the average bounds seem to cross, or atleast touch, at some points, but this can be explained by the property of the averagebeing sensitive to outliers; in fact, further analysis revealed that the bounds stayrelatively constant after only a few generations.

Figure 5.2 provides a closer examination of the search space. In the left chartone can see the initial population where individuals are spread evenly throughoutthe search space, from which their parameters were sampled uniformly. There are noindividuals northwest of the separating black line as a consequence of the conditionthat we required x1 < x2 for the bounds in the initial population, to prevent anabundance of invalid rules. Furthermore, solution candidates that lie close to theseparating line (i.e., rules that bet on a narrow interval) are frequently invalid,because they execute too few trades and are therefore penalized. An important

53

Page 62: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Figure 5.2: Comparison of the initial and final population in the searchspace which is represented by the parameters of the favorite-longshotrule. Intermediate steps of the optimization are shown in Figure A.4which is included in the appendix.

observation is that the elite in the initial population already clusters around relativelylow odds—the origin of the early convergence that we observed previously. On theright hand side one can see the final population where almost all solution candidatescluster around the elite at very low odds, while a few outliers represent mutationsthat are usually harmful.

Based on these results, we suggest that the evolutionary process was able toidentify the favorite-longshot bias. Nevertheless, one should also note that thestochastic nature of the algorithm does not guarantee convergence, even if it isrelatively likely as in this simple example.

Coping with overfitting

Above, we have shown the results of a reasonably good optimization. In the following,we explore how the sampling procedure helps to cope with the problem of overfitting.In particular, sampling could allow us not only to assess the generalizability of thefound strategies in hindsight, but also to decrease the risk of overfitting alreadyduring the optimization.

Again, we are using the best odds across bookmakers, because with the presenceof the favorite-longshot bias there is a signal we aim to detect—a baseline we canmeasure against. For the comparison we re-run the optimization without the help ofa sampling procedure. The results of a single experiment are contrasted in Figure 5.3,where the left plot shows the optimization curves we saw previously. In the rightplot we observe that, without sampling, there is a tendency towards overfitting in

54

Page 63: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Figure 5.3: Comparing a single optimization with and without sampling.

the course of the optimization: while the training performance of the elite improvesconsistently, the test performance starts to degrade as the rules adjust too specificallyto the peculiarities of the training data, even though it is considerably large. Forthe population’s average fitness, the problem of overfitting seems less pronounced,because the population is subjected to a substantial amount of changes from geneticoperations leading to the observable variability.

On the other hand, the sampling procedure potentially increases the bias ofeach generation, because we use fewer matches to assess the performance of eachindividual. Strikingly, the sampling results in a significant increase in the volatilityof the training performance of the population and elite, as one can see in the leftchart. This indicates that the elite may adjust too strongly to the sample of eachgeneration and that the population becomes very similar to the elite in the course ofthe optimization (the latter being an indication of a lack of diversity). In fact, this isa potential drawback of sampling, because an elite that adjusts too strongly to thesample at hand, bears the risk of preferring exceptional but unstable solutions overgood but more general ones. Therefore, it might be sensible to introduce a strategythat supports good solutions with a history of stable performances.6 Based on theobservation that the test performance without sampling tends to improve until acertain level, another conceivable strategy against overfitting would be to use “earlystopping”, i.e., to terminate the optimization as soon as the test performance ceasesto improve for a variable number of generations.

The above results were based on a single experiment, but to estimate the statisticalsignificance, we repeat the optimization ten times with di�erent random seeds. Theresults of those experiments are presented in Figure 5.4, showing the average fitnessin each generation across the ten experiments. The error bars represent one standard

6 We have experimented with simple heuristics that “protect” previous elitists whose performancedoes not decline in the subsequent generation, however, this did not significantly enhance the overallstability of the optimization, but only delayed the fluctuations by one or two generations.

55

Page 64: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Figure 5.4: Aggregation of ten experiments with and without sampling.Round markers track the average fitness of the population and elite testperformance respectively, while error bars depict one standard deviation.

deviation, computed across the performances of the experiments of the respectivegeneration. With sampling, the elite test performance seems comparable to theaverage fitness of the population, whereas without sampling the test performanceseems to degrade in the course of the optimization. Notably, the variation isconsiderably higher without sampling, because it depends on the similarity of thetraining and test sets.7 Therefore, sampling appears to be an e�ective measure toreduce the variance across experiments, and thus can enhance the generalizability ofthe results.

Further, we check whether the test performance in the last generation is signifi-cantly better with than without sampling, by using a t-test for paired samples.8 Thenull hypothesis states that the average test performance in the last generation isidentical with and without sampling. The t-statistic turns out to be 1.886 (p-value of9.19%), which indicates that we cannot reject the null hypothesis at a 5% confidencelevel. Therefore, there is not enough evidence to argue that, in the last generation, thetest performance is significantly better with than without sampling.9 Nevertheless,this seems to be related mostly to the high variance of the experiments withoutsampling, and therefore we still prefer to include the sampling procedure for theupcoming experiments, based on the observation of improved generalizability andthe increased risk of overfitting for strategies with a larger number of parameters.

Summarizing, we provided empirical evidence, showing that the optimizationframework is able to identify the favorite-longshot bias in the best odds across

7 If, for example, the training and test sets were equal, then the test performance would improve,even if the optimization overfits to the training data.

8 We use a t-test for paired samples, because the same random seeds are used for the experimentswith and without sampling. Therefore, we can pair those measurements that are taken on the sameset of matches and generations.

9 We provide the t-statistics for all generations in Table A.2 of the appendix.

56

Page 65: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

bookmakers. Furthermore, we demonstrated that the problem-specific design of theevolutionary algorithm is e�ective in three ways: first, it allows to limit the numberof invalid individuals in the initial population; secondly, the search space can berestricted by a subjective choice for the parameter range; third, the generalizability ofthe results can be improved through a built-in sampling procedure. Additionally, weconfirmed observations of previous studies (Tetlock, 2004; Smith, Paton, et al., 2006;Smith and Williams, 2008) about betting exchanges exhibiting a less pronouncedfavorite-longshot bias—evidence that is based on information from the order book.Together with the finding that available odds in betting exchanges are relativelyclose to the best odds across bookmakers, this supports the idea of a higher level ofinformation e�ciency in betting exchanges compared to traditional bookmakers.

5.2 Rule Discovery with Financial Indicators

In this section we proceed with the application of the optimization framework on thebetting exchange data, but now consider the in-play period and extend the tradingstrategy to the set of financial indicators that we discussed in Subsection 3.3.2. Now,the goal is to test how the optimization performs in a more realistic setting, bychallenging the information e�ciency of Betfair’s in-play football betting market.

As a reminder, the strategy under investigation consists of a set of technicalindicators that we adapted to the properties of betting markets:

S(x) = RFavLong(x(1)) · RFLT(x(2)) · REMA(x(3)) · RWOM(x(4))

where each rule has its own set of parameters which in turn are restricted to a specificset of values. As a performance metric, we use the Sortino ratio with the reasoningthat it measures the risk-adjusted return and penalizes downside deviation. Further,It is worth mentioning that we raise the population size to 1000 individuals to accordfor the increased search space, and we penalize individuals who bet on fewer thanhalf of all matches, to incentivize rules to trade more frequently. Now that there aremultiple rules in the strategy, one can apply the crossover operator as well as flipmutations, and we choose to set the crossover rate to 30% and the flip mutation rateto 2%. Furthermore, on the initial population we apply flip mutations turning o�20% of all rules, to start with a more diverse structure. The remaining parametersare set as in the previous experiment.10

Figure 5.5 visualizes the performance development over the course of 30 gener-

10 The concrete optimization parameters are listed in Table A.3 of the appendix.

57

Page 66: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Figure 5.5: Optimization results with technical rules and the Sortinoratio as a fitness function. The upper plot shows the development ofthe average fitness, while the lower plot tracks the average net profit.

ations. The overall trend of the optimization appears encouraging, as the averagefitness, which we see in the upper plot, improves steadily across both training andtest set. Moreover, the test performance of the elite becomes comparable to theaverage fitness of the population, suggesting that we do not overfit to the trainingdata.11 Further, there appears to be less instability in the training performance thanwe have observed in the previous experiment; this may be related to more diversityin the population as a possible consequence of the smaller size of the elite in therelation to the population.12 The optimization appears to converge (possibly to alocal optimum) between generations 8 and 12, from where on the population seemsto become very similar to elite (notice the strong correlation), and its average fitnessappears comparable to the test performance.

With the question of how this translates into practical terms, we turn to the lowerplot. The Sortino ratio cannot be directly interpreted, because it is a dimensionlessmeasure, but its sign already implies a negative average return. We get a betterinsight into the practical significance through the net profit, illustrated in the lowerplot. Clearly, the initial population contains rules that are highly unprofitable,

11 This assumes that the training and test sets are su�ciently distinct, which is reasonableconsidering the size of the dataset now that it includes the in-play periods.

12 Previously, we used 10 elitists in a population of 100 individuals, while we now use the samenumber of elitists for a population of 1000.

58

Page 67: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Figure 5.6: Composition of rules in each population.

resulting in an average net profit of around -1200 Euro for a period of approximatelytwo weeks.13 In the course of the optimization, the net profit converges aroundbreak-even, suggesting that, based on the used indicators, no profitable trading rulescould be found. In fact, further analysis revealed that the loss decreases mostlydue to a reduction in the number of trades, which also seems to be an importantfactor for the choice of the elite in the first generation.14 Thus, we suggest thatno profitable strategy could be found and that the optimization instead focused onreducing the losses by favoring rules that trade less frequently, but at least 50% ofthe time to avoid the respective penalty. However, we still see that by optimizingfor risk-adjusted returns, the net profit also improves relatively consistently until itconverges.

As a last step, we analyze the composition of rules in the course of the optimization.Thereby, we can explore whether particular rules are associated with a betterperformance, or if certain types of rules appear to be harmful. Figure 5.6 illustrateshow, for each type of rule, the number of its occurrences develops in the courseof the optimization. Most notably, the filter rule RFLT almost completely vanishesfrom the population, probably because it tends to become active most frequently.15

Interestingly, all other rules remain in the population, though, this might as wellbe a local optimum at which the number of trades happens to coincide with theminimal required number of trades to avoid a penalty.

13 Two weeks, because we sample 30% of the training set, which in turn accounts for 80% of theoverall data covering more than 4000 matches in two months.

14 We compare the net profit with the number of trades in Figure A.3 of the appendix.15 It is reasonable to assume that the filter rule becomes active at least once in every match

where there occurs a goals, due to the resulting shift in the odds.

59

Page 68: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

5.3 Summary and Discussion

Finally, we review the results of our experiments, discuss them in a more generalcontext, point to limitations of our study, and provide suggestions for further research.

First, we confirmed the functionality of the optimization framework on the dataacross bookmakers, as well as in a more realistic setting with technical trading rules inthe in-play market of a betting exchange. Therefore, we were able to provide supportfor the theoretical decisions that flowed into the design of the evolutionary algorithm.With respect to the validation strategy, we demonstrated that sampling can improvethe generalizability of the strategies during the optimization. Secondly, we gainedfurther insight into the e�ciency of betting markets: we found that betting exchangesexhibit a less pronounced favorite-longshot bias than traditional bookmakers do,consistent with previous research (Section 2.1.2). We did not, however, uncovermarket ine�ciencies in the in-play market of the betting exchange on the basisof technical indicators, and therefore cannot reject the weak-form e�ciency of themarket under investigation.

Although we have focused on the special case of betting markets, it is conceivablethat some of our results may be applicable to other types of financial markets. Mostimportantly, the genetic encoding was based on theoretical considerations for theproblem of rule discovery in general, and is not limited to the special case of bettingmarkets. In this regard, we have discussed ideas for a sensible encoding and geneticoperators that were designed for noisy, stochastic optimization problems where goodsolutions are rare, invalid solutions are frequent, and where one should be able toincorporate subjective information and risk preferences. Further, we endorse theimplementation of a sampling mechanism—an idea that is applicable to other typesof markets as well; even if securities cannot be treated as independently as matchesin betting markets, or if the temporal structure of the data is desired to be leftunchanged, there still exist related techniques—such as walk-forward analyses—thatallow researchers to cope with the problem of overfitting during optimization. Finally,we have demonstrated that evolutionary algorithms support the interpretability ofthe results and therefore o�er possible insight on trading strategies from the outputof an optimization; for example, we were able to pinpoint types of rules that appearedto be particularly harmful. In conclusion, we suggest that the designed optimizationframework is not limited to betting exchanges, but may generalize well to other typesof financial markets.

Nevertheless, our approach also contains several weaknesses. First and foremost,the design of trading systems is a complex task, thus we have introduced a variety of

60

Page 69: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

simplifying assumptions and heuristics in the simulation of the market (summarizedin Section 4.2) as well as in the choice of trading strategies. Even though we havetried to use plausible choices and pessimistic estimations, it is still important topoint out that a backtest on historical data is not a replacement for a live tradingstrategy. With respect to the problem-specific design, we have previously notedthat the assumption of uniform weights as well as the fixed chromosome size bothlimit the expressiveness and therefore the possible degrees of freedom in the testedstrategies.

Further research may look deeper into the application of technical trading rules inbetting markets, as we have found a lack of research in this field, despite substantialwork in financial literature to build on. Moreover, there are several enhancementsof evolutionary algorithms one could consider: non-uniform weights that can beoptimized; a more flexible encoding of solution candidates (e.g., genetic programming);the design of a memory process to stabilize the performance in spite of the strong pulltowards exploitation through sampling and elitism; and a better initialization of validindividuals across multi-rule strategies. Hence, there remain both methodologicalas well as practical issues to solve, as the e�cient markets hypothesis remains anambitious task to tackle for both academics as well as finance professionals.

61

Page 70: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes
Page 71: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

6. Conclusion

In this study we explored the application of evolutionary algorithms for the searchof information ine�ciencies in financial markets. We explained why evolutionaryalgorithms constitute a sensible choice for the rule discovery in financial markets andpointed to the issue of finding a problem-specific design for this task.

In particular, we focused on investigating how evolutionary processes can improvethe search for market ine�ciencies; a task for which, based on theoretical considera-tions, we crafted an optimization framework on top of a genetic algorithm. In thescope of betting markets, we performed two experiments, the first of which verifiedthe system’s basic functionality; whereas the second, more realistic experiment useda strategy based on technical indicators to investigate the information e�ciency ofthe in-play market of a major betting exchange. Although we have not uncovered aprofitable trading strategy, the results of our experiments still provided insight intothe optimization process. Overall, the system was able to evolve better performingrules in the course of the optimization, and the generalizability of the strategies wasimproved through an integrated sampling procedure. Further, we demonstrated thatdomain knowledge and subjective beliefs can be incorporated to restrict the searchspace to specific, valid regions. However, we also noticed that sampling and elitismcan undermine the stability of the optimization and pointed out the limitations ofuniform weights and a fixed chromosome size that reduce the expressiveness of astrategy.

Even though our analysis was limited to the scope of betting markets, in ourdiscussion (Section 5.3) we suggested that the optimization framework is applicableto other types of financial markets, because the encoding of solution candidates,choice of genetic operators, flexibility of fitness functions, and utility of the validationstrategy were defined for the general problem of rule discovery; merely the selectionof rules was based on properties that are unique to betting markets. Thus, we providean extensible optimization framework that can be used for subsequent research inthe realm of market e�ciency.

With respect to the information e�ciency of betting markets, we presented

63

Page 72: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

supporting evidence for the present view that betting exchanges exhibit a lesspronounced favorite-longshot bias than is usually found in the odds of traditionalbookmakers. This observation was based not only on the matched prices, but also onthe reconstructed order book. In our review of the existing literature, we pointed toa lack of research on technical analysis in the context of betting exchanges, despitetheir similarity to financial markets where technical analysis enjoys a prominent role.

Finally, the search for market ine�ciencies remains a challenging task which amanual approach is unlikely to solve. Therefore, insights into systematic approaches,that can be geared to the problem and integrate domain knowledge, bear the potentialfor progress towards the understanding of financial markets and their e�ciency, aswe aimed to demonstrate with the application of evolutionary algorithms.

64

Page 73: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

A. Appendix

A.1 Tables

count mean std

[1.01, 1.52] 869 -0.067 0.579(1.52, 1.84] 888 -0.064 0.822(1.84, 2.09] 850 -0.097 0.961(2.09, 2.39] 910 -0.004 1.090(2.39, 2.71] 830 -0.072 1.198(2.71, 3.14] 922 -0.114 1.314(3.14, 3.69] 840 -0.095 1.468(3.69, 4.58] 891 -0.028 1.703(4.58, 6.59] 830 -0.043 2.043(6.59, 390] 848 -0.094 3.352

overall 8678 -0.067 1.625

count mean std

[1.01, 1.52] 737 -0.153 0.603(1.52, 1.82] 727 -0.109 0.819(1.82, 2.09] 751 -0.089 0.957(2.09, 2.37] 746 -0.025 1.085(2.37, 2.71] 716 -0.124 1.183(2.71, 3.04] 715 -0.146 1.287(3.04, 3.64] 743 -0.146 1.424(3.64, 4.58] 769 -0.057 1.669(4.58, 6.39] 694 -0.065 2.007(6.39, 390] 711 -0.168 3.261

overall 7309 -0.108 1.591

Table A.1: Odds groupings of the betting exchange data with smin = 10(left) and smin = 100 (right). The total counts of events indicate that fora larger desired profit we have to remove an increasing amount of eventsfor which there is not enough volume available. Although individualodds groupings exhibit an average return that is considerably largerthan the average, this may be due to statistical variation in the sampleof events. In any case, the favorite-longshot bias appears to be lesspronounced than in the bookmaker data.

65

Page 74: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Generation t-statistic p-value

0 -2.059 0.06961 -1.434 0.18522 -2.135 0.06153 -0.238 0.81684 -0.649 0.53235 0.476 0.64526 0.848 0.41827 0.814 0.43668 0.916 0.38379 1.398 0.195710 1.571 0.150611 1.537 0.158712 2.252 0.050813 2.347 0.043514 1.591 0.146115 1.841 0.098816 1.314 0.221517 1.896 0.090518 1.755 0.113119 1.783 0.108320 1.700 0.123321 1.650 0.133322 1.781 0.108623 1.771 0.110324 1.683 0.126625 1.822 0.101826 1.789 0.107127 1.772 0.110128 1.871 0.094229 1.882 0.092530 1.886 0.0919

Table A.2: Results for the paired t-test on each generation. Underthe null hypothesis the average test performance is identical with andwithout sampling for the respective generation.

Parameter Value

number of generations 30population size 1000elite size 10sampling fraction 30%tournament size 3crossover rate 30%mutation rate 5%vicinity mutation rate 20%flip mutation rate 2%fitness metric Sortino ratio

Table A.3: Parameter settings for the final optimization.

66

Page 75: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

A.2 Figures

Figure A.1: Examples of exponential moving averages (EMAs) on adataset of irregular datapoints that represent non-equidistant measure-ments from a noisy sine wave. The left figures show a sample of 6000points (e.g., one sample per second, on average, in an interval of 100minutes), whereas the right figures exhibit a sample of only 100 points(e.g., one sample per minute, on average). In the upper plots we fit anEMA with a decay factor – = 10, while in the lower plots the decayfactor is increased to – = 1000. It can be observed that a large decayfactor is associated with a smoother moving average and an increasedlatency, while a small decay factor adapts rapidly to new observations.Also, it is noticeable that even relatively infrequent measurements canbe approximated relatively well with an EMA.

67

Page 76: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Figure A.2: An example of a truncated exponential distribution withscale ⁄ = 1 and support [0, 10]. The figure shows a histogram of arandom sample of 10000 draws from this distribution.

Figure A.3: Comparison of the net profit and the number of trades inthe optimization using technical trading rules. Clearly, a decrease in thenumber of trades is associated with smaller losses. The elite performanceseems to remain fairly constant around the break-even point and usuallythere are around 1000 trades which, in this particular case, correspondsto the minimum trade limit below which a rule would be penalized.

68

Page 77: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

. . .

Figure A.4: Optimization progress during the favorite-longshot experi-ment with the bookmaker data. After the seventh generation the elitestays almost unchanged.

69

Page 78: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes
Page 79: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Bibliography

Alexander, S. (1961). “Price Movements in speculative Markets: Trends or RandomWalks.” Industrial Management Review 2, pp. 7–26.

Allen, F. and R. Karjalainen (1999). “Using genetic algorithms to find technicaltrading rules.” Journal of financial Economics 51.2, pp. 245–271.

Bachelier, L. (1900). Théorie de la spéculation. Gauthier-Villars.Black, F. (1986). “Noise.” The Journal of Finance 41.3, pp. 528–543.Choi, D. and S. K. Hui (2014). “The role of surprise: Understanding overreaction

and underreaction to unanticipated events using in-play soccer betting market.”Journal of Economic Behavior & Organization 107, pp. 614–629.

Constantinou, A. C., N. E. Fenton, and M. Neil (2012). “pi-football: A Bayesiannetwork model for forecasting Association Football match outcomes.” Knowledge-Based Systems 36, pp. 322–339.

Croxson, K. and J. Reade (2014). “Information and e�ciency: Goal arrival in soccerbetting.” The Economic Journal 124.575, pp. 62–91.

Deb, K. (2001). Multi-objective optimization using evolutionary algorithms. Vol. 16.John Wiley & Sons.

Dixon, M. J. and S. G. Coles (1997). “Modelling association football scores andine�ciencies in the football betting market.” Journal of the Royal StatisticalSociety: Series C (Applied Statistics) 46.2, pp. 265–280.

Eckner, A. (2012). Algorithms for unevenly-spaced time series: Moving averages andother rolling operators. Tech. rep.

Estrada, J. (2006). “Downside risk in practice.” Journal of Applied Corporate Finance18.1, pp. 117–125.

Fama, E. F. (1970). “E�cient Capital Markets: A Review of Theory and EmpiricalWork.” Journal of Finance 25.2, pp. 383–417.

Fama, E. F. and K. R. French (2010). “Luck versus Skill in the Cross-Section ofMutual Fund Returns.” Journal of Finance, pp. 1915–1947.

71

Page 80: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Franck, E., E. Verbeek, and S. Nüesch (2010). “Prediction accuracy of di�erent marketstructures—bookmakers versus a betting exchange.” International Journal ofForecasting 26.3, pp. 448–459.

Gençay, R., M. Dacorogna, U. A. Muller, O. Pictet, and R. Olsen (2001). Anintroduction to high-frequency finance. Elsevier.

Ghandar, A., Z. Michalewicz, M. Schmidt, T.-D. Tô, and R. Zurbrugg (2009).“Computational intelligence for evolving trading rules.” IEEE Transactions onEvolutionary Computation 13.1, pp. 71–86.

Goddard, J. and I. Asimakopoulos (2004). “Forecasting football results and thee�ciency of fixed-odds betting.” Journal of Forecasting 23.1, pp. 51–66.

Goldberg, D. E. (1989). Genetic Algorithms in Search, Optimization and MachineLearning. Addison-Wesley Longman Publishing Co., Inc.

Graham, B. and D. L. Dodd (1934). Security analysis: Principles and technique.McGraw-Hill.

Gri�th, R. M. (1949). “Odds adjustments by American horse-race bettors.” TheAmerican Journal of Psychology 62.2, pp. 290–294.

Hausch, D. B., W. T. Ziemba, G. Constantinides, H. M. Markowitz, R. C. Merton,S. C. Myers, P. A. Samuelson, W. F. Sharpe, and K. Arrow (2008). Handbook ofSports and Lottery Markets. Elsevier.

Hu, Y., K. Liu, X. Zhang, L. Su, E. Ngai, and M. Liu (2015). “Application ofevolutionary computation for rule discovery in stock algorithmic trading: Aliterature review.” Applied Soft Computing 36, pp. 534–551.

Kampouridis, M. and E. Tsang (2010). “EDDIE for investment opportunities forecast-ing: Extending the search space of the GP.” Evolutionary Computation (CEC),2010 IEEE Congress on. IEEE, pp. 1–8.

Kaunitz, L., S. Zhong, and J. Kreiner (2017). “Beating the bookies with their ownnumbers - and how the online sports betting market is rigged.” ArXiv e-prints.

Koza, J. R. (1992). Genetic programming: on the programming of computers by meansof natural selection. Vol. 1. MIT press.

Kruse, R., C. Borgelt, C. Braune, S. Mostaghim, and M. Steinbrecher (2016). Com-putational intelligence: a methodological introduction. Springer.

Lim, K.-P. and R. Brooks (2011). “The Evolution of Stock Market E�ciency overTime: A Survey of the Empirical Literature.” Journal of Economic Surveys 25.1,pp. 69–108.

Lo, A. W. (2002). “The statistics of Sharpe ratios.” Financial analysts journal 58.4,pp. 36–52.

72

Page 81: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

— (2004). “The Adaptive Markets Hypothesis: Market E�ciency from an Evolution-ary Perspective.” Journal of Portfolio Management 30, pp. 15–29.

— (2005). Reconciling e�cient markets with behavioral finance: the adaptive marketshypothesis. Tech. rep.

Malkiel, B. G. (2003). “The e�cient market hypothesis and its critics.” The Journalof Economic Perspectives 17.1, pp. 59–82.

— (2005). “Reflections on the e�cient market hypothesis: 30 years later.” FinancialReview 40.1, pp. 1–9.

Maza, M. de la (1989). “A SEAGUL visits the race track.” Proceedings of the thirdinternational conference on genetic algorithms. Morgan Kaufmann PublishersInc., pp. 208–212.

Mendel, J. M. (2001). Uncertain rule-based fuzzy logic systems: introduction and newdirections. Prentice Hall PTR Upper Saddle River.

Mitchell, M. (1998). An introduction to genetic algorithms. MIT press.Müller, U. A. (1991). Specially weighted moving averages with repeated application of

the ema operator. Tech. rep. Olsen & Associates, Zurich, Switzerland.Neely, C., P. Weller, and R. Dittmar (1997). “Is technical analysis in the foreign ex-

change market profitable? A genetic programming approach.” Journal of financialand Quantitative Analysis 32.4, pp. 405–426.

Paddy Power Betfair plc (2017). Paddy Power Betfair plc, 2016 Annual Report. https://www.paddypowerbetfair.com/investor-relations/annual-reports/2017.Online; accessed 12-February-2018.

Park, C.-H. and S. H. Irwin (2007). “What do we know about the profitability oftechnical analysis?” Journal of Economic Surveys 21.4, pp. 786–826.

Potvin, J.-Y., P. Soriano, and M. Vallée (2004). “Generating trading rules on thestock markets with genetic programming.” Computers & Operations Research31.7, pp. 1033–1047.

Preston, M. G. and P. Baratta (1948). “An experimental study of the auction-valueof an uncertain outcome.” The American journal of psychology 61.2, pp. 183–193.

PricewaterhouseCoopers Mexico (2015). Global Gaming Industry Regulatory Frame-works. https://www.pwc.com/mx/es/knowledge-center/archivo/2015-03-kc-global-gaming-industry-regulatory-frameworks.pdf. Online; accessed08-February-2018.

Roberts, H. V. (1959). “Stock-Market “Patterns” And Financial Analysis: Method-ological Suggestions.” The Journal of Finance 14.1, pp. 1–10.

Rosett, R. N. (1971). “Weak experimental verification of the expected utility hypoth-esis.” The Review of Economic Studies 38.4, pp. 481–492.

73

Page 82: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Smith, M. A., D. Paton, and L. V. Williams (2006). “Market E�ciency in Person-to-Person Betting.” Economica 73.292, pp. 673–689.

Smith, M. A. and L. V. Williams (2008). “Betting exchanges: a technological revolu-tion in sports betting.” Handbook of sports and lottery markets. Elsevier, pp. 403–418.

— (2010). “Forecasting horse race outcomes: New evidence on odds bias in UKbetting markets.” International Journal of Forecasting 26.3, pp. 543–550.

Subramanian, H., S. Ramamoorthy, P. Stone, and B. J. Kuipers (2006). “Designingsafe, profitable automated stock trading agents using evolutionary algorithms.”Proceedings of the 8th annual conference on Genetic and evolutionary computation.ACM, pp. 1777–1784.

Tetlock, P. (2004). How e�cient are information markets? Evidence from an onlineexchange. Tech. rep.

Tsang, E. P. and J. Li (2002). “EDDIE for financial forecasting.” Genetic Algorithmsand Programming in Computational Finance, Kluwer Series in ComputationalFinance, pp. 161–174.

Tsang, E. P., J. Li, and J. M. Butler (1998). “EDDIE beats the bookies.” Softw.,Pract. Exper. 28.10, pp. 1033–1043.

Tsang, E. P., J. Li, S. Markose, H. Er, A. Salhi, and G. Iori (2000). “EDDIE infinancial decision making.” Journal of Management and Economics 4.4, pp. 1–13.

Tsang, E., P. Yung, and J. Li (2004). “EDDIE-Automation, a decision support toolfor financial forecasting.” Decision Support Systems 37.4, pp. 559–565.

Tsirimpas, P. and W. Knottenbelt (2013). “Metaheuristic Optimisation of Parame-terised Betting Exchange Strategies.” Proc. 4th IMA Intl. Conference on Mathe-matics in Sport, pp. 155–156.

Tsirimpas, P. (2014). “Specification and Performance Optimisation of Real-time Trad-ing Strategies for Betting Exchange Platforms.” Doctoral dissertation. ImperialCollege London.

Vlastakis, N., G. Dotsis, and R. N. Markellos (2009). “How e�cient is the Europeanfootball betting market? Evidence from arbitrage and trading strategies.” Journalof Forecasting 28.5, pp. 426–444.

Williams, L. V. (1999). “Information e�ciency in betting markets: A survey.” Bulletinof Economic Research 51.1, pp. 1–39.

— (2005). Information e�ciency in financial and betting markets. Cambridge Uni-versity Press.

74

Page 83: Evolutionary algorithms for the discovery of trading rules ...€¦ · in-play football betting market—a case study that aims to generalize to other types ... Chapter 6 concludes

Woodland, L. M. and B. M. Woodland (2003). “The Reverse Favourite–longshotBias and Market E�ciency in Major League Baseball: An Update.” Bulletin ofEconomic Research 55.2, pp. 113–123.

Yaari, M. E. (1965). “Convexity in the theory of choice under risk.” The QuarterlyJournal of Economics, pp. 278–290.

Zadeh, L. (1965). “Fuzzy sets.” Information and Control 8.3, pp. 338–353.

75


Recommended