Link to the original text ：http://tecdat.cn/?p=6811
My research topic this year is to use particle swarm optimization （PSO） To optimize the transaction portfolio of the currency . In this paper , I'll introduce portfolio optimization and explain its importance . secondly , I'll show you how particle swarm optimization can be applied to portfolio optimization . Third , I'll explain the arbitrage portfolio , And then summarize my findings .
A portfolio consists of assets and investment capital . Portfolio optimization involves determining how much money should be invested in each asset . With such diverse demands , Minimum and maximum asset exposure , The introduction of restrictive factors such as transaction cost and foreign exchange cost , I use particle swarm optimization （PSO） Algorithm .
The working principle of portfolio optimization is to predict the expected risk and return of each asset in the portfolio . The algorithm takes these predictions as input , And determine how much capital should be invested in each asset , In order to maximize the risk adjusted return of the portfolio and meet the constraints . The forecast of the expected risk and return of each asset needs to be as accurate as possible , To make the algorithm perform well . There are various ways , In this study , I studied three common methods .
- Normal distributed revenue - In this method , Create a distribution of historical asset values and randomly sample to get the future value of each asset . The method assumes that historical and future values are normally distributed .
- Revenue follows Brownian motion - In this way , Generate random walks for each asset over time , Represents daily revenue . The total return of the portfolio is calculated . This method assumes that future returns follow a random walk .
- The yield follows the geometric Brownian motion - In this way , Generate random walk again , But standardizing based on daily variance and long-term market drift . The method assumes that future earnings follow a standardized random walk .
In my research , I found the third method to be the most accurate
Particle swarm optimization （PSO）
stay PSO in , Each particle in a group is represented as a vector . In the context of portfolio optimization , This is a weight vector , Represents the allocated capital of each asset . The vector is transformed into a position in the multidimensional search space . Each particle will also remember its best historical position . about PSO Every iteration of , Find the global optimal location . This is the best position in the group . Once the global optimal location is found , Each particle will be closer to its local optimal position and global optimal position . When executed in multiple iterations , The process produces a good solution to the problem , Because the particles converge on the near optimal solution .
# This class contains the particle code in the swarm class Particle: velocity =  pos =  pBest =  def __init__(self): for i in range(dimension): self.pos.append(random.random()) self.velocity.append(0.01 * random.random()) self.pBest.append(self.pos[i]) return
The graph depicts the particle swarm optimization algorithm relative to the global optimum （ Blue ） And local optimal location （ Red ） How to update the position of each particle in the population .
# This class includes particle swarm optimization algorithm and particle parameter optimizer class ParticleSwarmOptimizer: solution =  swarm =  def __init__(self): for h in range(swarmSize): particle = Particle() self.swarm.append(particle)
PSO Performance is influenced by weight . Exploration describes PSO Explore the ability to search different areas of space .Exploitation It describes PSO The ability to focus search on promising areas of the search space . To enhance PSO The ability to explore and develop , The following algorithm enhancements are applied ：
- Random reinitialization of aggregate particles - Improve exploration by restarting particles when they gather on globally optimal particles . Using two particles （ carrier ） The similarity function between measurements converges .
If the particles converge near the globally optimal particles , But it's not as good as the global optimal particle , Then it is reinitialized randomly somewhere in the search space . This improves PSO The ability to explore .
- Selective mutation of the optimal particle - By initializing the neighbor of the nearest global optimal particle to improve . If neighbors are better than global optimal particles , Then the globally optimal particles are replaced by neighbors .
For each iteration of the algorithm , Creating neighbors near globally optimal particles . If any of these neighbors is better than the global optimal particle , Then replace the globally optimal particle .
Portfolio optimization using particle swarm optimization
PSO The algorithm can be used to optimize the portfolio . In the context of portfolio optimization , Each particle in the group represents the potential allocation of capital among the assets in the portfolio . The relative suitability of these portfolios can be determined using one of many financial utility functions that balance risk and expected return . I use the sharp ratio , Because it has become a benchmark portfolio performance standard recognized by the industry . Consider the following for a portfolio of three assets PSO Icon ,
Using particle swarm optimization （PSO） An example of portfolio optimization of . Grey particles are updating . The red particle is the local optimal position of the gray particle , The blue particle is the global best position .
Gray particles are transformed into vectors （0.5,0.2,0.3）, It means the cost of portfolio capital 50％ Allocated to assets 1,20％ Allocated to assets 2,30％ Allocated to assets 3. The expected Sharpe ratio for this allocation is 0.38, Less than the local optimal position （ Red particles ） And global optimal location （ Blue particles ）. such , The position of the gray particles is updated , Make it closer to the global optimal particle and the local optimal particle .
Using particle swarm optimization （PSO） An example of portfolio optimization of . The gray particles are updated , Make it closer to the global optimum , And it's locally optimal . The resulting vector is better than before .
The gray particles have moved , Now convert to vector （0.3,0.3,0.4）, Its expected Sharpe ratio is 0.48. This value is higher than the previous local optimal position , So the local optimal position （ Red particles ） Will be updated to the current location .
Using particle swarm optimization （PSO） An example of portfolio optimization of . Local optimal location （ Red particles ） Now updated to the current position of the particle .
The real challenge with particle swarm optimization is to ensure that the constraints of portfolio optimization are met . As mentioned earlier , There are many limitations . The most common constraints are, first of all, that assets are no longer allocated and no less than 100％ Available capital （ That is, the weight vector must add up to 1.0）. secondly , Negative distribution of assets is not allowed . Last , Capital should be allocated to at least so many assets in the portfolio . The latter is the cardinality constraint . Two common techniques are used to ensure that particles satisfy constraints ,
- Fix particles that don't satisfy the constraint - For each particle that doesn't satisfy the constraint , Apply a set of rules to change the position of particles .
- The adaptability of penalizing particles that don't satisfy the constraint - For each particle that doesn't satisfy the constraint , The Sharpe ratio that penalizes the particle .
For my research , I apply this technique to Arbitrage Portfolios . The arbitrage portfolio includes multiple arbitrage transactions . Arbitrage is a trading strategy , Among them, traders sell currencies with relatively low interest rates , And use that money to buy different currencies , That leads to higher interest rates . Traders using this strategy try to find the difference between interest rates called interest rate difference .
By diversifying investments in multiple currencies , Can reduce the risk of foreign exchange losses , But it can't be eliminated . therefore , The risk of arbitrage is lower than that of individual arbitrage . In the context of Arbitrage Portfolios , The objective of portfolio optimization is to further reduce the risk of foreign exchange losses , At the same time, improve the investment return realized by the portfolio .
The goal of portfolio optimization is to determine how much money should be allocated to each transaction to optimize risk adjusted returns .
In my research , I use particle swarm optimization to determine the optimal allocation of investment capital between a set of arbitrage transactions . The arbitrage portfolio in my research includes 22 Two different currencies . Currencies include the Australian dollar , Canadian dollars , Swiss francs , RMB, etc .
Thank you very much for reading this article , If you have any questions, please leave a message below ！
The most popular insights