Accessing the correct dividend data based on provider
Author: thodder
Creation Date: 7/23/2020 12:59 PM
profile picture

thodder

#1
Some of my strategies generate a dividend adjusted price for more reliable signals. For that to work properly, I need reliable dividends. I used to use Fidelity price data so all my strategies used it's dividend data.

At the moment I plan to use Yahoo and Wealth-Data providers for my datasets in WLD. Both of these appear to contain dividend fundamentals within the price data. I'd like to use the appropriate dividend based on the provider the strategy is running under. If a dataset uses a different provider than Yahoo, I've already discovered that I will not get any dividend data with "Dividend (Yahoo! Finance)" if there are no corresponding symbol downloaded by my Yahoo provider. Symbols only downloaded by the Wealth-Data provider would get no dividends in my strategy even if there were dividends available.

Question 1: In WealthScript, how can I determine which provider the strategy is using?

I noticed the following FAQS on wealth-data.com...
QUOTE:

Is Wealth-Data dividend-adjusted?
Stock prices are not adjusted for regular dividends, but they are adjusted for “special” one-time dividends and other dilutive corporate actions.


Question 2a: If I get dividend data from Wealth-Data, will the dividend data contain the "special" one-time dividends? If so, could that cause me to adjust the price twice with this dividend.

Question 2b: Might "Dividend (Yahoo! Finance)" return the "special" one-time dividend if I was using the wrong dividend data? Again, this might cause me to adjust the price twice.

SUGGESTION:

Can we have a ProviderDividend string property available in the script? This would allow the script to just use the dividend data which is appropriate.

There were two areas in Preferences where this would be good too:
* Chart annotation - show the dividend appropriate for the data provider.
* Backtest Settings | Apply dividends... Portfolio Simulation mode - same issue that I have above.

In the above cases there should be a setting for a default dividend provider if the provider is not Yahoo or Wealth-Data. That same default should be used by the script if it asks for ProviderDividend.
profile picture

Cone

#2
1. You can access the dividends from any provider in WealthScript. But the backtest uses the Preferences > Backtest Settings > Apply dividends.. setting.

2a. Special dividends show up as "Splits" (with an explanation) in Wealth-Data. Data are already adjusted for [all] splits.
2b. Y! will give you a split and/or a dividend for special dividends and corporate actions. Do not apply those to Wealth-Data.

It's true, with all the different DataSources and treatment of dividends it can be a can of worms if you're not careful. And that's further complicated in Y! because it has its own option to adjust the data for dividends automatically.
profile picture

thodder

#3
On question #1, I may not have been clear. In my WealthScript, I want to use "Dividend (Wealth-Data)" when the provider is Wealth-Data or "Dividend (Yahoo! Finance)" if the provider is Yahoo. Is there any method or property in WealthScript I can use to determine what provider is being used for the price data?? That would allow me to use the appropriate item name for requesting fundamental data.

When testing dividend data for mutual funds, I already discovered I will not get "Dividend (Yahoo! Finance)" results if I am backtesting with another provider and I do not have a Yahoo dataset containing the same symbol (see https://www.wealth-lab.com/Forum/Posts/Dividend-data-for-Mutual-Funds-40237 for that test). Lack of dividend data could cause false signals as the strategy may see a pullback or selloff when it was really a dividend payout. Plus you stated in #2b above that I should not use "Dividend (Yahoo! Finance)" with Wealth-Data. If I don't use dividends which match up with the provider, then my dividend adjusted price will be incorrect and could generate false signals.

It can be a can of worms. It would be nice to have code to check the can rather than require manual efforts to ensure I don't cross data.
profile picture

Eugene

#4
QUOTE:
Is there any method or property in WealthScript I can use to determine what provider is being used for the price data?

Yes it's possible. Such method exists in C.Components:

GetDataSource

QUOTE:
When testing dividend data for mutual funds, I already discovered I will not get "Dividend (Yahoo! Finance)" results if I am backtesting with another provider and I do not have a Yahoo dataset containing the same symbol

True. You have to maintain that symbol's data up to date in a Y! DataSet for this to work.
profile picture

thodder

#5
Nice simple solution. Thanks.

CODE:
Please log in to see this code.


I only plan on using two providers for now. I can expand on it later.

QUOTE:
True. You have to maintain that symbol's data up to date in a Y! DataSet for this to work.


Basically that was what I was getting at. With Wealth-Data, the main attraction to me is the automatically updating indexes. Mirroring the dataset with Yahoo provider didn't make sense and Cone is NOT recommending using Yahoo dividends to adjust Wealth-Data. (I think he was actually recommending I needed to skip some dividend types, but I don't want to put that kind of smarts into the code unless I have to). Even more of a reason to add this code. Having this easy solution to automate the DividendItemName is very helpful.

For those not familiar with Wealth-Data automated indexes, here's a clip from the FAQS page:
QUOTE:
Are the Index DataSets Automatically Updated?
Yes. When a DataSet is created from an Index classification groups and a symbol change is detected during an update, the DataSet is automatically updated when Wealth-Lab is restarted.


I'm sure there are other Fidelity migrates who haven't stumbled onto this yet. Occasionally I like to run a strategy through the whole index to see what jumps out at me, but first I usually have to go through the exercise of updating the symbols in the index. Hopefully that will be automated now.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).