How can I do to take stock prices in R?

I'm trying to take stocks data (day, hour, second, months, weeks)... to do some studys. But I can't do it. Some packages it's ok, but others it's not. look some messages that I saw

I tried to use all packages at this link too but I had any results:

anyone help me,

How can I fixe it ?

I need take stock prices from B3 - Brazil, and NYSE,SP500 etc...

In the second error message, it says that you need version 3.4.0 or above of cli. You only have version 3.3.0. To fix that, try install.packages("cli"). Then perhaps run everything again?

Otherwise, please post the code and errors as text instead of screenshots. It makes it easier to copy/paste.

The first error suggests that you don't have RTools. Try here: RTools: Toolchains for building R and R packages from source on Windows (r-project.org)

Also, where is the rbmfbovespa package from? I couldn't find it online, nor could I find it being referred to in your link.

1 Like

I tried to install the package (cli), but this happened

> library(cli)
> # get data!
> df_quandl <- get_Quandl_series(id_in = my_symbol,
+                                api_key = my_api_key, 
+                                first_date = first_date,
+                                last_date = last_date)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace ‘cli’ 3.3.0 is already loaded, but >= 3.4.0 is required

CODE:

library(GetQuandlData)
library(tidyverse)
install.packages("cli")
library(cli)

my_api_key <- 'KMGR3rk2Ur-c6_7oHEWA'


# set symbol and dates
my_symbol <- c('GOLD' = 'LBMA/GOLD')
first_date <- '1980-01-01'
last_date <- '2021-01-01'

# get data!
df_quandl <- get_Quandl_series(id_in = my_symbol,
                               api_key = my_api_key, 
                               first_date = first_date,
                               last_date = last_date)

# check it
glimpse(df_quandl)

You haven't installed it successfully, please restart your R session and post the complete console output you get when you run this command

install.packages("cli")

Also, a note about this. Packages only need to be installed once (interactively); you shouldn't include install commands in your script, otherwise, you'll be reinstalling them every time you execute the script.

1 Like

Crazy, I restart and Install all packages
cli; tidyverse and GetQuandlData and it's all ok, lmao

Thanks Andres

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.