GetExternalSymbol / DataSet
Author: ewessely
Creation Date: 11/17/2011 3:37 AM
profile picture

ewessely

#1
Is there any possibility to decide which dataset is used when calling
CODE:
Please log in to see this code.
?
If a symbol is in two (or more) datasets (eg Yahoo, BB, Google), I would like to decide which of them is used when loading an external symbol.
Greetings
profile picture

Eugene

#2
Yes, look up GetExternalSymbol in the QuickRef and it will return the right overload instantly.
profile picture

ewessely

#3
...thx for helping a blind man....
profile picture

Panache

#4
I have a lot of symbols in my Fidelity daily data that have out of sequence dates. I wrote the following snippet which I thought would list them all, regardless of whether or not they were contained in data sets.

CODE:
Please log in to see this code.


However, I'm getting an odd behavior with GetExternalSymbol. The way it is written, if Temp contains all of the symbols I want to check, the code works as expected and finds all of the symbols with bad data.

If I remove the dataSetName in GetExternalSymbol, the code only reports the symbol the code is being tested on as bad. If I run it on another symbol in a data set other than Temp, it doesn't report any bad data.

Ultimately, my purpose is to check all of my data, not just those in the root directly, which is why I would prefer not to have to create a data set first in order to check them.
profile picture

Eugene

#5
Give the Data Tool extension a try. It identifies out of sequence dates, as well as a number of other data integrity errors, w/o the need to write scripts.
profile picture

Panache

#6
I'll play with it, although it appears that I still have to put all the symbols into a data set in order to check them.

fyi - Here is a snippet to overcome the limitation in the Data Tool about not being able to check the exact dates when there is missing data:

CODE:
Please log in to see this code.


For this to work, Markets.xml has to be corrected. See http://www.wealth-lab.com/Forum/Posts/Bars-MarketInfo-Holidays-is-Incomplete-33776.
profile picture

Panache

#7
Here's a real interesting behavior. I'm comparing data for the same symbol in two different data sets. The symbol is contained both in the DataSet I'm running the Strategy against and the Bloomberg Terminal DataSet. (The DataSet I'm running the Strategy against is a BBFree DataSet, so there are two different files for the symbol in two different directories on my hard drive.) In order to make sure I'm getting the right external symbol, I use

CODE:
Please log in to see this code.


(In case you're wondering, the Bloomberg Terminal data was saved in a Fidelity DataSet; hence the reason I call Bloomberg Terminal bars Fidelity bars.) The first time I run the Strategy, I get the correct result.

CODE:
Please log in to see this code.


APIC 1/12/2016 12:00:00 AM 12/31/2015 12:00:00 AM

The interesting thing is that when I re-run the Strategy, I get a different result.

APIC 1/12/2016 12:00:00 AM 1/12/2016 12:00:00 AM

WealthLab appears to be using the cached data from the DataSet I am running the Strategy against for the fidelity bars the second time. I'm guessing the problem is that once the data for a particular symbol is loaded in memory, WealthLab doesn't use the optional DataSet parameter.

Any ideas how to override this?
profile picture

Eugene

#8
Here's a couple of ideas to try:

1. GetExternalSymbol without the DataSet name
2. GetAllDataForSymbol
profile picture

Panache

#9
Thanks. GetAllDataForSymbol solves the problem. For anyone who wants to use this, you need to SetContext before GetAllDataForSymbol.

CODE:
Please log in to see this code.
profile picture

Panache

#10
Is Bars.LoadFromFile a way to guarantee the data provider being used?

I was thinking something like

CODE:
Please log in to see this code.


I thought this might be a better alternative than
QUOTE:
Here's a couple of ideas to try:

1. GetExternalSymbol without the DataSet name
2. GetAllDataForSymbol
profile picture

Eugene

#11
Hint: GetDataPath can be replaced with
CODE:
Please log in to see this code.


What have you found? Does this provide an alternative?
profile picture

Panache

#12
Yes. This appears to get you the exact data specified, regardless of whether the symbol is contained in a Data Set.
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).