Skip to content
All library documents

Checking and Correcting Historical Price Data Errors

Article Quant Q&A · Author: Stupid_Intern

Summary

The document describes an apparent discontinuity in weekly historical prices retrieved through quantmod for an Indian equity. The response traces the discrepancy to the underlying Yahoo Finance history rather than to quantmod itself: the same inconsistent observations appear on the source site. This illustrates why a data library’s output should be checked against its provider before attributing a price anomaly to the software.

For a small number of affected observations, the suggested practical remedy is to verify prices using another source and replace the erroneous values. That is an ad hoc correction, not a general cleaning procedure. The discussion does not identify the cause of the source error, establish the full extent of affected records, or describe systematic validation. Researchers using historical prices should therefore document corrections and independently check unusual jumps before relying on the data in analysis or backtests.

Key ideas

  • A data retrieval package can faithfully return errors present in its upstream source.
  • Compare suspicious historical prices with the provider’s own records to locate where a discrepancy originates.
  • For isolated errors, the response suggests checking an alternative source and correcting the affected observations.
  • The suggested manual repair does not establish a general method for detecting or handling broader data problems.

Tags

Full text
# Inaccurate data from quantmod


# Inaccurate data from quantmod












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.

## Answer by Pleb (score 2)

https://quant.stackexchange.com/a/64152

#### 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.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.