Forum Discussion

akj2784's avatar
akj2784
Post Partisan
8 years ago

Importing Shares Data from yahoo Finance in Power BI Using R

Hi All,

 

I am trying to use R as a source and have below code to extract the share price from Yahoo finance which is free. The code works fine in R Studio but when I use the same code in Power BI, it gives the error.

 

Code: 

library(quantmod)

basket_symbols <- c('PNB.NS','SBIN.NS','FEDERALBNK.NS','AXISBANK.NS')

getSymbols(basket_symbols,src='yahoo')

 

Error:

 

Details: "ADO.NET: R script error.
Loading required package: xts
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

as.Date, as.Date.numeric

Loading required package: TTR
Loading required package: methods
Version 0.4-0 included new data defaults. See ?getSymbols.
'getSymbols' currently uses auto.assign=TRUE by default, but will
use auto.assign=FALSE in 0.5-0. You will still be able to use
'loadSymbols' to automatically load data. getOption("getSymbols.env")
and getOption("getSymbols.auto.assign") will still be checked for
alternate defaults.

This message is shown once per session and may be disabled by setting
options("getSymbols.warning4.0"=FALSE). See ?getSymbols for details.

 

Regards,

Akash

4 Replies

    • akj2784's avatar
      akj2784
      Post Partisan

      thanks for the reply.

      So looks like quantmod is not supported yet in Power BI.

       

      By any chance do you know the replacement of this package which is supported by Power BI ?

      Basically I want to analyze the stocks and do a predictive modeling using PBI.

       

      • ImkeF's avatar
        ImkeF
        Community Champion

        Hi akj2784 ,

        the quantmod-package is supported meanwhile.

         

        Unfortuantely I'm still getting error-messages and would therefore like to know if it works for you:

         

        Details: "ADO.NET: R script error.
        Loading required package: xts
        Loading required package: zoo
        
        Attaching package: 'zoo'
        
        The following objects are masked from 'package:base':
        
            as.Date, as.Date.numeric
        
        Registered S3 method overwritten by 'xts':
          method     from
          as.zoo.xts zoo 
        Loading required package: TTR
        Error: package or namespace load failed for 'TTR':
         package 'curl' was installed by an R version with different internals; it needs to be reinstalled for use with this R version
        Error: package 'TTR' could not be loaded
        Execution halted

        Anyone any ideas here?

        Works fine in RStudio.