This code illustrates the use of genetic programming to evolve financial trading strategies for a single equity stock. Individuals (strategies) are considered as functions of historical price data, outputting a position allocation. Strategy fitness evaluation is computed by simulating the strategy over historical financial data. Because financial investment requires a fundamental tradeoff between risk and return, strategies are evaluated on multi-objective fitness functions depending on profit and maximum drawdown of the strategy and ranging from very risk-prone to very risk-averse. The population of individual strategies is evolved using tournament selection, single-point crossover, and random mutation as evolutionary operators. Strategies with the best fitness at any stage in the evolutionary process are recorded in a ‘hall-of-fame’. At the end of the evolutionary process, strategies in the ‘hall-of-fame’ are evaluated over a set of test data and selected based on a train-test criterion which penalizes strategies that do not generalize well. This work exemplifies the opportunity to use python for rapid prototyping of evolutionary strategies for financial trading. The use of open-source packages for distributed evolutionary algorithms and financial simulation provides a foundation for standardization of model assumptions across research. A live trading version of the financial simulation package used is currently available in testing, meaning this work has practical applications and could be extended to live deployment.
joshua-xia / evolutionary-trading-strategies Goto Github PK
View Code? Open in Web Editor NEWThis project forked from zameyer1/evolutionary-trading-strategies
This code illustrates the use of genetic programming to evolve financial trading strategies for a single equity stock. Individuals (strategies) are considered as functions of historical price data, outputting a position allocation. Strategy fitness evaluation is computed by simulating the strategy over historical financial data. Because financial i