How to create Dataset dynamically?
Author: shielint
Creation Date: 2/9/2011 2:30 PM
profile picture

shielint

#1
To create a DataSet, I use "Create a New Dataset" dialog. Is it possible to create a Dataset from the Wealth-lab code? For example, use a strategy to filter/screen all the symbols of an existing dataset and dynamically create a new dataset based on the filtered results.
Also is it possible to enumerate symbols in a NON-current dataset? For example, my current dataset is SP500. Is there a way to get all the symbols in the "Nasdaq 100" dataset in a strategy code?
Any help is great appreciated.

profile picture

Cone

#2
It's not currently possible to create a DataSet in Strategy code and have Wealth-Lab recognize it in the same session. You can however, create a DataSet xml file for your provider (it's usually just a matter of giving it a different name and symbols), restart Wealth-Lab, and you're off and running.


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

Eugene

#3
1 - It is possible in theory. In practice, it would require coding a workaround i.e. manually saving data to an XML file. For an idea how to do it see traderray's post dated 4/3/2010 7:40 AM in this thread:

How to create/convert GICS database for symbols WL5

This one's a bit more easier to code if you create the DataSet manually, just adding/removing the symbols using script:

Adding/Removing symbols from Data Manager
WL5.5 - Is it possible to manipulate DataSet Contents and change symbols within the datasets programmatically from a strategy?

Note: these DataSet will not appear in WL6 until it's restarted. Life could be much easier if Fidelity implemented the missing WatchList* functions (baseline WL4 item).

2 - Yes it's possible. It was also discussed before - example:

Iterate through datasets
profile picture

shielint

#4
Thanks Cone and Eugene. You guys are great helpful.