Resumen
En este trabajo se ha resuelto el problema de optimización de carteras financieras haciendo uso de optimización multiobjetivo y algoritmos genéticos. Para ello, se comienzan explicando algunos conceptos fundamentales, así como las investigaciones que se han hecho hasta el momento relacionadas con el tema. Entre ellas destacan proyectos muy similares a lo que se quiere implementar en este trabajo, pero analizando datos, tipos de carteras o modelos multiobjetivo muy concretos. Desde este punto de partida, se ha procedido a desarrollar el problema genético y, posteriormente, implementar el código del algoritmo en Python. En el área del problema genético se describen todos los aspectos fundamentales para ser capaz de comprender como funciona el código sin necesidad de leerlo. El fin del algoritmo que se ha creado es encontrar las carteras que consigan maximizar su rentabilidad con el mínimo riesgo posible. Así, la función objetivo a optimizar por el algoritmo va a tener dos componentes que se encuentran en conflicto: maximizar rentabilidad y minimizar riesgo. Es por esto por lo que se habla de problema multiobjetivo, el cual se formula antes de empezar a explicar el algoritmo de forma más concreta. Como bien es característico de la optimización multiobjetivo, la salida principal del algoritmo es un conjunto de Pareto. En este tipo de funciones no solo hay una solución válida, ya que los valores de las variables que obtengan los mejores resultados para cada uno de los objetivos van a ser diferentes. Es por esto por lo que, en lugar de buscar una única solución que genere el mejor valor para un solo objetivo, se va a tratar de hallar un conjunto de soluciones buenas que tengan en cuenta todos los criterios. La idea de óptimo de Pareto define toda situación en la que no es posible optimizar más una función sin perjudicar a la evaluación de otra. Es un punto donde todos los criterios se encuentran en equilibrio. Dadas dos soluciones a y b, si a no es peor que b y, a la vez, b es no es peor que a, entonces a y b son igual de buenas. Todas las soluciones que no son superadas por otras son llamadas soluciones no dominadas. Una solución domina a otra si es mejor o igual en todos los objetivos y mejor en al menos uno de ellos. Así, se entiende como conjunto de Pareto a todas las soluciones no dominadas. Además, el algoritmo también genera una serie de gráficos que muestran cómo han evolucionado las soluciones a lo largo de las distintas iteraciones. Por otro lado, se escogen una serie de datos para utilizar como ejemplo para probar el modelo creado. Todos estos datos son valores históricos de determinados títulos en un periodo de un año. Los datos relativos a los primeros seis meses de dicho año se utilizan para que el algoritmo haga una predicción de cuáles serían las mejores inversiones posibles. Después, los datos correspondientes a los siguientes seis meses se usan para comprobar que hubiera ocurrido si se hubiera seguido alguna de las soluciones encontradas. Una vez se tiene toda esta información acerca de los resultados que se han conseguido con el algoritmo genético, se hace un análisis para evaluar algunos puntos que se habían definido como objetivo del trabajo. Dichos objetivos son los siguientes: 1. Conseguir clasificar las soluciones obtenidas en función de distintos tipos de inversor. 2. Analizar si el índice de Sharpe, uno de los indicadores más utilizados en el ámbito financiero para establecer como de buena es una cartera en función de su rentabilidad y riesgo, discrimina carteras hacia un tipo de perfil de inversor en concreto.---ABSTRACT---In this paper there is solved the problem of financial portfolio optimisation using multi-objective optimization and genetic algorithms. To do so, I begin by explaining some fundamental concepts, as well as the research that has been done so far on the subject. These include projects very similar to what I want to implement in this work, but analysing very specific data, types of portfolios or multi-objective models. From this starting point, the genetic problem has been developed and, subsequently, the algorithm code has been created in Python. In the area of the genetic computing, all the fundamental aspects are described to be able to understand how the code works without having to read it. The aim of the algorithm that has been created is to find the portfolios that manage to maximise their profitability with the minimum possible risk. Thus, the objective function to be optimised by the algorithm will have two conflicting components: maximising profitability and minimising risk. Therefore, I speak of a multiobjective problem, which is formulated before starting to explain the algorithm more in depth. As is characteristic of multi-objective optimisation, the main output of the algorithm is a Pareto set. In this type of functions there is not only one valid solution, since the values of the variables that obtain the best results for each of the objectives will be different. Therefore, instead of looking for a single solution that generates the best value for a single objective, I will try to find a set of good solutions that consider all the criteria. The idea of Pareto optimum defines any situation in which it is not possible to further optimise one function without impairing the evaluation of another. It is a point where all criteria are in equilibrium. Given two solutions a and b, if a is not worse than b and, at the same time, b is not worse than a, then a and b are equally good. All solutions that are not outperformed by others are called non-dominated solutions. A solution dominates another if it is better or equal in all objectives and better in at least one of them. Thus, a Pareto set is understood as all non-dominated solutions. In addition, the algorithm also generates a series of graphs that show how the solutions have evolved throughout the different iterations. Furthermore, a set of data has been picked to be used as an example to test the model. All these data are historical values of certain securities over a period of one year. The data for the first six months of that year are used for the algorithm to make a prediction of what would be the best possible investments. The data of the next six months is then used to see what would have happened if any of the solutions found had been followed. Once the results achieved with the genetic algorithm are available, an analysis has been carried out to evaluate some of the points that had been defined as the objective of the work. These objectives are as follows: 1. To be able to classify the solutions obtained according to different types of inverters. 2. To analyse whether the Sharpe ratio discriminates portfolios towards a particular type of investor profile. This index is one of the most widely used indicators in the financial sphere to establish how good a portfolio is in terms of its profitability and risk.