QUOTE:
for example, the "Consumer Durables and Apparel" group has GICS code 2520 and you want to look up for some index symbol behind it.
That's basically "correct," but let's take it a step further by including the GICS code lookup function, GetIndustry(symbol), for the stock symbol. For example, I want to pass the symbol for Apple "AAPL" and have it return ".GSPCOPE", the index
symbol for Technology, Hardware, Storage, & Peripherals (Apple's industry index).
Has anyone develop a C# class for doing that? If not, I can code it, and share the code. I just don't want to write code that's already been written. I thought about doing a sorted collection of struct {int, string} objects for the (1) GICS code and (2) index ticker symbols, but the problem is probably simpler than that. Simply declaring a sorted&paired "struct {int[], string[]}", then using an Array Find on the int[] to locate the int-index of the GICS code and looking that up in the string[] to fetch the corresponding index symbol should do it. The processor is more efficient at handling arrays than collections of objects, so an array solution is preferred.
The other reason for using an "array solution" is because this database is "static", so space never needs to be reallocated (and garbage collected). Collections are better when there's dynamic resizing and garbage collection is involved. (C# does a
terrible job at resizing arrays. It just dumps the entire old array space and allocates a new one. StringBuilder avoids "some" of that for strings (dynamic char arrays), but it's still a problem.)
---
Eventually, I want to perform a decorrelation and cross-correlation on the stock and its industry index. But that's another problem. As a personal note, I have always traded from the decorrelated line. But I've always decorrelated against the S&P500. Now I want to do that against the industry index for the stock in question.
The cross-correlation analysis will reveal if the stock leads or lags its industry index. As a signal processing (DSP) guy, I've done a fair amount of cross-correlation analyses (It's a common practice.), but never on financial data. This will be a first for me.