Simulation of Financial Market with Buying and Selling Optimized by Particle Swarm




Financial market, Optimization, Particle swarm optimization, Computational simulation, Dynamics systems


It has been of great interest, both on the part of researchers and investors, to define negotiation rules that make it possible to capture the dynamics of the financial markets. This article presents a negotiation model among financial agents, based on the stock buying and selling process, that form a financial market. For the adaptation of economic agents to the market, a Particle Swarm Optimization (PSO) algorithm was implemented to optimize trading rules between agents aiming at maximizing gains in the market. Times series of artificial markets and real Bovespa brazillian market, descripted by the index Bovespa, were used in the computational simulations. Through the simulations, the dynamics of the interaction of buying and selling between financial agents was explored. The results show that there is a dependence on the gains of the agents in the markets in relation to the trading strategies adopted. On the other hand, in the low markets this dependence was not observed, since no statistically significant differences were found for the amount of wealth accumulated among the market participants. For the Bovespa market, from the sell and purchase thresholds of the trades carried out, the agents that have the best strategies in the negotiations were identified.

Author Biographies

Kerolly Kedma Felix do Nascimento, Universidade Federal Rural de Pernambuco

Graduada em Matemática (Licenciatura). Mestre em Biometria e Estatística Aplicada. Atualmente é aluna do Doutorado em Biometria e Estatística Aplicada da Universidade Federal Rural de Pernambuco.

Jader da Silva Jale, Universidade Federal Rural de Pernambuco, Recife, PE

Possui Bacharelado em Estatística, Mestrado e Doutorado em Biometria e Estatística Aplicada e Pós-Doutorado em Ciência da Computação, todos pela Universidade Federal Rural de Pernambuco. Atualmente é professor Adjunto A e membro titular da Comissão de Pesquisa no Departamento de Estatística e Informática na Universidade Federal Rural de Pernambuco.

Tiago Alessandro Espínola Ferreira, Universidade Federal Rural de Pernambuco, Recife, PE

Possui graduação (Bacharelado) e mestrado em Física, tem doutorado em Ciências da Computação pela Universidade Federal de Pernambuco e pós-doutorado pela Harvard University e professor visitante do Institutee for Applied Computational Science at Harvard Jhon A. Paulson School of Engineering and Appied Sciences. Atualmente é professor associado, fundadores do Programa de Pós-graduação em Informática Aplicada e  membro permanente do Programa de Pós-Graduação em Biometria e Estatística Aplicada da Universidade Federal Rural de Pernambuco.


Abar, S., Theodoropoulos, G. K., Lemarinier, P., O’Hare, G. M. (2017). Agent based modelling and simulation tools: A review of the state-of-art software. Computer Science Review, 24, 13–33.

Antunes, M. A., Procianoy, J. L. (2003). Os efeitos das decisões de investimentos das empresas sobre os preços de suas ações no mercado de capitais. Revista de Administração da Universidade de São Paulo, 38(1), 5–14.

B3 (2016). Perfil e histórico. URL

Bai, J., Ng, S. (2005). Tests for skewness, kurtosis, and normality for time series data. Journal of Business & Economic Statistics, 23(1), 49–60.

Box, G. E., Jenkins, G. M., Reinsel, G. C. (2008). Time Series Analysis: Forecasting and Control, 4º edn. John Wiley and Sons.

Chatterjee, S., Sarkar, S., Hore, S., Dey, N., Ashour, A. S., Balas, V. E. (2017). Particle swarm optimization trained neural network for structural failure prediction of multistoried rc buildings. Neural Computing and Applications, 28(8), 2005–2016.

Clerc, M. (2010). Particle swarm optimization, vol 93. John Wiley & Sons.

Clerc, M., Kennedy, J. (2002). The particle swarm-explosion, stability, and convergence in a multidimensional complex space. IEEE transactions on Evolutionary Computation, 6(1), 58–73.

Cont, R. (2001). Empirical properties of asset returns: stylized facts and statistical issues. QUANTITATIVE FINANCE, 1, 223–236.

Damasceno, N. C., Gabriel Filho, O. (2017). Pi controller optimization for a heat exchanger through metaheuristic bat algorithm, particle swarm optimization, flower pollination algorithm and cuckoo search algorithm. IEEE Latin America Transactions, 15(9), 1801–1807.

Delice, Y., Aydogan, E. K., Özcan, U., Ilkay, M. S. (2017). A modified particle swarm optimization algorithm to mixed-model two-sided assembly line balancing. Journal of Intelligent Manufacturing, 28(1), 23–36.

Dorigo, M., Gambardella, L. M. (1997). Ant colony system: a cooperative learning approach to the traveling salesman problem. IEEE Transactions on evolutionary computation, 1(1), 53–66.

Eberhart, R., Kennedy, J. (1995). Particle swarm optimization. Em: Proceedings of the IEEE international conference on neural networks, Citeseer, vol 4, pp. 1942–1948.

Engle, R. F. (2011). Long-term skewness and systemic risk. Journal of Financial Econometrics, 9(3), 437–468.

Goez, G. D., Velasquez, R. A., Botero, J. S. (2016). On-line route planning of uav using particle swarm optimization on microcontrollers. IEEE Latin America Transactions, 14(4), 1705–1710.

Gujarati, D. N. (2006). Econometria Basica. Elsevier Brasil.

Hegazy, O., Soliman, O. S., Salam, M. A. (2015). Comparative study between fpa, ba, mcs, abc, and pso algorithms in training and optimizing of ls-svm for stock market prediction. International Journal of Advanced Computer Research, 5(18), 35–45.

Jale, J. S., Júnior, S. F., Stošic, T., Stošic, B., Ferreira, T. A. (2019). Information flow between ibovespa and constituent companies. Physica A: Statistical Mechanics and its Applications, 516(C), 233–239, URL

Karazmodeh, M., Nasiri, S., Hashemi, S. M. (2013). Stock price forecasting using support vector machines and improved particle swarm optimization. Journal of Automation and Control Engineering, 1(2), 173–176.

Koad, R., Zobaa, A. F., El-Shahat, A. (2017). A novel mppt algorithm based on particle swarm optimization for photovoltaic systems. IEEE Transactions on Sustainable Energy, 8(2), 468–476.

Kwapien, J., Drozdz, S. (2012). Physical approach to complex systems. Physics Reports, 515(3-4), 115–226.

de Lima, N. F., Fernandes, L. H., Jale, J. S., de Mattos Neto, P. S., Stošic, T., Stoši ´ c, B., Ferreira, T. A. (2018). Long-term ´correlations and cross-correlations in ibovespa and constituent companies. Physica A: Statistical Mechanics and its Applications, 492(C), 1431–1438, URL

Macal, C. M., North, M. J. (2005). Tutorial on agent-based modeling and simulation. Em: Proceedings of the Winter Simulation Conference, 2005., IEEE, pp. 14–pp.

Mandelbrot, B. (1963). The variation of certain speculative prices. The Journal of Business, 36(4), 394–419.

Miramontes, O., Volke, K. (2013). Fronteras de la física en el siglo XXI. CopIt-arXives.

Mitchell, M. (1996). An introduction to genetic algorithms. 9780585030944, MIT press.

Nenortaite, J., Simutis, R. (2004). Stocks’ trading system based on the particle swarm optimization algorithm. Em: International Conference on Computational Science, Springer, pp. 843–850.

Nenortaite, J., Simutis, R. (2005). Adapting particle swarm optimization to stock markets. Em: 5th International Conference on Intelligent Systems Design and Applications (ISDA’05), IEEE, pp. 520–525.

Ramos, W. V., Neto, C. R. (2015). A utilização da modelagem de sistemas complexos na construção de um mercado de ações artificial. Revista Eletrônica do Departamento de Ciências Contábeis & Departamento de Atuária e Métodos Quantitativos (REDECA), 2(1), 101–115.

Rao, P. S., Jana, P. K., Banka, H. (2017). A particle swarm optimization based energy efficient cluster head selection algorithm for wireless sensor networks. Wireless networks, 23(7), 2005–2020.

Serapião, A. B. d. S. (2009). Fundamentos de otimização por inteligência de enxames: uma visão geral. Sba: Controle & Automação Sociedade Brasileira de Automatica, 20(3), 271–304.

Shi, Y., Eberhart, R. C. (1999). Empirical study of particle swarm optimization. Em: Proceedings of the 1999 Congress on Evolutionary Computation-CEC99 (Cat. No. 99TH8406), IEEE, vol 3, pp. 1945–1950.

Stanley, H. E., Amaral, L. A. N., Canning, D., Gopikrishnan, P., Lee, Y., Liu, Y. (1999). Econophysics: Can physicists contribute to the science of economics? Physica A: Statistical Mechanics and its Applications, 269(1), 156–169.

Wang, F., Philip, L., Cheung, D. W. (2012). Complex stock trading strategy based on particle swarm optimization. Em: 2012 IEEE Conference on Computational Intelligence for Financial Engineering & Economics (CIFEr), IEEE, pp. 1–6.



How to Cite

Nascimento, K. K. F. do, Jale, J. da S., & Ferreira, T. A. E. (2021). Simulation of Financial Market with Buying and Selling Optimized by Particle Swarm. Ciência E Natura, 43, e21.