Adding synthetic bars to synchronize data between different countries
Author: hmtan
Creation Date: 2/27/2017 9:51 AM
profile picture


I tried to use the addCalendarDays function to create synchronized data for indices of different countries. Unfortunately, there are problems such as different countries has different non-trading days (e.g., public holidays, etc). In order to synchronize the data, synthetic bars for non-trading days are needed. Currently Wealth-Lab does not offer a satisfactory solution.

If I use AddCalendarDays with the interpolate parameter to TRUE, stock prices is extrapolated for Saturday and Sunday as well. For example, Friday is a non-trading day, it is OK if the extrapolation is based on the average of data of Thursday and the following Monday. Unfortunately, WealthScript extrapolated the data for Friday, Saturday and Sunday. This is unsatisfactory.

On the other hand, if the interpolate parameter is set to FALSE. It is OK if the function is working in accordance with the documentation, i.e., the extrapolated data for non-trading day is based on the OHLC prices of the preceding trading day. This make business sense as there were no activity on the non-trading day. However, the YAHOO Provider created synthetic bars using the OHLC bars of the succeeding trading days (e.g., fill the OHLC prices for Friday, Saturday and Sunday using the OHLC of the following Monday). This does not make sense it make use of prices of a future trading day.

Anyone has similar issue, please share with me on how you tackle the issue? My objective is try to avoid tedious effort in modifying the data generated by WealthScript using EXCEL spreadsheet.
profile picture


This does not make sense it make use of prices of a future trading day.

Trading on weekends makes as much sense as artificial prices. So I think that the opportunity provided by AddCalendarDays in its current state is still a good tradeoff between the tedious effort of using Excel. We may report the issue to Fidelity but I'd not have high hopes given that it's a less-used method.
profile picture


If anybody stumbles onto this thread in a similar situation, here's Cone's workaround to AddCalendarDays' incorrect behavior with the interpolate parameter set to false:

Please log in to see this code.