Getting Stock symbol from CUSIP or company name
Author: bobydesi123
Creation Date: 8/26/2013 9:07 AM
profile picture

bobydesi123

#1
Problem:
I am trying to extract stock symbols from the SEC FORM 13-F data to WLP dataset or even a text file. The Form 13-f lists the stocks by CUSIP and the company name but not the the stock symbols.
http://www.sec.gov/Archives/edgar/data/898382/000114036113032356/xslForm13F_X01/form13fInfoTable.xml

Question:
Does any one know a way to get stock symbol name from a given CUSIP or the the Company name.
I am looking an automated way to do it , may be WL can help? WL symbol object does not seem to have CUSIP as a property.
I know i can do it individually using tools available on web buy that is too cumbersome. Using company name to get stock symbol can result in ambiguity, e.g. APOLLO INVESTMENT CORP would result in three different stock symbols, AINV AIB AIY on yahoo. CUSIP will result in AINV.

Thanks in advance.
.
profile picture

bobydesi123

#2
Seems like all the WL Bars.SecurityName have ',INC' attached to it. I think if i strip the ',INC' and use the InStr(Bars.SecurityName, SEC's company name), it should mostly work. However, if some one does have solution idea with CUSIP, i would appreciate it.
Thanks.
profile picture

Eugene

#3
UPDATE 08/17/2017: Fidelity URL change

How about this?

This solution will download your SEC form, parse it, extract all CUSIPs, then look up by the symbol name of each one using Fidelity's tool. Uses HtmlAgilityPack (available with latest Community.Components), requires WL 6.4 or greater.

Prerequisites:

1. Installed Community Components 2012.12 or higher - just because it includes the required HtmlAgilityPack.dll v1.4.6
2. In Strategy Editor, click "References...", scroll down and check System.Xml
3. Until the Editor gets upgraded in WL 6.? to support C#4.0 out of the box, you need to add a reference to System.Core v4.0. Switch to "Other assemblies to reference...", click "Add a reference", find the file called System.Core.dll, highlight it and confirm. The file's placement depends on your OS and WLP "bitness". For 64-bit WLP, choose c:\windows\microsoft.net\framework64\v4.0.30319, for 32-bit WLP it's c:\windows\microsoft.net\framework\v4.0.30319

Give it a minute or two to run - after all, it's processing ~80 requests synchronously:

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

bobydesi123

#4
Super! Worked like a charm! Thanks as always have a nice day.
profile picture

bobydesi123

#5
QUOTE:
Give it a minute or two to run - after all, it's processing ~80 requests synchronously:


Surprisingly, it did not take more than 5-6 seconds!
BTW, if you happen to read this comment, is WL6.5..making use of multiple CPUs? I remember there being some discussion about it in one of the threads.
profile picture

Eugene

#6
And here's that thread: Any plans for multicore support?
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).