Skip to main content

Advertisement

Log in

The rise of the machines in commodities markets: new evidence obtained using Strongly Typed Genetic Programming

  • S.I.: Advances of OR in Commodities and Financial Modelling
  • Published:
Annals of Operations Research Aims and scope Submit manuscript

Abstract

Market regulators around the world are still debating whether or not high-frequency trading (HFT) is beneficial or harmful to market quality. We develop artificial commodities market populated with HFT scalpers and traditional commodities traders using Strongly Typed Genetic Programming (STGP) trading algorithm. We simulate real-life commodities trading at the millisecond timeframe by applying STGP to the S&P GSCI data stamped at the millisecond interval. We observe that HFT scalpers anticipate the order flow leading to severe damages to institutional traders. To mitigate the negative implications of HFT scalpers on commodities markets, we propose a minimum resting trading order period of more than 150 ms.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

Notes

  1. Jarnecic and Snape (2010) define high-frequency trading as high-speed computer algorithms that automatically generate and execute trading decisions for the specific purpose of making returns on proprietary capital. According to Cvitanic and Kirilenko (2010) high-frequency trading refers to trading activity that employs extremely fast automated programs for generating, cancelling and executing trading orders in electronic markets. HFTrs are capable of submitting and cancelling a massive amount of trading orders and execute a large number of trades, trade in and out of positions very quickly, and finish a trading day without open position. Brogaard (2010) define high-frequency trading as a type of investment strategy where securities are rapidly bought and sold by a computer algorithm and held for a very short period.

  2. Bodie and Rosansky (1980) estimate the returns for equally weighted cash—collateralised portfolio of commodity futures from 1949 to 1976 and report equity—like returns. In another study, Gordon and Rouwenhorst (2006) examine the performance of equally weighted cash—collateralised commodity futures portfolio from 1959 to 2004 and observe that that their equally weighted portfolio characterise by significant returns similar to those of equity. Fama and French (1987) compute an equally weighted portfolio of up to 21 commodity futures from 1967 to 1984 and report marginal evidence of statistically significant returns.

  3. Frino et al. (2014) use several proxies to identify algorithmic trading in futures markets.

  4. Genetic Programming deal with problems in which the search space of eventual solutions consists of entities such as computer programs that can be expressed in the form of decision parse trees, rather than as lines of code. The parse trees represent the trading rules of HFT scalpers and traditional commodity traders in our experiment. The typical genetic structure of the trading rule consists of hundreds of nodes and it is unwieldy to write out.

  5. Only the initial generation of trading rules in our experiment is created randomly. The random nature of the initial rules is to ensure that the whole range of all possible trading rules is fully investigated. To avoid the statistics being affected by the initialisation process, the first 5000 quotes of millisecond data of the S&P GSCI were omitted from empirical testing. We consider the first 5000 millisecond quotes of data as a training period during which the model may show initially chaotic behaviour.

  6. This process is further explained in Sects. 3.2 and 3.3.

  7. 50 % * (118,500/38.50) – 1000 \(\,=\,\) 539 contracts.

  8. The choice of data was based on the fact that we wanted to analyse data from a whole year, and 2014 was the most recent year at the time of running the experiments and writing the manuscript.

  9. Trading messages processed in a given month by STGP are all the trading messages in that month for S&P GSCI futures contracts.

References

  • Alon, I., Qi, M., & Sadowski, R. J. (2001). Forecasting aggregate retail sales: A comparison of artificial neural networks and traditional methods. Journal of Retailing and Consumer Services, 8, 147–156.

    Article  Google Scholar 

  • Bailey, D. H., & Lopez de Prado, M. M. (2012). The Sharpe ratio efficient frontier. Journal of Risk, 15(2), 34–57.

    Article  Google Scholar 

  • Banzhaf, W., Nordin, P., Keller, R. E., & Francone, F. D. (1998). Genetic programming—An introduction. San Francisco, CA: Morgan Kaufmann Publishers.

    Book  Google Scholar 

  • Barnes, J. (1982). Programming in Ada. Reading, MA: Addison-Wesley.

    Google Scholar 

  • Baron, M., Brogaard, J., & Kirilenko, A. (2012).The trading profits of high frequency traders. Working paper. Available at http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.471.9434&rep=rep1&type=pdf.

  • Biais, B., Foucault, T., & Moinas, S. (2015). Equilibrium fast trading. Journal of Financial Economics, forthcoming.

  • Benos, E., & Sagade, S. (2012). High-frequency trading behaviour and its impact on market quality: Evidence from the UK equity market. Working paper No 469. Bank of England.

  • Bernanke, B. (2008). Outstanding issues in the analysis of inflation. Speech given at the Federal Reserve Bank of Boston’s \(53^{{\rm rd}}\) Annual Economic Conference, Chatham, MA. June 9.

  • Bodie, Z., & Rosansky, V. (1980). Risk and return in commodity futures. Financial Analysts Journal, 36(3), 27–39.

    Article  Google Scholar 

  • Brogaard, J. (2010). High frequency trading and its impact on market quality. Working paper. Northwestern University. Available at http://www.clasesdebolsa.com/archivos/HTF.pdf.

  • Brorsen, B. W. (1989). Liquidity costs and scalping returns in the corn futures market. The Journal of Futures Markets, 9(3), 225–236.

    Article  Google Scholar 

  • Brunnermeier, M. K., & Pedersen, L. H. (2005). Predatory trading. The Journal of Finance, 34(4), 1825–1963.

    Article  Google Scholar 

  • Budish, E., Cramton, P., & Shim, J. (2015). The high frequency trading arms race: Frequent batch auctions as a market design response. The Quarterly Journal of Economics, 130(4), 1547–1621.

    Article  Google Scholar 

  • Chae, J., Khil, J., & Lee, E. (2013). Who makes markets? Liquidity providers versus algorithmic traders. The Journal of Futures Markets, 33(5), 397–420.

    Article  Google Scholar 

  • Chakraborti, A., Toke, I. M., Patriarca, M., & Abergel, F. (2011). Econophysics review: II Agent-based models. Quantitative Finance, 11(7), 1013–1041.

    Article  Google Scholar 

  • Connolly, R. A. (1989). An examination of the robustness of the weekend effect. Journal of Financial and Quantitative Analysis, 24, 133–169.

    Article  Google Scholar 

  • Cvitanic, J., & Kirilenko, A. (2010). High frequency traders and asset prices, Working Paper. Available at http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1569075.

  • DeFusco, R. A., Johnson, R. R., & Zorn, T. S. (1990). The effect of executive stock option plans on stockholders and bondholders. The Journal of Finance, 45(2), 617–627.

    Article  Google Scholar 

  • Delaney, L. (2015). An examination of the optimal timing strategy for a slow trader investing in a high frequency technology. Working paper. City University London. Available at http://openaccess.city.ac.uk/12175/.

  • Diebold, F. X., & Mariano, R. S. (1995). Comparing predictive accuracy. Journal of Business and Economic Statistics, 13, 253–263.

    Google Scholar 

  • Dunis, C. L., Laws, J., & Karathanasopolous, A. (2013). GP algorithm versus hybrid and mixed neural networks. The European Journal of Finance, 19(3), 180–205.

    Article  Google Scholar 

  • Egginton, J., Van Ness, B. F., & Van Ness, R. A. (2012). Quote stuffing. Financial Management, 30, 1–26.

    Google Scholar 

  • Erb, C. B., & Harvey, C. R. (2006). The strategic and tactical value of commodity futures. Financial Analysts Journal, 62(2), 69–97.

    Article  Google Scholar 

  • Fama, E., & French, K. R. (1987). Commodity futures prices: Some evidence on forecast power, premiums and the theory of storage. Journal of Business, 60(1), 55–73.

    Article  Google Scholar 

  • Foucault, T., Kozhan, R., & Tham, W. W. (2014).Toxic arbitrage. Working paper. CEPR Discussion Paper No. DP9925. Available at http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2444948.

  • Fishe, R. P. H., Haynes, R., & Onur, E. (2015). Anticipatory traders and trading speed. Working paper. Available at http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2606949.

  • Frino, A., Mollica, V., & Webb, R. (2014). The impact of co-location of securities exchange’s and traders’ computer servers on market liquidity. The Journal of Futures Markets, 34(1), 20–33.

    Article  Google Scholar 

  • Gilbert, C. L. (2010). Speculative influences on commodity futures prices, 2006–2008. Discussion paper No.197, United Nations Conference on Trade and Development.

  • Goldstein, M. A., Kumar, P., & Graves, F. C. (2014). Computerized and high-frequency trading. The Financial Review, 49(2), 177–202.

    Article  Google Scholar 

  • Gordon, G., & Rouwenhorst, G. (2006). Facts and fantasies about commodity futures. Financial Analysts Journal, 62(2), 47–68.

    Article  Google Scholar 

  • Han, J., Khapko, M., & Kyle, A. (2014). Liquidity with high frequency market making. Working paper. Swedish House of Finance Research Paper No. 14-06. Available at http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2416396.

  • Hasbrouck, J., & Saar, G. (2009). Technology and liquidity provision: The blurring of traditional definitions. Journal of Financial Markets, 12, 143–172.

    Article  Google Scholar 

  • Hasbrouck, J., & Sofianos, G. (1993). The trades of financial markets: An empirical analysis of NYSE specialists. Journal of Finance, 48(5), 1565–1593.

    Article  Google Scholar 

  • Haynes, T., Wainwright, R., Sen, S., & Schoenefeld, D. (1995). Strongly typed genetic programming in evolving cooperation strategies. In Proceedings of the sixth international conference on Genetic Algorithms.

  • Haynes, T., Schoenefeld, D., & Wainwright, R. (1996). Type inheritance in Strongly Typed Genetic Programming. In K. Kinnear & P. Angeline (Eds.), Advances in genetic programming 2. Cambridge: MIT Press.

    Google Scholar 

  • Hirschey, N. (2013). Do high frequency traders anticipate buying and selling pressure? Working paper. London Business School. Available at http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2238516.

  • Jarnecic, E., Snape, M. (2010). An analysis of trades by high frequency participants on the London Stock Exchange. \(17^{{\rm th}}\) Annual Conference of the Multinational Finance Society.

  • Jarnecic, E., & Snape, M. (2014). The provision of liquidity by high-frequency participants. The Financial Review, 49(2), 371–394.

    Article  Google Scholar 

  • Karlin, M., & Taylor, J. (1975). A first course in stochastic processes (2nd ed.). New York: Academic Press.

    Google Scholar 

  • Koza, J. R. (1992). Genetic programming. On the programming of computers by means of natural selection. Cambridge: MIT Press.

    Google Scholar 

  • Kumaresan, M., & Krejic, N. (2015). Optimal trading of algorithmic orders in a liquidity fragmented market place. Annals of Operations Research, 229, 521–540.

    Article  Google Scholar 

  • Leal, S. J., Napoletano, M., Roventini, A., & Fagiolo, G. (2014). Rock around the clock: An agent-based model of low- and high-frequency trading. Journal of Evolutionary Economics, 26(1), 49–76.

    Article  Google Scholar 

  • Lewis, M. (2014). Flash boys. Cracking the money code. New York: Penguin Group.

    Google Scholar 

  • Li, W. (2014). High frequency trading with speed hierarchies. Working paper. Available at http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2365121.

  • Marshall, B. R., Nguyen, N. H., & Visaltanachoti, N. (2012). Commodity liquidity measurement and transaction costs. Review of Financial Studies, 25(2), 599–638.

    Article  Google Scholar 

  • Meade, N. (2002). A comparison of short term foreign exchange forecasting methods. International Journal of Forecasting, 18, 67–83.

    Article  Google Scholar 

  • Menkveld, A., Zoican, M. (2014). Need for speed? Exchange latency and liquidity. Working paper. Tinbergen Institute Discussion Paper 14-097/IV/DSF78.

  • Montana, D. J. (1994). Strongly typed genetic programming. Technical report 7866. Bolt Beranek and Newman, Inc.

  • Montana, D. J. (1995). Strongly typed genetic programming. Evolutionary Computation, 3(2), 199–230.

    Article  Google Scholar 

  • Montana, D. J. (2002). Strongly typed genetic programming [online]. Available from http://personal.d.bbn.com/~dmontana/papers/stgp.pdf. Accessed 01 May 2015.

  • Narang, R. K. (2013). Inside the black box. A simple guide to quantitative and high-frequency trading. New Jersey: Wiley.

    Book  Google Scholar 

  • Paddrick, M., Hayes, R., Todd, A., Yang, S., Beling, P., & Scherer, W. (2012). An agent based model of the E-Mini S&P 500 applied to flash crash analysis. In Proceedings: 2012 IEEE Conference on Computational Intelligence for Financial Engineering & Economics (CIFEr). Available at http://ieeexplore.ieee.org/document/6327800/.

  • Sanders, D. R., & Irwin, S. H. (2013). Measuring index investment in commodity futures markets. The Energy Journal, 34(3), 105–127.

    Article  Google Scholar 

  • Silber, W. L. (1984). Marketmaker behaviour in an auction market: An analysis of scalpers in futures markets. Journal of Finance, 39(4), 937–953.

    Article  Google Scholar 

  • Singleton, K. (2012). Investor flows and the 2008 boom/bust oil prices. Management Science, 60(2), 300–318.

    Article  Google Scholar 

  • Steele, G. (1984). Common Lisp. Burlington, MA: Digital Press.

    Google Scholar 

  • Stoll, H. R., & Whaley, R. E. (2010). Commodity index investing and commodity futures prices. Journal of Applied Finance, 20(1), 7–46.

    Google Scholar 

  • Sun, E. W., Kruse, T., & Yu, M.-T. (2014). High frequency trading, liquidity, and execution cost. Annals of Operations Research, 223, 403–432.

    Article  Google Scholar 

  • Van Ness, B., Van Ness, R., & Watson, E. D. (2015). Canceling liquidity. The Journal of Financial Research, 38(1), 3–33.

    Article  Google Scholar 

  • Wah, E., & Wellman, M. (2013). Latency arbitrage, market fragmentation, and efficiency: A two-market model. Working paper.

  • Wappler, S., & Wegener, J. (2006). Evolutionary unit testing of object-orientated software using Strongly Typed Genetic Programming. GECCO’06, Seattle, Washington, USA.

  • Witkam, J. (2014). Altreva adaptive modeller, User’s Guide. Available from http://altreva.com/Adaptive_Modeler_Users_Guide.htm. Accessed 20 March 2015.

  • Working, H. (1977). Price effects of scalping and day trading. Selected Writings of Holbrook Working. Chicago Board of Trade.

  • Wu, C.-C., Chung, H., & Chang, Y.-H. (2012). The economic value of co-movement between oil price and exchange rate using copula-based GARCH models. Energy Economics, 34(1), 270–282.

    Article  Google Scholar 

  • Ye, M., Yao, C., & Gai, J. (2013). The externalities of high frequency trading. Working paper. Available at http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2066839.

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Viktor Manahov.

Appendices

Appendix 1

1.1 Strongly Typed Genetic Programming

Strongly Typed Genetic Programming (STGP) is a more sophisticated version of Genetic Programming (GP) whose application of generic functions and data types makes it more sophisticated than GP. GP represents a machine-learning method to automate the development of computer programs in terms of natural evolution (Banzhaf et al. 1998). If there are inputs X and outputs Y, a program p is generated which satisfies \(Y=p(X)\) . In nearly all GP models, the programs are organized as tree genomes. For example, Fig. 1 shows a tree which describes a mathematical expression that uses the input variables \(x=(a,b,c)\) where \(x\in X\) . The leaf nodes of the tree in Fig. 1 are the terminals whereas the non-leaf nodes are known as non-terminals. Terminals are usually inputs to the program with no argument and the non-terminals are functions often represented with at least one argument.

Fig. 1
figure 1

STGP program tree genomes (Copied from Wappler and Wegener 2006)

The fitness function of trading rules of 10,000 HFT scalpers and 90,000 traditional commodities traders are based on its ability to satisfy \(Y=p(X)\) . If \(Y_{\exp }\) is the expected known output and \(Y_{P}\) the actual output generated by a program p with \(Y_p =p(X)\), the fitness function f(p) of p has been calculated as:

$$\begin{aligned} f(p)=\sum _{i=1}^{|X|} {(p(x_i )-y_{{\exp }_{i}} )} \end{aligned}$$
(23)

Usually the nodes of the GP tree are not typed as Montana (2002) argues that many GP procedures can be formulated in a more efficient programming way by implementing a typing mechanism for GP nodes. In this way each node is connected to a particular return type and the process is known as Strongly Typed Genetic Programming (STGP). To create a parse tree one needs to take into account important additional programming criteria such as when the root node of the tree returns a value of the type required by the problem and each non-root node returns a value of the type required by the parent node as an argument (Montana 2002). While GP can be written in any programming language, the STGP is typically written in a specific programming language, which is a combination of Ada (Barnes 1982) and Lisp (Steele 1984) programming languages. The concept of generics as a method of developing strongly typed data is the critical component adopted from Ada. Additionally, Lisp incorporates the concept of having programs represented by their actual parse trees (Montana 1995).

While in conventional GP, one needs to specify all the programs and variables that can be used as nodes in a parse tree and deal with the search space of the order of \(10^{30} - 10^{40}\). STGP however reduces the searching state-space size to a greater degree (Montana 1994). On the other hand, the STGP search space composes the set of all legal parse trees, which means that all functions have the correct number of parameters of the correct type. In most occasions the STGP parse tree is limited to a certain maximum depth (Table 1 illustrates that 20 is the maximum depth in the artificial commodities market in this study). We set the maximum depth to 20 in order to keep the search space finite and manageable, while not allowing the trees to grow to an extremely large size. The critical concepts in STGP are generic functions (a mechanism for specifying a class of functions), and the process of assigning generic data types for these functions (Haynes et al. 1995).

STGP has the flexibility to allow all variables, constraints, arguments and returned values to be of any type. The only strict requirement is that the type of data for each element has to be specified in the early stage of the programming process. The resulting initialization process and the various genetic operators associated with it are enabled to create syntactically correct trees. Those trees on the other hand are beneficial to the entire programming process because the search space can be significantly reduced (Haynes et al. 1996).

The STGP generates trading rules through the crossover and mutation operators. During the process of crossover, the return value type of the two selected subtrees for exchange are examined to find out whether they are from the same type and that the resulting trees are not breaching depth restrictions. In the case when either check fails, then two completely new subtrees are selected. If, after performing a finite number of selections, there are no valid crossover points, then the two parent trees are copied and transferred into the pool for the next generation (Koza 1992).

STGP trading rules for the HFT scalpers and traditional commodities traders can be described through the following crossover process. Similar to GP, randomly chosen parts of two trading rules are exchanged in order to create two new trading rules (Fig. 2).

Fig. 2
figure 2

The process of crossover in STGP for generating new trading rules (Copied from Chakraborti et al. 2011)

Figure 2 illustrates that the trading strategies \(S_{i}\) and \(S_{j}\) are the two parents. The breaking point is based on random choice and then one-point crossover is applied to create new trading rules (children) \(S_{k}\) and \(S_{I}\).

The first generation of trading rules is created randomly to ensure that a large variety of possible trading rules is investigated at full capacity. The best performing trading rules from the initial selection are selected based on the Breeding Fitness return to act as parents in the crossover process. The Breeding Fitness return process represents a trailing return of a wealth moving average and is an integral part of the latency of HFT scalpers. This is in fact the return over the last n quotes of an exponential moving average of a trader’s wealth, where n could potentially have the maximum breeding value of 250. Each pair of parents generates two offspring trading rules, so the number of parents and the number of offspring are equal at all times.

In this innovative programming process the newly created trading rules replace those that are performing poorly in the initial selection based on the replacement fitness return. This type of return represents the average return of a wealth moving average per millisecond quote since the creation of the very first trading rule. In other words, this is the cumulative return of an exponential moving average of a trader’s wealth, divided by the trader’s breeding value.

Appendix 2

See Table 14.

Table 14 S&P GSCI futures daily trading volume generated by STGP trading algorithm

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Manahov, V. The rise of the machines in commodities markets: new evidence obtained using Strongly Typed Genetic Programming. Ann Oper Res 260, 321–352 (2018). https://doi.org/10.1007/s10479-016-2286-1

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10479-016-2286-1

Keywords

Navigation