Solving the Missing Stock Data Problem - A Feasible Solution

In the world of stock trading, accurate and up-to-date data is crucial. However, what happens when data is missing from one exchange? In this blog post, we’ll explore a feasible solution to this problem using USD Nasdaq data as a fallback for missing Tradegate EUR data.

The Problem

When dealing with illiquid assets or assets with small market caps (nano cap stocks), these assets may not always have readily available and up-to-date exchange rates data. This can lead to inaccurate portfolio valuations and misguided investment decisions. For example Tradegate no longer provides data for US42309B4023 which results in misleading portfolio valuations in the unlikely event that you own that stock (… like me - why I looked into this).

The Solution

The solution is a service that uses a strategy pattern to switch between various sources of exchange rates data, ensuring continuous service. Here’s how it works:

  1. It tries to fetch the exchange rates data from the primary source (e.g., a specific stock exchange).
  2. If the primary source is not available or does not provide data for a specific asset, the service switches to a fallback strategy. The fallback strategy involves fetching the data from a different source, potentially using a different currency (e.g., USD) and converting that data into the desired currency (e.g., EUR) using date accurate exchange rates data.
  3. If the fallback strategy fails, the service falls back to a default strategy, which uses the last known value or average of the last known values, or an average between the previous and the next value for historic data.

As an experiment I decided to implement some of the parts required for strategy 2 - it can be inspected here: cross-exchange-rate-fallback

The Results

The results of the analysis show that the deviation in the converted Yahoo stock data compared to the Tradegate data is sometimes spot on and deviates sometimes up to 1.5%. While this may seem high in terms of stock, alternative strategies like using the last known value or average could result in a two-digit percentage number for nano cap stocks. Occasionally misevaluating a stock by 1.5% is a better alternative to misevaluating it by 50%, especially when the stock is no longer listed on the exchange and the strategy of last known value makes the error permanent.

Comparison of Yahoo and Tradegate data

Potential Improvements

The deviation was only calculated for the closing price, which could be affected by the time zones and opening hours of the market places. Picking other values or markets with matching opening hours could yield better results.

Practical Implications

Developing a strategy based on these findings requires careful consideration of which values should be the base. It’s also important to prepare for missing data points in the stock price and exchange rates, and use the date to match them up. Additionally, having a fallback plan to interpolate the missing data points is crucial. For my quick exploration I excluded data from the 17th of June 2023 since it was not available on all APIs - this would be a scenario where a fallback plan would be required.

A Minor Finding

Different APIs use the word “end” for an end date differently. It’s important to figure out which API uses the end date inclusively and which one exclusively.

Conclusion

The key takeaway from this analysis is that using data from another exchange is a feasible solution to the problem of missing stock data. With an error of up to 1.5%, this method is not suitable to fuel short term trading strategies, but it can be used to provide a better estimate of the value of a portfolio. As always, careful consideration and testing are necessary when implementing any new strategy.

If you have any questions, suggestions, or feedback, feel free to reach out to me on Twitter @Aypahyo.

Written on July 11, 2023