How to create indices programmatically?
Author: tradercn
Creation Date: 2/16/2014 9:54 PM
profile picture

tradercn

#1
Here is my problem. In China stock market, there are several hundreds categories by different category standards. For example, Province, Industry, etc. By these categories, I can make datasets. However I would like to make indices (basic index) for each category. Manually making indices is a boring job. How can I code for that? Thanks.
profile picture

Eugene

#2
Is this what I answered last month?

How to create DataSet XML file?

Or it's about creating your own classification like the one found in Yahoo/MSN providers where you could pick a pre-built index and Wealth-Lab would create the DataSet? That's a totally different story.
profile picture

tradercn

#3
Sorry, I might mislead you.
So far I don't have problems to create DataSets with coding. I will make about 200 datasets with coding monthly. But, how to make 200 indices with coding based on 200 different datasets?
profile picture

Eugene

#4
So you're talking about IndexDefinitions. Index-Lab supports creation of mutiple indices at once. Highlight "Basic Index", select as many DataSets as you like (Ctrl-mouse click, Shift-click, or using the mouse), you're done.
profile picture

tradercn

#5
So I still have click 200 times every month. Is that possible to do that by programming? It is important to me. Thanks.
profile picture

Eugene

#6
Much less so when using multiple selection with the mouse or hotkeys.

Anyway, almost anything is possible. To reach your objective, you need to create:

1) Index-Lab DataSet file(s) -- like the one(s) found in the DataSets folder e.g. "Index-Lab Daily.xml"
2) Custom index parameter XML file -- see the "CustomIndices" folder for an example of the data format
profile picture

tradercn

#7
It is simpler than my expectation! It is amazing!

One more question, in the index xml files, what is ID? what is IndexDefinitionTypeID? How to get the identified item please?

Tx so much.
profile picture

Eugene

#8
Create a Basic Index the straight way using the IL and then copy the structure. Preserve the IndexDefinitionTypeID. Generate a new Guid for the ID field, and modify just the Symbol and DataSourceName tags.

Note that if the IL DataSet "master" file already exists (e.g. "Index-Lab Daily.xml" with some permanent indices that you don't shuffle every month), you just append your new indices to it. Any changes to DataSets will be reflected only after you restart Wealth-Lab.
profile picture

tradercn

#9
Thanks for your reply. In my understanding, if the index type is the same as Basic Index, I can simply copy the index xml file structure and IndexDefinitionTypID. However I am not a professional programmer, as regard to Guid, how to generate it? Honestly I saw Guid so many times, but so far I still don't understand it. Could you please simply explain it or show me some links? Thanks so much.
profile picture

Eugene

#10
Your understanding is correct.

GUID from the horse's mouth: MSDN.
profile picture

tradercn

#11
Thanks so much. The last question, what is the function of wl files under IndexStaticProvider\Daily? do I need to operate them?
profile picture

Eugene

#12
Not only there's no need, you can't. Index-Lab will build, rebuild and update these files when necessary.
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).