Knowing if a symbol is an ETF or a stock...

(In software, obviously.) I just need a boolean response to IsETF(ticker). I did google this but got so many irrelevant responses, like "What is an ETF?" hurr durr.

Obviously I can try to scrape websites for this info but that is brittle. What's a decent data provider option for this that does not include lots of other data (to the extent that raises price for no purpose). I would like to query once a day before market open.

I would trade ETFs if I could but European regulation prohibits me from trading US ETFs.
 
Which data provider or broker are you currently using? Some may provide such info through their API.

NxCore on sim. Haven't decided if I will connect this algo to my IB account or try to sign up with e.g. LightSpeed or Alpaca yet, so hesitant to look into IB API for this.
 
NxCore providers this info with their "Category" messages.
Look for "Categories" reference in the docs.

upload_2020-9-17_13-22-1.png


upload_2020-9-17_13-20-6.png


Otherwise IQFeed, or any broker you'll decide on using.
(I use NxCore with C# code if you need a sample)
 
Perfect, thanks! Saved me a bunch of time.


BTW, if I remember correctly, that ETF information may not be reliable and not sure who maintains it and how often. It's often inconsistent even across different providers. So I stopped using it a while ago, while replacing with couple other methods to identify ETFs:

a) All symbols coming from/listed on NYSE ARCA exchange (listed exchange id 7 in NxCore) are ETFs.

b) I use the following SQL to also identify and cross-check ETFs by stock/company name:
company_name LIKE '% etf' OR company_name LIKE '% etf %' OR company_name LIKE 'etfs%' OR company_name LIKE '% etn' OR company_name LIKE '% etn %' OR company_name2 LIKE '% etf' OR company_name2 LIKE '% etn' OR company_name2 LIKE '% fund'
OR company_name LIKE 'advisorshares%' OR company_name LIKE 'pro shares%' OR company_name LIKE '%xtrackers%' OR company_name LIKE '%x trackers%' OR company_name LIKE '%xtrkrs%'
OR company_name LIKE 'ipath%' OR company_name LIKE '% ipath %' OR company_name LIKE 'wisdom%tree%' OR company_name LIKE '%domtree %' OR company_name LIKE '%invesco %' OR company_name LIKE '%proshares%' OR company_name LIKE '%e-tracs%'
OR company_name LIKE '%ishares%' OR company_name LIKE '%powershares%' OR company_name LIKE '%velocityshares%' OR company_name LIKE '%velocity shares%' OR company_name LIKE '%factorshares%'
OR company_name LIKE '%SPDR%' OR company_name LIKE '%direxion%' OR company_name LIKE '%msci%'
OR company_name LIKE '%barclay%index%' OR company_name LIKE 'realty fund%' OR company_name LIKE 'focussh%'
OR company_name LIKE '% index%' OR company_name LIKE '% short %' OR company_name LIKE '%futures%' OR company_name LIKE '% bear' OR company_name LIKE '% bull'
OR company_name LIKE 'janus vel%' OR company_name LIKE 'janus hend%' OR company_name LIKE 'vaneck %' OR company_name LIKE '%vectors[ ,]%'
OR company_name LIKE '%first trust%fund%' OR company_name LIKE '%etfs commodity%' OR company_name LIKE '%rydex%2x%'
OR company_name LIKE '%blackrock%fund%' OR company_name LIKE '%blackrock%opp%' OR company_name LIKE 'nuveen %' OR company_name LIKE 'focus%morningstar%'
OR company_name LIKE 'putnam %' OR company_name LIKE 'pimco%fund%' OR company_name LIKE 'pimco%treas%' OR company_name LIKE 'pimco%income%' OR company_name LIKE 'pimco%advant%'
OR company_name LIKE 'russell %e%' OR company_name LIKE '%S[&]P% %cap%' OR company_name LIKE 'russell%cap%'
OR company_name LIKE 'vanguard %' OR company_name LIKE 'zacks %' OR company_name LIKE 'rex %' OR company_name LIKE '%credit suisse%links%' OR company_name LIKE '%claymore%mor%' OR company_name LIKE '%claymore%zack%'
OR company_name LIKE 'o''shares%' OR company_name LIKE 'nets trust%' OR company_name LIKE '% leveraged %'
OR company_name LIKE '% opportunities fund%' OR company_name LIKE '% opportunities et%' OR company_name LIKE '% opportunities trus%'
OR company_name LIKE '% fund %' OR company_name LIKE '% fund, %' OR company_name LIKE '% fund'
OR company_name LIKE '%income fund%' OR company_name LIKE '%opport%fund%' OR company_name LIKE '%growth%fund%'
OR company_name LIKE '%income trust%' OR company_name LIKE '%bond trust%'
OR company_name LIKE '%tuttle tactical%' OR company_name LIKE '%multi_strategy%'
OR company_name LIKE '%cap%growth' OR company_name LIKE '%cap%value'
 
Last edited:
For any given stock symbol XXX, check if there exists the symbol XXX.IV (or XXX.IV.X if you are using IQFeed).

This will be the ETF's Intraday Indicative Value. Works for 99% of all ETFs. Only exceptions are a few really old ETFs, like QQQ (which uses QXV), and these you can hard-code.

You can get a list of all market symbols from http://iqfeed.net/symbolguide/index...isplayaction=support&section=guide&web=iqfeed
or the associated zip file from http://www.dtniq.com/product/mktsymbols_v2.zip

Seems to be updated daily.
 
Last edited:
BTW, if I remember correctly, that ETF information may not be reliable and not sure who maintains it and how often. It's often inconsistent even across different providers. So I stopped using it a while ago, while replacing with couple other methods to identify ETFs:

a) All symbols coming from/listed on NYSE ARCA exchange (listed exchange id 7 in NxCore) are ETFs.

b) I use the following SQL to also identify and cross-check ETFs by stock/company name:
company_name LIKE '% etf' OR company_name LIKE '% etf %' OR company_name LIKE 'etfs%' OR company_name LIKE '% etn' OR company_name LIKE '% etn %' OR company_name2 LIKE '% etf' OR company_name2 LIKE '% etn' OR company_name2 LIKE '% fund'
OR company_name LIKE 'advisorshares%' OR company_name LIKE 'pro shares%' OR company_name LIKE '%xtrackers%' OR company_name LIKE '%x trackers%' OR company_name LIKE '%xtrkrs%'
OR company_name LIKE 'ipath%' OR company_name LIKE '% ipath %' OR company_name LIKE 'wisdom%tree%' OR company_name LIKE '%domtree %' OR company_name LIKE '%invesco %' OR company_name LIKE '%proshares%' OR company_name LIKE '%e-tracs%'
OR company_name LIKE '%ishares%' OR company_name LIKE '%powershares%' OR company_name LIKE '%velocityshares%' OR company_name LIKE '%velocity shares%' OR company_name LIKE '%factorshares%'
OR company_name LIKE '%SPDR%' OR company_name LIKE '%direxion%' OR company_name LIKE '%msci%'
OR company_name LIKE '%barclay%index%' OR company_name LIKE 'realty fund%' OR company_name LIKE 'focussh%'
OR company_name LIKE '% index%' OR company_name LIKE '% short %' OR company_name LIKE '%futures%' OR company_name LIKE '% bear' OR company_name LIKE '% bull'
OR company_name LIKE 'janus vel%' OR company_name LIKE 'janus hend%' OR company_name LIKE 'vaneck %' OR company_name LIKE '%vectors[ ,]%'
OR company_name LIKE '%first trust%fund%' OR company_name LIKE '%etfs commodity%' OR company_name LIKE '%rydex%2x%'
OR company_name LIKE '%blackrock%fund%' OR company_name LIKE '%blackrock%opp%' OR company_name LIKE 'nuveen %' OR company_name LIKE 'focus%morningstar%'
OR company_name LIKE 'putnam %' OR company_name LIKE 'pimco%fund%' OR company_name LIKE 'pimco%treas%' OR company_name LIKE 'pimco%income%' OR company_name LIKE 'pimco%advant%'
OR company_name LIKE 'russell %e%' OR company_name LIKE '%S[&]P% %cap%' OR company_name LIKE 'russell%cap%'
OR company_name LIKE 'vanguard %' OR company_name LIKE 'zacks %' OR company_name LIKE 'rex %' OR company_name LIKE '%credit suisse%links%' OR company_name LIKE '%claymore%mor%' OR company_name LIKE '%claymore%zack%'
OR company_name LIKE 'o''shares%' OR company_name LIKE 'nets trust%' OR company_name LIKE '% leveraged %'
OR company_name LIKE '% opportunities fund%' OR company_name LIKE '% opportunities et%' OR company_name LIKE '% opportunities trus%'
OR company_name LIKE '% fund %' OR company_name LIKE '% fund, %' OR company_name LIKE '% fund'
OR company_name LIKE '%income fund%' OR company_name LIKE '%opport%fund%' OR company_name LIKE '%growth%fund%'
OR company_name LIKE '%income trust%' OR company_name LIKE '%bond trust%'
OR company_name LIKE '%tuttle tactical%' OR company_name LIKE '%multi_strategy%'
OR company_name LIKE '%cap%growth' OR company_name LIKE '%cap%value'

You may want to see if your SQL database supports Regular Expresssions, which would vastly simply your test to something like:

company_name regexp '^.*(etfs?|etn|fund) ?$'
or company_name regexp '^advisorshares|pro ?shares|x ?tracker|ipath|wisdom ?tree'
etc
 
Back
Top