Instruções Gerais:
Lembre-se de enviar o arquivo .rmd e também o .html gerado.
Se vc preferir não usar o Rmarkdown, deve entregar a sua lista resolvida em um arquivo pdf e o script do R utilizado para resolver a lista.
1.1. Instalar os pacotes não instalados ainda e carregar as bibliotecas.
#install.packages("FinTS", repos='http://cran.us.r-project.org')
#install.packages("WriteXLS")
#install.packages('IRkernel')
#install.packages("tbl2xts", repos='http://cran.us.r-project.org')
# install.packages("forecast", repos='http://cran.us.r-project.org')
# install.packages('quadprog')
# install.packages('fracdiff')
# install.packages('lmtest')
# install.packages('timeDate')
# install.packages('urca')
# install.packages("tseries", repos='http://cran.us.r-project.org')
#install.packages("timeSeries", repos='http://cran.us.r-project.org')
# Limpar workspace
rm(list = ls())
library(BatchGetSymbols) ### pegar dados yahoo finance (preços diárias ativos negociados em bolsa)
## Warning: package 'BatchGetSymbols' was built under R version 4.3.1
## Carregando pacotes exigidos: rvest
## Carregando pacotes exigidos: dplyr
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
##
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.3.1
## Warning: package 'ggplot2' was built under R version 4.3.1
## Warning: package 'readr' was built under R version 4.3.1
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ readr 2.1.4
## ✔ ggplot2 3.4.2 ✔ stringr 1.5.0
## ✔ lubridate 1.9.2 ✔ tibble 3.2.1
## ✔ purrr 1.0.1 ✔ tidyr 1.3.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ readr::guess_encoding() masks rvest::guess_encoding()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(FinTS)
## Warning: package 'FinTS' was built under R version 4.3.1
## Carregando pacotes exigidos: zoo
##
## Attaching package: 'zoo'
##
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(WriteXLS)
library(xtable)
## Warning: package 'xtable' was built under R version 4.3.1
library(tbl2xts)
## Warning: package 'tbl2xts' was built under R version 4.3.1
library(forecast)
## Warning: package 'forecast' was built under R version 4.3.1
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
##
## Attaching package: 'forecast'
##
## The following object is masked from 'package:FinTS':
##
## Acf
library(tseries)
## Warning: package 'tseries' was built under R version 4.3.1
library(timeSeries)
## Warning: package 'timeSeries' was built under R version 4.3.1
## Carregando pacotes exigidos: timeDate
##
## Attaching package: 'timeDate'
##
## The following object is masked from 'package:xtable':
##
## align
##
##
## Attaching package: 'timeSeries'
##
## The following object is masked from 'package:zoo':
##
## time<-
# Bibliotecas Graficos
library(ggplot2)
library(cowplot)
## Warning: package 'cowplot' was built under R version 4.3.1
##
## Attaching package: 'cowplot'
##
## The following object is masked from 'package:lubridate':
##
## stamp
library(ggthemes)
## Warning: package 'ggthemes' was built under R version 4.3.1
##
## Attaching package: 'ggthemes'
##
## The following object is masked from 'package:cowplot':
##
## theme_map
1.2. Carregue os retornos diários do índice Ibovespa, utilizando o período de 2021 - presente.
#ticker IBOVESPA a partir de 2021
tickers<-c("^BVSP")
ibov2<- BatchGetSymbols(tickers,
first.date = '2021-01-03',
last.date = Sys.time(),
type.return = "log",
freq.data = "daily")
## Warning: `BatchGetSymbols()` was deprecated in BatchGetSymbols 2.6.4.
## ℹ Please use `yfR::yf_get()` instead.
## ℹ 2022-05-01: Package BatchGetSymbols will soon be replaced by yfR. More
## details about the change is available at github
## <<www.github.com/msperlin/yfR> You can install yfR by executing:
##
## remotes::install_github('msperlin/yfR')
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
##
## Running BatchGetSymbols for:
## tickers =^BVSP
## Downloading data for benchmark ticker
## ^GSPC | yahoo (1|1) | Not Cached | Saving cache
## ^BVSP | yahoo (1|1) | Not Cached | Saving cache - Got 96% of valid prices | Good job!
ibov2 <- ibov2[[2]]
head(ibov2)
## price.open price.high price.low price.close volume price.adjusted
## 1 119024 120354 118062 118558 8741400 118558
## 2 118835 119790 116756 119223 9257100 119223
## 3 119377 120924 118917 119851 11638200 119851
## 4 119103 121983 119101 121956 11774800 121956
## 5 122387 125324 122386 125077 11085800 125077
## 6 125075 125075 122506 122807 9537600 122807
## ref.date ticker ret.adjusted.prices ret.closing.prices
## 1 2021-01-04 ^BVSP NA NA
## 2 2021-01-05 ^BVSP 0.005593397 0.005593397
## 3 2021-01-06 ^BVSP 0.005253616 0.005253616
## 4 2021-01-07 ^BVSP 0.017411019 0.017411019
## 5 2021-01-08 ^BVSP 0.025269224 0.025269224
## 6 2021-01-11 ^BVSP -0.018315530 -0.018315530
# Olhando os dados se estão ok ibov src download.status total.obs perc.benchmark.dates threshold.decision
glimpse(ibov2)
## Rows: 638
## Columns: 10
## $ price.open <dbl> 119024, 118835, 119377, 119103, 122387, 125075, 12…
## $ price.high <dbl> 120354, 119790, 120924, 121983, 125324, 125075, 12…
## $ price.low <dbl> 118062, 116756, 118917, 119101, 122386, 122506, 12…
## $ price.close <dbl> 118558, 119223, 119851, 121956, 125077, 122807, 12…
## $ volume <dbl> 8741400, 9257100, 11638200, 11774800, 11085800, 95…
## $ price.adjusted <dbl> 118558, 119223, 119851, 121956, 125077, 122807, 12…
## $ ref.date <date> 2021-01-04, 2021-01-05, 2021-01-06, 2021-01-07, 2…
## $ ticker <chr> "^BVSP", "^BVSP", "^BVSP", "^BVSP", "^BVSP", "^BVS…
## $ ret.adjusted.prices <dbl> NA, 0.0055933967, 0.0052536156, 0.0174110193, 0.02…
## $ ret.closing.prices <dbl> NA, 0.0055933967, 0.0052536156, 0.0174110193, 0.02…
# Eliminando os valores NA
ibov2= na.omit(ibov2)
glimpse(ibov2)
## Rows: 637
## Columns: 10
## $ price.open <dbl> 118835, 119377, 119103, 122387, 125075, 123255, 12…
## $ price.high <dbl> 119790, 120924, 121983, 125324, 125075, 124584, 12…
## $ price.low <dbl> 116756, 118917, 119101, 122386, 122506, 123227, 12…
## $ price.close <dbl> 119223, 119851, 121956, 125077, 122807, 123998, 12…
## $ volume <dbl> 9257100, 11638200, 11774800, 11085800, 9537600, 89…
## $ price.adjusted <dbl> 119223, 119851, 121956, 125077, 122807, 123998, 12…
## $ ref.date <date> 2021-01-05, 2021-01-06, 2021-01-07, 2021-01-08, 2…
## $ ticker <chr> "^BVSP", "^BVSP", "^BVSP", "^BVSP", "^BVSP", "^BVS…
## $ ret.adjusted.prices <dbl> 0.0055933967, 0.0052536156, 0.0174110193, 0.025269…
## $ ret.closing.prices <dbl> 0.0055933967, 0.0052536156, 0.0174110193, 0.025269…
(a) Fazer uma análise visual da série, verificando os fatos estilizados.
# Função para plotar os gráficos para qualquer ação que deseja analisar.
plot_graficos <- function(acao) {
# Gráfico 1: preços
p <- ggplot(acao, aes(ref.date, price.close)) +
geom_line(color='#006600') +
labs(x = "", y = 'Preço Fechamento',
title = paste("Cotação Diária da", acao$ticker[1]),
subtitle = "Período: de 05/01/2021 à 20/07/2023",
caption = "Fonte: B3") +
theme_economist()
# Gráfico 2: retornos diários
daily_returns <- acao %>% select(ref.date, ticker, ret.closing.prices)
plot_returns <- ggplot(daily_returns) +
geom_line(aes(x = ref.date, y = ret.closing.prices), color='#006600') +
labs(x = "", y = 'Retornos',
title = paste("Retornos da", acao$ticker[1]),
subtitle = "Período: de 05/01/2021 à 20/07/2023",
caption = "Fonte: B3") +
theme_economist()
# Gráfico 3: Retornos absolutos (abs)
plot_volatility <- ggplot(daily_returns) +
geom_line(aes(x = ref.date, y = abs(ret.closing.prices)), color='#006600') +
labs(x = "", y = 'Retornos absolutos',
title = paste("Retornos abs da", acao$ticker[1]),
subtitle = "Período: de 05/01/2021 à 20/07/2023",
caption = "Fonte: B3") +
theme_economist()
# Gráfico 4: qqplot
qqplot <- ggplot(daily_returns, aes(sample = ret.closing.prices)) +
stat_qq() +
stat_qq_line() +
labs(x = "Teórico", y = 'Amostra',
title = "QQplot",
subtitle = paste("Retornos diários da", acao$ticker[1]),
caption = "Fonte: Elaborado a partir de dados da B3") +
theme_economist()
# Gráfico 5: Histograma
histogram <- ggplot(daily_returns) +
geom_histogram(aes(x = ret.closing.prices, y = after_stat(density)),
color = "white", fill = "Dark grey", linetype = "solid", alpha = 0.8, binwidth = 0.02) +
geom_density(aes(x = ret.closing.prices, y = after_stat(density)), color = "black") +
labs(x = "", y = 'Densidade',
title = "Histograma",
subtitle = paste("Retornos diários da", acao$ticker[1]),
caption = "Fonte: Elaborado a partir de dados da B3") +
theme_economist()
# Plotar os gráficos juntos
plot_grid(plot_returns, qqplot, plot_volatility, histogram, nrow = 2)
}
Plotar fatos estilizados do índice iBovespa
plot_graficos(ibov2)
Calcular estatísticas descritivas para cada ação
# Calcular estatísticas descritivas para cada ação
estatisticas <- ibov2 %>%
group_by(ticker) %>%
summarise(
media = mean(ret.closing.prices),
desvio_padrao = sd(ret.closing.prices),
variancia = var(ret.closing.prices),
curtose = kurtosis(ret.closing.prices),
assimetria = skewness(ret.closing.prices)
)
# Adicionar coluna indicando se a distribuição é normal ou de cauda pesada
estatisticas <- estatisticas %>%
mutate(distribuicao = ifelse(curtose > 3, "Cauda Pesada", "Normal"))
estatisticas
## # A tibble: 1 × 7
## ticker media desvio_padrao variancia curtose assimetria distribuicao
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr>
## 1 ^BVSP 0.0000450 0.0129 0.000168 0.701 -0.242 Normal
Função para calcular os graus de liberdade da distribuição t-Student
# Função para calcular os graus de liberdade da distribuição t-Student
df_t_student <- function(data) {
n <- length(data)
df <- ifelse(n < 30, n - 1, 30)
return(df)
}
# Função para calcular estatísticas descritivas e plotar histograma
plot_estatisticas_histograma <- function(data, tickers) {
# Plotar histograma
grafico <- ggplot(data = data) +
geom_histogram(aes(x = ret.closing.prices, y = after_stat(density)),
color = "black", fill = "white") +
facet_wrap(~ticker, ncol = 2) +
geom_density(aes(x = ret.closing.prices),
color = "blue", fill = "lightblue", alpha = 0.5) +
stat_function(fun = dnorm,
args = list(mean = mean(data$ret.closing.prices), sd = sd(data$ret.closing.prices)),
color = "red", linetype = "dashed") +
stat_function(fun = dt,
args = list(df = df_t_student(data$ret.closing.prices)),
color = "green", linetype = "dotted") +
labs(x = "Retornos", y = "Densidade",
title = "Distribuição Normal e t-Student",
subtitle = "distribuicoes BVSP",
caption = "Fonte: Dados da Acao") +
theme_minimal()
print(grafico)
}
# Chamar a função para as 4 ações desejadas
plot_estatisticas_histograma(ibov2, ticker)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Vamos selecionar os retornos diários da série do IBOVESPA e separar as
datas da série de retornos, além de declarar a variável como série
temporal.
daily_returns2 <- ibov2 %>%
select(ref.date,ret.closing.prices)
date2 <- daily_returns2 %>%
select(ref.date) %>%
rename(date = ref.date) %>%
slice(-1)
daily_returns2 <- daily_returns2 %>%
select(ret.closing.prices) %>%
slice(-1)
## declarando como série temporal através do comando as.ts
daily_returns2=as.ts(daily_returns2)
head(daily_returns2)
## Time Series:
## Start = 1
## End = 6
## Frequency = 1
## ret.closing.prices
## [1,] 0.005253616
## [2,] 0.017411019
## [3,] 0.025269224
## [4,] -0.018315530
## [5,] 0.009651419
## [6,] -0.015916577
# Convert daily_returns2 to a time series
daily_returns_ts <- ts(daily_returns2, frequency = 1)
# Identify the length of the time series
ts_length <- length(daily_returns_ts)
# Split the time series into training and test sets
training_data <- window(daily_returns_ts, end = ts_length - 20)
test_data <- window(daily_returns_ts, start = ts_length - 20)
head(training_data,2)
## Time Series:
## Start = 1
## End = 2
## Frequency = 1
## ret.closing.prices
## [1,] 0.005253616
## [2,] 0.017411019
tail(test_data,2)
## Time Series:
## Start = 635
## End = 636
## Frequency = 1
## ret.closing.prices
## [1,] 0.009314562
## [2,] 0.005473611
(b) Fazer a análise da FAC e da FACP. Objetivo é entender as autocorrelações da série de dados e nos ajudar a determinar qual o modelo e a ordem de defasagem escolher.
IDENTIFICAÇÃO DO MODELO
FAC e FACP
Para ter uma ideia do modelo a ser estimado, usamos as FAC e FACP. Podemos estipular o número máximo de defasagens a ser incluído através de lag.max.
acf(training_data, lag.max= 50)
pacf(training_data, lag.max=50)
tsdisplay(training_data, lag.max = 50)
Visualizando o ACF temos ruído branco e sem memoria, porém ACF onde nós da um MA(39) com lag em 39 com uma baixa correlação de 0.08 que está fora do intevalo de confiança.
Visualizando o gráfico do ACFP temos ruído branco e sem memoria, porém ACFP onde nós dá um AR(39) com lag em 39 com uma baixa correlação de 0.10 que está fora do intevalo de confiança também.
No modelo escolhido para iniciar a analise foi AR(39), o termo AR de ordem 39 permite que o modelo leve em consideração a dependência de longo prazo.
Durante o processo foi escolhido o modelo AR(1), pois o modelo AR(1) rodaria tão bem quanto AR(39)
(c) Estimar o modelo baseado na defasagem escolhida pelos critérios FAC e FACP. Qual a estatística-t de cada parâmetro? Qual o valor dos critérios de informação (BIC e AIC)?
ESTIMAÇÃO DO MODELO
Vamos tentar primeiro um modelo AR(39) vs AR(1). O comando arima faz a estimação do modelo. É preciso inserir a base de dados e a ordem ARIMA desejada. No caso de um AR(39), temos um ARIMA(39,0,0) e no caso AR(1), temos ARIMA(1,0,0) . Sempre que a série for estacionária, a ordem I é zero, pois a variável é integrada de ordem zero (ou seja, temos ruído branco).
ar_39 <- arima(training_data, order = c(39, 0, 0))
# Obter os coeficientes
print(ar_39)
##
## Call:
## arima(x = training_data, order = c(39, 0, 0))
##
## Coefficients:
## ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9
## -0.0356 -0.0183 0.0049 0.0082 -0.0689 0.0072 0.0413 0.0164 0.0283
## s.e. 0.0400 0.0401 0.0401 0.0402 0.0402 0.0402 0.0402 0.0403 0.0403
## ar10 ar11 ar12 ar13 ar14 ar15 ar16 ar17
## 0.0093 0.0408 -0.0094 -0.0475 -0.0471 -0.0561 0.0404 -0.0476
## s.e. 0.0402 0.0402 0.0402 0.0402 0.0403 0.0404 0.0405 0.0405
## ar18 ar19 ar20 ar21 ar22 ar23 ar24 ar25 ar26
## 0.0371 0.0045 0.0082 0.0621 0.0072 -0.0481 0.0279 -0.0207 0.0023
## s.e. 0.0407 0.0407 0.0407 0.0407 0.0408 0.0407 0.0407 0.0407 0.0406
## ar27 ar28 ar29 ar30 ar31 ar32 ar33 ar34
## -0.0323 0.0186 -0.0353 -0.0784 -0.0461 -0.0378 0.0209 0.0782
## s.e. 0.0405 0.0405 0.0405 0.0405 0.0412 0.0414 0.0414 0.0415
## ar35 ar36 ar37 ar38 ar39 intercept
## -0.0202 -0.0084 0.0468 0.0181 0.1144 0e+00
## s.e. 0.0417 0.0416 0.0418 0.0418 0.0418 5e-04
##
## sigma^2 estimated as 0.0001597: log likelihood = 1817.82, aic = -3553.64
# Obter o valor do BIC
bic_ar39 <- BIC(ar_39)
# Obter o valor do AIC
aic_ar_39 <- AIC(ar_39)
# Imprimir os valores do BIC e AIC
print(bic_ar39)
## [1] -3372.29
print(aic_ar_39)
## [1] -3553.644
# Retornar os valores de BIC, AIC e coeficientes
return_list <- list(BIC = bic_ar39, AIC = aic_ar_39)
return_list
## $BIC
## [1] -3372.29
##
## $AIC
## [1] -3553.644
Testando e estimando outros modelos ARIMA.
arma_11 <- arima(training_data, order = c(1, 0, 1))
# Obter os coeficientes
print(arma_11)
##
## Call:
## arima(x = training_data, order = c(1, 0, 1))
##
## Coefficients:
## ar1 ma1 intercept
## 0.6224 -0.6506 0e+00
## s.e. 0.5833 0.5630 5e-04
##
## sigma^2 estimated as 0.0001696: log likelihood = 1800.07, aic = -3592.13
# Obter o valor do BIC
bic_arma11 <- BIC(arma_11)
# Obter o valor do AIC
aic_arma11 <- AIC(arma_11)
# Retornar os valores de coeficiente BIC e AIC
return_list <- list(BIC = bic_arma11, AIC = aic_arma11)
return_list
## $BIC
## [1] -3574.437
##
## $AIC
## [1] -3592.13
arima_0 <- arima(training_data, order = c(0, 0, 0))
# Obter os coeficientes
print(arima_0)
##
## Call:
## arima(x = training_data, order = c(0, 0, 0))
##
## Coefficients:
## intercept
## 0e+00
## s.e. 5e-04
##
## sigma^2 estimated as 0.0001698: log likelihood = 1799.66, aic = -3595.32
# Obter o valor do BIC
bic_arima0 <- BIC(arima_0)
# Obter o valor do AIC
aic_arima0 <- AIC(arima_0)
# Retornar os valores de coeficiente BIC e AIC
return_list <- list(BIC = bic_arima0, AIC = aic_arima0)
return_list
## $BIC
## [1] -3586.475
##
## $AIC
## [1] -3595.321
ar_1 <- arima(training_data, order = c(1, 0, 0))
# Obter os coeficientes
print(ar_1)
##
## Call:
## arima(x = training_data, order = c(1, 0, 0))
##
## Coefficients:
## ar1 intercept
## -0.0309 0e+00
## s.e. 0.0403 5e-04
##
## sigma^2 estimated as 0.0001696: log likelihood = 1799.95, aic = -3593.91
# Obter o valor do BIC
bic_ar1 <- BIC(ar_1)
# Obter o valor do AIC
aic_ar_1 <- AIC(ar_1)
# Retornar os valores de coeficiente AR1, BIC e AIC
return_list <- list(BIC = bic_ar1, AIC = aic_ar_1)
return_list
## $BIC
## [1] -3580.639
##
## $AIC
## [1] -3593.909
Conclusão de estimação de modelos
Conclusão de estimação de modelos
| AR(39) | AR(1) | ARIMA(1,0,1) | AR(0) | |
|---|---|---|---|---|
| Número de coeficientes | 39 | 1 | 2 | 0 |
| BIC | -3453.7 | -3699.6 | -3655.1 | -3705.3 |
| AIC | -3635.8 | -3713.0 | -3672.9 | -3714.2 |
Analisando a tabela vimos que quanto menor os valor do BIC e AIC melhor, portanto o modelo mais adequado foi AR(1)
Como o valor foi negativo, podemos selecionar o modelo com a estatística de testes mais próxima de \(- \infty\)
(d) Diagnóstico dos resíduos. Verificar se os resíduos se comportam como ruído branco.
Diagnóstico do modelo AR(39) e AR(1)
Após estimar o modelo, é preciso verificar se o mesmo é adequado através da análise dos resíduos, que devem ter o comportamento de ruído branco. Podemos ver isso através da estatística Q (teste de Box-Pierce e Ljung-Box), das FAC e FACP e da análise visual do gráfico dos resíduos.
tsdiag(ar_39)
tsdiag(ar_1)
Teste de diagnóstico com Box-Pierce test AR(39) vs AR(1)
Box.test(ar_39$residuals,lag=1)
##
## Box-Pierce test
##
## data: ar_39$residuals
## X-squared = 0.0339, df = 1, p-value = 0.8539
Box.test(ar_1$residuals,lag=1)
##
## Box-Pierce test
##
## data: ar_1$residuals
## X-squared = 0.00019186, df = 1, p-value = 0.9889
Conclusão do teste de Box-Pierce AR(39), a estatística Q é igual a 1.1361 e o número de graus de liberdade (df) é 1. O valor-p associado ao teste é 1. Isso significa que o valor-p é maior que o nível de significância usual (0.05), indicando que não há evidências suficientes para rejeitar a hipótese nula de que os resíduos do modelo são ruído branco.
Conclusão do teste de Box-Pierce AR(1), a estatística Q é igual a 0.00020267 e o número de graus de liberdade (df) é 1. O valor-p associado ao teste é 0.9886. Isso significa que o valor-p é maior que o nível de significância usual (0.05), indicando que não há evidências suficientes para rejeitar a hipótese nula de que os resíduos do modelo são ruído branco.
Teste de diagnóstico com Box-Ljung AR(39) vs AR(1)
Box.test(residuals(ar_39), type="Ljung")
##
## Box-Ljung test
##
## data: residuals(ar_39)
## X-squared = 0.034065, df = 1, p-value = 0.8536
Box.test(residuals(ar_1), type="Ljung")
##
## Box-Ljung test
##
## data: residuals(ar_1)
## X-squared = 0.00019279, df = 1, p-value = 0.9889
Conclusão do teste de Box-Ljung AR(39), a estatística Q é igual a 0.028406 e o número de graus de liberdade (df) é 1. O valor-p associado ao teste é 0.8662, o que significa que o valor-p é maior que o nível de significância usual (0.05). O modelo
Conclusão do teste de Box-Ljung AR(1) portanto nesse caso será escolhido para fazer as próximas previsões, a estatística Q é igual a 0.00020363 e o número de graus de liberdade (df) é 1. O valor-p associado ao teste é 0.9886, o que significa que o valor-p é maior que o nível de significância usual (0.05)
Assim como no teste de Box-Pierce, o resultado do teste de Box-Ljung indica que não há evidências suficientes para rejeitar a hipótese nula de que os resíduos do modelo são ruído branco. Isso sugere que os resíduos são aleatórios e independentes ao longo do tempo, o que é uma boa notícia em termos de adequação do modelo.
Gráfico ACF e PACF Residual do AR(39) vs AR(1)
acf(residuals(ar_39))
pacf(residuals(ar_39))
acf(residuals(ar_1))
pacf(residuals(ar_1))
Gráfico de resíduos do AR(39) vs AR(1)
plot.ts(ar_39$residuals)
plot.ts(ar_1$residuals)
O teste de Box-Pierce e Box-Ljung aplicados aos resíduos do modelo ARIMA(39, 0, 0) e modelo ARIMA(1, 0, 0), apresentou os seguintes resultados:
| Teste de Box-Pierce AR(39) | Teste Box-Ljung AR(39) | Teste de Box-Pierce AR(1) | Teste Box-Ljung AR(1) | |
| Estatística Qui-Quadrado (X-squared): | 0.029023 | 0.029162 | 0.00020267 | 0.00020363 |
| Graus de liberdade (df): | 1 | 1 | 1 | 1 |
| Valor p: | 0.8647 | 0.8644 | 0.9886 | 0.9886 |
Os teste de Box-Pierce e Box-Ljung é utilizado para avaliar a presença de autocorrelação nos resíduos de um modelo. Nesse caso, a hipótese nula (\(H_0\)) é de que não há autocorrelação nos resíduos, ou seja, os resíduos são independentes.
Com base nos resultados do teste de Box-Pierce e Box-Ljung, não foi encontrada evidência suficiente para rejeitar a hipótese nula. O valor-p de 0.8647 é maior que um limiar de significância comumente utilizado (por exemplo, 0.05), indicando que não há autocorrelação estatisticamente significativa nos resíduos.
Isso sugere que tanto o modelo ARIMA(39, 0, 0) e ARIMA(1, 0, 0) foi capaz de capturar a estrutura de autocorrelação dos dados e que os resíduos não apresentam autocorrelação significativa.
Portanto optaremos pelo modelo ARIMA(1,0,0) por ter menos parâmetros. Porém toda a análise será realizada um comparado com o outro.
Em resumo, com base no teste de Box-Pierce, não há evidência para rejeitar a hipótese nula de independência dos resíduos. Isso indica que o modelo ARIMA(39, 0, 0) é adequado para capturar a estrutura dos dados e os resíduos podem ser considerados aleatórios e independentes.
2. Para o modelo escolhido no exercício anterior, calcule as previsões para 5 períodos à frente, com seu intervalo de confiança correspondente. Lembre-se que a previsão é do tipo estático: apenas informações até o momento t são usadas para fazer previsões em t + k.
PREVISÕES AR(39) vs AR(1)
forecast<-predict(ar_39,n.ahead=20)
#(4 passos a frente)
#Com desvio-padrão
predict(ar_39, n.ahead = 20, se.fit=T)
## $pred
## Time Series:
## Start = 617
## End = 636
## Frequency = 1
## [1] -0.0019203600 0.0024882290 0.0020728920 0.0020669739 0.0015992310
## [6] 0.0002245906 0.0039811303 -0.0018545746 -0.0008085960 -0.0003077441
## [11] 0.0008199615 0.0054592463 -0.0010755766 -0.0035290017 -0.0025615509
## [16] -0.0025877705 0.0008284941 -0.0019879301 -0.0024460590 0.0004439424
##
## $se
## Time Series:
## Start = 617
## End = 636
## Frequency = 1
## [1] 0.01263581 0.01264382 0.01264566 0.01264590 0.01264632 0.01267690
## [7] 0.01267779 0.01268951 0.01269047 0.01269433 0.01269528 0.01270466
## [13] 0.01270666 0.01272150 0.01273376 0.01274964 0.01276078 0.01277379
## [19] 0.01278841 0.01278888
forecast<-predict(ar_1,n.ahead=20)
#(4 passos a frente)
#Com desvio-padrão
predict(ar_1, n.ahead = 20, se.fit=T)
## $pred
## Time Series:
## Start = 617
## End = 636
## Frequency = 1
## [1] 1.613565e-04 -3.214932e-05 -2.617647e-05 -2.636083e-05 -2.635514e-05
## [6] -2.635532e-05 -2.635531e-05 -2.635531e-05 -2.635531e-05 -2.635531e-05
## [11] -2.635531e-05 -2.635531e-05 -2.635531e-05 -2.635531e-05 -2.635531e-05
## [16] -2.635531e-05 -2.635531e-05 -2.635531e-05 -2.635531e-05 -2.635531e-05
##
## $se
## Time Series:
## Start = 617
## End = 636
## Frequency = 1
## [1] 0.01302423 0.01303044 0.01303044 0.01303044 0.01303044 0.01303044
## [7] 0.01303044 0.01303044 0.01303044 0.01303044 0.01303044 0.01303044
## [13] 0.01303044 0.01303044 0.01303044 0.01303044 0.01303044 0.01303044
## [19] 0.01303044 0.01303044
forecast(ar_39, 20)
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## 617 -0.0019203600 -0.01811380 0.01427308 -0.02668609 0.02284537
## 618 0.0024882290 -0.01371548 0.01869194 -0.02229321 0.02726967
## 619 0.0020728920 -0.01413317 0.01827896 -0.02271215 0.02685793
## 620 0.0020669739 -0.01413940 0.01827335 -0.02271853 0.02685248
## 621 0.0015992310 -0.01460768 0.01780614 -0.02318710 0.02638556
## 622 0.0002245906 -0.01602151 0.01647069 -0.02462168 0.02507086
## 623 0.0039811303 -0.01226612 0.02022838 -0.02086689 0.02882915
## 624 -0.0018545746 -0.01811684 0.01440769 -0.02672556 0.02301641
## 625 -0.0008085960 -0.01707209 0.01545490 -0.02568147 0.02406427
## 626 -0.0003077441 -0.01657618 0.01596069 -0.02518816 0.02457268
## 627 0.0008199615 -0.01544969 0.01708962 -0.02406233 0.02570225
## 628 0.0054592463 -0.01082243 0.02174093 -0.01944143 0.03035993
## 629 -0.0010755766 -0.01735982 0.01520867 -0.02598018 0.02382902
## 630 -0.0035290017 -0.01983226 0.01277426 -0.02846269 0.02140469
## 631 -0.0025615509 -0.01888052 0.01375742 -0.02751926 0.02239616
## 632 -0.0025877705 -0.01892710 0.01375156 -0.02757661 0.02240107
## 633 0.0008284941 -0.01552510 0.01718209 -0.02418217 0.02583916
## 634 -0.0019879301 -0.01835820 0.01438234 -0.02702410 0.02304824
## 635 -0.0024460590 -0.01883506 0.01394294 -0.02751088 0.02261876
## 636 0.0004439424 -0.01594567 0.01683355 -0.02462181 0.02550969
plot(forecast(ar_39, 20))
forecast(ar_1, 20)
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## 617 1.613565e-04 -0.01652987 0.01685258 -0.02536567 0.02568839
## 618 -3.214932e-05 -0.01673133 0.01666703 -0.02557134 0.02550704
## 619 -2.617647e-05 -0.01672536 0.01667301 -0.02556538 0.02551302
## 620 -2.636083e-05 -0.01672555 0.01667282 -0.02556556 0.02551284
## 621 -2.635514e-05 -0.01672554 0.01667283 -0.02556555 0.02551284
## 622 -2.635532e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 623 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 624 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 625 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 626 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 627 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 628 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 629 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 630 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 631 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 632 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 633 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 634 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 635 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
## 636 -2.635531e-05 -0.01672554 0.01667283 -0.02556556 0.02551284
plot(forecast(ar_1, 20))
Outra forma de plotar os gráfico de previsão com intervalo de confiança.
forecast_ar39 <- predict(ar_39, n.ahead = 20)
# Dataframe para armazenar as previsões e o desvio-padrão
forecast_data <- data.frame(
Pred = forecast_ar39$pred,
SE = forecast_ar39$se
)
# Plotar as previsões com o intervalo de confiança de 95%
# Plotar a série temporal original
plot(daily_returns2, xlab = "Data", ylab = "Retornos Diários", main = "Previsões ARIMA(39, 0, 0) com intervalo de confiança de 95%")
# Plotar as previsões e o intervalo de confiança
lines(forecast_data$Pred, col = "blue")
lines(forecast_data$Pred + 1.96 * forecast_data$SE, col = "red", lty = 2)
lines(forecast_data$Pred - 1.96 * forecast_data$SE, col = "red", lty = 2)
# Adicionar legenda
legend("topleft", legend = c("Previsão", "Intervalo de Confiança 95%"), col = c("blue", "red"), lty = c(1, 2))
# imprimir o dataframe forecast_data para visualizar as previsões e o desvio-padrão
print(forecast_data)
## Pred SE
## 1 -0.0019203600 0.01263581
## 2 0.0024882290 0.01264382
## 3 0.0020728920 0.01264566
## 4 0.0020669739 0.01264590
## 5 0.0015992310 0.01264632
## 6 0.0002245906 0.01267690
## 7 0.0039811303 0.01267779
## 8 -0.0018545746 0.01268951
## 9 -0.0008085960 0.01269047
## 10 -0.0003077441 0.01269433
## 11 0.0008199615 0.01269528
## 12 0.0054592463 0.01270466
## 13 -0.0010755766 0.01270666
## 14 -0.0035290017 0.01272150
## 15 -0.0025615509 0.01273376
## 16 -0.0025877705 0.01274964
## 17 0.0008284941 0.01276078
## 18 -0.0019879301 0.01277379
## 19 -0.0024460590 0.01278841
## 20 0.0004439424 0.01278888
forecast_ar1 <- predict(ar_1, n.ahead = 20)
# Dataframe para armazenar as previsões e o desvio-padrão
forecast_data <- data.frame(
Pred = forecast_ar1$pred,
SE = forecast_ar1$se
)
# Plotar as previsões com o intervalo de confiança de 95%
# Plotar a série temporal original
plot(daily_returns2, xlab = "Data", ylab = "Retornos Diários", main = "Previsões ARIMA(1, 0, 0) com intervalo de confiança de 95%")
# Plotar as previsões e o intervalo de confiança
lines(forecast_data$Pred, col = "blue")
lines(forecast_data$Pred + 1.96 * forecast_data$SE, col = "red", lty = 2)
lines(forecast_data$Pred - 1.96 * forecast_data$SE, col = "red", lty = 2)
# Adicionar legenda
legend("topleft", legend = c("Previsão", "Intervalo de Confiança 95%"), col = c("blue", "red"), lty = c(1, 2))
# imprimir o dataframe forecast_data para visualizar as previsões e o desvio-padrão
print(forecast_data)
## Pred SE
## 1 1.613565e-04 0.01302423
## 2 -3.214932e-05 0.01303044
## 3 -2.617647e-05 0.01303044
## 4 -2.636083e-05 0.01303044
## 5 -2.635514e-05 0.01303044
## 6 -2.635532e-05 0.01303044
## 7 -2.635531e-05 0.01303044
## 8 -2.635531e-05 0.01303044
## 9 -2.635531e-05 0.01303044
## 10 -2.635531e-05 0.01303044
## 11 -2.635531e-05 0.01303044
## 12 -2.635531e-05 0.01303044
## 13 -2.635531e-05 0.01303044
## 14 -2.635531e-05 0.01303044
## 15 -2.635531e-05 0.01303044
## 16 -2.635531e-05 0.01303044
## 17 -2.635531e-05 0.01303044
## 18 -2.635531e-05 0.01303044
## 19 -2.635531e-05 0.01303044
## 20 -2.635531e-05 0.01303044
Valores ajustados x observados AR(39) vs AR(1)
Para ter uma idéia do ajuste do modelo, plotamos a série observada com a série estimada:
plot(daily_returns2, col="red")
lines(fitted(ar_39),col="blue")
plot(daily_returns2, col="red")
lines(fitted(ar_1),col="blue")
FUNÇÃO AUTOARIMA
Escolhe a “melhor” configuração do modelo
auto.arima(daily_returns2)
## Series: daily_returns2
## ARIMA(0,0,0) with zero mean
##
## sigma^2 = 0.0001675: log likelihood = 1862.45
## AIC=-3722.89 AICc=-3722.89 BIC=-3718.44
Métricas MAE MSE RMSE para os modelos AR(39) vs AR(1)
# FORECASTS FOR AR(39) and AR(1)
forecast_39 <- forecast(ar_39, h = 20)
forecast_1 <- forecast(ar_1, h = 20)
# Calculate the MAE, MSE, and RMSE for AR(39)
mae_ar_39 <- mean(abs(forecast_39$mean - test_data))
mse_ar_39 <- mean((forecast_39$mean - test_data)^2)
rmse_ar_39 <- sqrt(mse_ar_39)
# Calculate the MAE, MSE, and RMSE for AR(1)
mae_ar_1 <- mean(abs(forecast_1$mean - test_data))
mse_ar_1 <- mean((forecast_1$mean - test_data)^2)
rmse_ar_1 <- sqrt(mse_ar_1)
# Print the results
cat("AR(39) - MAE:", mae_ar_39, "\n")
## AR(39) - MAE: 0.008238894
cat("AR(39) - MSE:", mse_ar_39, "\n")
## AR(39) - MSE: 0.0001000721
cat("AR(39) - RMSE:", rmse_ar_39, "\n")
## AR(39) - RMSE: 0.0100036
cat("AR(1) - MAE:", mae_ar_1, "\n")
## AR(1) - MAE: 0.008444095
cat("AR(1) - MSE:", mse_ar_1, "\n")
## AR(1) - MSE: 9.656227e-05
cat("AR(1) - RMSE:", rmse_ar_1, "\n")
## AR(1) - RMSE: 0.00982661
3. Utilize função BatchGetSymbols::GetSP500Stocks para baixar dados de todas ações ao atual índice SP500. Utilizando seus conhecimentos sobre dplyr, estime um modelo ARMA para os retornos de cada ação dos dados importados. No mesmo dataframe de saída, crie uma nova coluna com a previsão em t+1 de cada modelo. Qual ação possui maior expectativa de retorno?
# Limpar workspace
rm(list = ls())
# Instalar e carregar as bibliotecas necessárias
#install.packages("BatchGetSymbols")
#install.packages("dplyr")
library(BatchGetSymbols)
library(dplyr)
library(tidyverse)
library(tseries)
library(ggplot2)
library(forecast)
# Tickers de um índice Ex: SP500 baixa todos os ticker do indice SP500
# Setar as datas
first.date <- Sys.Date() - 365
last.date <- Sys.Date()
freq.data <- 'daily'
# Setar o benchmark SP500
my.bench <- '^GSPC'
# Obter os tickers do índice SP500
sp500_stocks <- GetSP500Stocks()
tickers <- sp500_stocks$Tickers
# Baixar os dados
l.sp500 <- BatchGetSymbols(tickers = tickers,
freq.data = freq.data,
bench.ticker = my.bench,
type.return = "log",
first.date = first.date,
last.date = last.date,
cache.folder = file.path(tempdir(), 'BGS_Cache'))
##
## Running BatchGetSymbols for:
## tickers =MMM, AOS, ABT, ABBV, ACN, ATVI, ADM, ADBE, ADP, AAP, AES, AFL, A, APD, AKAM, ALK, ALB, ARE, ALGN, ALLE, LNT, ALL, GOOGL, GOOG, MO, AMZN, AMCR, AMD, AEE, AAL, AEP, AXP, AIG, AMT, AWK, AMP, ABC, AME, AMGN, APH, ADI, ANSS, AON, APA, AAPL, AMAT, APTV, ACGL, ANET, AJG, AIZ, T, ATO, ADSK, AZO, AVB, AVY, AXON, BKR, BALL, BAC, BBWI, BAX, BDX, WRB, BRK.B, BBY, BIO, TECH, BIIB, BLK, BK, BA, BKNG, BWA, BXP, BSX, BMY, AVGO, BR, BRO, BF.B, BG, CHRW, CDNS, CZR, CPT, CPB, COF, CAH, KMX, CCL, CARR, CTLT, CAT, CBOE, CBRE, CDW, CE, CNC, CNP, CDAY, CF, CRL, SCHW, CHTR, CVX, CMG, CB, CHD, CI, CINF, CTAS, CSCO, C, CFG, CLX, CME, CMS, KO, CTSH, CL, CMCSA, CMA, CAG, COP, ED, STZ, CEG, COO, CPRT, GLW, CTVA, CSGP, COST, CTRA, CCI, CSX, CMI, CVS, DHI, DHR, DRI, DVA, DE, DAL, XRAY, DVN, DXCM, FANG, DLR, DFS, DIS, DG, DLTR, D, DPZ, DOV, DOW, DTE, DUK, DD, DXC, EMN, ETN, EBAY, ECL, EIX, EW, EA, ELV, LLY, EMR, ENPH, ETR, EOG, EPAM, EQT, EFX, EQIX, EQR, ESS, EL, ETSY, EG, EVRG, ES, EXC, EXPE, EXPD, EXR, XOM, FFIV, FDS, FICO, FAST, FRT, FDX, FITB, FSLR, FE, FIS, FI, FLT, FMC, F, FTNT, FTV, FOXA, FOX, BEN, FCX, GRMN, IT, GEHC, GEN, GNRC, GD, GE, GIS, GM, GPC, GILD, GL, GPN, GS, HAL, HIG, HAS, HCA, PEAK, HSIC, HSY, HES, HPE, HLT, HOLX, HD, HON, HRL, HST, HWM, HPQ, HUM, HBAN, HII, IBM, IEX, IDXX, ITW, ILMN, INCY, IR, PODD, INTC, ICE, IFF, IP, IPG, INTU, ISRG, IVZ, INVH, IQV, IRM, JBHT, JKHY, J, JNJ, JCI, JPM, JNPR, K, KDP, KEY, KEYS, KMB, KIM, KMI, KLAC, KHC, KR, LHX, LH, LRCX, LW, LVS, LDOS, LEN, LNC, LIN, LYV, LKQ, LMT, L, LOW, LYB, MTB, MRO, MPC, MKTX, MAR, MMC, MLM, MAS, MA, MTCH, MKC, MCD, MCK, MDT, MRK, META, MET, MTD, MGM, MCHP, MU, MSFT, MAA, MRNA, MHK, MOH, TAP, MDLZ, MPWR, MNST, MCO, MS, MOS, MSI, MSCI, NDAQ, NTAP, NFLX, NWL, NEM, NWSA, NWS, NEE, NKE, NI, NDSN, NSC, NTRS, NOC, NCLH, NRG, NUE, NVDA, NVR, NXPI, ORLY, OXY, ODFL, OMC, ON, OKE, ORCL, OGN, OTIS, PCAR, PKG, PANW, PARA, PH, PAYX, PAYC, PYPL, PNR, PEP, PFE, PCG, PM, PSX, PNW, PXD, PNC, POOL, PPG, PPL, PFG, PG, PGR, PLD, PRU, PEG, PTC, PSA, PHM, QRVO, PWR, QCOM, DGX, RL, RJF, RTX, O, REG, REGN, RF, RSG, RMD, RVTY, RHI, ROK, ROL, ROP, ROST, RCL, SPGI, CRM, SBAC, SLB, STX, SEE, SRE, NOW, SHW, SPG, SWKS, SJM, SNA, SEDG, SO, LUV, SWK, SBUX, STT, STLD, STE, SYK, SYF, SNPS, SYY, TMUS, TROW, TTWO, TPR, TRGP, TGT, TEL, TDY, TFX, TER, TSLA, TXN, TXT, TMO, TJX, TSCO, TT, TDG, TRV, TRMB, TFC, TYL, TSN, USB, UDR, ULTA, UNP, UAL, UPS, URI, UNH, UHS, VLO, VTR, VRSN, VRSK, VZ, VRTX, VFC, VTRS, VICI, V, VMC, WAB, WBA, WMT, WBD, WM, WAT, WEC, WFC, WELL, WST, WDC, WRK, WY, WHR, WMB, WTW, GWW, WYNN, XEL, XYL, YUM, ZBRA, ZBH, ZION, ZTS
## Downloading data for benchmark ticker
## ^GSPC | yahoo (1|1) | Found cache file
## MMM | yahoo (1|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## AOS | yahoo (2|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## ABT | yahoo (3|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## ABBV | yahoo (4|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## ACN | yahoo (5|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## ATVI | yahoo (6|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## ADM | yahoo (7|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## ADBE | yahoo (8|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## ADP | yahoo (9|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## AAP | yahoo (10|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## AES | yahoo (11|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## AFL | yahoo (12|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## A | yahoo (13|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## APD | yahoo (14|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## AKAM | yahoo (15|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## ALK | yahoo (16|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## ALB | yahoo (17|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## ARE | yahoo (18|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## ALGN | yahoo (19|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## ALLE | yahoo (20|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## LNT | yahoo (21|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## ALL | yahoo (22|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## GOOGL | yahoo (23|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## GOOG | yahoo (24|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## MO | yahoo (25|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## AMZN | yahoo (26|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## AMCR | yahoo (27|503) | Not Cached | Saving cache - Got 100% of valid prices | Feliz que nem lambari de sanga!
## AMD | yahoo (28|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## AEE | yahoo (29|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## AAL | yahoo (30|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## AEP | yahoo (31|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## AXP | yahoo (32|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## AIG | yahoo (33|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## AMT | yahoo (34|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## AWK | yahoo (35|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## AMP | yahoo (36|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## ABC | yahoo (37|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## AME | yahoo (38|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## AMGN | yahoo (39|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## APH | yahoo (40|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## ADI | yahoo (41|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## ANSS | yahoo (42|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## AON | yahoo (43|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## APA | yahoo (44|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## AAPL | yahoo (45|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## AMAT | yahoo (46|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## APTV | yahoo (47|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## ACGL | yahoo (48|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## ANET | yahoo (49|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## AJG | yahoo (50|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## AIZ | yahoo (51|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## T | yahoo (52|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## ATO | yahoo (53|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## ADSK | yahoo (54|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## AZO | yahoo (55|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## AVB | yahoo (56|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## AVY | yahoo (57|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## AXON | yahoo (58|503) | Not Cached | Saving cache - Got 100% of valid prices | Feliz que nem lambari de sanga!
## BKR | yahoo (59|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## BALL | yahoo (60|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## BAC | yahoo (61|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## BBWI | yahoo (62|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## BAX | yahoo (63|503) | Not Cached | Saving cache - Got 100% of valid prices | Boa!
## BDX | yahoo (64|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## WRB | yahoo (65|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## BRK.B | yahoo (66|503) | Not Cached - Error in download..
## BBY | yahoo (67|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## BIO | yahoo (68|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## TECH | yahoo (69|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## BIIB | yahoo (70|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## BLK | yahoo (71|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## BK | yahoo (72|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## BA | yahoo (73|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## BKNG | yahoo (74|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## BWA | yahoo (75|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## BXP | yahoo (76|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## BSX | yahoo (77|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## BMY | yahoo (78|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## AVGO | yahoo (79|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## BR | yahoo (80|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## BRO | yahoo (81|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## BF.B | yahoo (82|503) | Not Cached - Error in download..
## BG | yahoo (83|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## CHRW | yahoo (84|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## CDNS | yahoo (85|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## CZR | yahoo (86|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## CPT | yahoo (87|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## CPB | yahoo (88|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## COF | yahoo (89|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## CAH | yahoo (90|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## KMX | yahoo (91|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## CCL | yahoo (92|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## CARR | yahoo (93|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## CTLT | yahoo (94|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## CAT | yahoo (95|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## CBOE | yahoo (96|503) | Not Cached | Saving cache - Got 100% of valid prices | Boa!
## CBRE | yahoo (97|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## CDW | yahoo (98|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## CE | yahoo (99|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## CNC | yahoo (100|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## CNP | yahoo (101|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## CDAY | yahoo (102|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## CF | yahoo (103|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## CRL | yahoo (104|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## SCHW | yahoo (105|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## CHTR | yahoo (106|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## CVX | yahoo (107|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## CMG | yahoo (108|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## CB | yahoo (109|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## CHD | yahoo (110|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## CI | yahoo (111|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## CINF | yahoo (112|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## CTAS | yahoo (113|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## CSCO | yahoo (114|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## C | yahoo (115|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## CFG | yahoo (116|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## CLX | yahoo (117|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## CME | yahoo (118|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## CMS | yahoo (119|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## KO | yahoo (120|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## CTSH | yahoo (121|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## CL | yahoo (122|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais contente que cusco de cozinheira!
## CMCSA | yahoo (123|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## CMA | yahoo (124|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## CAG | yahoo (125|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## COP | yahoo (126|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## ED | yahoo (127|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## STZ | yahoo (128|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## CEG | yahoo (129|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## COO | yahoo (130|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## CPRT | yahoo (131|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## GLW | yahoo (132|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## CTVA | yahoo (133|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## CSGP | yahoo (134|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## COST | yahoo (135|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## CTRA | yahoo (136|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## CCI | yahoo (137|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## CSX | yahoo (138|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## CMI | yahoo (139|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## CVS | yahoo (140|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## DHI | yahoo (141|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## DHR | yahoo (142|503) | Not Cached | Saving cache - Got 100% of valid prices | Mas bah tche, que coisa linda!
## DRI | yahoo (143|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## DVA | yahoo (144|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## DE | yahoo (145|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## DAL | yahoo (146|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## XRAY | yahoo (147|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## DVN | yahoo (148|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## DXCM | yahoo (149|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## FANG | yahoo (150|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## DLR | yahoo (151|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## DFS | yahoo (152|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## DIS | yahoo (153|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## DG | yahoo (154|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## DLTR | yahoo (155|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## D | yahoo (156|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## DPZ | yahoo (157|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## DOV | yahoo (158|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## DOW | yahoo (159|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## DTE | yahoo (160|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## DUK | yahoo (161|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## DD | yahoo (162|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## DXC | yahoo (163|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## EMN | yahoo (164|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## ETN | yahoo (165|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## EBAY | yahoo (166|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## ECL | yahoo (167|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## EIX | yahoo (168|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## EW | yahoo (169|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## EA | yahoo (170|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## ELV | yahoo (171|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## LLY | yahoo (172|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## EMR | yahoo (173|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## ENPH | yahoo (174|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## ETR | yahoo (175|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## EOG | yahoo (176|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## EPAM | yahoo (177|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## EQT | yahoo (178|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## EFX | yahoo (179|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## EQIX | yahoo (180|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## EQR | yahoo (181|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## ESS | yahoo (182|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## EL | yahoo (183|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## ETSY | yahoo (184|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## EG | yahoo (185|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## EVRG | yahoo (186|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## ES | yahoo (187|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## EXC | yahoo (188|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## EXPE | yahoo (189|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais faceiro que guri de bombacha nova!
## EXPD | yahoo (190|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## EXR | yahoo (191|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## XOM | yahoo (192|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## FFIV | yahoo (193|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## FDS | yahoo (194|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais faceiro que guri de bombacha nova!
## FICO | yahoo (195|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## FAST | yahoo (196|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## FRT | yahoo (197|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## FDX | yahoo (198|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## FITB | yahoo (199|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## FSLR | yahoo (200|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## FE | yahoo (201|503) | Not Cached | Saving cache - Got 100% of valid prices | Mas bah tche, que coisa linda!
## FIS | yahoo (202|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais contente que cusco de cozinheira!
## FI | yahoo (203|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## FLT | yahoo (204|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## FMC | yahoo (205|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## F | yahoo (206|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## FTNT | yahoo (207|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## FTV | yahoo (208|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## FOXA | yahoo (209|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## FOX | yahoo (210|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## BEN | yahoo (211|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## FCX | yahoo (212|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## GRMN | yahoo (213|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## IT | yahoo (214|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## GEHC | yahoo (215|503) | Not Cached | Saving cache - Got 60% of valid prices | OUT: not enough data (thresh.bad.data = 75%)
## GEN | yahoo (216|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## GNRC | yahoo (217|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## GD | yahoo (218|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## GE | yahoo (219|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## GIS | yahoo (220|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## GM | yahoo (221|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## GPC | yahoo (222|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## GILD | yahoo (223|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## GL | yahoo (224|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## GPN | yahoo (225|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## GS | yahoo (226|503) | Not Cached | Saving cache - Got 100% of valid prices | Feliz que nem lambari de sanga!
## HAL | yahoo (227|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## HIG | yahoo (228|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## HAS | yahoo (229|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## HCA | yahoo (230|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## PEAK | yahoo (231|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## HSIC | yahoo (232|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## HSY | yahoo (233|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## HES | yahoo (234|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## HPE | yahoo (235|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## HLT | yahoo (236|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## HOLX | yahoo (237|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais contente que cusco de cozinheira!
## HD | yahoo (238|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## HON | yahoo (239|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## HRL | yahoo (240|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## HST | yahoo (241|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## HWM | yahoo (242|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## HPQ | yahoo (243|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## HUM | yahoo (244|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## HBAN | yahoo (245|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## HII | yahoo (246|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## IBM | yahoo (247|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## IEX | yahoo (248|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## IDXX | yahoo (249|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## ITW | yahoo (250|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## ILMN | yahoo (251|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## INCY | yahoo (252|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## IR | yahoo (253|503) | Not Cached | Saving cache - Got 100% of valid prices | Feliz que nem lambari de sanga!
## PODD | yahoo (254|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## INTC | yahoo (255|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## ICE | yahoo (256|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## IFF | yahoo (257|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## IP | yahoo (258|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## IPG | yahoo (259|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## INTU | yahoo (260|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## ISRG | yahoo (261|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## IVZ | yahoo (262|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## INVH | yahoo (263|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## IQV | yahoo (264|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## IRM | yahoo (265|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## JBHT | yahoo (266|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## JKHY | yahoo (267|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## J | yahoo (268|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais contente que cusco de cozinheira!
## JNJ | yahoo (269|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## JCI | yahoo (270|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## JPM | yahoo (271|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## JNPR | yahoo (272|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## K | yahoo (273|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## KDP | yahoo (274|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## KEY | yahoo (275|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## KEYS | yahoo (276|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## KMB | yahoo (277|503) | Not Cached | Saving cache - Got 100% of valid prices | Mas bah tche, que coisa linda!
## KIM | yahoo (278|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## KMI | yahoo (279|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## KLAC | yahoo (280|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## KHC | yahoo (281|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## KR | yahoo (282|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## LHX | yahoo (283|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## LH | yahoo (284|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## LRCX | yahoo (285|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## LW | yahoo (286|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## LVS | yahoo (287|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## LDOS | yahoo (288|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## LEN | yahoo (289|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## LNC | yahoo (290|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## LIN | yahoo (291|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## LYV | yahoo (292|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## LKQ | yahoo (293|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## LMT | yahoo (294|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## L | yahoo (295|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## LOW | yahoo (296|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## LYB | yahoo (297|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## MTB | yahoo (298|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## MRO | yahoo (299|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## MPC | yahoo (300|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## MKTX | yahoo (301|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## MAR | yahoo (302|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## MMC | yahoo (303|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## MLM | yahoo (304|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## MAS | yahoo (305|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## MA | yahoo (306|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## MTCH | yahoo (307|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## MKC | yahoo (308|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## MCD | yahoo (309|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## MCK | yahoo (310|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## MDT | yahoo (311|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## MRK | yahoo (312|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## META | yahoo (313|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## MET | yahoo (314|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## MTD | yahoo (315|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## MGM | yahoo (316|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## MCHP | yahoo (317|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## MU | yahoo (318|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## MSFT | yahoo (319|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## MAA | yahoo (320|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## MRNA | yahoo (321|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## MHK | yahoo (322|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## MOH | yahoo (323|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## TAP | yahoo (324|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## MDLZ | yahoo (325|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## MPWR | yahoo (326|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais contente que cusco de cozinheira!
## MNST | yahoo (327|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## MCO | yahoo (328|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## MS | yahoo (329|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## MOS | yahoo (330|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## MSI | yahoo (331|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## MSCI | yahoo (332|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## NDAQ | yahoo (333|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## NTAP | yahoo (334|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## NFLX | yahoo (335|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## NWL | yahoo (336|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## NEM | yahoo (337|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## NWSA | yahoo (338|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais contente que cusco de cozinheira!
## NWS | yahoo (339|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## NEE | yahoo (340|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## NKE | yahoo (341|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## NI | yahoo (342|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## NDSN | yahoo (343|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## NSC | yahoo (344|503) | Not Cached | Saving cache - Got 100% of valid prices | Feliz que nem lambari de sanga!
## NTRS | yahoo (345|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## NOC | yahoo (346|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## NCLH | yahoo (347|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## NRG | yahoo (348|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## NUE | yahoo (349|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## NVDA | yahoo (350|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## NVR | yahoo (351|503) | Not Cached | Saving cache - Got 100% of valid prices | Mas bah tche, que coisa linda!
## NXPI | yahoo (352|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## ORLY | yahoo (353|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais contente que cusco de cozinheira!
## OXY | yahoo (354|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## ODFL | yahoo (355|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## OMC | yahoo (356|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## ON | yahoo (357|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## OKE | yahoo (358|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## ORCL | yahoo (359|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## OGN | yahoo (360|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## OTIS | yahoo (361|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## PCAR | yahoo (362|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## PKG | yahoo (363|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## PANW | yahoo (364|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## PARA | yahoo (365|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## PH | yahoo (366|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## PAYX | yahoo (367|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## PAYC | yahoo (368|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## PYPL | yahoo (369|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## PNR | yahoo (370|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## PEP | yahoo (371|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## PFE | yahoo (372|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## PCG | yahoo (373|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## PM | yahoo (374|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## PSX | yahoo (375|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## PNW | yahoo (376|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## PXD | yahoo (377|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## PNC | yahoo (378|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## POOL | yahoo (379|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## PPG | yahoo (380|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## PPL | yahoo (381|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## PFG | yahoo (382|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## PG | yahoo (383|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## PGR | yahoo (384|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## PLD | yahoo (385|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## PRU | yahoo (386|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## PEG | yahoo (387|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## PTC | yahoo (388|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## PSA | yahoo (389|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## PHM | yahoo (390|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## QRVO | yahoo (391|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## PWR | yahoo (392|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## QCOM | yahoo (393|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## DGX | yahoo (394|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## RL | yahoo (395|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## RJF | yahoo (396|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## RTX | yahoo (397|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## O | yahoo (398|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## REG | yahoo (399|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## REGN | yahoo (400|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## RF | yahoo (401|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## RSG | yahoo (402|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais contente que cusco de cozinheira!
## RMD | yahoo (403|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais faceiro que guri de bombacha nova!
## RVTY | yahoo (404|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## RHI | yahoo (405|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## ROK | yahoo (406|503) | Not Cached | Saving cache - Got 100% of valid prices | Feliz que nem lambari de sanga!
## ROL | yahoo (407|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais contente que cusco de cozinheira!
## ROP | yahoo (408|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## ROST | yahoo (409|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## RCL | yahoo (410|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## SPGI | yahoo (411|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## CRM | yahoo (412|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## SBAC | yahoo (413|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## SLB | yahoo (414|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## STX | yahoo (415|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## SEE | yahoo (416|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## SRE | yahoo (417|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## NOW | yahoo (418|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## SHW | yahoo (419|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## SPG | yahoo (420|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais faceiro que guri de bombacha nova!
## SWKS | yahoo (421|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## SJM | yahoo (422|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## SNA | yahoo (423|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## SEDG | yahoo (424|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## SO | yahoo (425|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## LUV | yahoo (426|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## SWK | yahoo (427|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## SBUX | yahoo (428|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## STT | yahoo (429|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## STLD | yahoo (430|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## STE | yahoo (431|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## SYK | yahoo (432|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## SYF | yahoo (433|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## SNPS | yahoo (434|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## SYY | yahoo (435|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## TMUS | yahoo (436|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## TROW | yahoo (437|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## TTWO | yahoo (438|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## TPR | yahoo (439|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## TRGP | yahoo (440|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## TGT | yahoo (441|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## TEL | yahoo (442|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## TDY | yahoo (443|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## TFX | yahoo (444|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## TER | yahoo (445|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## TSLA | yahoo (446|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## TXN | yahoo (447|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## TXT | yahoo (448|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## TMO | yahoo (449|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## TJX | yahoo (450|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## TSCO | yahoo (451|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## TT | yahoo (452|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais faceiro que guri de bombacha nova!
## TDG | yahoo (453|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## TRV | yahoo (454|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## TRMB | yahoo (455|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## TFC | yahoo (456|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## TYL | yahoo (457|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## TSN | yahoo (458|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## USB | yahoo (459|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## UDR | yahoo (460|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## ULTA | yahoo (461|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## UNP | yahoo (462|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## UAL | yahoo (463|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## UPS | yahoo (464|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## URI | yahoo (465|503) | Not Cached | Saving cache - Got 100% of valid prices | Good stuff!
## UNH | yahoo (466|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## UHS | yahoo (467|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## VLO | yahoo (468|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## VTR | yahoo (469|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## VRSN | yahoo (470|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## VRSK | yahoo (471|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## VZ | yahoo (472|503) | Not Cached | Saving cache - Got 100% of valid prices | Good job!
## VRTX | yahoo (473|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## VFC | yahoo (474|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## VTRS | yahoo (475|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## VICI | yahoo (476|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## V | yahoo (477|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## VMC | yahoo (478|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## WAB | yahoo (479|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## WBA | yahoo (480|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## WMT | yahoo (481|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## WBD | yahoo (482|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## WM | yahoo (483|503) | Not Cached | Saving cache - Got 100% of valid prices | Nice!
## WAT | yahoo (484|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## WEC | yahoo (485|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## WFC | yahoo (486|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## WELL | yahoo (487|503) | Not Cached | Saving cache - Got 100% of valid prices | Feels good!
## WST | yahoo (488|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## WDC | yahoo (489|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## WRK | yahoo (490|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## WY | yahoo (491|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## WHR | yahoo (492|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## WMB | yahoo (493|503) | Not Cached | Saving cache - Got 100% of valid prices | Mais contente que cusco de cozinheira!
## WTW | yahoo (494|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## GWW | yahoo (495|503) | Not Cached | Saving cache - Got 100% of valid prices | Got it!
## WYNN | yahoo (496|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## XEL | yahoo (497|503) | Not Cached | Saving cache - Got 100% of valid prices | You got it!
## XYL | yahoo (498|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
## YUM | yahoo (499|503) | Not Cached | Saving cache - Got 100% of valid prices | Well done!
## ZBRA | yahoo (500|503) | Not Cached | Saving cache - Got 100% of valid prices | Looking good!
## ZBH | yahoo (501|503) | Not Cached | Saving cache - Got 100% of valid prices | Feliz que nem lambari de sanga!
## ZION | yahoo (502|503) | Not Cached | Saving cache - Got 100% of valid prices | OK!
## ZTS | yahoo (503|503) | Not Cached | Saving cache - Got 100% of valid prices | Youre doing good!
Verificar os arquivos df.control e df.tickers
#head(l.sp500$df.control)
#head(l.sp500$df.tickers)
# Verificar se os dados foram baixados corretamente
table(l.sp500$df.control$threshold.decision)
##
## KEEP OUT
## 500 1
# Extrair as datas ações e retornos
data <- l.sp500$df.tickers %>%
rename(Date = ref.date, Symbol = ticker, Returns = ret.closing.prices) %>%
select(Date, Symbol, Returns)
head(data)
## Date Symbol Returns
## 1 2022-07-26 MMM NA
## 2 2022-07-27 MMM -0.01351903
## 3 2022-07-28 MMM 0.01081552
## 4 2022-07-29 MMM 0.02023982
## 5 2022-08-01 MMM 0.00083737
## 6 2022-08-02 MMM -0.01129401
# Eliminando os valores NA
data = na.omit(data)# Eliminando os valores NA
head(data)
## Date Symbol Returns
## 2 2022-07-27 MMM -0.01351903
## 3 2022-07-28 MMM 0.01081552
## 4 2022-07-29 MMM 0.02023982
## 5 2022-08-01 MMM 0.00083737
## 6 2022-08-02 MMM -0.01129401
## 7 2022-08-03 MMM 0.01220044
tail(data)
## Date Symbol Returns
## 125494 2023-07-18 ZTS 0.002047958
## 125495 2023-07-19 ZTS -0.001111223
## 125496 2023-07-20 ZTS 0.004204393
## 125497 2023-07-21 ZTS 0.067044668
## 125498 2023-07-24 ZTS 0.011216934
## 125499 2023-07-25 ZTS 0.024327136
Passo 2: Estimar o modelo ARMA para os retornos de cada ação.
# Passo 2: Estimar o modelo ARMA para os retornos de cada ação
# Função para estimar o modelo ARMA com auto.arima()
fit_arma_model <- function(data) {
model <- auto.arima(data$Returns)
return(model)
}
# Agrupar os dados por símbolo e aplicar o modelo ARMA com auto.arima() para cada grupo
arma_models <- data %>%
group_by(Symbol) %>%
group_modify(~{
model <- fit_arma_model(.x)
.x$ARMA_Model <- list(model)
return(.x)
})
Passo 3: Criar uma nova coluna com a previsão em t+1 de cada modelo
# Passo 3: Criar uma nova coluna com a previsão em t+1 de cada modelo
data$ARMA_Predictions <- NA
for (i in seq_along(arma_models$Symbol)) {
symbol <- arma_models$Symbol[i]
model <- arma_models$ARMA_Model[[i]]
pred <- forecast(model, h = 1)$mean
data$ARMA_Predictions[data$Symbol == symbol] <- pred
}
Passo 4: Identificar a ação com maior expectativa de retorno, e identificar as 20 ações com maior expectativa de retorno em t+1
# Passo 4: Identificar a ação com maior expectativa de retorno
expected_returns <- data %>%
group_by(Symbol) %>%
summarise(mean_return = mean(ARMA_Predictions, na.rm = TRUE)) %>%
drop_na(mean_return)
# Passo 4: Identificar as 20 ações com maior expectativa de retorno em t+1
top_5_returns <- expected_returns %>%
arrange(desc(mean_return)) %>%
head(20)
cat("As 20 ações com maior expectativa de retorno em t+1 são:\n")
## As 20 ações com maior expectativa de retorno em t+1 são:
for (i in seq_along(top_5_returns$Symbol)) {
symbol <- top_5_returns$Symbol[i]
mean_return <- top_5_returns$mean_return[i]
cat("Ação:", symbol,
"- Média de retorno:", sprintf("%.2f%%", mean_return * 100),
"\n")
}
## Ação: GNRC - Média de retorno: 0.92%
## Ação: AES - Média de retorno: 0.89%
## Ação: ANSS - Média de retorno: 0.72%
## Ação: GILD - Média de retorno: 0.63%
## Ação: ON - Média de retorno: 0.60%
## Ação: PHM - Média de retorno: 0.54%
## Ação: WFC - Média de retorno: 0.53%
## Ação: NVDA - Média de retorno: 0.48%
## Ação: TYL - Média de retorno: 0.40%
## Ação: LEN - Média de retorno: 0.32%
## Ação: ADSK - Média de retorno: 0.31%
## Ação: FFIV - Média de retorno: 0.30%
## Ação: GE - Média de retorno: 0.30%
## Ação: SYK - Média de retorno: 0.29%
## Ação: CEG - Média de retorno: 0.29%
## Ação: FICO - Média de retorno: 0.28%
## Ação: BBY - Média de retorno: 0.25%
## Ação: ACGL - Média de retorno: 0.24%
## Ação: ODFL - Média de retorno: 0.24%
## Ação: NOW - Média de retorno: 0.24%
4. Separe os dados do SP500 em duas partes, etapa de estimação e etapa de previsão. Suponha que você queira, por exemplo, comprar a ação quando a previsão de retorno for positiva, vendendo-a no dia seguinte. As previsões dos modelos ARIMA permitem a construção de uma estratégia de negociação lucrativa?
Após identificar e obter as ações com maior retorno, rodaria as previsões em um dia anterior e escolheria 7 ações, analisaria as ações em um homebroker e verificaria qual realmente está em tendência de alta e sua reputação no mercado e dividiria meu capital com as ações que obteve menor risco. Porém utilizaria FAC FACP e confirmaria com auto.arimaos critérios informações para analisar as ações e diagnóstico e partiria com a previsão do melhor modelo que se adequase aos meus dados.
# Extrair as datas ações e retornos
data2 <- l.sp500$df.tickers %>%
rename(Date = ref.date, Stocks = ticker, Returns = ret.closing.prices) %>%
select(Date,Stocks , Returns)
# Eliminando os valores NA
data2 = na.omit(data2)# Eliminando os valores NA
tail(data2)
## Date Stocks Returns
## 125494 2023-07-18 ZTS 0.002047958
## 125495 2023-07-19 ZTS -0.001111223
## 125496 2023-07-20 ZTS 0.004204393
## 125497 2023-07-21 ZTS 0.067044668
## 125498 2023-07-24 ZTS 0.011216934
## 125499 2023-07-25 ZTS 0.024327136
Função para estimar o modelo ARIMA com auto.arima()
Dividir os dados em etapa de estimação e etapa de previsão
Estimar o modelo ARIMA para os retornos de cada ação na etapa de estimação
# Função para estimar o modelo ARIMA com auto.arima()
fit_arima_model <- function(data) {
model <- auto.arima(data$Returns)
return(model)
}
# Dividir os dados em etapa de estimação e etapa de previsão
estimation_period <- data2 %>%
group_by(Stocks) %>%
slice(1:(n() - 1))
prediction_period <- data2 %>%
group_by(Stocks) %>%
slice(n())
# Estimar o modelo ARIMA para os retornos de cada ação na etapa de estimação
arima_models <- estimation_period %>%
group_by(Stocks) %>%
group_modify(~ {
model <- fit_arima_model(.x)
.x$ARIMA_Model <- list(model)
return(.x)
})
Criar uma nova coluna com a previsão em t+1 de cada modelo na etapa de previsão
Fazer a previsão em t+1
Atualizar a coluna ARIMA_Predictions no dataframe prediction_period
# Criar uma nova coluna com a previsão em t+1 de cada modelo na etapa de previsão
prediction_period$ARIMA_Predictions <- NA
for (i in seq_along(arima_models$Stocks)) {
stock <- arima_models$Stocks[i]
model <- arima_models$ARIMA_Model[[i]]
# Fazer a previsão em t+1
pred <- forecast(model, h = 1)$mean
# Atualizar a coluna ARIMA_Predictions no dataframe prediction_period
prediction_period$ARIMA_Predictions[prediction_period$Stocks == stock] <- pred
}
Filtrar apenas os dados com previsões disponíveis
Identificar as 5 ações com maior expectativa de retorno em t+1
# Filtrar apenas os dados com previsões disponíveis
prediction_period <- prediction_period %>%
drop_na(ARIMA_Predictions)
# Identificar as 5 ações com maior expectativa de retorno em t+1
expected_returns <- prediction_period %>%
group_by(Stocks) %>%
summarise(mean_return = mean(ARIMA_Predictions, na.rm = TRUE)) %>%
drop_na(mean_return)
top_5_returns <- expected_returns %>%
arrange(desc(mean_return)) %>%
head(5)
top_5_returns
## # A tibble: 5 × 2
## Stocks mean_return
## <chr> <dbl>
## 1 GNRC 0.0102
## 2 SCHW 0.00788
## 3 LVS 0.00529
## 4 INTC 0.00513
## 5 NVR 0.00479