Skip to content

πŸ“ˆ Application of neural networks in the prediction of PETR4.SA shares, compared with statistical models

License

Notifications You must be signed in to change notification settings

gprzy/PETR4.SA-forecasting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PETR4.SA Forecasting

Open in colab GitHub license

A collection of PIBIC 2020-2021 codes. Statistical models of time series analysis applied to stock market predictions, compared to CNN and LSTM forecasts. Trading simulation with PETR4.SA stocks. This repository includes the scientific paper (along with the LaTeX project) written at the end of the project, documenting the steps in more detail.

The PETR4.SA historical data is available on Yahoo Finance: https://finance.yahoo.com/quote/PETR4.SA/history?p=PETR4.SA

Topic of the PIBIC: "Evaluation of the Performance of Deep Learning Techniques for the Classification of the Temporal Behavior of Shares".

Tested Models

  • SMA 10, 30 & 50 (Simple Moving Average of 10, 30 and 50 days)
  • Autorregressive model (AR)
  • ARMA model
  • ARIMA model
  • Naive 1 & 5 (Naive model of 1 and 5 days)
  • CNN (Convolutional Neural Network)
  • LSTM (Long Short-Term Memory)

Models Results

SMA10 SMA30 SMA50 AR ARMA(2,0,2) ARIMA(5,0,2) Naive1 Naive5 CNN LSTM
Accuracy 0.589431 0.540650 0.520325 0.626016 0.491870 0.508130 0.491870 0.520325 0.544715 0.524390
MSE 0.550165 1.392854 2.068185 0.126310 0.272212 0.293134 0.244692 1.064078 4.456264 1.356165
R2 0.798460 0.489760 0.242368 0.953729 0.953729 0.891471 0.910363 0.610200 -0.632448 0.503201

Trading Results

AR ARMA(2,0,2) ARIMA(5,0,2) CNN LSTM
Final Wallet 134110.0150 105564.99850 110709.9910 110859.9835 103360.0075
Wallets Diff 34110.0150 5564.99850 10709.9910 10859.9835 3360.0075
% Wallets Diff 1.3411 1.05565 1.1071 1.1086 1.0336
Score 43.0000 21.00000 25.0000 35.0000 16.0000
Loss 23.0000 41.00000 38.0000 22.0000 17.0000