How is data handled when the same symbol is input from Fidelity and Yahoo?
Author: rmandel00
Creation Date: 5/12/2017 2:43 PM
profile picture

rmandel00

#1
I have situations where I have created two data sets with a list of stock symbols from Fidelity and from Yahoo. The symbol would be the same regardless of the source of data. The data is apparently treated differently in the two cases, as with Yahoo the closing price is adjusted for dividends whereas with Fidelity the dividend is added in. Some of my strategies use a SetContext command which takes a stock symbol and uses the data of that symbol. In this case I don't choose a specific data set to run the strategy but click on a symbol that I want charted.

Is there a default data set used (probably Fidelity) if the symbol appears in two different data sets?

Are there any problems with having duplicate symbols from different sources with the same name?.

What do you recommend that I do about this duplication?

Thanks,
Ricardo
profile picture

Cone

#2
Good questions.

QUOTE:
Yahoo the closing price is adjusted for dividends
Just remember that you can select if you want Yahoo! to adjust for dividends or not. That option is located in the Data Manager > Yahoo! Data view. If you do use Yahoo! dividend-adjusted data, make sure to turn off applying dividends to Portfolio Simulations in the Backtest Preferences.

QUOTE:
Some of my strategies use a SetContext
As of v6.9.12, SetContext has a Bars overload. In your scripts, you can grab a Bars handle to an external symbol from a specific DataSet (and therefore Provider) using GetExternalSymbol(). Then, when you SetContext() you can pass that Bars reference.

But all of this depends on your use. When you make a reference to an external symbol, Wealth-Lab will first search for the symbol in the same DataSet. If not found, then it will search for it in all DataSets in alphabetical order. Consequently, you might not have to use the method just described if all of your test symbols are in the same DataSet.

QUOTE:
Are there any problems with having duplicate symbols from different sources with the same name?.
No. That's clear now, right?
profile picture

rmandel00

#3
Thanks. That's just what I wanted to know with regard to WLP finding data symbols in the DataSets.

As to your comment about SetContext having a Bars overload, I don't understand the meaning or consequences of the Bars overload.

If I understand the use of GetExternalSymbol, would it mean that the symbol can be accessed even if it isn't in the DataSet run or even in any of the DataSets in your WLP.?

Can you only use SetContext if the symbol is in the DataSet used to run the strategy?

If you could show an exmaple of using GetExternalSymbol and how it passes the Bars reference, that would be most helpful.
Thanks
Ricardo
profile picture

Cone

#4
QUOTE:
..about SetContext having a Bars overload, I don't understand the meaning or consequences of the Bars overload.
Go to the QuickRef (F11) and look up SetContext. Right at the top you'll see the function syntax:

CODE:
Please log in to see this code.
This shows that the same function name, SetContext(), has two valid, but different, parameter lists, or signatures. The compiler figures out which signature to call based on the object types passed to the function. This is called "overloading".

QUOTE:
...GetExternalSymbol, would it mean that the symbol can be accessed even if it isn't in the DataSet run or even in any of the DataSets in your WLP.
It has to be in a DataSet. An external symbol is any symbol that is not the primary symbol. The primary symbol is the one that you click or the one that is currently loaded in a Multi-Symbol Backtest (MSB).

QUOTE:
Can you only use SetContext if the symbol is in the DataSet used to run the strategy?
No. The symbol can be anywhere. If you used the first overload, Wealth-Lab does the search described previously. If you use the second "Bars" overload, the symbol could be from any DataSet or from anywhere that created the Bars reference.. see next example..

QUOTE:
show an exmaple of using GetExternalSymbol and how it passes the Bars reference,
Example #1
The Bars overload was created to support synthetic options, where a Bars reference can be, for example, the result of a call to CreateSyntheticOption(). See WealthScript Programming Guide > Programming Trading Strategies > Options Strategies

Example #2 - Reference a symbol in a specific DataSet
CODE:
Please log in to see this code.
profile picture

rmandel00

#5
Thanks so much. You have been most helpful.
Ricardo
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).