These two python projects shows the implementation and usage of GA(Genetic Algorithm) and MCMC(Markov Chain Monte Carlo).
MCMC: It is a type of stochastic optimization algorithm that generates a sequence of portfolios (states) where each portfolio depends only on the previous one, which is the characteristic of a Markov chain.
GA: A genetic algorithm functions as a heuristic optimization method, emulating natural selection. Initially, it generates a population of solutions randomly, then progressively enhances them by favoring the most suitable individuals, facilitating their reproduction, and injecting genetic variability via mutation. This iterative process continues for a predetermined number of generations or until a specified stopping condition is fulfilled.
When investing in financial markets, the primary objectives are to maximize returns and minimize risk. Portfolio optimization is an important tool for achieving these goals.
The main aim of portfolio optimization is to maximize the investor's wealth for a given measure, with 'Sharpe ratio' being the chosen criterion for this project. The Sharpe ratio simply represents the 'return/risk' ratio of a portfolio. The higher the Sharpe ratio of our portfolio, the more reliable it is considered.
In this project, two tools have been developed to construct the best portfolio based on the available data. Genetic Algorithm has been utilized for the first tool, while Markov Chain has been employed for the second one.
In this project, investment instruments are required for the portfolios to be constructed. In this context, Gold, Dollar, Euro, and BIST100 index have been designated as investment instruments.
Returns for these instruments have been obtained for the last 1 week, 1 month, 3 months, 6 months, and 1 year. These data have been used to calculate the total return, risk, and Sharpe ratio for each portfolio. It should be noted that the currency for the invested amount is required to be in Turkish Lira (TL).