Comparing Market Data Sources with Timestamp Lags
Summary
The document considers how to assess bid, ask, and volume data from two vendors when observations do not share exact timestamps. The questioner samples prices at regular time intervals, finds that plots look similar, but sees weak cross-correlation after matching timestamps. The discussion suggests dynamic time warping (DTW) as a way to compare sequences while allowing nonlinear alignment in time.
It also warns that disagreement between historical vendors may reflect data-quality problems, and that it is not always possible to know which series is accurate. Suggested practices include using a reliable, cleaned vendor, analyzing discrepant sources separately to see whether they change trading signals, and avoiding the addition of suspect data to a trusted series. DTW addresses timing differences, but does not establish which source is correct; the response also notes that computation can become difficult for large inputs. No comparison results or validation procedure are supplied.
Key ideas
- Timestamp offsets can weaken direct correlations between otherwise similar market data series.
- Dynamic time warping can compare sequences while accommodating nonlinear shifts in time.
- Historical vendors may differ, and visual similarity alone does not establish data accuracy.
- Compare the trading signals produced by each source separately when their reliability is uncertain.
- DTW can be computationally demanding on large datasets.
Tags
Full text
# What are the proper metrics to look at for checking discrepancies in these two time series # What are the proper metrics to look at for checking discrepancies in these two time series I am obtaining bid/ask price and volume market data from two different sources for the same ticker and for the same day and checking to see that at time intervals X they are "roughly the same". The timestamps from the two different sources are not exactly the same, though, and so what I am doing is dumping the price every time the timestamps span a different second of the day. Sometimes the price varies in between that second, sometimes it doesn't, but regardless I dump the way it looks at the beginning of that second (or millisecond). After doing this for both sources, I did a simple plot of the results and things are looking consistent graphically: The time stamps do not always align, though when I intersect the time stamp columns and get a subset of the observations, and cross correlate them I get relatively poor values. Worse at higher granularities, probably due to time stamp lag-like discrepancies. I'm not sure if I should be looking at some other metric to convince myself that both sources are providing me with similar information about the ask/bid throughout the day, or what the appropiate methodology is to compare these two time series with each other. Is it cointegration between them that I am looking for? What I care to confirm is that, say, assuming the first source I know to be accurate data from which I build my view of the bid/ask throughout the day - that the second source is not too off. ## Answer by TonyMorland (score 2) https://quant.stackexchange.com/a/14136 It is not uncommon to find significant differences in historical price data from different sources & data vendors. For example, if you look at ETF ticker symbol "EEM" for the period from 2001 until now using free Yahoo data and free Google data from the Internet, you will see that for some of this period they agree and for some of the time they are quite different. When using historical data, the problem is: How do you actually "know" that one series is "accurate"? From a practical trading perspective, some suggestions are: 1) Be wary of free data. If you are a serious trader, it is probably in your best interests to buy data from a reliable data vendor who has checked it for errors and cleaned it up properly at the original time. This is especially important if you are looking at continuous futures contract data. 2) Rather than trying to merge two different versions of the same data series when they disagree (and therefore AT LEAST one of them is probably wrong), you may be better off analyzing them separately and then see what are the resulting differences in your trading signals from the two sets. 3) There is no point contaminating good data with bad data. If you really do know that one data set is good, then use it as it is. "Less data but good data" is better than "More data including some bad data", especially if you are intending to use some form of predictive algorithm. ## Answer by user11626 (score 0) https://quant.stackexchange.com/a/14137 To take into account lag-like discrepancies between two time series, DTW(Dynamic Time Warping) algorithm is generally used. Quoting from wiki - "In general, DTW is a method that calculates an optimal match between two given sequences (e.g. time series) with certain restrictions. The sequences are "warped" non-linearly in the time dimension to determine a measure of their similarity independent of certain non-linear variations in the time dimension." The catch here is that the algorithm can become intractable for a large input, so it is generally run on a distributed system.
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.