How to get all US equities without ETFs, ETNs and ADRs?
an623267
Posts: 7
I'm trying to get all US equities without ETFs, ETNs and ADRs by using "lists", but seems that it's not working for 2011-2013 years.
For example If I run a test for this code for any day in 2011:
def is_symbol_qualified(cls, symbol, md, service, account):
return symbol in ["SPY", "VXX", "MSFT", "ABB"]
def on_start(self, md, order, service, account):
print(self.symbol)
adr = service.symbol_list.get_handle('6b2fc6d0-3f87-41c3-a8e2-1507f43cb36e')
etf = service.symbol_list.get_handle('82e8721e-d9fe-4ac4-b597-5197a4309a60')
etn = service.symbol_list.get_handle('9389dd95-ca7e-4fe2-b2a6-329ce7de4665')
print("Is it ETF?",service.symbol_list.in_list(etf, self.symbol))
print("Is it ADR?",service.symbol_list.in_list(adr, self.symbol))
print("Is it ETN?",service.symbol_list.in_list(etn, self.symbol))
print("="*20)
I will have in console something like this:
ABB
('Is it ETF?', False)
('Is it ADR?', False)
('Is it ETN?', False)
====================
MSFT
('Is it ETF?', False)
('Is it ADR?', False)
('Is it ETN?', False)
====================
SPY
('Is it ETF?', False)
('Is it ADR?', False)
('Is it ETN?', False)
====================
VXX
('Is it ETF?', False)
('Is it ADR?', False)
('Is it ETN?', False)
====================
But for any day in 2019:
ABB
('Is it ETF?', False)
('Is it ADR?', True)
('Is it ETN?', False)
====================
MSFT
('Is it ETF?', False)
('Is it ADR?', False)
('Is it ETN?', False)
====================
SPY
('Is it ETF?', True)
('Is it ADR?', False)
('Is it ETN?', False)
====================
VXX
('Is it ETF?', False)
('Is it ADR?', False)
('Is it ETN?', True)
====================
What am I doing wrong?
Best Answer
-
ptunney Posts: 246
Most of our lists are self gathered not purchased from an outside vendor, as such they only go back to the date that we first started collecting them. For many this is some time around 2014. We should make that clearer. Even back in 2014 most vendors could not give us consistent and accurate data on symbol categories so initially some lists will be a little rough. Until somebody used a list and started getting granular with it, it would be imperfect.
Answers
Since VXX has been trading only since January 2018, it’s probably better to use TVIX as an example of ETN in this case.
Ok, thanks. Then I will try to collect my list and filter based on it.
Thought you might find this interesting, ran the most recent date comparing exchange to which list they were in....
I suspected you could probably exclude exchange P, looks like you could exclude Z as well md.stat.exchange in ["P","Z"]
A AMEX
N NYSE
P Pacific (the three on here that are none's are ESBA,FISK,OGCP)
Q NASDAQ
V IEX (1 symbol IBKR)
Z BATS (1 none is CBOE)
Thank you. This may help.