0
$\begingroup$

For some reason getSymbols is returning inaccurate data for the below symbol. Example for this data in the high column the price went from 35 to 3515 between 2021 feb and 2021 march 16th.

d <-  as.data.frame(
     getSymbols(
         paste("USHAMART" , ".NS", sep = ""),
         from ="2000-01-01", 
         periodicity = "weekly" ,
         return.class = 'zoo',
         env = NULL
     )
 )

Not sure if this is occurring for other symbols but I doubt it may.

$\endgroup$
2
$\begingroup$

The problem lies with Yahoo Finance and not the quantmod package:

By default, the quantmod package sources its data from Yahoo Finance. If you take a look at the historical data for "USHAMART" on Yahoo Finance, you will see the same inconsistencies between February 2021 and March 2021 (for a couple of days).

It seems there's only a few inconsistencies in the data. Therefore, an ad-hoc solution is simply to replace the inconsistent prices with the correct ones, found from an alternative source such as TradingView or similar.

$\endgroup$
2
  • $\begingroup$ Is it possible to get accurate source which quantmod uses? $\endgroup$ May 22 '21 at 15:09
  • 1
    $\begingroup$ It has a source function: src="yahoo", that tells you which source it's downloading from (and by default it is set to Yahoo Finance). See the documentation here. The only other alternative for OHLC data is Google Finance, which was discontinued from March 2018, so changing the source does not help. A list of sources can be found here. $\endgroup$
    – Pleb
    May 22 '21 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.